Revert "Generate GrGLInterface and GrGlAssembleInterface* from table"
This reverts commit93b3dce89d
. Revert "Delete old assembleInterface code" This reverts commit7b1cf20d47
. Revert "Delete in favor of autogenerated file" This reverts commit0223bd01d8
. Bug: skia:8474 NOTRY:true Change-Id: I23a904347f9d6cefd1710a2de056c39d52f4b178 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203463 Reviewed-by: Stan Iliev <stani@google.com> Commit-Queue: Stan Iliev <stani@google.com>
This commit is contained in:
parent
4cd0734f4c
commit
573cb87a07
@ -420,10 +420,10 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/text/GrTextBlobVertexRegenerator.cpp",
|
||||
"$_src/gpu/text/GrTextTarget.h",
|
||||
|
||||
"$_src/gpu/gl/GrGLAssembleGLESInterfaceAutogen.cpp",
|
||||
"$_src/gpu/gl/GrGLAssembleGLInterfaceAutogen.cpp",
|
||||
"$_src/gpu/gl/GrGLAssembleHelpers.cpp",
|
||||
"$_src/gpu/gl/GrGLAssembleInterface.cpp",
|
||||
"$_src/gpu/gl/GrGLAssembleInterface_gl.cpp",
|
||||
"$_src/gpu/gl/GrGLAssembleInterface_gles.cpp",
|
||||
"$_src/gpu/gl/GrGLAssembleHelpers.cpp",
|
||||
"$_src/gpu/gl/GrGLBuffer.cpp",
|
||||
"$_src/gpu/gl/GrGLBuffer.h",
|
||||
"$_src/gpu/gl/GrGLCaps.cpp",
|
||||
@ -441,7 +441,7 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/gl/GrGLGpuCommandBuffer.h",
|
||||
"$_src/gpu/gl/GrGLGpuProgramCache.cpp",
|
||||
"$_src/gpu/gl/GrGLExtensions.cpp",
|
||||
"$_src/gpu/gl/GrGLInterfaceAutogen.cpp",
|
||||
"$_src/gpu/gl/GrGLInterface.cpp",
|
||||
"$_src/gpu/gl/GrGLIRect.h",
|
||||
"$_src/gpu/gl/GrGLProgram.cpp",
|
||||
"$_src/gpu/gl/GrGLProgram.h",
|
||||
|
@ -3,10 +3,6 @@
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* THIS FILE IS AUTOGENERATED
|
||||
* Make edits to tools/gpu/gl/interface/templates.go or they will
|
||||
* be overwritten.
|
||||
*/
|
||||
|
||||
#include "gl/GrGLAssembleInterface.h"
|
||||
@ -54,12 +50,22 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc g
|
||||
sk_sp<GrGLInterface> interface(new GrGLInterface());
|
||||
GrGLInterface::Functions* functions = &interface->fFunctions;
|
||||
|
||||
// Autogenerated content follows
|
||||
GET_PROC(ActiveTexture);
|
||||
GET_PROC(AttachShader);
|
||||
GET_PROC(BindAttribLocation);
|
||||
GET_PROC(BindBuffer);
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(BindFragDataLocation);
|
||||
}
|
||||
GET_PROC(BeginQuery);
|
||||
GET_PROC(BindTexture);
|
||||
|
||||
if (extensions.has("GL_KHR_blend_equation_advanced")) {
|
||||
GET_PROC_SUFFIX(BlendBarrier, KHR);
|
||||
} else if (extensions.has("GL_NV_blend_equation_advanced")) {
|
||||
GET_PROC_SUFFIX(BlendBarrier, NV);
|
||||
}
|
||||
|
||||
GET_PROC(BlendColor);
|
||||
GET_PROC(BlendEquation);
|
||||
GET_PROC(BlendFunc);
|
||||
@ -68,6 +74,10 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc g
|
||||
GET_PROC(Clear);
|
||||
GET_PROC(ClearColor);
|
||||
GET_PROC(ClearStencil);
|
||||
if (glVer >= GR_GL_VER(4,4) || extensions.has("GL_ARB_clear_texture")) {
|
||||
GET_PROC(ClearTexImage);
|
||||
GET_PROC(ClearTexSubImage);
|
||||
}
|
||||
GET_PROC(ColorMask);
|
||||
GET_PROC(CompileShader);
|
||||
GET_PROC(CompressedTexImage2D);
|
||||
@ -78,33 +88,76 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc g
|
||||
GET_PROC(CullFace);
|
||||
GET_PROC(DeleteBuffers);
|
||||
GET_PROC(DeleteProgram);
|
||||
GET_PROC(DeleteQueries);
|
||||
GET_PROC(DeleteShader);
|
||||
GET_PROC(DeleteTextures);
|
||||
GET_PROC(DepthMask);
|
||||
GET_PROC(Disable);
|
||||
GET_PROC(DisableVertexAttribArray);
|
||||
GET_PROC(DrawArrays);
|
||||
GET_PROC(DrawBuffer);
|
||||
GET_PROC(DrawBuffers);
|
||||
GET_PROC(DrawElements);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,1) || extensions.has("GL_ARB_draw_instanced") ||
|
||||
extensions.has("GL_EXT_draw_instanced")) {
|
||||
GET_PROC(DrawArraysInstanced);
|
||||
GET_PROC(DrawElementsInstanced);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,0) || extensions.has("GL_ARB_draw_indirect")) {
|
||||
GET_PROC(DrawArraysIndirect);
|
||||
GET_PROC(DrawElementsIndirect);
|
||||
}
|
||||
GET_PROC(DrawRangeElements);
|
||||
GET_PROC(Enable);
|
||||
GET_PROC(EnableVertexAttribArray);
|
||||
GET_PROC(EndQuery);
|
||||
GET_PROC(Finish);
|
||||
GET_PROC(Flush);
|
||||
GET_PROC(FrontFace);
|
||||
GET_PROC(GenBuffers);
|
||||
GET_PROC(GenTextures);
|
||||
GET_PROC(GetBufferParameteriv);
|
||||
GET_PROC(GetError);
|
||||
GET_PROC(GetIntegerv);
|
||||
if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_texture_multisample")) {
|
||||
GET_PROC(GetMultisamplefv);
|
||||
}
|
||||
GET_PROC(GetQueryObjectiv);
|
||||
GET_PROC(GetQueryObjectuiv);
|
||||
if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) {
|
||||
GET_PROC(GetQueryObjecti64v);
|
||||
GET_PROC(GetQueryObjectui64v);
|
||||
GET_PROC(QueryCounter);
|
||||
} else if (extensions.has("GL_EXT_timer_query")) {
|
||||
GET_PROC_SUFFIX(GetQueryObjecti64v, EXT);
|
||||
GET_PROC_SUFFIX(GetQueryObjectui64v, EXT);
|
||||
}
|
||||
GET_PROC(GetQueryiv);
|
||||
GET_PROC(GetProgramInfoLog);
|
||||
GET_PROC(GetProgramiv);
|
||||
GET_PROC(GetShaderInfoLog);
|
||||
GET_PROC(GetShaderiv);
|
||||
GET_PROC(GetString);
|
||||
GET_PROC(GetStringi);
|
||||
GET_PROC(GetShaderPrecisionFormat);
|
||||
GET_PROC(GetTexLevelParameteriv);
|
||||
GET_PROC(GenQueries);
|
||||
GET_PROC(GenTextures);
|
||||
GET_PROC(GetUniformLocation);
|
||||
GET_PROC(IsTexture);
|
||||
GET_PROC(LineWidth);
|
||||
GET_PROC(LinkProgram);
|
||||
GET_PROC(MapBuffer);
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_multi_draw_indirect")) {
|
||||
GET_PROC(MultiDrawArraysIndirect);
|
||||
GET_PROC(MultiDrawElementsIndirect);
|
||||
}
|
||||
|
||||
GET_PROC(PixelStorei);
|
||||
GET_PROC(PolygonMode);
|
||||
GET_PROC(ReadBuffer);
|
||||
GET_PROC(ReadPixels);
|
||||
GET_PROC(Scissor);
|
||||
GET_PROC(ShaderSource);
|
||||
@ -114,141 +167,55 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc g
|
||||
GET_PROC(StencilMaskSeparate);
|
||||
GET_PROC(StencilOp);
|
||||
GET_PROC(StencilOpSeparate);
|
||||
if (glVer >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(TexBuffer);
|
||||
}
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
GET_PROC(TexBufferRange);
|
||||
}
|
||||
GET_PROC(TexImage2D);
|
||||
GET_PROC(TexParameterf);
|
||||
GET_PROC(TexParameterfv);
|
||||
GET_PROC(TexParameteri);
|
||||
GET_PROC(TexParameteriv);
|
||||
if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) {
|
||||
GET_PROC(TexStorage2D);
|
||||
} else if (extensions.has("GL_EXT_texture_storage")) {
|
||||
GET_PROC_SUFFIX(TexStorage2D, EXT);
|
||||
}
|
||||
GET_PROC(TexSubImage2D);
|
||||
if (glVer >= GR_GL_VER(4,5) || extensions.has("GL_ARB_texture_barrier")) {
|
||||
GET_PROC(TextureBarrier);
|
||||
} else if (extensions.has("GL_NV_texture_barrier")) {
|
||||
GET_PROC_SUFFIX(TextureBarrier, NV);
|
||||
}
|
||||
GET_PROC(Uniform1f);
|
||||
GET_PROC(Uniform1fv);
|
||||
GET_PROC(Uniform1i);
|
||||
GET_PROC(Uniform1fv);
|
||||
GET_PROC(Uniform1iv);
|
||||
GET_PROC(Uniform2f);
|
||||
GET_PROC(Uniform2fv);
|
||||
GET_PROC(Uniform2i);
|
||||
GET_PROC(Uniform2fv);
|
||||
GET_PROC(Uniform2iv);
|
||||
GET_PROC(Uniform3f);
|
||||
GET_PROC(Uniform3fv);
|
||||
GET_PROC(Uniform3i);
|
||||
GET_PROC(Uniform3fv);
|
||||
GET_PROC(Uniform3iv);
|
||||
GET_PROC(Uniform4f);
|
||||
GET_PROC(Uniform4fv);
|
||||
GET_PROC(Uniform4i);
|
||||
GET_PROC(Uniform4fv);
|
||||
GET_PROC(Uniform4iv);
|
||||
GET_PROC(UniformMatrix2fv);
|
||||
GET_PROC(UniformMatrix3fv);
|
||||
GET_PROC(UniformMatrix4fv);
|
||||
GET_PROC(UnmapBuffer);
|
||||
GET_PROC(UseProgram);
|
||||
GET_PROC(VertexAttrib1f);
|
||||
GET_PROC(VertexAttrib2fv);
|
||||
GET_PROC(VertexAttrib3fv);
|
||||
GET_PROC(VertexAttrib4fv);
|
||||
GET_PROC(VertexAttribPointer);
|
||||
GET_PROC(Viewport);
|
||||
|
||||
GET_PROC(DrawBuffer);
|
||||
GET_PROC(PolygonMode);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(GetStringi);
|
||||
}
|
||||
|
||||
GET_PROC(BindVertexArray);
|
||||
GET_PROC(DeleteVertexArrays);
|
||||
GET_PROC(GenVertexArrays);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(BindFragDataLocation);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,3)) {
|
||||
GET_PROC(BindFragDataLocationIndexed);
|
||||
} else if (extensions.has("GL_ARB_blend_func_extended")) {
|
||||
GET_PROC(BindFragDataLocationIndexed);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_KHR_blend_equation_advanced")) {
|
||||
GET_PROC_SUFFIX(BlendBarrier, KHR);
|
||||
} else if (extensions.has("GL_NV_blend_equation_advanced")) {
|
||||
GET_PROC_SUFFIX(BlendBarrier, NV);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,4)) {
|
||||
GET_PROC(ClearTexImage);
|
||||
GET_PROC(ClearTexSubImage);
|
||||
} else if (extensions.has("GL_ARB_clear_texture")) {
|
||||
GET_PROC(ClearTexImage);
|
||||
GET_PROC(ClearTexSubImage);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(DrawArraysInstanced);
|
||||
GET_PROC(DrawElementsInstanced);
|
||||
} else if (extensions.has("GL_ARB_draw_instanced")) {
|
||||
GET_PROC(DrawArraysInstanced);
|
||||
GET_PROC(DrawElementsInstanced);
|
||||
} else if (extensions.has("GL_EXT_draw_instanced")) {
|
||||
GET_PROC_SUFFIX(DrawArraysInstanced, EXT);
|
||||
GET_PROC_SUFFIX(DrawElementsInstanced, EXT);
|
||||
}
|
||||
|
||||
GET_PROC(DrawBuffers);
|
||||
GET_PROC(ReadBuffer);
|
||||
|
||||
if (glVer >= GR_GL_VER(4,0)) {
|
||||
GET_PROC(DrawArraysIndirect);
|
||||
GET_PROC(DrawElementsIndirect);
|
||||
} else if (extensions.has("GL_ARB_draw_indirect")) {
|
||||
GET_PROC(DrawArraysIndirect);
|
||||
GET_PROC(DrawElementsIndirect);
|
||||
}
|
||||
|
||||
GET_PROC(DrawRangeElements);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,2)) {
|
||||
GET_PROC(GetMultisamplefv);
|
||||
} else if (extensions.has("GL_ARB_texture_multisample")) {
|
||||
GET_PROC(GetMultisamplefv);
|
||||
}
|
||||
|
||||
GET_PROC(GetTexLevelParameteriv);
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
GET_PROC(MultiDrawArraysIndirect);
|
||||
GET_PROC(MultiDrawElementsIndirect);
|
||||
} else if (extensions.has("GL_ARB_multi_draw_indirect")) {
|
||||
GET_PROC(MultiDrawArraysIndirect);
|
||||
GET_PROC(MultiDrawElementsIndirect);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(TexBuffer);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
GET_PROC(TexBufferRange);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,2)) {
|
||||
GET_PROC(TexStorage2D);
|
||||
} else if (extensions.has("GL_ARB_texture_storage")) {
|
||||
GET_PROC(TexStorage2D);
|
||||
} else if (extensions.has("GL_EXT_texture_storage")) {
|
||||
GET_PROC_SUFFIX(TexStorage2D, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,5)) {
|
||||
GET_PROC(TextureBarrier);
|
||||
} else if (extensions.has("GL_ARB_texture_barrier")) {
|
||||
GET_PROC(TextureBarrier);
|
||||
} else if (extensions.has("GL_NV_texture_barrier")) {
|
||||
GET_PROC_SUFFIX(TextureBarrier, NV);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,2)) {
|
||||
GET_PROC(VertexAttribDivisor);
|
||||
} else if (extensions.has("GL_ARB_instanced_arrays")) {
|
||||
if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_instanced_arrays")) {
|
||||
GET_PROC(VertexAttribDivisor);
|
||||
}
|
||||
|
||||
@ -256,185 +223,156 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc g
|
||||
GET_PROC(VertexAttribIPointer);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(BindFramebuffer);
|
||||
GET_PROC(BindRenderbuffer);
|
||||
GET_PROC(CheckFramebufferStatus);
|
||||
GET_PROC(DeleteFramebuffers);
|
||||
GET_PROC(DeleteRenderbuffers);
|
||||
GET_PROC(FramebufferRenderbuffer);
|
||||
GET_PROC(FramebufferTexture2D);
|
||||
GET_PROC(GenFramebuffers);
|
||||
GET_PROC(GenRenderbuffers);
|
||||
GET_PROC(VertexAttribPointer);
|
||||
GET_PROC(Viewport);
|
||||
GET_PROC(BindFragDataLocationIndexed);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object")) {
|
||||
// no ARB suffix for GL_ARB_vertex_array_object
|
||||
GET_PROC(BindVertexArray);
|
||||
GET_PROC(GenVertexArrays);
|
||||
GET_PROC(DeleteVertexArrays);
|
||||
} else if (extensions.has("GL_APPLE_vertex_array_object")) {
|
||||
GET_PROC_SUFFIX(BindVertexArray, APPLE);
|
||||
GET_PROC_SUFFIX(GenVertexArrays, APPLE);
|
||||
GET_PROC_SUFFIX(DeleteVertexArrays, APPLE);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_map_buffer_range")) {
|
||||
GET_PROC(MapBufferRange);
|
||||
GET_PROC(FlushMappedBufferRange);
|
||||
}
|
||||
|
||||
// First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
|
||||
// GL_ARB_framebuffer_object doesn't use ARB suffix.)
|
||||
if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")) {
|
||||
GET_PROC(GenerateMipmap);
|
||||
GET_PROC(GenFramebuffers);
|
||||
GET_PROC(GetFramebufferAttachmentParameteriv);
|
||||
GET_PROC(GetRenderbufferParameteriv);
|
||||
GET_PROC(RenderbufferStorage);
|
||||
} else if (extensions.has("GL_ARB_framebuffer_object")) {
|
||||
GET_PROC(BindFramebuffer);
|
||||
GET_PROC(BindRenderbuffer);
|
||||
GET_PROC(FramebufferTexture2D);
|
||||
GET_PROC(CheckFramebufferStatus);
|
||||
GET_PROC(DeleteFramebuffers);
|
||||
GET_PROC(RenderbufferStorage);
|
||||
GET_PROC(GenRenderbuffers);
|
||||
GET_PROC(DeleteRenderbuffers);
|
||||
GET_PROC(FramebufferRenderbuffer);
|
||||
GET_PROC(FramebufferTexture2D);
|
||||
GET_PROC(GenFramebuffers);
|
||||
GET_PROC(GenRenderbuffers);
|
||||
GET_PROC(GenerateMipmap);
|
||||
GET_PROC(GetFramebufferAttachmentParameteriv);
|
||||
GET_PROC(GetRenderbufferParameteriv);
|
||||
GET_PROC(RenderbufferStorage);
|
||||
GET_PROC(BindRenderbuffer);
|
||||
GET_PROC(RenderbufferStorageMultisample);
|
||||
GET_PROC(BlitFramebuffer);
|
||||
} else if (extensions.has("GL_EXT_framebuffer_object")) {
|
||||
GET_PROC_SUFFIX(BindFramebuffer, EXT);
|
||||
GET_PROC_SUFFIX(BindRenderbuffer, EXT);
|
||||
GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);
|
||||
GET_PROC_SUFFIX(DeleteFramebuffers, EXT);
|
||||
GET_PROC_SUFFIX(DeleteRenderbuffers, EXT);
|
||||
GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT);
|
||||
GET_PROC_SUFFIX(FramebufferTexture2D, EXT);
|
||||
GET_PROC_SUFFIX(GenFramebuffers, EXT);
|
||||
GET_PROC_SUFFIX(GenRenderbuffers, EXT);
|
||||
GET_PROC_SUFFIX(GenerateMipmap, EXT);
|
||||
GET_PROC_SUFFIX(GenFramebuffers, EXT);
|
||||
GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
|
||||
GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
|
||||
GET_PROC_SUFFIX(BindFramebuffer, EXT);
|
||||
GET_PROC_SUFFIX(FramebufferTexture2D, EXT);
|
||||
GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);
|
||||
GET_PROC_SUFFIX(DeleteFramebuffers, EXT);
|
||||
GET_PROC_SUFFIX(RenderbufferStorage, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(BlitFramebuffer);
|
||||
} else if (extensions.has("GL_ARB_framebuffer_object")) {
|
||||
GET_PROC(BlitFramebuffer);
|
||||
} else if (extensions.has("GL_EXT_framebuffer_blit")) {
|
||||
GET_PROC_SUFFIX(BlitFramebuffer, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(RenderbufferStorageMultisample);
|
||||
} else if (extensions.has("GL_ARB_framebuffer_object")) {
|
||||
GET_PROC(RenderbufferStorageMultisample);
|
||||
} else if (extensions.has("GL_EXT_framebuffer_multisample")) {
|
||||
GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
|
||||
}
|
||||
|
||||
GET_PROC(MapBuffer);
|
||||
|
||||
GET_PROC(UnmapBuffer);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(FlushMappedBufferRange);
|
||||
GET_PROC(MapBufferRange);
|
||||
} else if (extensions.has("GL_ARB_map_buffer_range")) {
|
||||
GET_PROC(FlushMappedBufferRange);
|
||||
GET_PROC(MapBufferRange);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_EXT_debug_marker")) {
|
||||
GET_PROC_SUFFIX(InsertEventMarker, EXT);
|
||||
GET_PROC_SUFFIX(PopGroupMarker, EXT);
|
||||
GET_PROC_SUFFIX(PushGroupMarker, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
GET_PROC(GetProgramResourceLocation);
|
||||
} else if (extensions.has("GL_ARB_program_interface_query")) {
|
||||
GET_PROC(GetProgramResourceLocation);
|
||||
GET_PROC_SUFFIX(GenRenderbuffers, EXT);
|
||||
GET_PROC_SUFFIX(DeleteRenderbuffers, EXT);
|
||||
GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT);
|
||||
GET_PROC_SUFFIX(BindRenderbuffer, EXT);
|
||||
if (extensions.has("GL_EXT_framebuffer_multisample")) {
|
||||
GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
|
||||
}
|
||||
if (extensions.has("GL_EXT_framebuffer_blit")) {
|
||||
GET_PROC_SUFFIX(BlitFramebuffer, EXT);
|
||||
}
|
||||
} else {
|
||||
// we must have FBOs
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (extensions.has("GL_NV_path_rendering")) {
|
||||
GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
|
||||
GET_PROC_SUFFIX(MatrixLoadf, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_NV_path_rendering")) {
|
||||
GET_PROC_SUFFIX(CoverFillPath, NV);
|
||||
GET_PROC_SUFFIX(CoverFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(CoverStrokePath, NV);
|
||||
GET_PROC_SUFFIX(CoverStrokePathInstanced, NV);
|
||||
GET_PROC_SUFFIX(DeletePaths, NV);
|
||||
GET_PROC_SUFFIX(GenPaths, NV);
|
||||
GET_PROC_SUFFIX(IsPath, NV);
|
||||
GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
|
||||
GET_PROC_SUFFIX(PathCommands, NV);
|
||||
GET_PROC_SUFFIX(PathParameterf, NV);
|
||||
GET_PROC_SUFFIX(PathParameteri, NV);
|
||||
GET_PROC_SUFFIX(PathParameterf, NV);
|
||||
GET_PROC_SUFFIX(GenPaths, NV);
|
||||
GET_PROC_SUFFIX(DeletePaths, NV);
|
||||
GET_PROC_SUFFIX(IsPath, NV);
|
||||
GET_PROC_SUFFIX(PathStencilFunc, NV);
|
||||
GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV);
|
||||
GET_PROC_SUFFIX(StencilFillPath, NV);
|
||||
GET_PROC_SUFFIX(StencilFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilStrokePath, NV);
|
||||
GET_PROC_SUFFIX(StencilFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilStrokePathInstanced, NV);
|
||||
GET_PROC_SUFFIX(CoverFillPath, NV);
|
||||
GET_PROC_SUFFIX(CoverStrokePath, NV);
|
||||
GET_PROC_SUFFIX(CoverFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(CoverStrokePathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPath, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverStrokePath, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV);
|
||||
GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
|
||||
GET_PROC_SUFFIX(CoverageModulation, NV);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
GET_PROC(DebugMessageCallback);
|
||||
if (extensions.has("GL_EXT_debug_marker")) {
|
||||
GET_PROC_SUFFIX(InsertEventMarker, EXT);
|
||||
GET_PROC_SUFFIX(PushGroupMarker, EXT);
|
||||
GET_PROC_SUFFIX(PopGroupMarker, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_invalidate_subdata")) {
|
||||
GET_PROC(InvalidateBufferData);
|
||||
GET_PROC(InvalidateBufferSubData);
|
||||
GET_PROC(InvalidateFramebuffer);
|
||||
GET_PROC(InvalidateSubFramebuffer);
|
||||
GET_PROC(InvalidateTexImage);
|
||||
GET_PROC(InvalidateTexSubImage);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_program_interface_query")) {
|
||||
GET_PROC(GetProgramResourceLocation);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_KHR_debug")) {
|
||||
// KHR_debug defines these methods to have no suffix in an OpenGL (not ES) context.
|
||||
GET_PROC(DebugMessageControl);
|
||||
GET_PROC(DebugMessageInsert);
|
||||
GET_PROC(GetDebugMessageLog);
|
||||
GET_PROC(ObjectLabel);
|
||||
GET_PROC(PopDebugGroup);
|
||||
GET_PROC(PushDebugGroup);
|
||||
} else if (extensions.has("GL_KHR_debug")) {
|
||||
GET_PROC(DebugMessageCallback);
|
||||
GET_PROC(DebugMessageControl);
|
||||
GET_PROC(DebugMessageInsert);
|
||||
GET_PROC(GetDebugMessageLog);
|
||||
GET_PROC(ObjectLabel);
|
||||
GET_PROC(PopDebugGroup);
|
||||
GET_PROC(PushDebugGroup);
|
||||
GET_PROC(PopDebugGroup);
|
||||
GET_PROC(ObjectLabel);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_EXT_window_rectangles")) {
|
||||
GET_PROC_SUFFIX(WindowRectangles, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("EGL_KHR_image")) {
|
||||
GET_EGL_PROC_SUFFIX(CreateImage, KHR);
|
||||
GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
|
||||
} else if (extensions.has("EGL_KHR_image_base")) {
|
||||
if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) {
|
||||
GET_EGL_PROC_SUFFIX(CreateImage, KHR);
|
||||
GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,2)) {
|
||||
GET_PROC(ClientWaitSync);
|
||||
GET_PROC(DeleteSync);
|
||||
if (glVer >= GR_GL_VER(3, 2) || extensions.has("GL_ARB_sync")) {
|
||||
GET_PROC(FenceSync);
|
||||
GET_PROC(IsSync);
|
||||
GET_PROC(WaitSync);
|
||||
} else if (extensions.has("GL_ARB_sync")) {
|
||||
GET_PROC(ClientWaitSync);
|
||||
GET_PROC(DeleteSync);
|
||||
GET_PROC(FenceSync);
|
||||
GET_PROC(IsSync);
|
||||
GET_PROC(WaitSync);
|
||||
GET_PROC(DeleteSync);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,2)) {
|
||||
GET_PROC(GetInternalformativ);
|
||||
} else if (extensions.has("GL_ARB_internalformat_query")) {
|
||||
if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_internalformat_query")) {
|
||||
GET_PROC(GetInternalformativ);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,1)) {
|
||||
if (glVer >= GR_GL_VER(4, 1)) {
|
||||
GET_PROC(GetProgramBinary);
|
||||
GET_PROC(ProgramBinary);
|
||||
GET_PROC(ProgramParameteri);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,2)) {
|
||||
GET_PROC(BindSampler);
|
||||
GET_PROC(DeleteSamplers);
|
||||
GET_PROC(GenSamplers);
|
||||
GET_PROC(SamplerParameteri);
|
||||
GET_PROC(SamplerParameteriv);
|
||||
} else if (extensions.has("GL_ARB_sampler_objects")) {
|
||||
if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_sampler_objects")) {
|
||||
GET_PROC(BindSampler);
|
||||
GET_PROC(DeleteSamplers);
|
||||
GET_PROC(GenSamplers);
|
||||
@ -442,60 +380,6 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc g
|
||||
GET_PROC(SamplerParameteriv);
|
||||
}
|
||||
|
||||
GET_PROC(GetQueryObjectiv);
|
||||
|
||||
GET_PROC(BeginQuery);
|
||||
GET_PROC(DeleteQueries);
|
||||
GET_PROC(EndQuery);
|
||||
GET_PROC(GenQueries);
|
||||
GET_PROC(GetQueryObjectuiv);
|
||||
GET_PROC(GetQueryiv);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,3)) {
|
||||
GET_PROC(GetQueryObjecti64v);
|
||||
GET_PROC(GetQueryObjectui64v);
|
||||
} else if (extensions.has("GL_ARB_timer_query")) {
|
||||
GET_PROC(GetQueryObjecti64v);
|
||||
GET_PROC(GetQueryObjectui64v);
|
||||
} else if (extensions.has("GL_EXT_timer_query")) {
|
||||
GET_PROC_SUFFIX(GetQueryObjecti64v, EXT);
|
||||
GET_PROC_SUFFIX(GetQueryObjectui64v, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,3)) {
|
||||
GET_PROC(QueryCounter);
|
||||
} else if (extensions.has("GL_ARB_timer_query")) {
|
||||
GET_PROC(QueryCounter);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
GET_PROC(InvalidateBufferData);
|
||||
GET_PROC(InvalidateBufferSubData);
|
||||
GET_PROC(InvalidateTexImage);
|
||||
GET_PROC(InvalidateTexSubImage);
|
||||
} else if (extensions.has("GL_ARB_invalidate_subdata")) {
|
||||
GET_PROC(InvalidateBufferData);
|
||||
GET_PROC(InvalidateBufferSubData);
|
||||
GET_PROC(InvalidateTexImage);
|
||||
GET_PROC(InvalidateTexSubImage);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
GET_PROC(InvalidateFramebuffer);
|
||||
GET_PROC(InvalidateSubFramebuffer);
|
||||
} else if (extensions.has("GL_ARB_invalidate_subdata")) {
|
||||
GET_PROC(InvalidateFramebuffer);
|
||||
GET_PROC(InvalidateSubFramebuffer);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
GET_PROC(GetShaderPrecisionFormat);
|
||||
} else if (extensions.has("GL_ARB_ES2_compatibility")) {
|
||||
GET_PROC(GetShaderPrecisionFormat);
|
||||
}
|
||||
|
||||
|
||||
// End autogenerated content
|
||||
interface->fStandard = kGL_GrGLStandard;
|
||||
interface->fExtensions.swap(&extensions);
|
||||
|
@ -3,10 +3,6 @@
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* THIS FILE IS AUTOGENERATED
|
||||
* Make edits to tools/gpu/gl/interface/templates.go or they will
|
||||
* be overwritten.
|
||||
*/
|
||||
|
||||
#include "gl/GrGLAssembleInterface.h"
|
||||
@ -31,9 +27,9 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
}
|
||||
|
||||
const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
|
||||
GrGLVersion glVer = GrGLGetVersionFromString(verStr);
|
||||
GrGLVersion version = GrGLGetVersionFromString(verStr);
|
||||
|
||||
if (glVer < GR_GL_VER(2,0)) {
|
||||
if (version < GR_GL_VER(2,0)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -51,12 +47,33 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
sk_sp<GrGLInterface> interface(new GrGLInterface);
|
||||
GrGLInterface::Functions* functions = &interface->fFunctions;
|
||||
|
||||
// Autogenerated content follows
|
||||
GET_PROC(ActiveTexture);
|
||||
GET_PROC(AttachShader);
|
||||
GET_PROC(BindAttribLocation);
|
||||
GET_PROC(BindBuffer);
|
||||
GET_PROC(BindTexture);
|
||||
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(BindVertexArray);
|
||||
GET_PROC(DeleteVertexArrays);
|
||||
GET_PROC(GenVertexArrays);
|
||||
} else if (extensions.has("GL_OES_vertex_array_object")) {
|
||||
GET_PROC_SUFFIX(BindVertexArray, OES);
|
||||
GET_PROC_SUFFIX(DeleteVertexArrays, OES);
|
||||
GET_PROC_SUFFIX(GenVertexArrays, OES);
|
||||
}
|
||||
|
||||
if (version >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) {
|
||||
GET_PROC_SUFFIX(BindFragDataLocation, EXT);
|
||||
GET_PROC_SUFFIX(BindFragDataLocationIndexed, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_KHR_blend_equation_advanced")) {
|
||||
GET_PROC_SUFFIX(BlendBarrier, KHR);
|
||||
} else if (extensions.has("GL_NV_blend_equation_advanced")) {
|
||||
GET_PROC_SUFFIX(BlendBarrier, NV);
|
||||
}
|
||||
|
||||
GET_PROC(BlendColor);
|
||||
GET_PROC(BlendEquation);
|
||||
GET_PROC(BlendFunc);
|
||||
@ -65,6 +82,10 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
GET_PROC(Clear);
|
||||
GET_PROC(ClearColor);
|
||||
GET_PROC(ClearStencil);
|
||||
if (extensions.has("GL_EXT_clear_texture")) {
|
||||
GET_PROC_SUFFIX(ClearTexImage, EXT);
|
||||
GET_PROC_SUFFIX(ClearTexSubImage, EXT);
|
||||
}
|
||||
GET_PROC(ColorMask);
|
||||
GET_PROC(CompileShader);
|
||||
GET_PROC(CompressedTexImage2D);
|
||||
@ -81,27 +102,66 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
GET_PROC(Disable);
|
||||
GET_PROC(DisableVertexAttribArray);
|
||||
GET_PROC(DrawArrays);
|
||||
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(DrawArraysInstanced);
|
||||
GET_PROC(DrawBuffers);
|
||||
GET_PROC(DrawElementsInstanced);
|
||||
} else if (extensions.has("GL_EXT_draw_instanced")) {
|
||||
GET_PROC_SUFFIX(DrawArraysInstanced, EXT);
|
||||
GET_PROC_SUFFIX(DrawElementsInstanced, EXT);
|
||||
}
|
||||
|
||||
if (version >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(DrawArraysIndirect);
|
||||
GET_PROC(DrawElementsIndirect);
|
||||
}
|
||||
|
||||
GET_PROC(DrawElements);
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(DrawRangeElements);
|
||||
}
|
||||
GET_PROC(Enable);
|
||||
GET_PROC(EnableVertexAttribArray);
|
||||
GET_PROC(Finish);
|
||||
GET_PROC(Flush);
|
||||
GET_PROC(FrontFace);
|
||||
GET_PROC(GenBuffers);
|
||||
GET_PROC(GenerateMipmap);
|
||||
GET_PROC(GenTextures);
|
||||
GET_PROC(GetBufferParameteriv);
|
||||
GET_PROC(GetError);
|
||||
GET_PROC(GetIntegerv);
|
||||
|
||||
if (version >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(GetMultisamplefv);
|
||||
}
|
||||
|
||||
GET_PROC(GetProgramInfoLog);
|
||||
GET_PROC(GetProgramiv);
|
||||
GET_PROC(GetShaderInfoLog);
|
||||
GET_PROC(GetShaderPrecisionFormat);
|
||||
GET_PROC(GetShaderiv);
|
||||
GET_PROC(GetString);
|
||||
GET_PROC(GetStringi);
|
||||
if (version >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(GetTexLevelParameteriv);
|
||||
}
|
||||
GET_PROC(GetUniformLocation);
|
||||
GET_PROC(IsTexture);
|
||||
GET_PROC(LineWidth);
|
||||
GET_PROC(LinkProgram);
|
||||
|
||||
if (extensions.has("GL_EXT_multi_draw_indirect")) {
|
||||
GET_PROC_SUFFIX(MultiDrawArraysIndirect, EXT);
|
||||
GET_PROC_SUFFIX(MultiDrawElementsIndirect, EXT);
|
||||
}
|
||||
|
||||
GET_PROC(PixelStorei);
|
||||
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(ReadBuffer);
|
||||
}
|
||||
GET_PROC(ReadPixels);
|
||||
GET_PROC(Scissor);
|
||||
GET_PROC(ShaderSource);
|
||||
@ -111,27 +171,51 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
GET_PROC(StencilMaskSeparate);
|
||||
GET_PROC(StencilOp);
|
||||
GET_PROC(StencilOpSeparate);
|
||||
|
||||
if (version >= GR_GL_VER(3,2)) {
|
||||
GET_PROC(TexBuffer);
|
||||
GET_PROC(TexBufferRange);
|
||||
} else if (extensions.has("GL_OES_texture_buffer")) {
|
||||
GET_PROC_SUFFIX(TexBuffer, OES);
|
||||
GET_PROC_SUFFIX(TexBufferRange, OES);
|
||||
} else if (extensions.has("GL_EXT_texture_buffer")) {
|
||||
GET_PROC_SUFFIX(TexBuffer, EXT);
|
||||
GET_PROC_SUFFIX(TexBufferRange, EXT);
|
||||
}
|
||||
|
||||
GET_PROC(TexImage2D);
|
||||
GET_PROC(TexParameterf);
|
||||
GET_PROC(TexParameterfv);
|
||||
GET_PROC(TexParameteri);
|
||||
GET_PROC(TexParameteriv);
|
||||
GET_PROC(TexSubImage2D);
|
||||
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(TexStorage2D);
|
||||
} else {
|
||||
GET_PROC_SUFFIX(TexStorage2D, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_NV_texture_barrier")) {
|
||||
GET_PROC_SUFFIX(TextureBarrier, NV);
|
||||
}
|
||||
|
||||
GET_PROC_SUFFIX(DiscardFramebuffer, EXT);
|
||||
GET_PROC(Uniform1f);
|
||||
GET_PROC(Uniform1fv);
|
||||
GET_PROC(Uniform1i);
|
||||
GET_PROC(Uniform1fv);
|
||||
GET_PROC(Uniform1iv);
|
||||
GET_PROC(Uniform2f);
|
||||
GET_PROC(Uniform2fv);
|
||||
GET_PROC(Uniform2i);
|
||||
GET_PROC(Uniform2fv);
|
||||
GET_PROC(Uniform2iv);
|
||||
GET_PROC(Uniform3f);
|
||||
GET_PROC(Uniform3fv);
|
||||
GET_PROC(Uniform3i);
|
||||
GET_PROC(Uniform3fv);
|
||||
GET_PROC(Uniform3iv);
|
||||
GET_PROC(Uniform4f);
|
||||
GET_PROC(Uniform4fv);
|
||||
GET_PROC(Uniform4i);
|
||||
GET_PROC(Uniform4fv);
|
||||
GET_PROC(Uniform4iv);
|
||||
GET_PROC(UniformMatrix2fv);
|
||||
GET_PROC(UniformMatrix3fv);
|
||||
@ -141,117 +225,19 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
GET_PROC(VertexAttrib2fv);
|
||||
GET_PROC(VertexAttrib3fv);
|
||||
GET_PROC(VertexAttrib4fv);
|
||||
GET_PROC(VertexAttribPointer);
|
||||
GET_PROC(Viewport);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(GetStringi);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(BindVertexArray);
|
||||
GET_PROC(DeleteVertexArrays);
|
||||
GET_PROC(GenVertexArrays);
|
||||
} else if (extensions.has("GL_OES_vertex_array_object")) {
|
||||
GET_PROC_SUFFIX(BindVertexArray, OES);
|
||||
GET_PROC_SUFFIX(DeleteVertexArrays, OES);
|
||||
GET_PROC_SUFFIX(GenVertexArrays, OES);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) {
|
||||
GET_PROC_SUFFIX(BindFragDataLocation, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) {
|
||||
GET_PROC_SUFFIX(BindFragDataLocationIndexed, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_KHR_blend_equation_advanced")) {
|
||||
GET_PROC_SUFFIX(BlendBarrier, KHR);
|
||||
} else if (extensions.has("GL_NV_blend_equation_advanced")) {
|
||||
GET_PROC_SUFFIX(BlendBarrier, NV);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_EXT_clear_texture")) {
|
||||
GET_PROC_SUFFIX(ClearTexImage, EXT);
|
||||
GET_PROC_SUFFIX(ClearTexSubImage, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(DrawArraysInstanced);
|
||||
GET_PROC(DrawElementsInstanced);
|
||||
} else if (extensions.has("GL_EXT_draw_instanced")) {
|
||||
GET_PROC_SUFFIX(DrawArraysInstanced, EXT);
|
||||
GET_PROC_SUFFIX(DrawElementsInstanced, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(DrawBuffers);
|
||||
GET_PROC(ReadBuffer);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(DrawArraysIndirect);
|
||||
GET_PROC(DrawElementsIndirect);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(DrawRangeElements);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(GetMultisamplefv);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(GetTexLevelParameteriv);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_EXT_multi_draw_indirect")) {
|
||||
GET_PROC_SUFFIX(MultiDrawArraysIndirect, EXT);
|
||||
GET_PROC_SUFFIX(MultiDrawElementsIndirect, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,2)) {
|
||||
GET_PROC(TexBuffer);
|
||||
} else if (extensions.has("GL_OES_texture_buffer")) {
|
||||
GET_PROC_SUFFIX(TexBuffer, OES);
|
||||
} else if (extensions.has("GL_EXT_texture_buffer")) {
|
||||
GET_PROC_SUFFIX(TexBuffer, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,2)) {
|
||||
GET_PROC(TexBufferRange);
|
||||
} else if (extensions.has("GL_OES_texture_buffer")) {
|
||||
GET_PROC_SUFFIX(TexBufferRange, OES);
|
||||
} else if (extensions.has("GL_EXT_texture_buffer")) {
|
||||
GET_PROC_SUFFIX(TexBufferRange, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(TexStorage2D);
|
||||
} else if (extensions.has("GL_EXT_texture_storage")) {
|
||||
GET_PROC_SUFFIX(TexStorage2D, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_NV_texture_barrier")) {
|
||||
GET_PROC_SUFFIX(TextureBarrier, NV);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_EXT_discard_framebuffer")) {
|
||||
GET_PROC_SUFFIX(DiscardFramebuffer, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(VertexAttribDivisor);
|
||||
} else if (extensions.has("GL_EXT_instanced_arrays")) {
|
||||
GET_PROC_SUFFIX(VertexAttribDivisor, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(VertexAttribIPointer);
|
||||
}
|
||||
|
||||
GET_PROC(VertexAttribPointer);
|
||||
GET_PROC(Viewport);
|
||||
GET_PROC(BindFramebuffer);
|
||||
GET_PROC(BindRenderbuffer);
|
||||
GET_PROC(CheckFramebufferStatus);
|
||||
@ -259,27 +245,20 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
GET_PROC(DeleteRenderbuffers);
|
||||
GET_PROC(FramebufferRenderbuffer);
|
||||
GET_PROC(FramebufferTexture2D);
|
||||
GET_PROC(GenFramebuffers);
|
||||
GET_PROC(GenRenderbuffers);
|
||||
GET_PROC(GenerateMipmap);
|
||||
GET_PROC(GetFramebufferAttachmentParameteriv);
|
||||
GET_PROC(GetRenderbufferParameteriv);
|
||||
GET_PROC(RenderbufferStorage);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(RenderbufferStorageMultisample);
|
||||
GET_PROC(BlitFramebuffer);
|
||||
} else if (extensions.has("GL_CHROMIUM_framebuffer_multisample")) {
|
||||
GET_PROC_SUFFIX(BlitFramebuffer, CHROMIUM);
|
||||
} else if (extensions.has("GL_ANGLE_framebuffer_blit")) {
|
||||
GET_PROC_SUFFIX(BlitFramebuffer, ANGLE);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(RenderbufferStorageMultisample);
|
||||
} else if (extensions.has("GL_CHROMIUM_framebuffer_multisample")) {
|
||||
GET_PROC_SUFFIX(RenderbufferStorageMultisample, CHROMIUM);
|
||||
} else if (extensions.has("GL_ANGLE_framebuffer_multisample")) {
|
||||
GET_PROC_SUFFIX(RenderbufferStorageMultisample, ANGLE);
|
||||
GET_PROC_SUFFIX(BlitFramebuffer, CHROMIUM);
|
||||
} else {
|
||||
if (extensions.has("GL_ANGLE_framebuffer_multisample")) {
|
||||
GET_PROC_SUFFIX(RenderbufferStorageMultisample, ANGLE);
|
||||
}
|
||||
if (extensions.has("GL_ANGLE_framebuffer_blit")) {
|
||||
GET_PROC_SUFFIX(BlitFramebuffer, ANGLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (extensions.has("GL_CHROMIUM_map_sub")) {
|
||||
@ -291,121 +270,144 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
|
||||
if (extensions.has("GL_EXT_multisampled_render_to_texture")) {
|
||||
GET_PROC_SUFFIX(FramebufferTexture2DMultisample, EXT);
|
||||
functions->fRenderbufferStorageMultisampleES2EXT =
|
||||
(GrGLRenderbufferStorageMultisampleFn*)get(ctx,
|
||||
"glRenderbufferStorageMultisampleEXT");
|
||||
} else if (extensions.has("GL_IMG_multisampled_render_to_texture")) {
|
||||
GET_PROC_SUFFIX(FramebufferTexture2DMultisample, IMG);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_EXT_multisampled_render_to_texture")) {
|
||||
functions->fRenderbufferStorageMultisampleES2EXT =(GrGLRenderbufferStorageMultisampleFn*)get(ctx, "glRenderbufferStorageMultisampleEXT");
|
||||
}
|
||||
|
||||
if (extensions.has("GL_IMG_multisampled_render_to_texture")) {
|
||||
functions->fRenderbufferStorageMultisampleES2EXT =(GrGLRenderbufferStorageMultisampleFn*)get(ctx, "glRenderbufferStorageMultisampleIMG");
|
||||
}
|
||||
|
||||
if (extensions.has("GL_APPLE_framebuffer_multisample")) {
|
||||
functions->fRenderbufferStorageMultisampleES2EXT =
|
||||
(GrGLRenderbufferStorageMultisampleFn*)get(ctx,
|
||||
"glRenderbufferStorageMultisampleIMG");
|
||||
} else if (extensions.has("GL_APPLE_framebuffer_multisample")) {
|
||||
functions->fRenderbufferStorageMultisampleES2APPLE =
|
||||
(GrGLRenderbufferStorageMultisampleFn*)get(ctx,
|
||||
"glRenderbufferStorageMultisampleAPPLE");
|
||||
GET_PROC_SUFFIX(ResolveMultisampleFramebuffer, APPLE);
|
||||
functions->fRenderbufferStorageMultisampleES2APPLE =(GrGLRenderbufferStorageMultisampleFn*)get(ctx, "glRenderbufferStorageMultisampleAPPLE");
|
||||
}
|
||||
|
||||
if (extensions.has("GL_OES_mapbuffer")) {
|
||||
GET_PROC_SUFFIX(MapBuffer, OES);
|
||||
}
|
||||
GET_PROC(GenFramebuffers);
|
||||
GET_PROC(GenRenderbuffers);
|
||||
GET_PROC(GetFramebufferAttachmentParameteriv);
|
||||
GET_PROC(GetRenderbufferParameteriv);
|
||||
GET_PROC(RenderbufferStorage);
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
// There are several APIs for buffer mapping:
|
||||
// ES2 + GL_OES_mapbuffer: MapBufferOES and UnmapBufferOES
|
||||
// ES2 + GL_EXT_map_buffer_range: Adds MapBufferRangeEXT and FlushMappedBufferRangeEXT
|
||||
// ES3: MapBufferRange, FlushMappedBufferRange, and UnmapBuffer are core (so no suffix).
|
||||
//
|
||||
// MapBuffer is not part of ES3, but implementations may still report the OES versions of
|
||||
// MapBuffer and UnmapBuffer, per the older GL_OES_mapbuffer extension. Some implementations
|
||||
// let us mix the newer MapBufferRange with the older UnmapBufferOES, but we've hit others that
|
||||
// don't permit it. Note that in GrGLBuffer, we choose which API to use based on version and
|
||||
// extensions. This code is written so that we never mix OES and non-OES functions.
|
||||
GET_PROC_SUFFIX(MapBuffer, OES);
|
||||
if (version >= GR_GL_VER(3, 0)) {
|
||||
GET_PROC(UnmapBuffer);
|
||||
} else if (extensions.has("GL_OES_mapbuffer")) {
|
||||
} else {
|
||||
GET_PROC_SUFFIX(UnmapBuffer, OES);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(FlushMappedBufferRange);
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(MapBufferRange);
|
||||
GET_PROC(FlushMappedBufferRange);
|
||||
} else if (extensions.has("GL_EXT_map_buffer_range")) {
|
||||
GET_PROC_SUFFIX(FlushMappedBufferRange, EXT);
|
||||
GET_PROC_SUFFIX(MapBufferRange, EXT);
|
||||
GET_PROC_SUFFIX(FlushMappedBufferRange, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_EXT_debug_marker")) {
|
||||
GET_PROC_SUFFIX(InsertEventMarker, EXT);
|
||||
GET_PROC_SUFFIX(PopGroupMarker, EXT);
|
||||
GET_PROC_SUFFIX(PushGroupMarker, EXT);
|
||||
GET_PROC_SUFFIX(PopGroupMarker, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(InvalidateFramebuffer);
|
||||
GET_PROC(InvalidateSubFramebuffer);
|
||||
GET_PROC(InvalidateBufferData);
|
||||
GET_PROC(InvalidateBufferSubData);
|
||||
GET_PROC(InvalidateTexImage);
|
||||
GET_PROC(InvalidateTexSubImage);
|
||||
|
||||
if (version >= GR_GL_VER(3,1)) {
|
||||
GET_PROC(GetProgramResourceLocation);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_CHROMIUM_path_rendering")) {
|
||||
GET_PROC_SUFFIX(MatrixLoadIdentity, CHROMIUM);
|
||||
GET_PROC_SUFFIX(MatrixLoadf, CHROMIUM);
|
||||
} else if (extensions.has("GL_NV_path_rendering")) {
|
||||
GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
|
||||
if (extensions.has("GL_NV_path_rendering")) {
|
||||
GET_PROC_SUFFIX(MatrixLoadf, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_CHROMIUM_path_rendering")) {
|
||||
GET_PROC_SUFFIX(CoverFillPath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(CoverFillPathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(CoverStrokePath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(CoverStrokePathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(DeletePaths, CHROMIUM);
|
||||
GET_PROC_SUFFIX(GenPaths, CHROMIUM);
|
||||
GET_PROC_SUFFIX(IsPath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(PathCommands, CHROMIUM);
|
||||
GET_PROC_SUFFIX(PathParameterf, CHROMIUM);
|
||||
GET_PROC_SUFFIX(PathParameteri, CHROMIUM);
|
||||
GET_PROC_SUFFIX(PathStencilFunc, CHROMIUM);
|
||||
GET_PROC_SUFFIX(ProgramPathFragmentInputGen, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilFillPath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilFillPathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilStrokePath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilStrokePathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilThenCoverStrokePath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, CHROMIUM);
|
||||
} else if (extensions.has("GL_NV_path_rendering")) {
|
||||
GET_PROC_SUFFIX(CoverFillPath, NV);
|
||||
GET_PROC_SUFFIX(CoverFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(CoverStrokePath, NV);
|
||||
GET_PROC_SUFFIX(CoverStrokePathInstanced, NV);
|
||||
GET_PROC_SUFFIX(DeletePaths, NV);
|
||||
GET_PROC_SUFFIX(GenPaths, NV);
|
||||
GET_PROC_SUFFIX(IsPath, NV);
|
||||
GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
|
||||
GET_PROC_SUFFIX(PathCommands, NV);
|
||||
GET_PROC_SUFFIX(PathParameterf, NV);
|
||||
GET_PROC_SUFFIX(PathParameteri, NV);
|
||||
GET_PROC_SUFFIX(PathParameterf, NV);
|
||||
GET_PROC_SUFFIX(GenPaths, NV);
|
||||
GET_PROC_SUFFIX(DeletePaths, NV);
|
||||
GET_PROC_SUFFIX(IsPath, NV);
|
||||
GET_PROC_SUFFIX(PathStencilFunc, NV);
|
||||
GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV);
|
||||
GET_PROC_SUFFIX(StencilFillPath, NV);
|
||||
GET_PROC_SUFFIX(StencilFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilStrokePath, NV);
|
||||
GET_PROC_SUFFIX(StencilFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilStrokePathInstanced, NV);
|
||||
GET_PROC_SUFFIX(CoverFillPath, NV);
|
||||
GET_PROC_SUFFIX(CoverStrokePath, NV);
|
||||
GET_PROC_SUFFIX(CoverFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(CoverStrokePathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPath, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverStrokePath, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV);
|
||||
GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV);
|
||||
GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_CHROMIUM_path_rendering")) {
|
||||
GET_PROC_SUFFIX(MatrixLoadf, CHROMIUM);
|
||||
GET_PROC_SUFFIX(MatrixLoadIdentity, CHROMIUM);
|
||||
GET_PROC_SUFFIX(PathCommands, CHROMIUM);
|
||||
GET_PROC_SUFFIX(PathParameteri, CHROMIUM);
|
||||
GET_PROC_SUFFIX(PathParameterf, CHROMIUM);
|
||||
GET_PROC_SUFFIX(GenPaths, CHROMIUM);
|
||||
GET_PROC_SUFFIX(DeletePaths, CHROMIUM);
|
||||
GET_PROC_SUFFIX(IsPath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(PathStencilFunc, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilFillPath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilStrokePath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilFillPathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilStrokePathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(CoverFillPath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(CoverStrokePath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(CoverFillPathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(CoverStrokePathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilThenCoverStrokePath, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, CHROMIUM);
|
||||
GET_PROC_SUFFIX(ProgramPathFragmentInputGen, CHROMIUM);
|
||||
// GL_CHROMIUM_path_rendering additions:
|
||||
GET_PROC_SUFFIX(BindFragmentInputLocation, CHROMIUM);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
|
||||
GET_PROC_SUFFIX(CoverageModulation, NV);
|
||||
}
|
||||
if (extensions.has("GL_CHROMIUM_framebuffer_mixed_samples")) {
|
||||
GET_PROC_SUFFIX(CoverageModulation, CHROMIUM);
|
||||
} else if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
|
||||
GET_PROC_SUFFIX(CoverageModulation, NV);
|
||||
}
|
||||
|
||||
if (extensions.has("GL_KHR_debug")) {
|
||||
GET_PROC_SUFFIX(DebugMessageCallback, KHR);
|
||||
GET_PROC_SUFFIX(DebugMessageControl, KHR);
|
||||
GET_PROC_SUFFIX(DebugMessageInsert, KHR);
|
||||
GET_PROC_SUFFIX(DebugMessageCallback, KHR);
|
||||
GET_PROC_SUFFIX(GetDebugMessageLog, KHR);
|
||||
GET_PROC_SUFFIX(ObjectLabel, KHR);
|
||||
GET_PROC_SUFFIX(PopDebugGroup, KHR);
|
||||
GET_PROC_SUFFIX(PushDebugGroup, KHR);
|
||||
GET_PROC_SUFFIX(PopDebugGroup, KHR);
|
||||
GET_PROC_SUFFIX(ObjectLabel, KHR);
|
||||
// In general we have a policy against removing extension strings when the driver does
|
||||
// not provide function pointers for an advertised extension. However, because there is a
|
||||
// known device that advertises GL_KHR_debug but fails to provide the functions and this is
|
||||
// a debugging- only extension we've made an exception. This also can happen when using
|
||||
// APITRACE.
|
||||
if (!interface->fFunctions.fDebugMessageControl) {
|
||||
extensions.remove("GL_KHR_debug");
|
||||
}
|
||||
}
|
||||
|
||||
if (extensions.has("GL_CHROMIUM_bind_uniform_location")) {
|
||||
@ -416,39 +418,36 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
GET_PROC_SUFFIX(WindowRectangles, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("EGL_KHR_image")) {
|
||||
GET_EGL_PROC_SUFFIX(CreateImage, KHR);
|
||||
GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
|
||||
} else if (extensions.has("EGL_KHR_image_base")) {
|
||||
if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) {
|
||||
GET_EGL_PROC_SUFFIX(CreateImage, KHR);
|
||||
GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(ClientWaitSync);
|
||||
GET_PROC(DeleteSync);
|
||||
if (version >= GR_GL_VER(3, 0)) {
|
||||
GET_PROC(FenceSync);
|
||||
GET_PROC(IsSync);
|
||||
GET_PROC(ClientWaitSync);
|
||||
GET_PROC(WaitSync);
|
||||
GET_PROC(DeleteSync);
|
||||
} else if (extensions.has("GL_APPLE_sync")) {
|
||||
GET_PROC_SUFFIX(ClientWaitSync, APPLE);
|
||||
GET_PROC_SUFFIX(DeleteSync, APPLE);
|
||||
GET_PROC_SUFFIX(FenceSync, APPLE);
|
||||
GET_PROC_SUFFIX(IsSync, APPLE);
|
||||
GET_PROC_SUFFIX(ClientWaitSync, APPLE);
|
||||
GET_PROC_SUFFIX(WaitSync, APPLE);
|
||||
GET_PROC_SUFFIX(DeleteSync, APPLE);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(GetInternalformativ);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
if (version >= GR_GL_VER(3, 0)) {
|
||||
GET_PROC(GetProgramBinary);
|
||||
GET_PROC(ProgramBinary);
|
||||
GET_PROC(ProgramParameteri);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
if (version >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(BindSampler);
|
||||
GET_PROC(DeleteSamplers);
|
||||
GET_PROC(GenSamplers);
|
||||
@ -456,44 +455,6 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
GET_PROC(SamplerParameteriv);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(BeginQuery);
|
||||
GET_PROC(DeleteQueries);
|
||||
GET_PROC(EndQuery);
|
||||
GET_PROC(GenQueries);
|
||||
GET_PROC(GetQueryObjectuiv);
|
||||
GET_PROC(GetQueryiv);
|
||||
} else if (extensions.has("GL_EXT_occlusion_query_boolean")) {
|
||||
GET_PROC_SUFFIX(BeginQuery, EXT);
|
||||
GET_PROC_SUFFIX(DeleteQueries, EXT);
|
||||
GET_PROC_SUFFIX(EndQuery, EXT);
|
||||
GET_PROC_SUFFIX(GenQueries, EXT);
|
||||
GET_PROC_SUFFIX(GetQueryObjectuiv, EXT);
|
||||
GET_PROC_SUFFIX(GetQueryiv, EXT);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(InvalidateFramebuffer);
|
||||
GET_PROC(InvalidateSubFramebuffer);
|
||||
}
|
||||
|
||||
GET_PROC(GetShaderPrecisionFormat);
|
||||
|
||||
|
||||
// End autogenerated content
|
||||
// TODO(kjlubick): Do we want a feature that removes the extension if it doesn't have
|
||||
// the function? This is common on some low-end GPUs.
|
||||
|
||||
if (extensions.has("GL_KHR_debug")) {
|
||||
// In general we have a policy against removing extension strings when the driver does
|
||||
// not provide function pointers for an advertised extension. However, because there is a
|
||||
// known device that advertises GL_KHR_debug but fails to provide the functions and this is
|
||||
// a debugging- only extension we've made an exception. This also can happen when using
|
||||
// APITRACE.
|
||||
if (!interface->fFunctions.fDebugMessageControl) {
|
||||
extensions.remove("GL_KHR_debug");
|
||||
}
|
||||
}
|
||||
interface->fStandard = kGLES_GrGLStandard;
|
||||
interface->fExtensions.swap(&extensions);
|
||||
|
659
src/gpu/gl/GrGLInterface.cpp
Normal file
659
src/gpu/gl/GrGLInterface.cpp
Normal file
@ -0,0 +1,659 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
|
||||
#include "gl/GrGLInterface.h"
|
||||
#include "gl/GrGLExtensions.h"
|
||||
#include "gl/GrGLUtil.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
GrGLInterface::GrGLInterface() {
|
||||
fStandard = kNone_GrGLStandard;
|
||||
}
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
static int kIsDebug = 1;
|
||||
#else
|
||||
static int kIsDebug = 0;
|
||||
#endif
|
||||
|
||||
#define RETURN_FALSE_INTERFACE \
|
||||
if (kIsDebug) { SkDebugf("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); } \
|
||||
return false
|
||||
|
||||
bool GrGLInterface::validate() const {
|
||||
|
||||
if (kNone_GrGLStandard == fStandard) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
if (!fExtensions.isInitialized()) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
// functions that are always required
|
||||
if (!fFunctions.fActiveTexture ||
|
||||
!fFunctions.fAttachShader ||
|
||||
!fFunctions.fBindAttribLocation ||
|
||||
!fFunctions.fBindBuffer ||
|
||||
!fFunctions.fBindTexture ||
|
||||
!fFunctions.fBlendColor || // -> GL >= 1.4 or extension, ES >= 2.0
|
||||
!fFunctions.fBlendEquation || // -> GL >= 1.4 or extension, ES >= 2.0
|
||||
!fFunctions.fBlendFunc ||
|
||||
!fFunctions.fBufferData ||
|
||||
!fFunctions.fBufferSubData ||
|
||||
!fFunctions.fClear ||
|
||||
!fFunctions.fClearColor ||
|
||||
!fFunctions.fClearStencil ||
|
||||
!fFunctions.fColorMask ||
|
||||
!fFunctions.fCompileShader ||
|
||||
!fFunctions.fCompressedTexImage2D ||
|
||||
!fFunctions.fCompressedTexSubImage2D ||
|
||||
!fFunctions.fCopyTexSubImage2D ||
|
||||
!fFunctions.fCreateProgram ||
|
||||
!fFunctions.fCreateShader ||
|
||||
!fFunctions.fCullFace ||
|
||||
!fFunctions.fDeleteBuffers ||
|
||||
!fFunctions.fDeleteProgram ||
|
||||
!fFunctions.fDeleteShader ||
|
||||
!fFunctions.fDeleteTextures ||
|
||||
!fFunctions.fDepthMask ||
|
||||
!fFunctions.fDisable ||
|
||||
!fFunctions.fDisableVertexAttribArray ||
|
||||
!fFunctions.fDrawArrays ||
|
||||
!fFunctions.fDrawElements ||
|
||||
!fFunctions.fEnable ||
|
||||
!fFunctions.fEnableVertexAttribArray ||
|
||||
!fFunctions.fFrontFace ||
|
||||
!fFunctions.fGenBuffers ||
|
||||
!fFunctions.fGenTextures ||
|
||||
!fFunctions.fGetBufferParameteriv ||
|
||||
!fFunctions.fGenerateMipmap ||
|
||||
!fFunctions.fGetError ||
|
||||
!fFunctions.fGetIntegerv ||
|
||||
!fFunctions.fGetProgramInfoLog ||
|
||||
!fFunctions.fGetProgramiv ||
|
||||
!fFunctions.fGetShaderInfoLog ||
|
||||
!fFunctions.fGetShaderiv ||
|
||||
!fFunctions.fGetString ||
|
||||
!fFunctions.fGetUniformLocation ||
|
||||
!fFunctions.fIsTexture ||
|
||||
!fFunctions.fLinkProgram ||
|
||||
!fFunctions.fLineWidth ||
|
||||
!fFunctions.fPixelStorei ||
|
||||
!fFunctions.fReadPixels ||
|
||||
!fFunctions.fScissor ||
|
||||
!fFunctions.fShaderSource ||
|
||||
!fFunctions.fStencilFunc ||
|
||||
!fFunctions.fStencilFuncSeparate ||
|
||||
!fFunctions.fStencilMask ||
|
||||
!fFunctions.fStencilMaskSeparate ||
|
||||
!fFunctions.fStencilOp ||
|
||||
!fFunctions.fStencilOpSeparate ||
|
||||
!fFunctions.fTexImage2D ||
|
||||
!fFunctions.fTexParameterf ||
|
||||
!fFunctions.fTexParameterfv ||
|
||||
!fFunctions.fTexParameteri ||
|
||||
!fFunctions.fTexParameteriv ||
|
||||
!fFunctions.fTexSubImage2D ||
|
||||
!fFunctions.fUniform1f ||
|
||||
!fFunctions.fUniform1i ||
|
||||
!fFunctions.fUniform1fv ||
|
||||
!fFunctions.fUniform1iv ||
|
||||
!fFunctions.fUniform2f ||
|
||||
!fFunctions.fUniform2i ||
|
||||
!fFunctions.fUniform2fv ||
|
||||
!fFunctions.fUniform2iv ||
|
||||
!fFunctions.fUniform3f ||
|
||||
!fFunctions.fUniform3i ||
|
||||
!fFunctions.fUniform3fv ||
|
||||
!fFunctions.fUniform3iv ||
|
||||
!fFunctions.fUniform4f ||
|
||||
!fFunctions.fUniform4i ||
|
||||
!fFunctions.fUniform4fv ||
|
||||
!fFunctions.fUniform4iv ||
|
||||
!fFunctions.fUniformMatrix2fv ||
|
||||
!fFunctions.fUniformMatrix3fv ||
|
||||
!fFunctions.fUniformMatrix4fv ||
|
||||
!fFunctions.fUseProgram ||
|
||||
!fFunctions.fVertexAttrib1f ||
|
||||
!fFunctions.fVertexAttrib2fv ||
|
||||
!fFunctions.fVertexAttrib3fv ||
|
||||
!fFunctions.fVertexAttrib4fv ||
|
||||
!fFunctions.fVertexAttribPointer ||
|
||||
!fFunctions.fViewport ||
|
||||
!fFunctions.fBindFramebuffer ||
|
||||
!fFunctions.fBindRenderbuffer ||
|
||||
!fFunctions.fCheckFramebufferStatus ||
|
||||
!fFunctions.fDeleteFramebuffers ||
|
||||
!fFunctions.fDeleteRenderbuffers ||
|
||||
!fFunctions.fFinish ||
|
||||
!fFunctions.fFlush ||
|
||||
!fFunctions.fFramebufferRenderbuffer ||
|
||||
!fFunctions.fFramebufferTexture2D ||
|
||||
!fFunctions.fGetFramebufferAttachmentParameteriv ||
|
||||
!fFunctions.fGetRenderbufferParameteriv ||
|
||||
!fFunctions.fGenFramebuffers ||
|
||||
!fFunctions.fGenRenderbuffers ||
|
||||
!fFunctions.fRenderbufferStorage) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
GrGLVersion glVer = GrGLGetVersion(this);
|
||||
if (GR_GL_INVALID_VER == glVer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
// Now check that baseline ES/Desktop fns not covered above are present
|
||||
// and that we have fn pointers for any advertised fExtensions that we will
|
||||
// try to use.
|
||||
|
||||
// these functions are part of ES2, we assume they are available
|
||||
// On the desktop we assume they are available if the extension
|
||||
// is present or GL version is high enough.
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,0) && !fFunctions.fBindFragDataLocation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,3) ||
|
||||
fExtensions.has("GL_ARB_timer_query") ||
|
||||
fExtensions.has("GL_EXT_timer_query")) {
|
||||
if (!fFunctions.fGetQueryObjecti64v ||
|
||||
!fFunctions.fGetQueryObjectui64v) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) {
|
||||
if (!fFunctions.fQueryCounter) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// part of desktop GL, but not ES
|
||||
if (GR_IS_GR_GL(fStandard) &&
|
||||
(!fFunctions.fDrawBuffer ||
|
||||
!fFunctions.fPolygonMode)) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
// ES 3.0 (or ES 2.0 extended) has glDrawBuffers but not glDrawBuffer
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,0))) {
|
||||
if (!fFunctions.fDrawBuffers) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
if (!fFunctions.fReadBuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
// glGetTexLevelParameteriv was added to ES in 3.1.
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,1))) {
|
||||
if (!fFunctions.fGetTexLevelParameteriv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
// GL_EXT_texture_storage is part of desktop 4.2
|
||||
// There is a desktop ARB extension and an ES+desktop EXT extension
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(4,2) ||
|
||||
fExtensions.has("GL_ARB_texture_storage") ||
|
||||
fExtensions.has("GL_EXT_texture_storage")) {
|
||||
if (!fFunctions.fTexStorage2D) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (fExtensions.has("GL_EXT_texture_storage")) {
|
||||
if (!fFunctions.fTexStorage2D) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// glTextureBarrier is part of desktop 4.5. There are also ARB and NV extensions.
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(4,5) ||
|
||||
fExtensions.has("GL_ARB_texture_barrier") ||
|
||||
fExtensions.has("GL_NV_texture_barrier")) {
|
||||
if (!fFunctions.fTextureBarrier) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (fExtensions.has("GL_NV_texture_barrier")) {
|
||||
if (!fFunctions.fTextureBarrier) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fExtensions.has("GL_KHR_blend_equation_advanced") ||
|
||||
fExtensions.has("GL_NV_blend_equation_advanced")) {
|
||||
if (!fFunctions.fBlendBarrier) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (fExtensions.has("GL_EXT_discard_framebuffer")) {
|
||||
if (!fFunctions.fDiscardFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
// Required since OpenGL 1.5 and ES 3.0 or with GL_EXT_occlusion_query_boolean
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (glVer >= GR_GL_VER(3,0) ||
|
||||
fExtensions.has("GL_EXT_occlusion_query_boolean")))) {
|
||||
#if 0 // Not yet added to chrome's bindings.
|
||||
if (!fFunctions.fGenQueries ||
|
||||
!fFunctions.fDeleteQueries ||
|
||||
!fFunctions.fBeginQuery ||
|
||||
!fFunctions.fEndQuery ||
|
||||
!fFunctions.fGetQueryiv ||
|
||||
!fFunctions.fGetQueryObjectuiv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// glGetQueryObjectiv doesn't exist in ES.
|
||||
if (GR_IS_GR_GL(fStandard) && !fFunctions.fGetQueryObjectiv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
// FBO MSAA
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
// GL 3.0 and the ARB extension have multisample + blit
|
||||
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) {
|
||||
if (!fFunctions.fRenderbufferStorageMultisample ||
|
||||
!fFunctions.fBlitFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
} else {
|
||||
if (fExtensions.has("GL_EXT_framebuffer_blit") &&
|
||||
!fFunctions.fBlitFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
if (fExtensions.has("GL_EXT_framebuffer_multisample") &&
|
||||
!fFunctions.fRenderbufferStorageMultisample) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) {
|
||||
if (!fFunctions.fRenderbufferStorageMultisample ||
|
||||
!fFunctions.fBlitFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
} else {
|
||||
if (fExtensions.has("GL_ANGLE_framebuffer_multisample") &&
|
||||
!fFunctions.fRenderbufferStorageMultisample) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
if (fExtensions.has("GL_ANGLE_framebuffer_blit") &&
|
||||
!fFunctions.fBlitFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
if (fExtensions.has("GL_APPLE_framebuffer_multisample")) {
|
||||
if (!fFunctions.fRenderbufferStorageMultisampleES2APPLE ||
|
||||
!fFunctions.fResolveMultisampleFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
if (fExtensions.has("GL_IMG_multisampled_render_to_texture") ||
|
||||
fExtensions.has("GL_EXT_multisampled_render_to_texture")) {
|
||||
if (!fFunctions.fRenderbufferStorageMultisampleES2EXT ||
|
||||
!fFunctions.fFramebufferTexture2DMultisample) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On ES buffer mapping is an extension. On Desktop
|
||||
// buffer mapping was part of original VBO extension
|
||||
// which we require.
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && fExtensions.has("GL_OES_mapbuffer"))) {
|
||||
if (!fFunctions.fMapBuffer ||
|
||||
!fFunctions.fUnmapBuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
// Dual source blending
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended")) {
|
||||
if (!fFunctions.fBindFragDataLocationIndexed) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended")) {
|
||||
if (!fFunctions.fBindFragDataLocation ||
|
||||
!fFunctions.fBindFragDataLocationIndexed) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard) || GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3, 0)) {
|
||||
// glGetStringi was added in version 3.0 of both desktop and ES.
|
||||
if (!fFunctions.fGetStringi) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
// glVertexAttribIPointer was added in version 3.0 of both desktop and ES.
|
||||
if (!fFunctions.fVertexAttribIPointer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,1)) {
|
||||
if (!fFunctions.fTexBuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
if (glVer >= GR_GL_VER(4,3)) {
|
||||
if (!fFunctions.fTexBufferRange) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_OES_texture_buffer") ||
|
||||
fExtensions.has("GL_EXT_texture_buffer")) {
|
||||
if (!fFunctions.fTexBuffer ||
|
||||
!fFunctions.fTexBufferRange) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) {
|
||||
if (!fFunctions.fBindVertexArray ||
|
||||
!fFunctions.fDeleteVertexArrays ||
|
||||
!fFunctions.fGenVertexArrays) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) {
|
||||
if (!fFunctions.fBindVertexArray ||
|
||||
!fFunctions.fDeleteVertexArrays ||
|
||||
!fFunctions.fGenVertexArrays) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fExtensions.has("GL_EXT_debug_marker")) {
|
||||
if (!fFunctions.fInsertEventMarker ||
|
||||
!fFunctions.fPushGroupMarker ||
|
||||
!fFunctions.fPopGroupMarker) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && glVer >= GR_GL_VER(4,3)) ||
|
||||
fExtensions.has("GL_ARB_invalidate_subdata")) {
|
||||
if (!fFunctions.fInvalidateBufferData ||
|
||||
!fFunctions.fInvalidateBufferSubData ||
|
||||
!fFunctions.fInvalidateFramebuffer ||
|
||||
!fFunctions.fInvalidateSubFramebuffer ||
|
||||
!fFunctions.fInvalidateTexImage ||
|
||||
!fFunctions.fInvalidateTexSubImage) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,0)) {
|
||||
// ES 3.0 adds the framebuffer functions but not the others.
|
||||
if (!fFunctions.fInvalidateFramebuffer ||
|
||||
!fFunctions.fInvalidateSubFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL_ES(fStandard) && fExtensions.has("GL_CHROMIUM_map_sub")) {
|
||||
if (!fFunctions.fMapBufferSubData ||
|
||||
!fFunctions.fMapTexSubImage2D ||
|
||||
!fFunctions.fUnmapBufferSubData ||
|
||||
!fFunctions.fUnmapTexSubImage2D) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && fExtensions.has("GL_ARB_map_buffer_range")) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && fExtensions.has("GL_EXT_map_buffer_range")) ||
|
||||
// These functions are added to the 3.0 version of both GLES and GL.
|
||||
((GR_IS_GR_GL(fStandard) || GR_IS_GR_GL_ES(fStandard)) && glVer >= GR_GL_VER(3,0))) {
|
||||
if (!fFunctions.fMapBufferRange ||
|
||||
!fFunctions.fFlushMappedBufferRange) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) &&
|
||||
(glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_texture_multisample"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,1))) {
|
||||
if (!fFunctions.fGetMultisamplefv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) &&
|
||||
(glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_program_interface_query"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,1))) {
|
||||
if (!fFunctions.fGetProgramResourceLocation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL_ES(fStandard) || glVer >= GR_GL_VER(4,1) ||
|
||||
fExtensions.has("GL_ARB_ES2_compatibility")) {
|
||||
if (!fFunctions.fGetShaderPrecisionFormat) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (fExtensions.has("GL_NV_path_rendering") || fExtensions.has("GL_CHROMIUM_path_rendering")) {
|
||||
if (!fFunctions.fMatrixLoadf ||
|
||||
!fFunctions.fMatrixLoadIdentity ||
|
||||
!fFunctions.fPathCommands ||
|
||||
!fFunctions.fPathParameteri ||
|
||||
!fFunctions.fPathParameterf ||
|
||||
!fFunctions.fGenPaths ||
|
||||
!fFunctions.fDeletePaths ||
|
||||
!fFunctions.fIsPath ||
|
||||
!fFunctions.fPathStencilFunc ||
|
||||
!fFunctions.fStencilFillPath ||
|
||||
!fFunctions.fStencilStrokePath ||
|
||||
!fFunctions.fStencilFillPathInstanced ||
|
||||
!fFunctions.fStencilStrokePathInstanced ||
|
||||
!fFunctions.fCoverFillPath ||
|
||||
!fFunctions.fCoverStrokePath ||
|
||||
!fFunctions.fCoverFillPathInstanced ||
|
||||
!fFunctions.fCoverStrokePathInstanced
|
||||
#if 0
|
||||
// List of functions that Skia uses, but which have been added since the initial release
|
||||
// of NV_path_rendering driver. We do not want to fail interface validation due to
|
||||
// missing features, we will just not use the extension.
|
||||
// Update this list -> update GrGLCaps::hasPathRenderingSupport too.
|
||||
|| !fFunctions.fStencilThenCoverFillPath ||
|
||||
!fFunctions.fStencilThenCoverStrokePath ||
|
||||
!fFunctions.fStencilThenCoverFillPathInstanced ||
|
||||
!fFunctions.fStencilThenCoverStrokePathInstanced ||
|
||||
!fFunctions.fProgramPathFragmentInputGen
|
||||
#endif
|
||||
) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
if (fExtensions.has("GL_CHROMIUM_path_rendering")) {
|
||||
if (!fFunctions.fBindFragmentInputLocation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fExtensions.has("GL_NV_framebuffer_mixed_samples") ||
|
||||
fExtensions.has("GL_CHROMIUM_framebuffer_mixed_samples")) {
|
||||
if (!fFunctions.fCoverageModulation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,1) ||
|
||||
fExtensions.has("GL_EXT_draw_instanced") || fExtensions.has("GL_ARB_draw_instanced")) {
|
||||
if (!fFunctions.fDrawArraysInstanced ||
|
||||
!fFunctions.fDrawElementsInstanced) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_draw_instanced")) {
|
||||
if (!fFunctions.fDrawArraysInstanced ||
|
||||
!fFunctions.fDrawElementsInstanced) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_instanced_arrays")) {
|
||||
if (!fFunctions.fVertexAttribDivisor) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_instanced_arrays")) {
|
||||
if (!fFunctions.fVertexAttribDivisor) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) &&
|
||||
(glVer >= GR_GL_VER(4,0) || fExtensions.has("GL_ARB_draw_indirect"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,1))) {
|
||||
if (!fFunctions.fDrawArraysIndirect ||
|
||||
!fFunctions.fDrawElementsIndirect) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) &&
|
||||
(glVer >= GR_GL_VER(4,3) || fExtensions.has("GL_ARB_multi_draw_indirect"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && fExtensions.has("GL_EXT_multi_draw_indirect"))) {
|
||||
if (!fFunctions.fMultiDrawArraysIndirect ||
|
||||
!fFunctions.fMultiDrawElementsIndirect) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && glVer >= GR_GL_VER(4,3)) ||
|
||||
fExtensions.has("GL_KHR_debug")) {
|
||||
if (!fFunctions.fDebugMessageControl ||
|
||||
!fFunctions.fDebugMessageInsert ||
|
||||
!fFunctions.fDebugMessageCallback ||
|
||||
!fFunctions.fGetDebugMessageLog ||
|
||||
!fFunctions.fPushDebugGroup ||
|
||||
!fFunctions.fPopDebugGroup ||
|
||||
!fFunctions.fObjectLabel) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (fExtensions.has("GL_EXT_window_rectangles")) {
|
||||
if (!fFunctions.fWindowRectangles) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3, 2) || fExtensions.has("GL_ARB_sync")) {
|
||||
if (!fFunctions.fFenceSync ||
|
||||
!fFunctions.fIsSync ||
|
||||
!fFunctions.fClientWaitSync ||
|
||||
!fFunctions.fWaitSync ||
|
||||
!fFunctions.fDeleteSync) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
} else if (GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_APPLE_sync")) {
|
||||
if (!fFunctions.fFenceSync ||
|
||||
!fFunctions.fIsSync ||
|
||||
!fFunctions.fClientWaitSync ||
|
||||
!fFunctions.fWaitSync ||
|
||||
!fFunctions.fDeleteSync) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fExtensions.has("EGL_KHR_image") || fExtensions.has("EGL_KHR_image_base")) {
|
||||
if (!fFunctions.fEGLCreateImage ||
|
||||
!fFunctions.fEGLDestroyImage) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
// glDrawRangeElements was added to ES in 3.0.
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,0))) {
|
||||
if (!fFunctions.fDrawRangeElements) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
// getInternalformativ was added in GL 4.2, ES 3.0, and with extension ARB_internalformat_query
|
||||
if ((GR_IS_GR_GL(fStandard) && (glVer >= GR_GL_VER(4,2) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_ARB_internalformat_query")))) {
|
||||
if (!fFunctions.fGetInternalformativ) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && glVer >= GR_GL_VER(4,1)) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,0))) {
|
||||
if (!fFunctions.fGetProgramBinary ||
|
||||
!fFunctions.fProgramBinary ||
|
||||
!fFunctions.fProgramParameteri) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && glVer >= GR_GL_VER(4,1)) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && glVer >= GR_GL_VER(3,0))) {
|
||||
if (!fFunctions.fBindSampler ||
|
||||
!fFunctions.fDeleteSamplers ||
|
||||
!fFunctions.fGenSamplers ||
|
||||
!fFunctions.fSamplerParameteri ||
|
||||
!fFunctions.fSamplerParameteriv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
void GrGLInterface::abandon() const {
|
||||
const_cast<GrGLInterface*>(this)->fFunctions = GrGLInterface::Functions();
|
||||
}
|
||||
|
||||
#endif // GR_TEST_UTILS
|
||||
|
@ -1,702 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* THIS FILE IS AUTOGENERATED
|
||||
* Make edits to tools/gpu/gl/interface/templates.go or they will
|
||||
* be overwritten.
|
||||
*/
|
||||
|
||||
#include "gl/GrGLInterface.h"
|
||||
#include "gl/GrGLExtensions.h"
|
||||
#include "gl/GrGLUtil.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
GrGLInterface::GrGLInterface() {
|
||||
fStandard = kNone_GrGLStandard;
|
||||
}
|
||||
|
||||
#define RETURN_FALSE_INTERFACE \
|
||||
SkDEBUGF("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); \
|
||||
return false
|
||||
|
||||
bool GrGLInterface::validate() const {
|
||||
|
||||
if (kNone_GrGLStandard == fStandard) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
if (!fExtensions.isInitialized()) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
GrGLVersion glVer = GrGLGetVersion(this);
|
||||
if (GR_GL_INVALID_VER == glVer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
// Autogenerated content follows
|
||||
if (!fFunctions.fActiveTexture ||
|
||||
!fFunctions.fAttachShader ||
|
||||
!fFunctions.fBindAttribLocation ||
|
||||
!fFunctions.fBindBuffer ||
|
||||
!fFunctions.fBindTexture ||
|
||||
!fFunctions.fBlendColor ||
|
||||
!fFunctions.fBlendEquation ||
|
||||
!fFunctions.fBlendFunc ||
|
||||
!fFunctions.fBufferData ||
|
||||
!fFunctions.fBufferSubData ||
|
||||
!fFunctions.fClear ||
|
||||
!fFunctions.fClearColor ||
|
||||
!fFunctions.fClearStencil ||
|
||||
!fFunctions.fColorMask ||
|
||||
!fFunctions.fCompileShader ||
|
||||
!fFunctions.fCompressedTexImage2D ||
|
||||
!fFunctions.fCompressedTexSubImage2D ||
|
||||
!fFunctions.fCopyTexSubImage2D ||
|
||||
!fFunctions.fCreateProgram ||
|
||||
!fFunctions.fCreateShader ||
|
||||
!fFunctions.fCullFace ||
|
||||
!fFunctions.fDeleteBuffers ||
|
||||
!fFunctions.fDeleteProgram ||
|
||||
!fFunctions.fDeleteShader ||
|
||||
!fFunctions.fDeleteTextures ||
|
||||
!fFunctions.fDepthMask ||
|
||||
!fFunctions.fDisable ||
|
||||
!fFunctions.fDisableVertexAttribArray ||
|
||||
!fFunctions.fDrawArrays ||
|
||||
!fFunctions.fDrawElements ||
|
||||
!fFunctions.fEnable ||
|
||||
!fFunctions.fEnableVertexAttribArray ||
|
||||
!fFunctions.fFinish ||
|
||||
!fFunctions.fFlush ||
|
||||
!fFunctions.fFrontFace ||
|
||||
!fFunctions.fGenBuffers ||
|
||||
!fFunctions.fGenTextures ||
|
||||
!fFunctions.fGetBufferParameteriv ||
|
||||
!fFunctions.fGetError ||
|
||||
!fFunctions.fGetIntegerv ||
|
||||
!fFunctions.fGetProgramInfoLog ||
|
||||
!fFunctions.fGetProgramiv ||
|
||||
!fFunctions.fGetShaderInfoLog ||
|
||||
!fFunctions.fGetShaderiv ||
|
||||
!fFunctions.fGetString ||
|
||||
!fFunctions.fGetUniformLocation ||
|
||||
!fFunctions.fIsTexture ||
|
||||
!fFunctions.fLineWidth ||
|
||||
!fFunctions.fLinkProgram ||
|
||||
!fFunctions.fPixelStorei ||
|
||||
!fFunctions.fReadPixels ||
|
||||
!fFunctions.fScissor ||
|
||||
!fFunctions.fShaderSource ||
|
||||
!fFunctions.fStencilFunc ||
|
||||
!fFunctions.fStencilFuncSeparate ||
|
||||
!fFunctions.fStencilMask ||
|
||||
!fFunctions.fStencilMaskSeparate ||
|
||||
!fFunctions.fStencilOp ||
|
||||
!fFunctions.fStencilOpSeparate ||
|
||||
!fFunctions.fTexImage2D ||
|
||||
!fFunctions.fTexParameterf ||
|
||||
!fFunctions.fTexParameterfv ||
|
||||
!fFunctions.fTexParameteri ||
|
||||
!fFunctions.fTexParameteriv ||
|
||||
!fFunctions.fTexSubImage2D ||
|
||||
!fFunctions.fUniform1f ||
|
||||
!fFunctions.fUniform1fv ||
|
||||
!fFunctions.fUniform1i ||
|
||||
!fFunctions.fUniform1iv ||
|
||||
!fFunctions.fUniform2f ||
|
||||
!fFunctions.fUniform2fv ||
|
||||
!fFunctions.fUniform2i ||
|
||||
!fFunctions.fUniform2iv ||
|
||||
!fFunctions.fUniform3f ||
|
||||
!fFunctions.fUniform3fv ||
|
||||
!fFunctions.fUniform3i ||
|
||||
!fFunctions.fUniform3iv ||
|
||||
!fFunctions.fUniform4f ||
|
||||
!fFunctions.fUniform4fv ||
|
||||
!fFunctions.fUniform4i ||
|
||||
!fFunctions.fUniform4iv ||
|
||||
!fFunctions.fUniformMatrix2fv ||
|
||||
!fFunctions.fUniformMatrix3fv ||
|
||||
!fFunctions.fUniformMatrix4fv ||
|
||||
!fFunctions.fUseProgram ||
|
||||
!fFunctions.fVertexAttrib1f ||
|
||||
!fFunctions.fVertexAttrib2fv ||
|
||||
!fFunctions.fVertexAttrib3fv ||
|
||||
!fFunctions.fVertexAttrib4fv ||
|
||||
!fFunctions.fVertexAttribPointer ||
|
||||
!fFunctions.fViewport) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (!fFunctions.fDrawBuffer ||
|
||||
!fFunctions.fPolygonMode) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0))))) {
|
||||
if (!fFunctions.fGetStringi) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_OES_vertex_array_object")))) {
|
||||
if (!fFunctions.fBindVertexArray ||
|
||||
!fFunctions.fDeleteVertexArrays ||
|
||||
!fFunctions.fGenVertexArrays) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) {
|
||||
if (!fFunctions.fBindFragDataLocation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,3)) ||
|
||||
fExtensions.has("GL_ARB_blend_func_extended"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0) && fExtensions.has("GL_EXT_blend_func_extended"))))) {
|
||||
if (!fFunctions.fBindFragDataLocationIndexed) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
fExtensions.has("GL_KHR_blend_equation_advanced") ||
|
||||
fExtensions.has("GL_NV_blend_equation_advanced"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_KHR_blend_equation_advanced") ||
|
||||
fExtensions.has("GL_NV_blend_equation_advanced")))) {
|
||||
if (!fFunctions.fBlendBarrier) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,4)) ||
|
||||
fExtensions.has("GL_ARB_clear_texture"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_EXT_clear_texture")))) {
|
||||
if (!fFunctions.fClearTexImage ||
|
||||
!fFunctions.fClearTexSubImage) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,1)) ||
|
||||
fExtensions.has("GL_ARB_draw_instanced") ||
|
||||
fExtensions.has("GL_EXT_draw_instanced"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_EXT_draw_instanced")))) {
|
||||
if (!fFunctions.fDrawArraysInstanced ||
|
||||
!fFunctions.fDrawElementsInstanced) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0))))) {
|
||||
if (!fFunctions.fDrawBuffers ||
|
||||
!fFunctions.fReadBuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,0)) ||
|
||||
fExtensions.has("GL_ARB_draw_indirect"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,1))))) {
|
||||
if (!fFunctions.fDrawArraysIndirect ||
|
||||
!fFunctions.fDrawElementsIndirect) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0))))) {
|
||||
if (!fFunctions.fDrawRangeElements) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,2)) ||
|
||||
fExtensions.has("GL_ARB_texture_multisample"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,1))))) {
|
||||
if (!fFunctions.fGetMultisamplefv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,1))))) {
|
||||
if (!fFunctions.fGetTexLevelParameteriv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,3)) ||
|
||||
fExtensions.has("GL_ARB_multi_draw_indirect"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_EXT_multi_draw_indirect")))) {
|
||||
if (!fFunctions.fMultiDrawArraysIndirect ||
|
||||
!fFunctions.fMultiDrawElementsIndirect) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,1)))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,2)) ||
|
||||
fExtensions.has("GL_OES_texture_buffer") ||
|
||||
fExtensions.has("GL_EXT_texture_buffer")))) {
|
||||
if (!fFunctions.fTexBuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,3)))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,2)) ||
|
||||
fExtensions.has("GL_OES_texture_buffer") ||
|
||||
fExtensions.has("GL_EXT_texture_buffer")))) {
|
||||
if (!fFunctions.fTexBufferRange) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,2)) ||
|
||||
fExtensions.has("GL_ARB_texture_storage") ||
|
||||
fExtensions.has("GL_EXT_texture_storage"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_EXT_texture_storage")))) {
|
||||
if (!fFunctions.fTexStorage2D) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,5)) ||
|
||||
fExtensions.has("GL_ARB_texture_barrier") ||
|
||||
fExtensions.has("GL_NV_texture_barrier"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_NV_texture_barrier")))) {
|
||||
if (!fFunctions.fTextureBarrier) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_EXT_discard_framebuffer")))) {
|
||||
if (!fFunctions.fDiscardFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,2)) ||
|
||||
fExtensions.has("GL_ARB_instanced_arrays"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_EXT_instanced_arrays")))) {
|
||||
if (!fFunctions.fVertexAttribDivisor) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0))))) {
|
||||
if (!fFunctions.fVertexAttribIPointer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_ARB_framebuffer_object") ||
|
||||
fExtensions.has("GL_EXT_framebuffer_object"))) ||
|
||||
GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (!fFunctions.fBindFramebuffer ||
|
||||
!fFunctions.fBindRenderbuffer ||
|
||||
!fFunctions.fCheckFramebufferStatus ||
|
||||
!fFunctions.fDeleteFramebuffers ||
|
||||
!fFunctions.fDeleteRenderbuffers ||
|
||||
!fFunctions.fFramebufferRenderbuffer ||
|
||||
!fFunctions.fFramebufferTexture2D ||
|
||||
!fFunctions.fGenFramebuffers ||
|
||||
!fFunctions.fGenRenderbuffers ||
|
||||
!fFunctions.fGenerateMipmap ||
|
||||
!fFunctions.fGetFramebufferAttachmentParameteriv ||
|
||||
!fFunctions.fGetRenderbufferParameteriv ||
|
||||
!fFunctions.fRenderbufferStorage) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_ARB_framebuffer_object") ||
|
||||
fExtensions.has("GL_EXT_framebuffer_blit"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_CHROMIUM_framebuffer_multisample") ||
|
||||
fExtensions.has("GL_ANGLE_framebuffer_blit")))) {
|
||||
if (!fFunctions.fBlitFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_ARB_framebuffer_object") ||
|
||||
fExtensions.has("GL_EXT_framebuffer_multisample"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_CHROMIUM_framebuffer_multisample") ||
|
||||
fExtensions.has("GL_ANGLE_framebuffer_multisample")))) {
|
||||
if (!fFunctions.fRenderbufferStorageMultisample) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_CHROMIUM_map_sub")))) {
|
||||
if (!fFunctions.fMapBufferSubData ||
|
||||
!fFunctions.fMapTexSubImage2D ||
|
||||
!fFunctions.fUnmapBufferSubData ||
|
||||
!fFunctions.fUnmapTexSubImage2D) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_EXT_multisampled_render_to_texture") ||
|
||||
fExtensions.has("GL_IMG_multisampled_render_to_texture")))) {
|
||||
if (!fFunctions.fFramebufferTexture2DMultisample) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_EXT_multisampled_render_to_texture")))) {
|
||||
if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_IMG_multisampled_render_to_texture")))) {
|
||||
if (!fFunctions.fRenderbufferStorageMultisampleES2EXT) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_APPLE_framebuffer_multisample")))) {
|
||||
if (!fFunctions.fResolveMultisampleFramebuffer ||
|
||||
!fFunctions.fRenderbufferStorageMultisampleES2APPLE) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_OES_mapbuffer")))) {
|
||||
if (!fFunctions.fMapBuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_OES_mapbuffer")))) {
|
||||
if (!fFunctions.fUnmapBuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_ARB_map_buffer_range"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_EXT_map_buffer_range")))) {
|
||||
if (!fFunctions.fFlushMappedBufferRange ||
|
||||
!fFunctions.fMapBufferRange) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
fExtensions.has("GL_EXT_debug_marker"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_EXT_debug_marker")))) {
|
||||
if (!fFunctions.fInsertEventMarker ||
|
||||
!fFunctions.fPopGroupMarker ||
|
||||
!fFunctions.fPushGroupMarker) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,3)) ||
|
||||
fExtensions.has("GL_ARB_program_interface_query"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,1))))) {
|
||||
if (!fFunctions.fGetProgramResourceLocation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
fExtensions.has("GL_NV_path_rendering"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_CHROMIUM_path_rendering") ||
|
||||
fExtensions.has("GL_NV_path_rendering")))) {
|
||||
if (!fFunctions.fMatrixLoadIdentity ||
|
||||
!fFunctions.fMatrixLoadf) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
fExtensions.has("GL_NV_path_rendering"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_CHROMIUM_path_rendering") ||
|
||||
fExtensions.has("GL_NV_path_rendering")))) {
|
||||
if (!fFunctions.fCoverFillPath ||
|
||||
!fFunctions.fCoverFillPathInstanced ||
|
||||
!fFunctions.fCoverStrokePath ||
|
||||
!fFunctions.fCoverStrokePathInstanced ||
|
||||
!fFunctions.fDeletePaths ||
|
||||
!fFunctions.fGenPaths ||
|
||||
!fFunctions.fIsPath ||
|
||||
!fFunctions.fPathCommands ||
|
||||
!fFunctions.fPathParameterf ||
|
||||
!fFunctions.fPathParameteri ||
|
||||
!fFunctions.fPathStencilFunc ||
|
||||
!fFunctions.fStencilFillPath ||
|
||||
!fFunctions.fStencilFillPathInstanced ||
|
||||
!fFunctions.fStencilStrokePath ||
|
||||
!fFunctions.fStencilStrokePathInstanced) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_CHROMIUM_path_rendering")))) {
|
||||
if (!fFunctions.fBindFragmentInputLocation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
fExtensions.has("GL_NV_framebuffer_mixed_samples"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_CHROMIUM_framebuffer_mixed_samples") ||
|
||||
fExtensions.has("GL_NV_framebuffer_mixed_samples")))) {
|
||||
if (!fFunctions.fCoverageModulation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,3)) ||
|
||||
fExtensions.has("GL_KHR_debug"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_KHR_debug")))) {
|
||||
if (!fFunctions.fDebugMessageCallback ||
|
||||
!fFunctions.fDebugMessageControl ||
|
||||
!fFunctions.fDebugMessageInsert ||
|
||||
!fFunctions.fGetDebugMessageLog ||
|
||||
!fFunctions.fObjectLabel ||
|
||||
!fFunctions.fPopDebugGroup ||
|
||||
!fFunctions.fPushDebugGroup) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_CHROMIUM_bind_uniform_location")))) {
|
||||
if (!fFunctions.fBindUniformLocation) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
fExtensions.has("GL_EXT_window_rectangles"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("GL_EXT_window_rectangles")))) {
|
||||
if (!fFunctions.fWindowRectangles) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
fExtensions.has("EGL_KHR_image") ||
|
||||
fExtensions.has("EGL_KHR_image_base"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("EGL_KHR_image") ||
|
||||
fExtensions.has("EGL_KHR_image_base")))) {
|
||||
if (!fFunctions.fEGLCreateImage ||
|
||||
!fFunctions.fEGLDestroyImage) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,2)) ||
|
||||
fExtensions.has("GL_ARB_sync"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_APPLE_sync")))) {
|
||||
if (!fFunctions.fClientWaitSync ||
|
||||
!fFunctions.fDeleteSync ||
|
||||
!fFunctions.fFenceSync ||
|
||||
!fFunctions.fIsSync ||
|
||||
!fFunctions.fWaitSync) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,2)) ||
|
||||
fExtensions.has("GL_ARB_internalformat_query"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0))))) {
|
||||
if (!fFunctions.fGetInternalformativ) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,1)))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0))))) {
|
||||
if (!fFunctions.fGetProgramBinary ||
|
||||
!fFunctions.fProgramBinary ||
|
||||
!fFunctions.fProgramParameteri) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,2)) ||
|
||||
fExtensions.has("GL_ARB_sampler_objects"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0))))) {
|
||||
if (!fFunctions.fBindSampler ||
|
||||
!fFunctions.fDeleteSamplers ||
|
||||
!fFunctions.fGenSamplers ||
|
||||
!fFunctions.fSamplerParameteri ||
|
||||
!fFunctions.fSamplerParameteriv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard)) {
|
||||
if (!fFunctions.fGetQueryObjectiv) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GR_IS_GR_GL(fStandard) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0)) ||
|
||||
fExtensions.has("GL_EXT_occlusion_query_boolean")))) {
|
||||
// all functions were marked optional
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,3)) ||
|
||||
fExtensions.has("GL_ARB_timer_query") ||
|
||||
fExtensions.has("GL_EXT_timer_query")))) {
|
||||
if (!fFunctions.fGetQueryObjecti64v ||
|
||||
!fFunctions.fGetQueryObjectui64v) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,3)) ||
|
||||
fExtensions.has("GL_ARB_timer_query")))) {
|
||||
if (!fFunctions.fQueryCounter) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,3)) ||
|
||||
fExtensions.has("GL_ARB_invalidate_subdata")))) {
|
||||
if (!fFunctions.fInvalidateBufferData ||
|
||||
!fFunctions.fInvalidateBufferSubData ||
|
||||
!fFunctions.fInvalidateTexImage ||
|
||||
!fFunctions.fInvalidateTexSubImage) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,3)) ||
|
||||
fExtensions.has("GL_ARB_invalidate_subdata"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,0))))) {
|
||||
if (!fFunctions.fInvalidateFramebuffer ||
|
||||
!fFunctions.fInvalidateSubFramebuffer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(4,3)) ||
|
||||
fExtensions.has("GL_ARB_ES2_compatibility"))) ||
|
||||
GR_IS_GR_GL_ES(fStandard)) {
|
||||
if (!fFunctions.fGetShaderPrecisionFormat) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// End autogenerated content
|
||||
return true;
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
void GrGLInterface::abandon() const {
|
||||
const_cast<GrGLInterface*>(this)->fFunctions = GrGLInterface::Functions();
|
||||
}
|
||||
|
||||
#endif // GR_TEST_UTILS
|
@ -1,5 +0,0 @@
|
||||
generate:
|
||||
go run *.go --in_table "./interface.json5" --out_dir "../../../../src/gpu/gl"
|
||||
|
||||
dryrun:
|
||||
go run *.go --in_table "./interface.json5" --out_dir "../../../../src/gpu/gl" --dryrun
|
@ -1,22 +0,0 @@
|
||||
GrGlInterface Autogeneration
|
||||
============================
|
||||
|
||||
Background
|
||||
----------
|
||||
|
||||
At a high level, the first three steps of making a GrGLInterface (a generic way to
|
||||
interact with a GL-like GPU) are:
|
||||
|
||||
- Assemble: Copy a set of function pointers into the struct
|
||||
- Validate: Make sure the function pointers advertised actually exist.
|
||||
- Capabilities: Compute what fast/slow paths are enabled based on the functions
|
||||
in the struct (GrGLCaps, for short)
|
||||
|
||||
Autogeneration
|
||||
--------------
|
||||
|
||||
The first two steps have been automated with a table-based generation script located
|
||||
in this folder. The table is in JSON5 format (like JSON, but with comments). O
|
||||
|
||||
Once edited, the Assemble/Validate code can be re-generated by running
|
||||
`make generate` in this folder.
|
@ -1,428 +0,0 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
// gen_interface creates the assemble/validate cpp files given the
|
||||
// interface.json5 file.
|
||||
// See README for more details.
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/flynn/json5"
|
||||
)
|
||||
|
||||
var (
|
||||
outDir = flag.String("out_dir", "../../src/gpu/gl", "Where to output the GrGlAssembleInterface_* and GrGlInterface.cpp files")
|
||||
inTable = flag.String("in_table", "./interface.json5", "The JSON5 table to read in")
|
||||
dryRun = flag.Bool("dryrun", false, "Print the outputs, don't write to file")
|
||||
)
|
||||
|
||||
const (
|
||||
CORE_FEATURE = "<core>"
|
||||
SPACER = " "
|
||||
GLES_FILE_NAME = "GrGLAssembleGLESInterfaceAutogen.cpp"
|
||||
GL_FILE_NAME = "GrGLAssembleGLInterfaceAutogen.cpp"
|
||||
INTERFACE_FILE_NAME = "GrGLInterfaceAutogen.cpp"
|
||||
)
|
||||
|
||||
// FeatureSet represents one set of requirements for each of the GL "standards" that
|
||||
// Skia supports. This is currently OpenGL, OpenGL ES and WebGL.
|
||||
// OpenGL is typically abbreviated as just "GL".
|
||||
// https://www.khronos.org/registry/OpenGL/index_gl.php
|
||||
// https://www.khronos.org/opengles/
|
||||
// https://www.khronos.org/registry/webgl/specs/1.0/
|
||||
type FeatureSet struct {
|
||||
GLReqs []Requirement `json:"GL"`
|
||||
GLESReqs []Requirement `json:"GLES"`
|
||||
WebGLReqs []Requirement `json:"WebGL"`
|
||||
|
||||
Functions []string `json:"functions"`
|
||||
HardCodeFunctions []HardCodeFunction `json:"hardcode_functions"`
|
||||
OptionalFunctions []string `json:"optional"` // not checked in validate
|
||||
|
||||
Required bool `json:"required"`
|
||||
EGLProc bool `json:"egl_proc"`
|
||||
}
|
||||
|
||||
// Requirement lists how we know if a function exists. Extension is the
|
||||
// GL extension (or the string CORE_FEATURE if it's part of the core functionality).
|
||||
// MinVersion optionally indicates the minimum version of a standard
|
||||
// that has the function.
|
||||
// SuffixOverride allows the extension suffix to be manually specified instead
|
||||
// of automatically derived from the extension name.
|
||||
// (for example, if an NV extension specifies some EXT extensions)
|
||||
type Requirement struct {
|
||||
Extension string `json:"ext"` // required
|
||||
MinVersion *GLVersion `json:"min_version"`
|
||||
SuffixOverride *string `json:"suffix"`
|
||||
}
|
||||
|
||||
// HardCodeFunction indicates to not use the C++ macro and just directly
|
||||
// adds a given function ptr to the struct.
|
||||
type HardCodeFunction struct {
|
||||
PtrName string `json:"ptr_name"`
|
||||
CastName string `json:"cast_name"`
|
||||
GetName string `json:"get_name"`
|
||||
}
|
||||
|
||||
var CORE_REQUIREMENT = Requirement{Extension: CORE_FEATURE, MinVersion: nil}
|
||||
|
||||
type GLVersion [2]int
|
||||
|
||||
// RequirementGetter functions allows us to "iterate" over the requirements
|
||||
// of the different standards which are stored as keys in FeatureSet and
|
||||
// normally not easily iterable.
|
||||
type RequirementGetter func(FeatureSet) []Requirement
|
||||
|
||||
func glRequirements(fs FeatureSet) []Requirement {
|
||||
return fs.GLReqs
|
||||
}
|
||||
|
||||
func glesRequirements(fs FeatureSet) []Requirement {
|
||||
return fs.GLESReqs
|
||||
}
|
||||
|
||||
func webglRequirements(fs FeatureSet) []Requirement {
|
||||
return fs.WebGLReqs
|
||||
}
|
||||
|
||||
// generateAssembleInterface creates one GrGLAssembleInterface_[type]_gen.cpp
|
||||
// for each of the standards
|
||||
func generateAssembleInterface(features []FeatureSet) {
|
||||
gl := fillAssembleTemplate(ASSEMBLE_INTERFACE_GL, features, glRequirements)
|
||||
writeToFile(*outDir, GL_FILE_NAME, gl)
|
||||
gles := fillAssembleTemplate(ASSEMBLE_INTERFACE_GL_ES, features, glesRequirements)
|
||||
writeToFile(*outDir, GLES_FILE_NAME, gles)
|
||||
// uncomment this when ready to implement WebGL
|
||||
// webgl := fillAssembleTemplate(ASSEMBLE_INTERFACE_WEB_GL, features, webglRequirements)
|
||||
// writeToFile(*outDir, "GrGLAssembleInterface_webgl_gen.cpp", webgl)
|
||||
}
|
||||
|
||||
// fillAssembleTemplate returns a generated file given a template (for a single standard)
|
||||
// to fill out and a slice of features with which to fill it. getReqs is used to select
|
||||
// the requirements for the standard we are working on.
|
||||
func fillAssembleTemplate(template string, features []FeatureSet, getReqs RequirementGetter) string {
|
||||
content := ""
|
||||
for _, feature := range features {
|
||||
// For each feature set, we are going to create a series of
|
||||
// if statements, which check for the requirements (e.g. extensions, version)
|
||||
// and inside those if branches, write the code to load the
|
||||
// correct function pointer to the interface. GET_PROC and
|
||||
// GET_PROC_SUFFIX are macros defined in C++ part of the template
|
||||
// to accomplish this (for a core feature and extensions, respectively).
|
||||
reqs := getReqs(feature)
|
||||
if len(reqs) == 0 {
|
||||
continue
|
||||
}
|
||||
// blocks holds all the if blocks generated - it will be joined with else
|
||||
// after and appended to content
|
||||
blocks := []string{}
|
||||
for i, req := range reqs {
|
||||
block := ""
|
||||
ifExpr := requirementIfExpression(req, true)
|
||||
|
||||
if ifExpr != "" {
|
||||
if strings.HasPrefix(ifExpr, "(") {
|
||||
ifExpr = "if " + ifExpr + " {"
|
||||
} else {
|
||||
ifExpr = "if (" + ifExpr + ") {"
|
||||
}
|
||||
// Indent the first if statement
|
||||
if i == 0 {
|
||||
block = addLine(block, ifExpr)
|
||||
} else {
|
||||
block += ifExpr + "\n"
|
||||
}
|
||||
}
|
||||
// sort for determinism
|
||||
sort.Strings(feature.Functions)
|
||||
for _, function := range feature.Functions {
|
||||
if ifExpr != "" {
|
||||
// extra tab for being in an if statement
|
||||
block += SPACER
|
||||
}
|
||||
suffix := deriveSuffix(req.Extension)
|
||||
// Some ARB extensions don't have ARB suffixes because they were written
|
||||
// for backwards compatibility simultaneous to adding them as required
|
||||
// in a new GL version.
|
||||
if suffix == "ARB" {
|
||||
suffix = ""
|
||||
}
|
||||
if req.SuffixOverride != nil {
|
||||
suffix = *req.SuffixOverride
|
||||
}
|
||||
if feature.EGLProc {
|
||||
block = addLine(block, fmt.Sprintf("GET_EGL_PROC_SUFFIX(%s, %s);", function, suffix))
|
||||
} else if req.Extension == CORE_FEATURE || suffix == "" {
|
||||
block = addLine(block, fmt.Sprintf("GET_PROC(%s);", function))
|
||||
} else if req.Extension != "" {
|
||||
block = addLine(block, fmt.Sprintf("GET_PROC_SUFFIX(%s, %s);", function, suffix))
|
||||
}
|
||||
}
|
||||
// a hard code function does not use the C++ macro
|
||||
for _, hcf := range feature.HardCodeFunctions {
|
||||
if ifExpr != "" {
|
||||
// extra tab for being in an if statement
|
||||
block += SPACER
|
||||
}
|
||||
line := fmt.Sprintf(`functions->%s =(%s*)get(ctx, "%s");`, hcf.PtrName, hcf.CastName, hcf.GetName)
|
||||
block = addLine(block, line)
|
||||
}
|
||||
if ifExpr != "" {
|
||||
block += SPACER + "}"
|
||||
}
|
||||
blocks = append(blocks, block)
|
||||
}
|
||||
content += strings.Join(blocks, " else ")
|
||||
|
||||
if feature.Required && reqs[0] != CORE_REQUIREMENT {
|
||||
content += ` else {
|
||||
SkASSERT(false); // Required feature
|
||||
return nullptr;
|
||||
}`
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(content, "\n") {
|
||||
content += "\n"
|
||||
}
|
||||
// Add an extra space between blocks for easier readability
|
||||
content += "\n"
|
||||
|
||||
}
|
||||
|
||||
return strings.Replace(template, "[[content]]", content, 1)
|
||||
}
|
||||
|
||||
// requirementIfExpression returns a string that is an if expression
|
||||
// Notably, there is no if expression if the function is a "core" function
|
||||
// on all supported versions.
|
||||
// The expressions are wrapped in parentheses so they can be safely
|
||||
// joined together with && or ||.
|
||||
func requirementIfExpression(req Requirement, isLocal bool) string {
|
||||
mv := req.MinVersion
|
||||
if req == CORE_REQUIREMENT {
|
||||
return ""
|
||||
}
|
||||
if req.Extension == CORE_FEATURE && mv != nil {
|
||||
return fmt.Sprintf("(glVer >= GR_GL_VER(%d,%d))", mv[0], mv[1])
|
||||
}
|
||||
extVar := "fExtensions"
|
||||
if isLocal {
|
||||
extVar = "extensions"
|
||||
}
|
||||
// We know it has an extension
|
||||
if req.Extension != "" {
|
||||
if mv == nil {
|
||||
return fmt.Sprintf("%s.has(%q)", extVar, req.Extension)
|
||||
} else {
|
||||
return fmt.Sprintf("(glVer >= GR_GL_VER(%d,%d) && %s.has(%q))", mv[0], mv[1], extVar, req.Extension)
|
||||
}
|
||||
}
|
||||
abort("ERROR: requirement must have ext\n")
|
||||
return "ERROR"
|
||||
}
|
||||
|
||||
// driveSuffix returns the suffix of the function associated with the given
|
||||
// extension.
|
||||
func deriveSuffix(ext string) string {
|
||||
// Some extensions begin with GL_ or EGL_ and then have the actual
|
||||
// extension like KHR, EXT etc.
|
||||
ext = strings.TrimPrefix(ext, "GL_")
|
||||
ext = strings.TrimPrefix(ext, "EGL_")
|
||||
return strings.Split(ext, "_")[0]
|
||||
}
|
||||
|
||||
// addLine is a little helper function which handles the newline and tab
|
||||
func addLine(str, line string) string {
|
||||
return str + SPACER + line + "\n"
|
||||
}
|
||||
|
||||
func writeToFile(parent, file, content string) {
|
||||
p := filepath.Join(parent, file)
|
||||
if *dryRun {
|
||||
fmt.Printf("Writing to %s\n", p)
|
||||
fmt.Println(content)
|
||||
} else {
|
||||
if err := ioutil.WriteFile(p, []byte(content), 0644); err != nil {
|
||||
abort("Error while writing to file %s: %s", p, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// validationEntry is a helper struct that contains anything
|
||||
// necessary to make validation code for a given standard.
|
||||
type validationEntry struct {
|
||||
StandardCheck string
|
||||
GetReqs RequirementGetter
|
||||
}
|
||||
|
||||
func generateValidateInterface(features []FeatureSet) {
|
||||
standards := []validationEntry{
|
||||
{
|
||||
StandardCheck: "GR_IS_GR_GL(fStandard)",
|
||||
GetReqs: glRequirements,
|
||||
}, {
|
||||
StandardCheck: "GR_IS_GR_GL_ES(fStandard)",
|
||||
GetReqs: glesRequirements,
|
||||
}, /*{ Disable until ready to add WebGL support
|
||||
StandardCheck: "GR_IS_GR_WEB_GL(fStandard)",
|
||||
GetReqs: webglRequirements
|
||||
},*/
|
||||
}
|
||||
content := ""
|
||||
// For each feature, we are going to generate a series of
|
||||
// boolean expressions which check that the functions we thought
|
||||
// were gathered during the assemble phase actually were applied to
|
||||
// the interface (functionCheck). This check will be guarded
|
||||
// another set of if statements (one per standard) based
|
||||
// on the same requirements (standardChecks) that were used when
|
||||
// assembling the interface.
|
||||
for _, feature := range features {
|
||||
if allReqsAreCore(feature) {
|
||||
content += functionCheck(feature, 1)
|
||||
} else {
|
||||
content += SPACER
|
||||
standardChecks := []string{}
|
||||
for _, std := range standards {
|
||||
reqs := std.GetReqs(feature)
|
||||
if reqs == nil || len(reqs) == 0 {
|
||||
continue
|
||||
}
|
||||
expr := []string{}
|
||||
for _, r := range reqs {
|
||||
e := requirementIfExpression(r, false)
|
||||
if e != "" {
|
||||
expr = append(expr, e)
|
||||
}
|
||||
}
|
||||
check := ""
|
||||
if len(expr) == 0 {
|
||||
check = fmt.Sprintf("%s", std.StandardCheck)
|
||||
} else {
|
||||
lineBreak := "\n" + SPACER + " "
|
||||
check = fmt.Sprintf("(%s && (%s%s))", std.StandardCheck, lineBreak, strings.Join(expr, " ||"+lineBreak))
|
||||
}
|
||||
standardChecks = append(standardChecks, check)
|
||||
}
|
||||
content += fmt.Sprintf("if (%s) {\n", strings.Join(standardChecks, " ||\n"+SPACER+" "))
|
||||
content += functionCheck(feature, 2)
|
||||
|
||||
content += SPACER + "}\n"
|
||||
}
|
||||
// add additional line between each block
|
||||
content += "\n"
|
||||
}
|
||||
content = strings.Replace(VALIDATE_INTERFACE, "[[content]]", content, 1)
|
||||
writeToFile(*outDir, INTERFACE_FILE_NAME, content)
|
||||
}
|
||||
|
||||
// functionCheck returns an if statement that checks that all functions
|
||||
// in the passed in slice are on the interface (that is, they are truthy
|
||||
// on the fFunctions struct)
|
||||
func functionCheck(feature FeatureSet, indentLevel int) string {
|
||||
// sort for determinism
|
||||
sort.Strings(feature.Functions)
|
||||
indent := strings.Repeat(SPACER, indentLevel)
|
||||
|
||||
checks := []string{}
|
||||
for _, function := range feature.Functions {
|
||||
if in(function, feature.OptionalFunctions) {
|
||||
continue
|
||||
}
|
||||
if feature.EGLProc {
|
||||
checks = append(checks, "!fFunctions.fEGL"+function)
|
||||
} else {
|
||||
checks = append(checks, "!fFunctions.f"+function)
|
||||
}
|
||||
|
||||
}
|
||||
for _, hcf := range feature.HardCodeFunctions {
|
||||
checks = append(checks, "!fFunctions."+hcf.PtrName)
|
||||
}
|
||||
if len(checks) == 0 {
|
||||
return strings.Repeat(SPACER, indentLevel) + "// all functions were marked optional\n"
|
||||
}
|
||||
|
||||
return fmt.Sprintf(`%sif (%s) {
|
||||
%s%sRETURN_FALSE_INTERFACE;
|
||||
%s}
|
||||
`, indent, strings.Join(checks, " ||\n"+indent+" "), indent, SPACER, indent)
|
||||
}
|
||||
|
||||
// allReqsAreCore returns true iff the FeatureSet is part of "core" for
|
||||
// all standards
|
||||
func allReqsAreCore(feature FeatureSet) bool {
|
||||
if feature.GLReqs == nil || feature.GLESReqs == nil {
|
||||
return false
|
||||
}
|
||||
return feature.GLReqs[0] == CORE_REQUIREMENT && feature.GLESReqs[0] == CORE_REQUIREMENT
|
||||
// uncomment below when adding WebGL support
|
||||
// && feature.WebGLReqs[0] == CORE_REQUIREMENT
|
||||
}
|
||||
|
||||
func validateFeatures(features []FeatureSet) {
|
||||
seen := map[string]bool{}
|
||||
for _, feature := range features {
|
||||
for _, fn := range feature.Functions {
|
||||
if seen[fn] {
|
||||
abort("ERROR: Duplicate function %s\n", fn)
|
||||
}
|
||||
seen[fn] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// in returns true if |s| is *in* |a| slice.
|
||||
func in(s string, a []string) bool {
|
||||
for _, x := range a {
|
||||
if x == s {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func abort(fmtStr string, inputs ...interface{}) {
|
||||
fmt.Printf(fmtStr+"\n", inputs...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
b, err := ioutil.ReadFile(*inTable)
|
||||
if err != nil {
|
||||
abort("Could not read file %s", err)
|
||||
}
|
||||
|
||||
dir, err := os.Open(*outDir)
|
||||
if err != nil {
|
||||
abort("Could not write to output dir %s", err)
|
||||
}
|
||||
defer dir.Close()
|
||||
if fi, err := dir.Stat(); err != nil {
|
||||
abort("Error getting info about %s: %s", *outDir, err)
|
||||
} else if !fi.IsDir() {
|
||||
abort("%s must be a directory", *outDir)
|
||||
}
|
||||
|
||||
features := []FeatureSet{}
|
||||
|
||||
err = json5.Unmarshal(b, &features)
|
||||
if err != nil {
|
||||
abort("Invalid JSON: %s", err)
|
||||
}
|
||||
|
||||
validateFeatures(features)
|
||||
|
||||
generateAssembleInterface(features)
|
||||
generateValidateInterface(features)
|
||||
}
|
@ -1,626 +0,0 @@
|
||||
// This file specifies which functions should be attached to GrGLInterface
|
||||
// for a given standard (OpenGL, OpenGL ES, etc). It allows specifing
|
||||
// how and when to attach them (e.g. only if an extension is present).
|
||||
// It is used for both the assemble and validate step.
|
||||
//
|
||||
// Currently it assumes the minimum versions:
|
||||
// - GL: 2.0
|
||||
// - GLES: 2.0
|
||||
// - WebGL: [WIP] 1.0
|
||||
//
|
||||
// http://web.eecs.umich.edu/~sugih/courses/eecs487/common/notes/APITables.xml
|
||||
// is a handy reference comparing GL and GLES API
|
||||
[
|
||||
{
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": [{"ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"ActiveTexture", "AttachShader", "BindAttribLocation", "BindBuffer",
|
||||
"BindTexture", "BlendColor", "BlendEquation", "BlendFunc",
|
||||
"BufferData", "BufferSubData", "Clear", "ClearColor",
|
||||
"ClearStencil", "ColorMask", "CompileShader", "CompressedTexImage2D",
|
||||
"CompressedTexSubImage2D", "CopyTexSubImage2D", "CreateProgram", "CreateShader",
|
||||
"CullFace", "DeleteBuffers", "DeleteProgram",
|
||||
"DeleteShader", "DeleteTextures", "DepthMask", "Disable",
|
||||
"DisableVertexAttribArray", "DrawArrays", "DrawElements", "Enable",
|
||||
"EnableVertexAttribArray", "Finish", "Flush",
|
||||
"FrontFace", "GenBuffers",
|
||||
"GenTextures", "GetBufferParameteriv", "GetError",
|
||||
"GetIntegerv", "GetProgramInfoLog",
|
||||
"GetProgramiv", "GetShaderInfoLog",
|
||||
"GetShaderiv", "GetString",
|
||||
"GetUniformLocation", "IsTexture", "LineWidth", "LinkProgram", "PixelStorei",
|
||||
"ReadPixels", "Scissor", "ShaderSource", "StencilFunc",
|
||||
"StencilFuncSeparate", "StencilMask", "StencilMaskSeparate", "StencilOp",
|
||||
"StencilOpSeparate", "TexImage2D", "TexParameterf", "TexParameterfv", "TexParameteri",
|
||||
"TexParameteriv", "TexSubImage2D", "Uniform1f", "Uniform1fv", "Uniform1i", "Uniform1iv",
|
||||
"Uniform2f", "Uniform2fv", "Uniform2i", "Uniform2iv", "Uniform3f", "Uniform3fv", "Uniform3i",
|
||||
"Uniform3iv", "Uniform4f", "Uniform4fv", "Uniform4i", "Uniform4iv", "UniformMatrix2fv",
|
||||
"UniformMatrix3fv", "UniformMatrix4fv", "UseProgram", "VertexAttrib1f",
|
||||
"VertexAttrib2fv", "VertexAttrib3fv", "VertexAttrib4fv", "VertexAttribPointer",
|
||||
"Viewport",
|
||||
],
|
||||
},
|
||||
{ // GL exclusive core functions
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": null,
|
||||
|
||||
"functions": [
|
||||
"DrawBuffer", "PolygonMode",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"GetStringi",
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_OES_vertex_array_object"}],
|
||||
"WebGL": [{"min_version": [2, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "OES_vertex_array_object"}],
|
||||
|
||||
// WebGL uses createVertexArray instead of genVertexArrays, but Emscripten
|
||||
// creates an alias called genVertexArray which papers over this difference.
|
||||
"functions": [
|
||||
"BindVertexArray", "DeleteVertexArrays", "GenVertexArrays",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "GL_EXT_blend_func_extended"}],
|
||||
|
||||
"functions": [
|
||||
"BindFragDataLocation",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [3, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_blend_func_extended"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "GL_EXT_blend_func_extended"}],
|
||||
|
||||
"functions": [
|
||||
"BindFragDataLocationIndexed",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"ext": "GL_KHR_blend_equation_advanced"},
|
||||
{"ext": "GL_NV_blend_equation_advanced"}],
|
||||
"GLES": [{"ext": "GL_KHR_blend_equation_advanced"},
|
||||
{"ext": "GL_NV_blend_equation_advanced"}],
|
||||
|
||||
"functions": [
|
||||
"BlendBarrier",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [4, 4], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_clear_texture"}],
|
||||
"GLES": [{"ext": "GL_EXT_clear_texture", "suffix": "EXT"}],
|
||||
|
||||
"functions": [
|
||||
"ClearTexImage", "ClearTexSubImage",
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [3, 1], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_draw_instanced"},
|
||||
{/* else if */ "ext": "GL_EXT_draw_instanced"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_EXT_draw_instanced"}],
|
||||
|
||||
"functions": [
|
||||
"DrawArraysInstanced", "DrawElementsInstanced",
|
||||
]
|
||||
},
|
||||
{ // ES 3.0 has glDrawBuffers but not glDrawBuffer
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"DrawBuffers", "ReadBuffer",
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [4, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_draw_indirect"}],
|
||||
"GLES": [{"min_version": [3, 1], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"DrawArraysIndirect", "DrawElementsIndirect",
|
||||
]
|
||||
},
|
||||
|
||||
{ // glDrawRangeElements was added to ES in 3.0.
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"DrawRangeElements",
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [3, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_texture_multisample"}],
|
||||
"GLES": [{"min_version": [3, 1], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"GetMultisamplefv",
|
||||
]
|
||||
},
|
||||
|
||||
// glGetTexLevelParameteriv was added to ES in 3.1.
|
||||
{
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 1], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"GetTexLevelParameteriv",
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [4, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_multi_draw_indirect"}],
|
||||
"GLES": [{"ext": "GL_EXT_multi_draw_indirect"}],
|
||||
|
||||
"functions": [
|
||||
"MultiDrawArraysIndirect", "MultiDrawElementsIndirect",
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [3, 1], "ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_OES_texture_buffer"},
|
||||
{/* else if */ "ext": "GL_EXT_texture_buffer"}],
|
||||
|
||||
"functions": [
|
||||
"TexBuffer",
|
||||
]
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [4, 3], "ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_OES_texture_buffer"},
|
||||
{/* else if */ "ext": "GL_EXT_texture_buffer"}],
|
||||
|
||||
"functions": [
|
||||
"TexBufferRange",
|
||||
]
|
||||
},
|
||||
|
||||
// GL_EXT_texture_storage is part of desktop 4.2
|
||||
// There is a desktop ARB extension and an ES+desktop EXT extension
|
||||
{
|
||||
"GL": [{"min_version": [4, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_texture_storage"},
|
||||
{/* else if */ "ext": "GL_EXT_texture_storage"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_EXT_texture_storage"}],
|
||||
|
||||
"functions": [
|
||||
"TexStorage2D",
|
||||
]
|
||||
},
|
||||
|
||||
// glTextureBarrier is part of desktop 4.5. There are also ARB and NV extensions.
|
||||
{
|
||||
"GL": [{"min_version": [4, 5], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_texture_barrier"},
|
||||
{/* else if */ "ext": "GL_NV_texture_barrier"}],
|
||||
"GLES": [{"ext": "GL_NV_texture_barrier"}],
|
||||
|
||||
"functions": [
|
||||
"TextureBarrier",
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"GL": null, // Not supported
|
||||
"GLES": [{"ext": "GL_EXT_discard_framebuffer"}],
|
||||
|
||||
"functions": [
|
||||
"DiscardFramebuffer",
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [3, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_instanced_arrays"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_EXT_instanced_arrays"}],
|
||||
|
||||
"functions": [
|
||||
"VertexAttribDivisor",
|
||||
]
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"VertexAttribIPointer",
|
||||
]
|
||||
},
|
||||
|
||||
// FrameBuffer Object (FBO) related calls
|
||||
{
|
||||
"GL": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_framebuffer_object"},
|
||||
{/* else if */ "ext": "GL_EXT_framebuffer_object"}],
|
||||
"GLES": [{"ext": "<core>"}], // These are all in ES 2.0 and above
|
||||
|
||||
"functions": [
|
||||
"BindFramebuffer", "BindRenderbuffer", "CheckFramebufferStatus",
|
||||
"DeleteFramebuffers", "DeleteRenderbuffers", "FramebufferRenderbuffer",
|
||||
"FramebufferTexture2D", "GenFramebuffers", "GenRenderbuffers", "GenerateMipmap",
|
||||
"GetFramebufferAttachmentParameteriv", "GetRenderbufferParameteriv",
|
||||
"RenderbufferStorage",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_framebuffer_object"},
|
||||
{/* else if */ "ext": "GL_EXT_framebuffer_blit"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_CHROMIUM_framebuffer_multisample"},
|
||||
{/* else if */ "ext": "GL_ANGLE_framebuffer_blit"}],
|
||||
|
||||
"functions": [
|
||||
"BlitFramebuffer",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_framebuffer_object"},
|
||||
{/* else if */ "ext": "GL_EXT_framebuffer_multisample"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_CHROMIUM_framebuffer_multisample"},
|
||||
{/* else if */ "ext": "GL_ANGLE_framebuffer_multisample"}],
|
||||
|
||||
"functions": [
|
||||
"RenderbufferStorageMultisample",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": null,
|
||||
"GLES": [{"ext": "GL_CHROMIUM_map_sub"}],
|
||||
|
||||
"functions": [
|
||||
"MapBufferSubData", "MapTexSubImage2D", "UnmapBufferSubData",
|
||||
"UnmapTexSubImage2D"
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": null,
|
||||
"GLES": [{"ext": "GL_EXT_multisampled_render_to_texture"},
|
||||
{"ext": "GL_IMG_multisampled_render_to_texture"}],
|
||||
|
||||
"functions": [
|
||||
"FramebufferTexture2DMultisample",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": null,
|
||||
"GLES": [{"ext": "GL_EXT_multisampled_render_to_texture"}],
|
||||
|
||||
"hardcode_functions" : [
|
||||
{
|
||||
"ptr_name": "fRenderbufferStorageMultisampleES2EXT",
|
||||
"cast_name": "GrGLRenderbufferStorageMultisampleFn",
|
||||
"get_name": "glRenderbufferStorageMultisampleEXT",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"GL": null,
|
||||
"GLES": [{"ext": "GL_IMG_multisampled_render_to_texture"}],
|
||||
|
||||
"hardcode_functions" : [
|
||||
{
|
||||
"ptr_name": "fRenderbufferStorageMultisampleES2EXT",
|
||||
"cast_name": "GrGLRenderbufferStorageMultisampleFn",
|
||||
"get_name": "glRenderbufferStorageMultisampleIMG",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"GL": null,
|
||||
"GLES": [{"ext": "GL_APPLE_framebuffer_multisample"}],
|
||||
|
||||
"functions" : ["ResolveMultisampleFramebuffer"],
|
||||
"hardcode_functions" : [
|
||||
{
|
||||
"ptr_name": "fRenderbufferStorageMultisampleES2APPLE",
|
||||
"cast_name": "GrGLRenderbufferStorageMultisampleFn",
|
||||
"get_name": "glRenderbufferStorageMultisampleAPPLE",
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// There are several APIs for buffer mapping:
|
||||
// ES2 + GL_OES_mapbuffer: MapBufferOES and UnmapBufferOES
|
||||
// ES2 + GL_EXT_map_buffer_range: Adds MapBufferRangeEXT and FlushMappedBufferRangeEXT
|
||||
// ES3: MapBufferRange, FlushMappedBufferRange, and UnmapBuffer are core (so no suffix).
|
||||
//
|
||||
// MapBuffer is not part of ES3, but implementations may still report the OES versions of
|
||||
// MapBuffer and UnmapBuffer, per the older GL_OES_mapbuffer extension. Some implementations
|
||||
// let us mix the newer MapBufferRange with the older UnmapBufferOES, but we've hit others that
|
||||
// don't permit it. Note that in GrGLBuffer, we choose which API to use based on version and
|
||||
// extensions. This code is written so that we never mix OES and non-OES functions.
|
||||
{
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": [{"ext": "GL_OES_mapbuffer"}],
|
||||
|
||||
"functions": [
|
||||
"MapBuffer",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_OES_mapbuffer"}],
|
||||
|
||||
"functions": [
|
||||
"UnmapBuffer",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_map_buffer_range"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_EXT_map_buffer_range"}],
|
||||
|
||||
"functions": [
|
||||
// These functions are added to the 3.0 version of both GLES and GL.
|
||||
"MapBufferRange", "FlushMappedBufferRange",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"ext": "GL_EXT_debug_marker"}],
|
||||
"GLES": [{"ext": "GL_EXT_debug_marker"}],
|
||||
|
||||
"functions": [
|
||||
"InsertEventMarker", "PushGroupMarker", "PopGroupMarker"
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [4, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_program_interface_query"}],
|
||||
"GLES": [{"min_version": [3, 1], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"GetProgramResourceLocation",
|
||||
],
|
||||
},
|
||||
|
||||
{ // It appears that the GL_NV_path_rendering sometimes provides these
|
||||
// functions under the "EXT" extension instead of "NV".
|
||||
"GL": [{"ext": "GL_NV_path_rendering", "suffix": "EXT"}],
|
||||
|
||||
"GLES": [{"ext": "GL_CHROMIUM_path_rendering"},
|
||||
{"ext": "GL_NV_path_rendering", "suffix": "EXT"}],
|
||||
|
||||
"functions": [
|
||||
"MatrixLoadIdentity", "MatrixLoadf"
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"ext": "GL_NV_path_rendering"}],
|
||||
"GLES": [{"ext": "GL_CHROMIUM_path_rendering"},
|
||||
{"ext": "GL_NV_path_rendering"}],
|
||||
|
||||
"functions": [
|
||||
"CoverFillPath", "CoverFillPathInstanced", "CoverStrokePath",
|
||||
"CoverStrokePathInstanced", "DeletePaths", "GenPaths",
|
||||
"IsPath", "PathCommands", "PathParameterf", "PathParameteri",
|
||||
"PathStencilFunc", "ProgramPathFragmentInputGen", "StencilFillPath",
|
||||
"StencilFillPathInstanced", "StencilStrokePath", "StencilStrokePathInstanced",
|
||||
"StencilThenCoverFillPath", "StencilThenCoverFillPathInstanced",
|
||||
"StencilThenCoverStrokePath", "StencilThenCoverStrokePathInstanced",
|
||||
],
|
||||
// List of functions that Skia uses, but which have been added since the initial release
|
||||
// of NV_path_rendering driver. We do not want to fail interface validation due to
|
||||
// missing features, we will just not use the extension.
|
||||
// If one updates this list, then update GrGLCaps::hasPathRenderingSupport too.
|
||||
"optional": [
|
||||
"ProgramPathFragmentInputGen", "StencilThenCoverFillPath",
|
||||
"StencilThenCoverFillPathInstanced", "StencilThenCoverStrokePath",
|
||||
"StencilThenCoverStrokePathInstanced",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": null,
|
||||
"GLES": [{"ext": "GL_CHROMIUM_path_rendering"}],
|
||||
|
||||
"functions": [
|
||||
"BindFragmentInputLocation",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"ext": "GL_NV_framebuffer_mixed_samples"}],
|
||||
"GLES": [{"ext": "GL_CHROMIUM_framebuffer_mixed_samples"},
|
||||
{"ext": "GL_NV_framebuffer_mixed_samples"}],
|
||||
|
||||
"functions": [
|
||||
"CoverageModulation",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [4, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_KHR_debug", "suffix": ""}],
|
||||
"GLES": [{"ext": "GL_KHR_debug"}],
|
||||
|
||||
// In OpenGL (but not ES), KHR_debug defines these methods to have no suffix.
|
||||
"functions": [
|
||||
"DebugMessageControl", "DebugMessageInsert", "DebugMessageCallback",
|
||||
"GetDebugMessageLog", "PushDebugGroup", "PopDebugGroup", "ObjectLabel",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": null,
|
||||
"GLES": [{"ext": "GL_CHROMIUM_bind_uniform_location"}],
|
||||
|
||||
"functions": [
|
||||
"BindUniformLocation",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"ext": "GL_EXT_window_rectangles"}],
|
||||
"GLES": [{"ext": "GL_EXT_window_rectangles"}],
|
||||
|
||||
"functions": [
|
||||
"WindowRectangles",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"ext": "EGL_KHR_image"},
|
||||
{"ext": "EGL_KHR_image_base"}],
|
||||
"GLES": [{"ext": "EGL_KHR_image"},
|
||||
{"ext": "EGL_KHR_image_base"}],
|
||||
|
||||
"functions": [
|
||||
"CreateImage", "DestroyImage",
|
||||
],
|
||||
"egl_proc": true
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [3, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_sync"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_APPLE_sync"}],
|
||||
|
||||
"functions": [
|
||||
"ClientWaitSync", "DeleteSync", "FenceSync",
|
||||
"IsSync", "WaitSync"
|
||||
],
|
||||
},
|
||||
|
||||
{ // getInternalformativ was added in GL 4.2, ES 3.0, and with
|
||||
// extension ARB_internalformat_query
|
||||
"GL": [{"min_version": [4, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_internalformat_query"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"GetInternalformativ"
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [4, 1], "ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"GetProgramBinary", "ProgramBinary", "ProgramParameteri",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [3, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_sampler_objects"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"BindSampler", "DeleteSamplers", "GenSamplers",
|
||||
"SamplerParameteri", "SamplerParameteriv",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": null, // not in ES
|
||||
|
||||
"functions": [
|
||||
"GetQueryObjectiv",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"ext": "<core>"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_EXT_occlusion_query_boolean"}],
|
||||
|
||||
"functions": [
|
||||
"GenQueries", "DeleteQueries", "BeginQuery", "EndQuery",
|
||||
"GetQueryObjectuiv", "GetQueryiv",
|
||||
],
|
||||
|
||||
// Original comment says "Not yet added to chrome's bindings."
|
||||
"optional": [
|
||||
"GenQueries", "DeleteQueries", "BeginQuery", "EndQuery",
|
||||
"GetQueryObjectuiv", "GetQueryiv",
|
||||
]
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [3, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_timer_query"},
|
||||
{/* else if */ "ext": "GL_EXT_timer_query"}],
|
||||
"GLES": null,
|
||||
|
||||
"functions": [
|
||||
"GetQueryObjecti64v", "GetQueryObjectui64v",
|
||||
],
|
||||
},
|
||||
{
|
||||
"GL": [{"min_version": [3, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_timer_query"}],
|
||||
"GLES": null,
|
||||
|
||||
"functions": [
|
||||
"QueryCounter",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [4, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_invalidate_subdata"}],
|
||||
"GLES": null,
|
||||
|
||||
"functions": [
|
||||
"InvalidateBufferData", "InvalidateBufferSubData", "InvalidateTexImage",
|
||||
"InvalidateTexSubImage",
|
||||
],
|
||||
},
|
||||
{ // ES 3.0 adds the framebuffer functions but not the others.
|
||||
"GL": [{"min_version": [4, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_invalidate_subdata"}],
|
||||
"GLES": [{"min_version": [3, 0], "ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"InvalidateFramebuffer", "InvalidateSubFramebuffer",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [4, 3], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_ES2_compatibility"}],
|
||||
"GLES": [{"ext": "<core>"}],
|
||||
|
||||
"functions": [
|
||||
"GetShaderPrecisionFormat",
|
||||
],
|
||||
},
|
||||
|
||||
]
|
@ -1,203 +0,0 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
const ASSEMBLE_INTERFACE_GL_ES = `/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* THIS FILE IS AUTOGENERATED
|
||||
* Make edits to tools/gpu/gl/interface/templates.go or they will
|
||||
* be overwritten.
|
||||
*/
|
||||
|
||||
#include "gl/GrGLAssembleInterface.h"
|
||||
#include "gl/GrGLAssembleHelpers.h"
|
||||
#include "gl/GrGLUtil.h"
|
||||
|
||||
#define GET_PROC(F) functions->f##F = (GrGL##F##Fn*)get(ctx, "gl" #F)
|
||||
#define GET_PROC_SUFFIX(F, S) functions->f##F = (GrGL##F##Fn*)get(ctx, "gl" #F #S)
|
||||
#define GET_PROC_LOCAL(F) GrGL##F##Fn* F = (GrGL##F##Fn*)get(ctx, "gl" #F)
|
||||
|
||||
#define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL##F = (GrEGL##F##Fn*)get(ctx, "egl" #F #S)
|
||||
|
||||
#if SK_DISABLE_GL_ES_INTERFACE
|
||||
sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc get) {
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc get) {
|
||||
GET_PROC_LOCAL(GetString);
|
||||
if (nullptr == GetString) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
|
||||
GrGLVersion glVer = GrGLGetVersionFromString(verStr);
|
||||
|
||||
if (glVer < GR_GL_VER(2,0)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GET_PROC_LOCAL(GetIntegerv);
|
||||
GET_PROC_LOCAL(GetStringi);
|
||||
GrEGLQueryStringFn* queryString;
|
||||
GrEGLDisplay display;
|
||||
GrGetEGLQueryAndDisplay(&queryString, &display, ctx, get);
|
||||
GrGLExtensions extensions;
|
||||
if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
|
||||
display)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<GrGLInterface> interface(new GrGLInterface);
|
||||
GrGLInterface::Functions* functions = &interface->fFunctions;
|
||||
|
||||
// Autogenerated content follows
|
||||
[[content]]
|
||||
// End autogenerated content
|
||||
// TODO(kjlubick): Do we want a feature that removes the extension if it doesn't have
|
||||
// the function? This is common on some low-end GPUs.
|
||||
|
||||
if (extensions.has("GL_KHR_debug")) {
|
||||
// In general we have a policy against removing extension strings when the driver does
|
||||
// not provide function pointers for an advertised extension. However, because there is a
|
||||
// known device that advertises GL_KHR_debug but fails to provide the functions and this is
|
||||
// a debugging- only extension we've made an exception. This also can happen when using
|
||||
// APITRACE.
|
||||
if (!interface->fFunctions.fDebugMessageControl) {
|
||||
extensions.remove("GL_KHR_debug");
|
||||
}
|
||||
}
|
||||
interface->fStandard = kGLES_GrGLStandard;
|
||||
interface->fExtensions.swap(&extensions);
|
||||
|
||||
return std::move(interface);
|
||||
}
|
||||
#endif
|
||||
`
|
||||
|
||||
const ASSEMBLE_INTERFACE_GL = `/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* THIS FILE IS AUTOGENERATED
|
||||
* Make edits to tools/gpu/gl/interface/templates.go or they will
|
||||
* be overwritten.
|
||||
*/
|
||||
|
||||
#include "gl/GrGLAssembleInterface.h"
|
||||
#include "gl/GrGLAssembleHelpers.h"
|
||||
#include "gl/GrGLUtil.h"
|
||||
|
||||
#define GET_PROC(F) functions->f##F = (GrGL##F##Fn*)get(ctx, "gl" #F)
|
||||
#define GET_PROC_SUFFIX(F, S) functions->f##F = (GrGL##F##Fn*)get(ctx, "gl" #F #S)
|
||||
#define GET_PROC_LOCAL(F) GrGL##F##Fn* F = (GrGL##F##Fn*)get(ctx, "gl" #F)
|
||||
|
||||
#define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL##F = (GrEGL##F##Fn*)get(ctx, "egl" #F #S)
|
||||
|
||||
#if SK_DISABLE_GL_INTERFACE
|
||||
sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc get) {
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc get) {
|
||||
GET_PROC_LOCAL(GetString);
|
||||
GET_PROC_LOCAL(GetStringi);
|
||||
GET_PROC_LOCAL(GetIntegerv);
|
||||
|
||||
// GetStringi may be nullptr depending on the GL version.
|
||||
if (nullptr == GetString || nullptr == GetIntegerv) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* versionString = (const char*) GetString(GR_GL_VERSION);
|
||||
GrGLVersion glVer = GrGLGetVersionFromString(versionString);
|
||||
|
||||
if (glVer < GR_GL_VER(2,0) || GR_GL_INVALID_VER == glVer) {
|
||||
// This is our minimum for non-ES GL.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrEGLQueryStringFn* queryString;
|
||||
GrEGLDisplay display;
|
||||
GrGetEGLQueryAndDisplay(&queryString, &display, ctx, get);
|
||||
GrGLExtensions extensions;
|
||||
if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
|
||||
display)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<GrGLInterface> interface(new GrGLInterface());
|
||||
GrGLInterface::Functions* functions = &interface->fFunctions;
|
||||
|
||||
// Autogenerated content follows
|
||||
[[content]]
|
||||
// End autogenerated content
|
||||
interface->fStandard = kGL_GrGLStandard;
|
||||
interface->fExtensions.swap(&extensions);
|
||||
|
||||
return std::move(interface);
|
||||
}
|
||||
#endif
|
||||
`
|
||||
|
||||
const VALIDATE_INTERFACE = `/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* THIS FILE IS AUTOGENERATED
|
||||
* Make edits to tools/gpu/gl/interface/templates.go or they will
|
||||
* be overwritten.
|
||||
*/
|
||||
|
||||
#include "gl/GrGLInterface.h"
|
||||
#include "gl/GrGLExtensions.h"
|
||||
#include "gl/GrGLUtil.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
GrGLInterface::GrGLInterface() {
|
||||
fStandard = kNone_GrGLStandard;
|
||||
}
|
||||
|
||||
#define RETURN_FALSE_INTERFACE \
|
||||
SkDEBUGF("%s:%d GrGLInterface::validate() failed.\n", __FILE__, __LINE__); \
|
||||
return false
|
||||
|
||||
bool GrGLInterface::validate() const {
|
||||
|
||||
if (kNone_GrGLStandard == fStandard) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
if (!fExtensions.isInitialized()) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
|
||||
GrGLVersion glVer = GrGLGetVersion(this);
|
||||
if (GR_GL_INVALID_VER == glVer) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
// Autogenerated content follows
|
||||
[[content]]
|
||||
// End autogenerated content
|
||||
return true;
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
void GrGLInterface::abandon() const {
|
||||
const_cast<GrGLInterface*>(this)->fFunctions = GrGLInterface::Functions();
|
||||
}
|
||||
|
||||
#endif // GR_TEST_UTILS
|
||||
`
|
Loading…
Reference in New Issue
Block a user