diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrShaderCaps.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 22 | ||||
-rw-r--r-- | src/gpu/vk/GrVkCaps.cpp | 2 |
3 files changed, 20 insertions, 10 deletions
diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp index 90c2e68a93..0ee9339b45 100644 --- a/src/gpu/GrShaderCaps.cpp +++ b/src/gpu/GrShaderCaps.cpp @@ -43,6 +43,7 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { fGLSLGeneration = k330_GrGLSLGeneration; fShaderDerivativeSupport = false; fGeometryShaderSupport = false; + fGSInvocationsSupport = false; fPathRenderingSupport = false; fDstReadInShaderSupport = false; fDualSourceBlendingSupport = false; @@ -61,7 +62,6 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { fMustForceNegatedAtanParamToFloat = false; fAtan2ImplementedAsAtanYOverX = false; fRequiresLocalOutputColorForFBFetch = false; - fMustImplementGSInvocationsWithLoop = false; fMustObfuscateUniformColor = false; fMustGuardDivisionEvenAfterExplicitZeroCheck = false; fFlatInterpolationSupport = false; @@ -76,6 +76,7 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { fVersionDeclString = nullptr; fShaderDerivativeExtensionString = nullptr; + fGSInvocationsExtensionString = nullptr; fFragCoordConventionsExtensionString = nullptr; fSecondaryOutputExtensionString = nullptr; fExternalTextureExtensionString = nullptr; @@ -102,6 +103,7 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const { writer->appendBool("Shader Derivative Support", fShaderDerivativeSupport); writer->appendBool("Geometry Shader Support", fGeometryShaderSupport); + writer->appendBool("Geometry Shader Invocations Support", fGSInvocationsSupport); writer->appendBool("Path Rendering Support", fPathRenderingSupport); writer->appendBool("Dst Read In Shader Support", fDstReadInShaderSupport); writer->appendBool("Dual Source Blending Support", fDualSourceBlendingSupport); @@ -150,8 +152,6 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const { writer->appendBool("Can use fract() for negative values", fCanUseFractForNegativeValues); writer->appendBool("Must force negated atan param to float", fMustForceNegatedAtanParamToFloat); writer->appendBool("Must use local out color for FBFetch", fRequiresLocalOutputColorForFBFetch); - writer->appendBool("Must implement geo shader invocations with loop", - fMustImplementGSInvocationsWithLoop); writer->appendBool("Must obfuscate uniform color", fMustObfuscateUniformColor); writer->appendBool("Must guard division even after explicit zero check", fMustGuardDivisionEvenAfterExplicitZeroCheck); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index c424b84a1a..21aadd59f6 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -307,10 +307,24 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, shaderCaps->fDualSourceBlendingSupport = (ctxInfo.version() >= GR_GL_VER(3, 3) || ctxInfo.hasExtension("GL_ARB_blend_func_extended")) && GrGLSLSupportsNamedFragmentShaderOutputs(ctxInfo.glslGeneration()); + shaderCaps->fShaderDerivativeSupport = true; + // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS shaderCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) && ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; + if (shaderCaps->fGeometryShaderSupport) { + // On at least some MacBooks, GLSL 4.0 geometry shaders break if we use invocations. +#ifndef SK_BUILD_FOR_MAC + if (ctxInfo.glslGeneration() >= k400_GrGLSLGeneration) { + shaderCaps->fGSInvocationsSupport = true; + } else if (ctxInfo.hasExtension("GL_ARB_gpu_shader5")) { + shaderCaps->fGSInvocationsSupport = true; + shaderCaps->fGSInvocationsExtensionString = "GL_ARB_gpu_shader5"; + } +#endif + } + shaderCaps->fIntegerSupport = ctxInfo.version() >= GR_GL_VER(3, 0) && ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; } @@ -321,6 +335,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, ctxInfo.hasExtension("GL_OES_standard_derivatives"); shaderCaps->fGeometryShaderSupport = ctxInfo.hasExtension("GL_EXT_geometry_shader"); + shaderCaps->fGSInvocationsSupport = shaderCaps->fGeometryShaderSupport; shaderCaps->fIntegerSupport = ctxInfo.version() >= GR_GL_VER(3, 0) && ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; // We use this value for GLSL ES 3.0. @@ -938,13 +953,6 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { shaderCaps->fRequiresLocalOutputColorForFBFetch = true; } -#ifdef SK_BUILD_FOR_MAC - // On at least some MacBooks, geometry shaders fall apart if we use more than one invocation. To - // work around this, we always use a single invocation and wrap the shader in a loop. The long- - // term plan for this WAR is for it to eventually be baked into SkSL. - shaderCaps->fMustImplementGSInvocationsWithLoop = true; -#endif - // Newer Mali GPUs do incorrect static analysis in specific situations: If there is uniform // color, and that uniform contains an opaque color, and the output of the shader is only based // on that uniform plus soemthing un-trackable (like a texture read), the compiler will deduce diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index c92c7d59f9..1b0db7fb23 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -242,7 +242,9 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint // GrShaderCaps shaderCaps->fShaderDerivativeSupport = true; + shaderCaps->fGeometryShaderSupport = SkToBool(featureFlags & kGeometryShader_GrVkFeatureFlag); + shaderCaps->fGSInvocationsSupport = shaderCaps->fGeometryShaderSupport; shaderCaps->fDualSourceBlendingSupport = SkToBool(featureFlags & kDualSrcBlend_GrVkFeatureFlag); if (kAMD_VkVendor == properties.vendorID) { |