diff options
author | Brian Salomon <bsalomon@google.com> | 2017-05-08 11:10:53 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-08 16:52:14 +0000 |
commit | 15b2509a7ef81bb23242f19641f7f660430fea96 (patch) | |
tree | 915790ec2bdd48da219160408fc8d895c552e5a8 | |
parent | f0861675d7fdef3f8f51a586c6ddfbcecdc4cb0a (diff) |
Update minimum non-ES OpenGL spec to 2.0.
As a consequence of removing support for GLs lacking separate stencil settings our effective minimum GL version is 2.0. This formalizes that by explicitly failing if the version in the version string is lower.
As a consequence we will always have wrapping stencil operations available.
Bug: skia:
Change-Id: Ibe302f72a063dbadc773bda811cc0d0f6c08c61a
Reviewed-on: https://skia-review.googlesource.com/15610
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
-rw-r--r-- | include/gpu/GrCaps.h | 2 | ||||
-rw-r--r-- | src/gpu/GrCaps.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrPathRendererChain.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLAssembleInterface.cpp | 87 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 10 | ||||
-rw-r--r-- | src/gpu/gl/GrGLInterface.cpp | 149 | ||||
-rw-r--r-- | src/gpu/ops/GrDefaultPathRenderer.cpp | 9 | ||||
-rw-r--r-- | src/gpu/ops/GrDefaultPathRenderer.h | 5 | ||||
-rw-r--r-- | src/gpu/ops/GrMSAAPathRenderer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/ops/GrPathStencilSettings.h | 66 | ||||
-rw-r--r-- | src/gpu/vk/GrVkCaps.cpp | 2 |
11 files changed, 115 insertions, 221 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index a41caf6ff7..92171204b3 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -43,7 +43,6 @@ public: * Is there support for enabling/disabling sRGB writes for sRGB-capable color buffers? */ bool srgbWriteControl() const { return fSRGBWriteControl; } - bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } bool discardRenderTargetSupport() const { return fDiscardRenderTargetSupport; } bool gpuTracingSupport() const { return fGpuTracingSupport; } bool compressedTexSubImageSupport() const { return fCompressedTexSubImageSupport; } @@ -207,7 +206,6 @@ protected: bool fMipMapSupport : 1; bool fSRGBSupport : 1; bool fSRGBWriteControl : 1; - bool fStencilWrapOpsSupport : 1; bool fDiscardRenderTargetSupport : 1; bool fReuseScratchTextures : 1; bool fReuseScratchBuffers : 1; diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp index 78bb6795e9..57ab5fdece 100644 --- a/src/gpu/GrCaps.cpp +++ b/src/gpu/GrCaps.cpp @@ -36,7 +36,6 @@ GrCaps::GrCaps(const GrContextOptions& options) { fNPOTTextureTileSupport = false; fSRGBSupport = false; fSRGBWriteControl = false; - fStencilWrapOpsSupport = false; fDiscardRenderTargetSupport = false; fReuseScratchTextures = true; fReuseScratchBuffers = true; @@ -125,7 +124,6 @@ SkString GrCaps::dump() const { r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]); r.appendf("sRGB Support : %s\n", gNY[fSRGBSupport]); r.appendf("sRGB Write Control : %s\n", gNY[fSRGBWriteControl]); - r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]); r.appendf("Discard Render Target Support : %s\n", gNY[fDiscardRenderTargetSupport]); r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]); r.appendf("Reuse Scratch Buffers : %s\n", gNY[fReuseScratchBuffers]); diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp index 8d06a5e7cf..076dea7b82 100644 --- a/src/gpu/GrPathRendererChain.cpp +++ b/src/gpu/GrPathRendererChain.cpp @@ -60,7 +60,7 @@ GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& opti fChain.push_back(sk_make_sp<GrTessellatingPathRenderer>()); } if (options.fGpuPathRenderers & GpuPathRenderers::kDefault) { - fChain.push_back(sk_make_sp<GrDefaultPathRenderer>(caps.stencilWrapOpsSupport())); + fChain.push_back(sk_make_sp<GrDefaultPathRenderer>()); } } diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp index 83920dba8d..7914934eac 100644 --- a/src/gpu/gl/GrGLAssembleInterface.cpp +++ b/src/gpu/gl/GrGLAssembleInterface.cpp @@ -64,8 +64,8 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { const char* versionString = (const char*) GetString(GR_GL_VERSION); GrGLVersion glVer = GrGLGetVersionFromString(versionString); - if (glVer < GR_GL_VER(1,5) || GR_GL_INVALID_VER == glVer) { - // We must have array and element_array buffer objects. + if (glVer < GR_GL_VER(2,0) || GR_GL_INVALID_VER == glVer) { + // This is our minimum for non-ES GL. return nullptr; } @@ -97,20 +97,8 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { GET_PROC_SUFFIX(BlendBarrier, NV); } - if (glVer >= GR_GL_VER(1,4) || - extensions.has("GL_ARB_imaging")) { - GET_PROC(BlendColor); - } else if (extensions.has("GL_EXT_blend_color")) { - GET_PROC_SUFFIX(BlendColor, EXT); - } - - if (glVer >= GR_GL_VER(1,4) || - extensions.has("GL_ARB_imaging")) { - GET_PROC(BlendEquation); - } else if (extensions.has("GL_EXT_blend_subtract")) { - GET_PROC_SUFFIX(BlendEquation, EXT); - } - + GET_PROC(BlendColor); + GET_PROC(BlendEquation); GET_PROC(BlendFunc); GET_PROC(BufferData); GET_PROC(BufferSubData); @@ -148,9 +136,7 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { GET_PROC(DrawArraysIndirect); GET_PROC(DrawElementsIndirect); } - if (glVer >= GR_GL_VER(2,0)) { - GET_PROC(DrawRangeElements); - } + GET_PROC(DrawRangeElements); GET_PROC(Enable); GET_PROC(EnableVertexAttribArray); GET_PROC(EndQuery); @@ -406,11 +392,37 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { GET_PROC_SUFFIX(CopyTextureImage2D, EXT); GET_PROC_SUFFIX(CopyTextureSubImage1D, EXT); GET_PROC_SUFFIX(CopyTextureSubImage2D, EXT); + GET_PROC_SUFFIX(GetNamedBufferParameteriv, EXT); + GET_PROC_SUFFIX(GetNamedBufferPointerv, EXT); + GET_PROC_SUFFIX(GetNamedBufferSubData, EXT); GET_PROC_SUFFIX(GetTextureImage, EXT); GET_PROC_SUFFIX(GetTextureParameterfv, EXT); GET_PROC_SUFFIX(GetTextureParameteriv, EXT); GET_PROC_SUFFIX(GetTextureLevelParameterfv, EXT); GET_PROC_SUFFIX(GetTextureLevelParameteriv, EXT); + GET_PROC_SUFFIX(MapNamedBuffer, EXT); + GET_PROC_SUFFIX(NamedBufferData, EXT); + GET_PROC_SUFFIX(NamedBufferSubData, EXT); + GET_PROC_SUFFIX(ProgramUniform1f, EXT); + GET_PROC_SUFFIX(ProgramUniform2f, EXT); + GET_PROC_SUFFIX(ProgramUniform3f, EXT); + GET_PROC_SUFFIX(ProgramUniform4f, EXT); + GET_PROC_SUFFIX(ProgramUniform1i, EXT); + GET_PROC_SUFFIX(ProgramUniform2i, EXT); + GET_PROC_SUFFIX(ProgramUniform3i, EXT); + GET_PROC_SUFFIX(ProgramUniform4i, EXT); + GET_PROC_SUFFIX(ProgramUniform1fv, EXT); + GET_PROC_SUFFIX(ProgramUniform2fv, EXT); + GET_PROC_SUFFIX(ProgramUniform3fv, EXT); + GET_PROC_SUFFIX(ProgramUniform4fv, EXT); + GET_PROC_SUFFIX(ProgramUniform1iv, EXT); + GET_PROC_SUFFIX(ProgramUniform2iv, EXT); + GET_PROC_SUFFIX(ProgramUniform3iv, EXT); + GET_PROC_SUFFIX(ProgramUniform4iv, EXT); + GET_PROC_SUFFIX(ProgramUniformMatrix2fv, EXT); + GET_PROC_SUFFIX(ProgramUniformMatrix3fv, EXT); + GET_PROC_SUFFIX(ProgramUniformMatrix4fv, EXT); + GET_PROC_SUFFIX(UnmapNamedBuffer, EXT); if (glVer >= GR_GL_VER(1,2)) { GET_PROC_SUFFIX(TextureImage3D, EXT); GET_PROC_SUFFIX(TextureSubImage3D, EXT); @@ -423,36 +435,6 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { GET_PROC_SUFFIX(CompressedTextureSubImage1D, EXT); GET_PROC_SUFFIX(GetCompressedTextureImage, EXT); } - if (glVer >= GR_GL_VER(1,5)) { - GET_PROC_SUFFIX(NamedBufferData, EXT); - GET_PROC_SUFFIX(NamedBufferSubData, EXT); - GET_PROC_SUFFIX(MapNamedBuffer, EXT); - GET_PROC_SUFFIX(UnmapNamedBuffer, EXT); - GET_PROC_SUFFIX(GetNamedBufferParameteriv, EXT); - GET_PROC_SUFFIX(GetNamedBufferPointerv, EXT); - GET_PROC_SUFFIX(GetNamedBufferSubData, EXT); - } - if (glVer >= GR_GL_VER(2,0)) { - GET_PROC_SUFFIX(ProgramUniform1f, EXT); - GET_PROC_SUFFIX(ProgramUniform2f, EXT); - GET_PROC_SUFFIX(ProgramUniform3f, EXT); - GET_PROC_SUFFIX(ProgramUniform4f, EXT); - GET_PROC_SUFFIX(ProgramUniform1i, EXT); - GET_PROC_SUFFIX(ProgramUniform2i, EXT); - GET_PROC_SUFFIX(ProgramUniform3i, EXT); - GET_PROC_SUFFIX(ProgramUniform4i, EXT); - GET_PROC_SUFFIX(ProgramUniform1fv, EXT); - GET_PROC_SUFFIX(ProgramUniform2fv, EXT); - GET_PROC_SUFFIX(ProgramUniform3fv, EXT); - GET_PROC_SUFFIX(ProgramUniform4fv, EXT); - GET_PROC_SUFFIX(ProgramUniform1iv, EXT); - GET_PROC_SUFFIX(ProgramUniform2iv, EXT); - GET_PROC_SUFFIX(ProgramUniform3iv, EXT); - GET_PROC_SUFFIX(ProgramUniform4iv, EXT); - GET_PROC_SUFFIX(ProgramUniformMatrix2fv, EXT); - GET_PROC_SUFFIX(ProgramUniformMatrix3fv, EXT); - GET_PROC_SUFFIX(ProgramUniformMatrix4fv, EXT); - } if (glVer >= GR_GL_VER(2,1)) { GET_PROC_SUFFIX(ProgramUniformMatrix2x3fv, EXT); GET_PROC_SUFFIX(ProgramUniformMatrix3x2fv, EXT); @@ -622,6 +604,7 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) { 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); @@ -661,6 +644,9 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) { 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); @@ -677,6 +663,9 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) { GET_PROC_SUFFIX(RasterSamples, EXT); } + if (version >= GR_GL_VER(3,0)) { + GET_PROC(ReadBuffer); + } GET_PROC(ReadPixels); GET_PROC(Scissor); GET_PROC(ShaderSource); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index ad0b6bc9b3..47f26ff2f5 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -378,14 +378,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, this->initBlendEqationSupport(ctxInfo); this->initStencilFormats(ctxInfo); - if (kGL_GrGLStandard == standard) { - // supported on GL 1.4 and higher or by extension - fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) || - ctxInfo.hasExtension("GL_EXT_stencil_wrap"); - } else { - // ES 2 has stencil wrap - fStencilWrapOpsSupport = true; - } if (kGL_GrGLStandard == standard) { fMapBufferFlags = kCanMap_MapFlag; // we require VBO support and the desktop VBO @@ -437,8 +429,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, } if (kGL_GrGLStandard == standard) { - SkASSERT(ctxInfo.version() >= GR_GL_VER(2,0) || - ctxInfo.hasExtension("GL_ARB_texture_non_power_of_two")); fNPOTTextureTileSupport = true; fMipMapSupport = true; } else { diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index 5bb4b5f6f8..ee67b21124 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -79,6 +79,8 @@ bool GrGLInterface::validate() const { nullptr == fFunctions.fClearStencil || nullptr == fFunctions.fColorMask || nullptr == fFunctions.fCompileShader || + nullptr == fFunctions.fCompressedTexImage2D || + nullptr == fFunctions.fCompressedTexSubImage2D || nullptr == fFunctions.fCopyTexSubImage2D || nullptr == fFunctions.fCreateProgram || nullptr == fFunctions.fCreateShader || @@ -107,9 +109,7 @@ bool GrGLInterface::validate() const { nullptr == fFunctions.fGetShaderiv || nullptr == fFunctions.fGetString || nullptr == fFunctions.fGetUniformLocation || -#if 0 // Not included in Chrome yet nullptr == fFunctions.fIsTexture || -#endif nullptr == fFunctions.fLinkProgram || nullptr == fFunctions.fLineWidth || nullptr == fFunctions.fPixelStorei || @@ -182,31 +182,10 @@ bool GrGLInterface::validate() const { // On the desktop we assume they are available if the extension // is present or GL version is high enough. if (kGL_GrGLStandard == fStandard) { - if (glVer >= GR_GL_VER(2,0)) { - if (nullptr == fFunctions.fPolygonMode) { - RETURN_FALSE_INTERFACE - } - } if (glVer >= GR_GL_VER(3,0) && nullptr == fFunctions.fBindFragDataLocation) { RETURN_FALSE_INTERFACE } - if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) { - if (nullptr == fFunctions.fDrawBuffers) { - RETURN_FALSE_INTERFACE - } - } - if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) { - if (nullptr == fFunctions.fGenQueries || - nullptr == fFunctions.fDeleteQueries || - nullptr == fFunctions.fBeginQuery || - nullptr == fFunctions.fEndQuery || - nullptr == fFunctions.fGetQueryiv || - nullptr == fFunctions.fGetQueryObjectiv || - nullptr == fFunctions.fGetQueryObjectuiv) { - RETURN_FALSE_INTERFACE - } - } if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query") || fExtensions.has("GL_EXT_timer_query")) { @@ -222,25 +201,31 @@ bool GrGLInterface::validate() const { } } - // optional function on desktop before 1.3 - if (kGL_GrGLStandard != fStandard || - (glVer >= GR_GL_VER(1,3)) || - fExtensions.has("GL_ARB_texture_compression")) { - if (nullptr == fFunctions.fCompressedTexImage2D -#if 0 - || nullptr == fFunctions.fCompressedTexSubImage2D -#endif - ) { + // part of desktop GL, but not ES + if (kGL_GrGLStandard == fStandard && + (nullptr == fFunctions.fDrawBuffer || + nullptr == fFunctions.fPolygonMode)) { + RETURN_FALSE_INTERFACE + } + + // ES 3.0 (or ES 2.0 extended) has glDrawBuffers but not glDrawBuffer + if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,0)) { + if (nullptr == fFunctions.fDrawBuffers) { RETURN_FALSE_INTERFACE } } - // part of desktop GL, but not ES - if (kGL_GrGLStandard == fStandard && - (nullptr == fFunctions.fGetTexLevelParameteriv || - nullptr == fFunctions.fDrawBuffer || - nullptr == fFunctions.fReadBuffer)) { - RETURN_FALSE_INTERFACE + if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,0)) { + if (nullptr == fFunctions.fReadBuffer) { + RETURN_FALSE_INTERFACE + } + } + + // glGetTexLevelParameteriv was added to ES in 3.1. + if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,1)) { + if (nullptr == fFunctions.fGetTexLevelParameteriv) { + RETURN_FALSE_INTERFACE + } } // GL_EXT_texture_storage is part of desktop 4.2 @@ -287,6 +272,25 @@ bool GrGLInterface::validate() const { } } + // Required since OpenGL 1.5 and ES 3.0 or with GL_EXT_occlusion_query_boolean + if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,0) || + fExtensions.has("GL_EXT_occlusion_query_boolean")) { +#if 0 // Not yet added to chrome's bindings. + if (nullptr == fFunctions.fGenQueries || + nullptr == fFunctions.fDeleteQueries || + nullptr == fFunctions.fBeginQuery || + nullptr == fFunctions.fEndQuery || + nullptr == fFunctions.fGetQueryiv || + nullptr == fFunctions.fGetQueryObjectuiv) { + RETURN_FALSE_INTERFACE + } +#endif + } + // glGetQueryObjectiv doesn't exist in ES. + if (kGL_GrGLStandard == fStandard && nullptr == fFunctions.fGetQueryObjectiv) { + RETURN_FALSE_INTERFACE + } + // FBO MSAA if (kGL_GrGLStandard == fStandard) { // GL 3.0 and the ARB extension have multisample + blit @@ -616,11 +620,37 @@ bool GrGLInterface::validate() const { nullptr == fFunctions.fCopyTextureImage2D || nullptr == fFunctions.fCopyTextureSubImage1D || nullptr == fFunctions.fCopyTextureSubImage2D || + nullptr == fFunctions.fGetNamedBufferParameteriv || + nullptr == fFunctions.fGetNamedBufferPointerv || + nullptr == fFunctions.fGetNamedBufferSubData || nullptr == fFunctions.fGetTextureImage || nullptr == fFunctions.fGetTextureParameterfv || nullptr == fFunctions.fGetTextureParameteriv || nullptr == fFunctions.fGetTextureLevelParameterfv || - nullptr == fFunctions.fGetTextureLevelParameteriv) { + nullptr == fFunctions.fGetTextureLevelParameteriv || + nullptr == fFunctions.fMapNamedBuffer || + nullptr == fFunctions.fNamedBufferData || + nullptr == fFunctions.fNamedBufferSubData || + nullptr == fFunctions.fProgramUniform1f || + nullptr == fFunctions.fProgramUniform2f || + nullptr == fFunctions.fProgramUniform3f || + nullptr == fFunctions.fProgramUniform4f || + nullptr == fFunctions.fProgramUniform1i || + nullptr == fFunctions.fProgramUniform2i || + nullptr == fFunctions.fProgramUniform3i || + nullptr == fFunctions.fProgramUniform4i || + nullptr == fFunctions.fProgramUniform1fv || + nullptr == fFunctions.fProgramUniform2fv || + nullptr == fFunctions.fProgramUniform3fv || + nullptr == fFunctions.fProgramUniform4fv || + nullptr == fFunctions.fProgramUniform1iv || + nullptr == fFunctions.fProgramUniform2iv || + nullptr == fFunctions.fProgramUniform3iv || + nullptr == fFunctions.fProgramUniform4iv || + nullptr == fFunctions.fProgramUniformMatrix2fv || + nullptr == fFunctions.fProgramUniformMatrix3fv || + nullptr == fFunctions.fProgramUniformMatrix4fv || + nullptr == fFunctions.fUnmapNamedBuffer) { RETURN_FALSE_INTERFACE } if (glVer >= GR_GL_VER(1,2)) { @@ -637,40 +667,6 @@ bool GrGLInterface::validate() const { RETURN_FALSE_INTERFACE } } - if (glVer >= GR_GL_VER(1,5)) { - if (nullptr == fFunctions.fNamedBufferData || - nullptr == fFunctions.fNamedBufferSubData || - nullptr == fFunctions.fMapNamedBuffer || - nullptr == fFunctions.fUnmapNamedBuffer || - nullptr == fFunctions.fGetNamedBufferParameteriv || - nullptr == fFunctions.fGetNamedBufferPointerv || - nullptr == fFunctions.fGetNamedBufferSubData) { - RETURN_FALSE_INTERFACE - } - } - if (glVer >= GR_GL_VER(2,0)) { - if (nullptr == fFunctions.fProgramUniform1f || - nullptr == fFunctions.fProgramUniform2f || - nullptr == fFunctions.fProgramUniform3f || - nullptr == fFunctions.fProgramUniform4f || - nullptr == fFunctions.fProgramUniform1i || - nullptr == fFunctions.fProgramUniform2i || - nullptr == fFunctions.fProgramUniform3i || - nullptr == fFunctions.fProgramUniform4i || - nullptr == fFunctions.fProgramUniform1fv || - nullptr == fFunctions.fProgramUniform2fv || - nullptr == fFunctions.fProgramUniform3fv || - nullptr == fFunctions.fProgramUniform4fv || - nullptr == fFunctions.fProgramUniform1iv || - nullptr == fFunctions.fProgramUniform2iv || - nullptr == fFunctions.fProgramUniform3iv || - nullptr == fFunctions.fProgramUniform4iv || - nullptr == fFunctions.fProgramUniformMatrix2fv || - nullptr == fFunctions.fProgramUniformMatrix3fv || - nullptr == fFunctions.fProgramUniformMatrix4fv) { - RETURN_FALSE_INTERFACE - } - } if (glVer >= GR_GL_VER(2,1)) { if (nullptr == fFunctions.fProgramUniformMatrix2x3fv || nullptr == fFunctions.fProgramUniformMatrix3x2fv || @@ -785,11 +781,8 @@ bool GrGLInterface::validate() const { } } - if (kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(2,0)) { - if (nullptr == fFunctions.fDrawRangeElements) { - RETURN_FALSE_INTERFACE; - } - } else if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) { + // glDrawRangeElements was added to ES in 3.0. + if (kGL_GrGLStandard == fStandard || glVer >= GR_GL_VER(3,0)) { if (nullptr == fFunctions.fDrawRangeElements) { RETURN_FALSE_INTERFACE; } diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp index faa8daa93c..0ec090e535 100644 --- a/src/gpu/ops/GrDefaultPathRenderer.cpp +++ b/src/gpu/ops/GrDefaultPathRenderer.cpp @@ -24,8 +24,7 @@ #include "ops/GrMeshDrawOp.h" #include "ops/GrRectOpFactory.h" -GrDefaultPathRenderer::GrDefaultPathRenderer(bool stencilWrapOpsSupport) - : fStencilWrapOps(stencilWrapOpsSupport) { +GrDefaultPathRenderer::GrDefaultPathRenderer() { } //////////////////////////////////////////////////////////////////////////////// @@ -475,11 +474,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget reverse = true; // fallthrough case SkPath::kWinding_FillType: - if (fStencilWrapOps) { - passes[0] = &gWindStencilSeparateWithWrap; - } else { - passes[0] = &gWindStencilSeparateNoWrap; - } + passes[0] = &gWindStencilPass; passCount = 2; if (stencilOnly) { lastPassIsBounds = false; diff --git a/src/gpu/ops/GrDefaultPathRenderer.h b/src/gpu/ops/GrDefaultPathRenderer.h index ea2127dbf5..7f7ab2a5e0 100644 --- a/src/gpu/ops/GrDefaultPathRenderer.h +++ b/src/gpu/ops/GrDefaultPathRenderer.h @@ -18,10 +18,9 @@ */ class SK_API GrDefaultPathRenderer : public GrPathRenderer { public: - GrDefaultPathRenderer(bool stencilWrapOpsSupport); + GrDefaultPathRenderer(); private: - StencilSupport onGetStencilSupport(const GrShape&) const override; bool onCanDrawPath(const CanDrawPathArgs&) const override; @@ -39,8 +38,6 @@ private: const GrShape&, bool stencilOnly); - bool fStencilWrapOps; - typedef GrPathRenderer INHERITED; }; diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp index f4d14cdf71..d4c0f3f16b 100644 --- a/src/gpu/ops/GrMSAAPathRenderer.cpp +++ b/src/gpu/ops/GrMSAAPathRenderer.cpp @@ -611,7 +611,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetCon reverse = true; // fallthrough case SkPath::kWinding_FillType: - passes[0] = &gWindStencilSeparateWithWrap; + passes[0] = &gWindStencilPass; if (!stencilOnly) { passes[1] = reverse ? &gInvWindColorPass : &gWindColorPass; } diff --git a/src/gpu/ops/GrPathStencilSettings.h b/src/gpu/ops/GrPathStencilSettings.h index f37d1b2f18..10e6dddab3 100644 --- a/src/gpu/ops/GrPathStencilSettings.h +++ b/src/gpu/ops/GrPathStencilSettings.h @@ -49,11 +49,7 @@ static constexpr GrUserStencilSettings gInvEOColorPass( ////// Winding -// when we have separate stencil we increment front faces / decrement back faces -// when we don't have wrap incr and decr we use the stencil test to simulate -// them. - -static constexpr GrUserStencilSettings gWindStencilSeparateWithWrap( +static constexpr GrUserStencilSettings gWindStencilPass ( GrUserStencilSettings::StaticInitSeparate< 0xffff, 0xffff, GrUserStencilTest::kAlwaysIfInClip, GrUserStencilTest::kAlwaysIfInClip, @@ -63,66 +59,6 @@ static constexpr GrUserStencilSettings gWindStencilSeparateWithWrap( 0xffff, 0xffff>() ); -// if inc'ing the max value, invert to make 0 -// if dec'ing zero invert to make all ones. -// we can't avoid touching the stencil on both passing and -// failing, so we can't resctrict ourselves to the clip. -static constexpr GrUserStencilSettings gWindStencilSeparateNoWrap( - GrUserStencilSettings::StaticInitSeparate< - 0xffff, 0x0000, - GrUserStencilTest::kEqual, GrUserStencilTest::kEqual, - 0xffff, 0xffff, - GrUserStencilOp::kInvert, GrUserStencilOp::kInvert, - GrUserStencilOp::kIncMaybeClamp, GrUserStencilOp::kDecMaybeClamp, - 0xffff, 0xffff>() -); - -// When there are no separate faces we do two passes to setup the winding rule -// stencil. First we draw the front faces and inc, then we draw the back faces -// and dec. These are same as the above two split into the incrementing and -// decrementing passes. -static constexpr GrUserStencilSettings gWindSingleStencilWithWrapInc( - GrUserStencilSettings::StaticInit< - 0xffff, - GrUserStencilTest::kAlwaysIfInClip, - 0xffff, - GrUserStencilOp::kIncWrap, - GrUserStencilOp::kKeep, - 0xffff>() -); - -static constexpr GrUserStencilSettings gWindSingleStencilWithWrapDec( - GrUserStencilSettings::StaticInit< - 0xffff, - GrUserStencilTest::kAlwaysIfInClip, - 0xffff, - GrUserStencilOp::kDecWrap, - GrUserStencilOp::kKeep, - 0xffff>() -); - -static constexpr GrUserStencilSettings gWindSingleStencilNoWrapInc( - GrUserStencilSettings::StaticInit< - 0xffff, - GrUserStencilTest::kEqual, - 0xffff, - GrUserStencilOp::kInvert, - GrUserStencilOp::kIncMaybeClamp, - 0xffff>() -); - -static constexpr GrUserStencilSettings gWindSingleStencilNoWrapDec( - GrUserStencilSettings::StaticInit< - 0x0000, - GrUserStencilTest::kEqual, - 0xffff, - GrUserStencilOp::kInvert, - GrUserStencilOp::kDecMaybeClamp, - 0xffff>() -); - -// Color passes are the same whether we use the two-sided stencil or two passes - static constexpr GrUserStencilSettings gWindColorPass( GrUserStencilSettings::StaticInit< 0x0000, diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 238b954dfc..2326c63382 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -28,7 +28,6 @@ GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface* fMipMapSupport = true; // always available in Vulkan fSRGBSupport = true; // always available in Vulkan fNPOTTextureTileSupport = true; // always available in Vulkan - fStencilWrapOpsSupport = true; // always available in Vulkan fDiscardRenderTargetSupport = true; fReuseScratchTextures = true; //TODO: figure this out fGpuTracingSupport = false; //TODO: figure this out @@ -177,7 +176,6 @@ void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties, fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; - fStencilWrapOpsSupport = true; fOversizedStencilSupport = true; fSampleShadingSupport = SkToBool(featureFlags & kSampleRateShading_GrVkFeatureFlag); |