HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Pie
|
9.0.0_r8
下载
查看原文件
收藏
根目录
external
skqp
include
gpu
gl
GrGLInterface.h
/* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrGLInterface_DEFINED #define GrGLInterface_DEFINED #include "GrGLFunctions.h" #include "GrGLExtensions.h" #include "SkRefCnt.h" //////////////////////////////////////////////////////////////////////////////// typedef void(*GrGLFuncPtr)(); struct GrGLInterface; /** * Rather than depend on platform-specific GL headers and libraries, we require * the client to provide a struct of GL function pointers. This struct can be * specified per-GrContext as a parameter to GrContext::MakeGL. If NULL is * passed to MakeGL then a "native" GL interface is created. If the native is * also NULL GrContext creation will fail. * * The default interface is returned by GrGLMakeNativeInterface. This function's * implementation is platform-specific. Several have been provided * (for GLX, WGL, EGL, etc), along with an implementation that simply returns * NULL. */ SK_API sk_sp
GrGLMakeNativeInterface(); // Deprecated alternative to GrGLMakeNativeInterface(). SK_API const GrGLInterface* GrGLCreateNativeInterface(); /** * Creates a null GrGLInterface that doesn't draw anything. Used for measuring * CPU overhead. TODO: We would like to move this to tools/gpu/gl/null but currently * Chromium is using it in its unit tests. */ const SK_API GrGLInterface* GrGLCreateNullInterface(bool enableNVPR = false); /** * GrContext uses the following interface to make all calls into OpenGL. When a * GrContext is created it is given a GrGLInterface. The interface's function * pointers must be valid for the OpenGL context associated with the GrContext. * On some platforms, such as Windows, function pointers for OpenGL extensions * may vary between OpenGL contexts. So the caller must be careful to use a * GrGLInterface initialized for the correct context. All functions that should * be available based on the OpenGL's version and extension string must be * non-NULL or GrContext creation will fail. This can be tested with the * validate() method when the OpenGL context has been made current. */ struct SK_API GrGLInterface : public SkRefCnt { private: typedef SkRefCnt INHERITED; public: GrGLInterface(); // Validates that the GrGLInterface supports its advertised standard. This means the necessary // function pointers have been initialized for both the GL version and any advertised // extensions. bool validate() const; // Indicates the type of GL implementation union { GrGLStandard fStandard; GrGLStandard fBindingsExported; // Legacy name, will be remove when Chromium is updated. }; GrGLExtensions fExtensions; bool hasExtension(const char ext[]) const { return fExtensions.has(ext); } /** * The function pointers are in a struct so that we can have a compiler generated assignment * operator. */ struct Functions { GrGLFunction
fActiveTexture; GrGLFunction
fAttachShader; GrGLFunction
fBeginQuery; GrGLFunction
fBindAttribLocation; GrGLFunction
fBindBuffer; GrGLFunction
fBindFragDataLocation; GrGLFunction
fBindFragDataLocationIndexed; GrGLFunction
fBindFramebuffer; GrGLFunction
fBindRenderbuffer; GrGLFunction
fBindTexture; GrGLFunction
fBindImageTexture; GrGLFunction
fBindVertexArray; GrGLFunction
fBlendBarrier; GrGLFunction
fBlendColor; GrGLFunction
fBlendEquation; GrGLFunction
fBlendFunc; GrGLFunction
fBlitFramebuffer; GrGLFunction
fBufferData; GrGLFunction
fBufferSubData; GrGLFunction
fCheckFramebufferStatus; GrGLFunction
fClear; GrGLFunction
fClearColor; GrGLFunction
fClearStencil; GrGLFunction
fClearTexImage; GrGLFunction
fClearTexSubImage; GrGLFunction
fColorMask; GrGLFunction
fCompileShader; GrGLFunction
fCompressedTexImage2D; GrGLFunction
fCompressedTexSubImage2D; GrGLFunction
fCopyTexSubImage2D; GrGLFunction
fCreateProgram; GrGLFunction
fCreateShader; GrGLFunction
fCullFace; GrGLFunction
fDeleteBuffers; GrGLFunction
fDeleteFramebuffers; GrGLFunction
fDeleteProgram; GrGLFunction
fDeleteQueries; GrGLFunction
fDeleteRenderbuffers; GrGLFunction
fDeleteShader; GrGLFunction
fDeleteTextures; GrGLFunction
fDeleteVertexArrays; GrGLFunction
fDepthMask; GrGLFunction
fDisable; GrGLFunction
fDisableVertexAttribArray; GrGLFunction
fDrawArrays; GrGLFunction
fDrawArraysIndirect; GrGLFunction
fDrawArraysInstanced; GrGLFunction
fDrawBuffer; GrGLFunction
fDrawBuffers; GrGLFunction
fDrawElements; GrGLFunction
fDrawElementsIndirect; GrGLFunction
fDrawElementsInstanced; GrGLFunction
fDrawRangeElements; GrGLFunction
fEnable; GrGLFunction
fEnableVertexAttribArray; GrGLFunction
fEndQuery; GrGLFunction
fFinish; GrGLFunction
fFlush; GrGLFunction
fFlushMappedBufferRange; GrGLFunction
fFramebufferRenderbuffer; GrGLFunction
fFramebufferTexture2D; GrGLFunction
fFramebufferTexture2DMultisample; GrGLFunction
fFrontFace; GrGLFunction
fGenBuffers; GrGLFunction
fGenFramebuffers; GrGLFunction
fGenerateMipmap; GrGLFunction
fGenQueries; GrGLFunction
fGenRenderbuffers; GrGLFunction
fGenTextures; GrGLFunction
fGenVertexArrays; GrGLFunction
fGetBufferParameteriv; GrGLFunction
fGetError; GrGLFunction
fGetFramebufferAttachmentParameteriv; GrGLFunction
fGetIntegerv; GrGLFunction
fGetMultisamplefv; GrGLFunction
fGetProgramBinary; GrGLFunction
fGetProgramInfoLog; GrGLFunction
fGetProgramiv; GrGLFunction
fGetQueryObjecti64v; GrGLFunction
fGetQueryObjectiv; GrGLFunction
fGetQueryObjectui64v; GrGLFunction
fGetQueryObjectuiv; GrGLFunction
fGetQueryiv; GrGLFunction
fGetRenderbufferParameteriv; GrGLFunction
fGetShaderInfoLog; GrGLFunction
fGetShaderiv; GrGLFunction
fGetShaderPrecisionFormat; GrGLFunction
fGetString; GrGLFunction
fGetStringi; GrGLFunction
fGetTexLevelParameteriv; GrGLFunction
fGetUniformLocation; GrGLFunction
fInsertEventMarker; GrGLFunction
fInvalidateBufferData; GrGLFunction
fInvalidateBufferSubData; GrGLFunction
fInvalidateFramebuffer; GrGLFunction
fInvalidateSubFramebuffer; GrGLFunction
fInvalidateTexImage; GrGLFunction
fInvalidateTexSubImage; GrGLFunction
fIsTexture; GrGLFunction
fLineWidth; GrGLFunction
fLinkProgram; GrGLFunction
fProgramBinary; GrGLFunction
fProgramParameteri; GrGLFunction
fMapBuffer; GrGLFunction
fMapBufferRange; GrGLFunction
fMapBufferSubData; GrGLFunction
fMapTexSubImage2D; GrGLFunction
fMemoryBarrier; GrGLFunction
fMemoryBarrierByRegion; GrGLFunction
fMultiDrawArraysIndirect; GrGLFunction
fMultiDrawElementsIndirect; GrGLFunction
fPixelStorei; GrGLFunction
fPolygonMode; GrGLFunction
fPopGroupMarker; GrGLFunction
fPushGroupMarker; GrGLFunction
fQueryCounter; GrGLFunction
fRasterSamples; GrGLFunction
fReadBuffer; GrGLFunction
fReadPixels; GrGLFunction
fRenderbufferStorage; // On OpenGL ES there are multiple incompatible extensions that add support for MSAA // and ES3 adds MSAA support to the standard. On an ES3 driver we may still use the // older extensions for performance reasons or due to ES3 driver bugs. We want the function // that creates the GrGLInterface to provide all available functions and internally // we will select among them. They all have a method called glRenderbufferStorageMultisample*. // So we have separate function pointers for GL_IMG/EXT_multisampled_to_texture, // GL_CHROMIUM/ANGLE_framebuffer_multisample/ES3, and GL_APPLE_framebuffer_multisample // variations. // // If a driver supports multiple GL_ARB_framebuffer_multisample-style extensions then we will // assume the function pointers for the standard (or equivalent GL_ARB) version have // been preferred over GL_EXT, GL_CHROMIUM, or GL_ANGLE variations that have reduced // functionality. // GL_EXT_multisampled_render_to_texture (preferred) or GL_IMG_multisampled_render_to_texture GrGLFunction
fRenderbufferStorageMultisampleES2EXT; // GL_APPLE_framebuffer_multisample GrGLFunction
fRenderbufferStorageMultisampleES2APPLE; // This is used to store the pointer for GL_ARB/EXT/ANGLE/CHROMIUM_framebuffer_multisample or // the standard function in ES3+ or GL 3.0+. GrGLFunction
fRenderbufferStorageMultisample; // Pointer to BindUniformLocationCHROMIUM from the GL_CHROMIUM_bind_uniform_location extension. GrGLFunction
fBindUniformLocation; GrGLFunction
fResolveMultisampleFramebuffer; GrGLFunction
fScissor; GrGLFunction
fShaderSource; GrGLFunction
fStencilFunc; GrGLFunction
fStencilFuncSeparate; GrGLFunction
fStencilMask; GrGLFunction
fStencilMaskSeparate; GrGLFunction
fStencilOp; GrGLFunction
fStencilOpSeparate; GrGLFunction
fTexBuffer; GrGLFunction
fTexBufferRange; GrGLFunction
fTexImage2D; GrGLFunction
fTexParameteri; GrGLFunction
fTexParameteriv; GrGLFunction
fTexSubImage2D; GrGLFunction
fTexStorage2D; GrGLFunction
fTextureBarrier; GrGLFunction
fDiscardFramebuffer; GrGLFunction
fUniform1f; GrGLFunction
fUniform1i; GrGLFunction
fUniform1fv; GrGLFunction
fUniform1iv; GrGLFunction
fUniform2f; GrGLFunction
fUniform2i; GrGLFunction
fUniform2fv; GrGLFunction
fUniform2iv; GrGLFunction
fUniform3f; GrGLFunction
fUniform3i; GrGLFunction
fUniform3fv; GrGLFunction
fUniform3iv; GrGLFunction
fUniform4f; GrGLFunction
fUniform4i; GrGLFunction
fUniform4fv; GrGLFunction
fUniform4iv; GrGLFunction
fUniformMatrix2fv; GrGLFunction
fUniformMatrix3fv; GrGLFunction
fUniformMatrix4fv; GrGLFunction
fUnmapBuffer; GrGLFunction
fUnmapBufferSubData; GrGLFunction
fUnmapTexSubImage2D; GrGLFunction
fUseProgram; GrGLFunction
fVertexAttrib1f; GrGLFunction
fVertexAttrib2fv; GrGLFunction
fVertexAttrib3fv; GrGLFunction
fVertexAttrib4fv; GrGLFunction
fVertexAttribDivisor; GrGLFunction
fVertexAttribIPointer; GrGLFunction
fVertexAttribPointer; GrGLFunction
fViewport; /* GL_NV_path_rendering */ GrGLFunction
fMatrixLoadf; GrGLFunction
fMatrixLoadIdentity; GrGLFunction
fGetProgramResourceLocation; GrGLFunction
fPathCommands; GrGLFunction
fPathParameteri; GrGLFunction
fPathParameterf; GrGLFunction
fGenPaths; GrGLFunction
fDeletePaths; GrGLFunction
fIsPath; GrGLFunction
fPathStencilFunc; GrGLFunction
fStencilFillPath; GrGLFunction
fStencilStrokePath; GrGLFunction
fStencilFillPathInstanced; GrGLFunction
fStencilStrokePathInstanced; GrGLFunction
fCoverFillPath; GrGLFunction
fCoverStrokePath; GrGLFunction
fCoverFillPathInstanced; GrGLFunction
fCoverStrokePathInstanced; // NV_path_rendering v1.2 GrGLFunction
fStencilThenCoverFillPath; GrGLFunction
fStencilThenCoverStrokePath; GrGLFunction
fStencilThenCoverFillPathInstanced; GrGLFunction
fStencilThenCoverStrokePathInstanced; // NV_path_rendering v1.3 GrGLFunction
fProgramPathFragmentInputGen; // CHROMIUM_path_rendering GrGLFunction
fBindFragmentInputLocation; /* NV_framebuffer_mixed_samples */ GrGLFunction
fCoverageModulation; /* NV_bindless_texture */ // We use the NVIDIA verson for now because it does not require dynamically uniform handles. // We may switch the the ARB version and/or omit methods in the future. GrGLFunction
fGetTextureHandle; GrGLFunction
fGetTextureSamplerHandle; GrGLFunction
fMakeTextureHandleResident; GrGLFunction
fMakeTextureHandleNonResident; GrGLFunction
fGetImageHandle; GrGLFunction
fMakeImageHandleResident; GrGLFunction
fMakeImageHandleNonResident; GrGLFunction
fIsTextureHandleResident; GrGLFunction
fIsImageHandleResident; GrGLFunction
fUniformHandleui64; GrGLFunction
fUniformHandleui64v; GrGLFunction
fProgramUniformHandleui64; GrGLFunction
fProgramUniformHandleui64v; /* ARB_sample_shading */ GrGLFunction
fMinSampleShading; /* EXT_direct_state_access */ // We use the EXT verson because it is more expansive and interacts with more extensions // than the ARB or core (4.5) versions. We may switch and/or omit methods in the future. GrGLFunction
fTextureParameteri; GrGLFunction
fTextureParameteriv; GrGLFunction
fTextureParameterf; GrGLFunction
fTextureParameterfv; GrGLFunction
fTextureImage1D; GrGLFunction
fTextureImage2D; GrGLFunction
fTextureSubImage1D; GrGLFunction
fTextureSubImage2D; GrGLFunction
fCopyTextureImage1D; GrGLFunction
fCopyTextureImage2D; GrGLFunction
fCopyTextureSubImage1D; GrGLFunction
fCopyTextureSubImage2D; GrGLFunction
fGetTextureImage; GrGLFunction
fGetTextureParameterfv; GrGLFunction
fGetTextureParameteriv; GrGLFunction
fGetTextureLevelParameterfv; GrGLFunction
fGetTextureLevelParameteriv; // OpenGL 1.2 GrGLFunction
fTextureImage3D; GrGLFunction
fTextureSubImage3D; GrGLFunction
fCopyTextureSubImage3D; GrGLFunction
fCompressedTextureImage3D; GrGLFunction
fCompressedTextureImage2D; GrGLFunction
fCompressedTextureImage1D; GrGLFunction
fCompressedTextureSubImage3D; GrGLFunction
fCompressedTextureSubImage2D; GrGLFunction
fCompressedTextureSubImage1D; GrGLFunction
fGetCompressedTextureImage; // OpenGL 1.5 GrGLFunction
fNamedBufferData; GrGLFunction
fNamedBufferSubData; GrGLFunction
fMapNamedBuffer; GrGLFunction
fUnmapNamedBuffer; GrGLFunction
fGetNamedBufferParameteriv; GrGLFunction
fGetNamedBufferPointerv; GrGLFunction
fGetNamedBufferSubData; // OpenGL 2.0 GrGLFunction
fProgramUniform1f; GrGLFunction
fProgramUniform2f; GrGLFunction
fProgramUniform3f; GrGLFunction
fProgramUniform4f; GrGLFunction
fProgramUniform1i; GrGLFunction
fProgramUniform2i; GrGLFunction