diff options
author | 2015-10-22 08:20:00 -0700 | |
---|---|---|
committer | 2015-10-22 08:20:00 -0700 | |
commit | 472d44e8f881f87449d11ba66515d3c1c5e69891 (patch) | |
tree | 1dc846f52b93a583ba0095403f63392446d51f05 /src | |
parent | 26ad17b8f872fc8bc18df7f49067edbd8b9799e8 (diff) |
Add version string and force highp NDS transfrom to GLSLCaps
This also include the use of any() in the shaders.
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/cef4bce8e260b49bf3417eadbac806cf7d39cdc8
Review URL: https://codereview.chromium.org/1417993004
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/effects/GrTextureDomain.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 227 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 1 | ||||
-rwxr-xr-x | src/gpu/gl/GrGLGLSL.cpp | 42 | ||||
-rwxr-xr-x | src/gpu/gl/GrGLGLSL.h | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp | 14 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp | 4 | ||||
-rwxr-xr-x | src/gpu/glsl/GrGLSLCaps.cpp | 6 | ||||
-rwxr-xr-x | src/gpu/glsl/GrGLSLCaps.h | 10 |
10 files changed, 174 insertions, 140 deletions
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index 19882423fe..93d3afb8c4 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -87,7 +87,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLShaderBuilder* builder, GrGLShaderBuilder::ShaderBlock block(builder); const char* domain = fDomainName.c_str(); - if (kImagination_GrGLVendor == program->ctxInfo().vendor()) { + if (!program->glslCaps()->canUseAnyFunctionInShader()) { // On the NexusS and GalaxyNexus, the other path (with the 'any' // call) causes the compilation error "Calls to any function that // may require a gradient calculation inside a conditional block diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 9a185be72d..ad8f1e3c84 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -65,42 +65,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, GrGLVersion version = ctxInfo.version(); /************************************************************************** - * Caps specific to GrGLSLCaps - **************************************************************************/ - - GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); - glslCaps->fGLSLGeneration = ctxInfo.glslGeneration(); - - if (kGLES_GrGLStandard == standard) { - if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { - glslCaps->fFBFetchNeedsCustomOutput = (version >= GR_GL_VER(3, 0)); - glslCaps->fFBFetchSupport = true; - glslCaps->fFBFetchColorName = "gl_LastFragData[0]"; - glslCaps->fFBFetchExtensionString = "GL_EXT_shader_framebuffer_fetch"; - } - else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { - // Actually, we haven't seen an ES3.0 device with this extension yet, so we don't know - glslCaps->fFBFetchNeedsCustomOutput = false; - glslCaps->fFBFetchSupport = true; - glslCaps->fFBFetchColorName = "gl_LastFragData[0]"; - glslCaps->fFBFetchExtensionString = "GL_NV_shader_framebuffer_fetch"; - } - else if (ctxInfo.hasExtension("GL_ARM_shader_framebuffer_fetch")) { - // The arm extension also requires an additional flag which we will set onResetContext - glslCaps->fFBFetchNeedsCustomOutput = false; - glslCaps->fFBFetchSupport = true; - glslCaps->fFBFetchColorName = "gl_LastFragColorARM"; - glslCaps->fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch"; - } - glslCaps->fUsesPrecisionModifiers = true; - } - - glslCaps->fBindlessTextureSupport = ctxInfo.hasExtension("GL_NV_bindless_texture"); - - // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader - glslCaps->fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); - - /************************************************************************** * Caps specific to GrGLCaps **************************************************************************/ @@ -319,51 +283,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, #endif /************************************************************************** - * GrShaderCaps fields - **************************************************************************/ - - glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli); - - // For now these two are equivalent but we could have dst read in shader via some other method - glslCaps->fDstReadInShaderSupport = glslCaps->fFBFetchSupport; - - // Enable supported shader-related caps - if (kGL_GrGLStandard == standard) { - glslCaps->fDualSourceBlendingSupport = (ctxInfo.version() >= GR_GL_VER(3, 3) || - ctxInfo.hasExtension("GL_ARB_blend_func_extended")) && - GrGLSLSupportsNamedFragmentShaderOutputs(ctxInfo.glslGeneration()); - glslCaps->fShaderDerivativeSupport = true; - // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS - glslCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) && - ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; - } - else { - glslCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blend_func_extended"); - - glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) || - ctxInfo.hasExtension("GL_OES_standard_derivatives"); - } - - // We need dual source blending and the ability to disable multisample in order to support mixed - // samples in every corner case. - if (fMultisampleDisableSupport && glslCaps->fDualSourceBlendingSupport) { - // We understand "mixed samples" to mean the collective capability of 3 different extensions - glslCaps->fMixedSamplesSupport = - ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") && - ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") && - ctxInfo.hasExtension("GL_EXT_raster_multisample"); - } - // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed samples. - if (kNVIDIA_GrGLDriver == ctxInfo.driver() && fShaderCaps->mixedSamplesSupport()) { - fDiscardRenderTargetSupport = false; - fInvalidateFBType = kNone_InvalidateFBType; - } - glslCaps->fProgrammableSampleLocationsSupport = - ctxInfo.hasExtension("GL_NV_sample_locations") || - ctxInfo.hasExtension("GL_ARB_sample_locations"); - - - /************************************************************************** * GrCaps fields **************************************************************************/ @@ -513,6 +432,10 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, ctxInfo.hasExtension("GL_EXT_instanced_arrays")); } + // Must init GLSLCaps after setting GLCaps + this->initGLSL(contextOptions, ctxInfo, gli); + GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); + this->initConfigTexturableTable(ctxInfo, gli, srgbSupport); this->initConfigRenderableTable(ctxInfo, srgbSupport); this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); @@ -521,6 +444,148 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, glslCaps->applyOptionsOverrides(contextOptions); } +const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration generation, + bool isCoreProfile) { + switch (generation) { + case k110_GrGLSLGeneration: + if (kGLES_GrGLStandard == standard) { + // ES2s shader language is based on version 1.20 but is version + // 1.00 of the ES language. + return "#version 100\n"; + } else { + SkASSERT(kGL_GrGLStandard == standard); + return "#version 110\n"; + } + case k130_GrGLSLGeneration: + SkASSERT(kGL_GrGLStandard == standard); + return "#version 130\n"; + case k140_GrGLSLGeneration: + SkASSERT(kGL_GrGLStandard == standard); + return "#version 140\n"; + case k150_GrGLSLGeneration: + SkASSERT(kGL_GrGLStandard == standard); + if (isCoreProfile) { + return "#version 150\n"; + } else { + return "#version 150 compatibility\n"; + } + case k330_GrGLSLGeneration: + if (kGLES_GrGLStandard == standard) { + return "#version 300 es\n"; + } else { + SkASSERT(kGL_GrGLStandard == standard); + if (isCoreProfile) { + return "#version 330\n"; + } else { + return "#version 330 compatibility\n"; + } + } + case k310es_GrGLSLGeneration: + SkASSERT(kGLES_GrGLStandard == standard); + return "#version 310 es\n"; + } + return "<no version>"; +} + +void GrGLCaps::initGLSL(const GrContextOptions& contextOptions, + const GrGLContextInfo& ctxInfo, + const GrGLInterface* gli) { + GrGLStandard standard = ctxInfo.standard(); + GrGLVersion version = ctxInfo.version(); + + /************************************************************************** + * Caps specific to GrGLSLCaps + **************************************************************************/ + + GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); + glslCaps->fGLSLGeneration = ctxInfo.glslGeneration(); + + if (kGLES_GrGLStandard == standard) { + if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { + glslCaps->fFBFetchNeedsCustomOutput = (version >= GR_GL_VER(3, 0)); + glslCaps->fFBFetchSupport = true; + glslCaps->fFBFetchColorName = "gl_LastFragData[0]"; + glslCaps->fFBFetchExtensionString = "GL_EXT_shader_framebuffer_fetch"; + } + else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { + // Actually, we haven't seen an ES3.0 device with this extension yet, so we don't know + glslCaps->fFBFetchNeedsCustomOutput = false; + glslCaps->fFBFetchSupport = true; + glslCaps->fFBFetchColorName = "gl_LastFragData[0]"; + glslCaps->fFBFetchExtensionString = "GL_NV_shader_framebuffer_fetch"; + } + else if (ctxInfo.hasExtension("GL_ARM_shader_framebuffer_fetch")) { + // The arm extension also requires an additional flag which we will set onResetContext + glslCaps->fFBFetchNeedsCustomOutput = false; + glslCaps->fFBFetchSupport = true; + glslCaps->fFBFetchColorName = "gl_LastFragColorARM"; + glslCaps->fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch"; + } + glslCaps->fUsesPrecisionModifiers = true; + } + + glslCaps->fBindlessTextureSupport = ctxInfo.hasExtension("GL_NV_bindless_texture"); + + // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader + glslCaps->fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); + + // On the NexusS and GalaxyNexus, the use of 'any' causes the compilation error "Calls to any + // function that may require a gradient calculation inside a conditional block may return + // undefined results". This appears to be an issue with the 'any' call since even the simple + // "result=black; if (any()) result=white;" code fails to compile. This issue comes into play + // from our GrTextureDomain processor. + glslCaps->fCanUseAnyFunctionInShader = kImagination_GrGLVendor != ctxInfo.vendor(); + + glslCaps->fForceHighPrecisionNDSTransform = kARM_GrGLVendor != ctxInfo.vendor(); + + glslCaps->fVersionDeclString = get_glsl_version_decl_string(standard, glslCaps->fGLSLGeneration, + fIsCoreProfile); + + /************************************************************************** + * GrShaderCaps fields + **************************************************************************/ + + glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli); + + // For now these two are equivalent but we could have dst read in shader via some other method + glslCaps->fDstReadInShaderSupport = glslCaps->fFBFetchSupport; + + // Enable supported shader-related caps + if (kGL_GrGLStandard == standard) { + glslCaps->fDualSourceBlendingSupport = (ctxInfo.version() >= GR_GL_VER(3, 3) || + ctxInfo.hasExtension("GL_ARB_blend_func_extended")) && + GrGLSLSupportsNamedFragmentShaderOutputs(ctxInfo.glslGeneration()); + glslCaps->fShaderDerivativeSupport = true; + // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS + glslCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) && + ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; + } + else { + glslCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blend_func_extended"); + + glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) || + ctxInfo.hasExtension("GL_OES_standard_derivatives"); + } + + // We need dual source blending and the ability to disable multisample in order to support mixed + // samples in every corner case. + if (fMultisampleDisableSupport && glslCaps->fDualSourceBlendingSupport) { + // We understand "mixed samples" to mean the collective capability of 3 different extensions + glslCaps->fMixedSamplesSupport = + ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") && + ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage") && + ctxInfo.hasExtension("GL_EXT_raster_multisample"); + } + // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed samples. + if (kNVIDIA_GrGLDriver == ctxInfo.driver() && fShaderCaps->mixedSamplesSupport()) { + fDiscardRenderTargetSupport = false; + fInvalidateFBType = kNone_InvalidateFBType; + } + glslCaps->fProgrammableSampleLocationsSupport = + ctxInfo.hasExtension("GL_NV_sample_locations") || + ctxInfo.hasExtension("GL_ARB_sample_locations"); +} + bool GrGLCaps::hasPathRenderingSupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { bool hasChromiumPathRendering = ctxInfo.hasExtension("GL_CHROMIUM_path_rendering"); diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 34dde70a36..8c901deade 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -270,6 +270,7 @@ public: private: void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*); + void initGLSL(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*); bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*); /** diff --git a/src/gpu/gl/GrGLGLSL.cpp b/src/gpu/gl/GrGLGLSL.cpp index 76988513c0..4d2bf9794b 100755 --- a/src/gpu/gl/GrGLGLSL.cpp +++ b/src/gpu/gl/GrGLGLSL.cpp @@ -48,48 +48,6 @@ bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation } } -const char* GrGLGetGLSLVersionDecl(const GrGLContextInfo& info) { - switch (info.glslGeneration()) { - case k110_GrGLSLGeneration: - if (kGLES_GrGLStandard == info.standard()) { - // ES2s shader language is based on version 1.20 but is version - // 1.00 of the ES language. - return "#version 100\n"; - } else { - SkASSERT(kGL_GrGLStandard == info.standard()); - return "#version 110\n"; - } - case k130_GrGLSLGeneration: - SkASSERT(kGL_GrGLStandard == info.standard()); - return "#version 130\n"; - case k140_GrGLSLGeneration: - SkASSERT(kGL_GrGLStandard == info.standard()); - return "#version 140\n"; - case k150_GrGLSLGeneration: - SkASSERT(kGL_GrGLStandard == info.standard()); - if (info.caps()->isCoreProfile()) { - return "#version 150\n"; - } else { - return "#version 150 compatibility\n"; - } - case k330_GrGLSLGeneration: - if (kGLES_GrGLStandard == info.standard()) { - return "#version 300 es\n"; - } else { - SkASSERT(kGL_GrGLStandard == info.standard()); - if (info.caps()->isCoreProfile()) { - return "#version 330\n"; - } else { - return "#version 330 compatibility\n"; - } - } - case k310es_GrGLSLGeneration: - SkASSERT(kGLES_GrGLStandard == info.standard()); - return "#version 310 es\n"; - } - return "<no version>"; -} - void GrGLAppendGLSLDefaultFloatPrecisionDeclaration(GrSLPrecision p, GrGLStandard s, SkString* out) { // Desktop GLSL has added precision qualifiers but they don't do anything. if (kGLES_GrGLStandard == s) { diff --git a/src/gpu/gl/GrGLGLSL.h b/src/gpu/gl/GrGLGLSL.h index 724765f1a8..fa2b6ae153 100755 --- a/src/gpu/gl/GrGLGLSL.h +++ b/src/gpu/gl/GrGLGLSL.h @@ -22,12 +22,6 @@ class GrGLContextInfo; bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation); /** - * Returns a string to include at the beginning of a shader to declare the GLSL - * version. - */ -const char* GrGLGetGLSLVersionDecl(const GrGLContextInfo&); - -/** * Adds a line of GLSL code to declare the default precision for float types. */ void GrGLAppendGLSLDefaultFloatPrecisionDeclaration(GrSLPrecision, GrGLStandard, SkString* out); diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 9834b6e617..1ad398f829 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -2809,7 +2809,7 @@ bool GrGLGpu::onCopySurface(GrSurface* dst, void GrGLGpu::createCopyProgram() { - const char* version = GrGLGetGLSLVersionDecl(this->ctxInfo()); + const char* version = this->glCaps().glslCaps()->versionDeclString(); GrGLSLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttribute_TypeModifier); GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp index 4a5814de51..d31482a4bb 100644 --- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp +++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp @@ -192,14 +192,14 @@ const char* GrGLFragmentShaderBuilder::fragmentPosition() { const char* GrGLFragmentShaderBuilder::dstColor() { fHasReadDstColor = true; - GrGLGpu* gpu = fProgramBuilder->gpu(); - if (gpu->glCaps().glslCaps()->fbFetchSupport()) { + const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps(); + if (glslCaps->fbFetchSupport()) { this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeature + 1), - gpu->glCaps().glslCaps()->fbFetchExtensionString()); + glslCaps->fbFetchExtensionString()); // Some versions of this extension string require declaring custom color output on ES 3.0+ - const char* fbFetchColorName = gpu->glCaps().glslCaps()->fbFetchColorName(); - if (gpu->glCaps().glslCaps()->fbFetchNeedsCustomOutput()) { + const char* fbFetchColorName = glslCaps->fbFetchColorName(); + if (glslCaps->fbFetchNeedsCustomOutput()) { this->enableCustomOutput(); fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOut_TypeModifier); fbFetchColorName = declared_color_output_name(); @@ -213,7 +213,7 @@ const char* GrGLFragmentShaderBuilder::dstColor() { void GrGLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquation equation) { SkASSERT(GrBlendEquationIsAdvanced(equation)); - const GrGLSLCaps& caps = *fProgramBuilder->gpu()->glCaps().glslCaps(); + const GrGLSLCaps& caps = *fProgramBuilder->glslCaps(); if (!caps.mustEnableAdvBlendEqs()) { return; } @@ -268,7 +268,7 @@ const char* GrGLFragmentShaderBuilder::getSecondaryColorOutputName() const { bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shaderIds) { GrGLGpu* gpu = fProgramBuilder->gpu(); - this->versionDecl() = GrGLGetGLSLVersionDecl(gpu->ctxInfo()); + this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); GrGLAppendGLSLDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, gpu->glStandard(), &this->precisionQualifier()); diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp index de0bb03aa3..c1a7dee56a 100644 --- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp +++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp @@ -39,7 +39,7 @@ void GrGLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& posV SkASSERT(!fRtAdjustName); GrSLPrecision precision = kDefault_GrSLPrecision; - if (fProgramBuilder->ctxInfo().vendor() == kARM_GrGLVendor) { + if (fProgramBuilder->glslCaps()->forceHighPrecisionNDSTransform()) { precision = kHigh_GrSLPrecision; } @@ -89,7 +89,7 @@ void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shaderIds) { - this->versionDecl() = GrGLGetGLSLVersionDecl(fProgramBuilder->ctxInfo()); + this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); this->compileAndAppendLayoutQualifiers(); fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &this->uniforms()); this->appendDecls(fInputs, &this->inputs()); diff --git a/src/gpu/glsl/GrGLSLCaps.cpp b/src/gpu/glsl/GrGLSLCaps.cpp index 449ceabd76..fef5ab377c 100755 --- a/src/gpu/glsl/GrGLSLCaps.cpp +++ b/src/gpu/glsl/GrGLSLCaps.cpp @@ -18,6 +18,9 @@ GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) { fFBFetchNeedsCustomOutput = false; fBindlessTextureSupport = false; fUsesPrecisionModifiers = false; + fCanUseAnyFunctionInShader = true; + fForceHighPrecisionNDSTransform = false; + fVersionDeclString = nullptr; fFBFetchColorName = nullptr; fFBFetchExtensionString = nullptr; fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction; @@ -44,6 +47,9 @@ SkString GrGLSLCaps::dump() const { r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES" : "NO")); r.appendf("Uses precision modifiers: %s\n", (fUsesPrecisionModifiers ? "YES" : "NO")); + r.appendf("Can Use any() function: %s\n", (fCanUseAnyFunctionInShader ? "YES" : "NO")); + r.appendf("Force high precision on NDS transform: %s\n", (fForceHighPrecisionNDSTransform ? + "YES" : "NO")); r.appendf("Advanced blend equation interaction: %s\n", kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]); return r; diff --git a/src/gpu/glsl/GrGLSLCaps.h b/src/gpu/glsl/GrGLSLCaps.h index d147aac3c1..4d6f580667 100755 --- a/src/gpu/glsl/GrGLSLCaps.h +++ b/src/gpu/glsl/GrGLSLCaps.h @@ -45,6 +45,8 @@ public: bool bindlessTextureSupport() const { return fBindlessTextureSupport; } + const char* versionDeclString() const { return fVersionDeclString; } + const char* fbFetchColorName() const { return fFBFetchColorName; } const char* fbFetchExtensionString() const { return fFBFetchExtensionString; } @@ -67,6 +69,11 @@ public: bool usesPrecisionModifiers() const { return fUsesPrecisionModifiers; } + // Returns whether we can use the glsl funciton any() in our shader code. + bool canUseAnyFunctionInShader() const { return fCanUseAnyFunctionInShader; } + + bool forceHighPrecisionNDSTransform() const { return fForceHighPrecisionNDSTransform; } + GrGLSLGeneration generation() const { return fGLSLGeneration; } /** @@ -82,7 +89,10 @@ private: bool fFBFetchNeedsCustomOutput : 1; bool fBindlessTextureSupport : 1; bool fUsesPrecisionModifiers : 1; + bool fCanUseAnyFunctionInShader : 1; + bool fForceHighPrecisionNDSTransform : 1; + const char* fVersionDeclString; const char* fFBFetchColorName; const char* fFBFetchExtensionString; |