diff options
author | Brian Salomon <bsalomon@google.com> | 2016-11-29 13:43:46 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-29 20:17:48 +0000 |
commit | 1edc5b92fecefb79f01cf0e302646eacf32b06c7 (patch) | |
tree | aaffe2729d3801c4dfd4ecb64f9ac4c4f78d4ad9 /src/gpu/gl | |
parent | a0c4c3407d57296eb914cd1c6e0f588f86fe8404 (diff) |
Rename vars and functions from 'glslcaps'->'shadercaps'
Change-Id: I34d226d866dd4ba8e5f33f95cb8cbf01292f9314
Reviewed-on: https://skia-review.googlesource.com/5312
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 255 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 8 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 106 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpuProgramCache.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLTexture.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLShaderStringBuilder.cpp | 2 |
7 files changed, 188 insertions, 189 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index c47763583c..f961a4b7c0 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -254,98 +254,100 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, // This must be called after fCoreProfile is set on the GrGLCaps this->initGLSL(ctxInfo); - GrShaderCaps* glslCaps = static_cast<GrShaderCaps*>(fShaderCaps.get()); + GrShaderCaps* shaderCaps = fShaderCaps.get(); - glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli); + shaderCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli); // For now these two are equivalent but we could have dst read in shader via some other method. // Before setting this, initGLSL() must have been called. - glslCaps->fDstReadInShaderSupport = glslCaps->fFBFetchSupport; + shaderCaps->fDstReadInShaderSupport = shaderCaps->fFBFetchSupport; // Enable supported shader-related caps if (kGL_GrGLStandard == standard) { - glslCaps->fDualSourceBlendingSupport = (ctxInfo.version() >= GR_GL_VER(3, 3) || + shaderCaps->fDualSourceBlendingSupport = (ctxInfo.version() >= GR_GL_VER(3, 3) || ctxInfo.hasExtension("GL_ARB_blend_func_extended")) && GrGLSLSupportsNamedFragmentShaderOutputs(ctxInfo.glslGeneration()); - glslCaps->fShaderDerivativeSupport = true; + shaderCaps->fShaderDerivativeSupport = true; // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS - glslCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) && + shaderCaps->fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) && ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; - glslCaps->fIntegerSupport = ctxInfo.version() >= GR_GL_VER(3, 0) && + shaderCaps->fIntegerSupport = ctxInfo.version() >= GR_GL_VER(3, 0) && ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; } else { - glslCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blend_func_extended"); + shaderCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blend_func_extended"); - glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) || + shaderCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_OES_standard_derivatives"); - glslCaps->fIntegerSupport = ctxInfo.version() >= GR_GL_VER(3, 0) && + shaderCaps->fIntegerSupport = ctxInfo.version() >= GR_GL_VER(3, 0) && ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; // We use this value for GLSL ES 3.0. } if (ctxInfo.hasExtension("GL_EXT_shader_pixel_local_storage")) { #define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 GR_GL_GetIntegerv(gli, GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT, - &glslCaps->fPixelLocalStorageSize); - glslCaps->fPLSPathRenderingSupport = glslCaps->fFBFetchSupport; + &shaderCaps->fPixelLocalStorageSize); + shaderCaps->fPLSPathRenderingSupport = shaderCaps->fFBFetchSupport; } else { - glslCaps->fPixelLocalStorageSize = 0; - glslCaps->fPLSPathRenderingSupport = false; + shaderCaps->fPixelLocalStorageSize = 0; + shaderCaps->fPLSPathRenderingSupport = false; } // Protect ourselves against tracking huge amounts of texture state. static const uint8_t kMaxSaneSamplers = 32; GrGLint maxSamplers; GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &maxSamplers); - glslCaps->fMaxVertexSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); - if (glslCaps->fGeometryShaderSupport) { + shaderCaps->fMaxVertexSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); + if (shaderCaps->fGeometryShaderSupport) { GR_GL_GetIntegerv(gli, GR_GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &maxSamplers); - glslCaps->fMaxGeometrySamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); + shaderCaps->fMaxGeometrySamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); } GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &maxSamplers); - glslCaps->fMaxFragmentSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); + shaderCaps->fMaxFragmentSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); GR_GL_GetIntegerv(gli, GR_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxSamplers); - glslCaps->fMaxCombinedSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); + shaderCaps->fMaxCombinedSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); if (kGL_GrGLStandard == standard) { - glslCaps->fImageLoadStoreSupport = ctxInfo.version() >= GR_GL_VER(4, 2); - if (!glslCaps->fImageLoadStoreSupport && + shaderCaps->fImageLoadStoreSupport = ctxInfo.version() >= GR_GL_VER(4, 2); + if (!shaderCaps->fImageLoadStoreSupport && ctxInfo.hasExtension("GL_ARB_shader_image_load_store")) { - glslCaps->fImageLoadStoreSupport = true; - glslCaps->fImageLoadStoreExtensionString = "GL_ARB_shader_image_load_store"; + shaderCaps->fImageLoadStoreSupport = true; + shaderCaps->fImageLoadStoreExtensionString = "GL_ARB_shader_image_load_store"; } } else { - glslCaps->fImageLoadStoreSupport = ctxInfo.version() >= GR_GL_VER(3, 1); + shaderCaps->fImageLoadStoreSupport = ctxInfo.version() >= GR_GL_VER(3, 1); } - if (glslCaps->fImageLoadStoreSupport) { + if (shaderCaps->fImageLoadStoreSupport) { // Protect ourselves against tracking huge amounts of image state. static constexpr int kMaxSaneImages = 4; GrGLint maxUnits; GR_GL_GetIntegerv(gli, GR_GL_MAX_IMAGE_UNITS, &maxUnits); GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_IMAGE_UNIFORMS, - &glslCaps->fMaxVertexImageStorages); - if (glslCaps->fGeometryShaderSupport) { + &shaderCaps->fMaxVertexImageStorages); + if (shaderCaps->fGeometryShaderSupport) { GR_GL_GetIntegerv(gli, GR_GL_MAX_GEOMETRY_IMAGE_UNIFORMS, - &glslCaps->fMaxGeometryImageStorages); + &shaderCaps->fMaxGeometryImageStorages); } GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_IMAGE_UNIFORMS, - &glslCaps->fMaxFragmentImageStorages); + &shaderCaps->fMaxFragmentImageStorages); GR_GL_GetIntegerv(gli, GR_GL_MAX_COMBINED_IMAGE_UNIFORMS, - &glslCaps->fMaxCombinedImageStorages); + &shaderCaps->fMaxCombinedImageStorages); // We use one unit for every image uniform - glslCaps->fMaxCombinedImageStorages = SkTMin(SkTMin(glslCaps->fMaxCombinedImageStorages, - maxUnits), kMaxSaneImages); - glslCaps->fMaxVertexImageStorages = SkTMin(maxUnits, glslCaps->fMaxVertexImageStorages); - glslCaps->fMaxGeometryImageStorages = SkTMin(maxUnits, glslCaps->fMaxGeometryImageStorages); - glslCaps->fMaxFragmentImageStorages = SkTMin(maxUnits, - glslCaps->fMaxFragmentImageStorages); + shaderCaps->fMaxCombinedImageStorages = SkTMin(SkTMin(shaderCaps->fMaxCombinedImageStorages, + maxUnits), kMaxSaneImages); + shaderCaps->fMaxVertexImageStorages = SkTMin(maxUnits, + shaderCaps->fMaxVertexImageStorages); + shaderCaps->fMaxGeometryImageStorages = SkTMin(maxUnits, + shaderCaps->fMaxGeometryImageStorages); + shaderCaps->fMaxFragmentImageStorages = SkTMin(maxUnits, + shaderCaps->fMaxFragmentImageStorages); // HACK: Currently we only use images in a unit test in the fragment shader. The individual // stage image limits aren't exposed through GrShaderCaps. Soon GrShaderCaps and GrGLSLCaps // will merge and the test can look for fragment support. - if (!glslCaps->fMaxFragmentImageStorages) { - glslCaps->fImageLoadStoreSupport = false; + if (!shaderCaps->fMaxFragmentImageStorages) { + shaderCaps->fImageLoadStoreSupport = false; } } @@ -356,7 +358,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, // We need dual source blending and the ability to disable multisample in order to support mixed // samples in every corner case. if (fMultisampleDisableSupport && - glslCaps->dualSourceBlendingSupport() && + shaderCaps->dualSourceBlendingSupport() && fShaderCaps->pathRenderingSupport()) { fUsesMixedSamples = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_samples") || ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_mixed_samples"); @@ -575,7 +577,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, fDrawRangeElementsSupport = version >= GR_GL_VER(3,0); } - this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); + this->initShaderPrecisionTable(ctxInfo, gli, shaderCaps); if (contextOptions.fUseShaderSwizzling) { fTextureSwizzleSupport = false; @@ -613,10 +615,10 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES compatibility have // already been detected. - this->initConfigTable(ctxInfo, gli, glslCaps); + this->initConfigTable(ctxInfo, gli, shaderCaps); this->applyOptionsOverrides(contextOptions); - glslCaps->applyOptionsOverrides(contextOptions); + shaderCaps->applyOptionsOverrides(contextOptions); } const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration generation, @@ -685,109 +687,110 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { GrGLVersion version = ctxInfo.version(); /************************************************************************** - * Caps specific to GrGLSLCaps + * Caps specific to GrShaderCaps **************************************************************************/ - GrShaderCaps* glslCaps = fShaderCaps.get(); - glslCaps->fGLSLGeneration = ctxInfo.glslGeneration(); + GrShaderCaps* shaderCaps = fShaderCaps.get(); + shaderCaps->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"; + shaderCaps->fFBFetchNeedsCustomOutput = (version >= GR_GL_VER(3, 0)); + shaderCaps->fFBFetchSupport = true; + shaderCaps->fFBFetchColorName = "gl_LastFragData[0]"; + shaderCaps->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"; + shaderCaps->fFBFetchNeedsCustomOutput = false; + shaderCaps->fFBFetchSupport = true; + shaderCaps->fFBFetchColorName = "gl_LastFragData[0]"; + shaderCaps->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"; + shaderCaps->fFBFetchNeedsCustomOutput = false; + shaderCaps->fFBFetchSupport = true; + shaderCaps->fFBFetchColorName = "gl_LastFragColorARM"; + shaderCaps->fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch"; } - glslCaps->fUsesPrecisionModifiers = true; + shaderCaps->fUsesPrecisionModifiers = true; } // Currently the extension is advertised but fb fetch is broken on 500 series Adrenos like the // Galaxy S7. // TODO: Once this is fixed we can update the check here to look at a driver version number too. if (kAdreno5xx_GrGLRenderer == ctxInfo.renderer()) { - glslCaps->fFBFetchSupport = false; + shaderCaps->fFBFetchSupport = false; } - glslCaps->fBindlessTextureSupport = ctxInfo.hasExtension("GL_NV_bindless_texture"); + shaderCaps->fBindlessTextureSupport = ctxInfo.hasExtension("GL_NV_bindless_texture"); if (kGL_GrGLStandard == standard) { - glslCaps->fFlatInterpolationSupport = ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; + shaderCaps->fFlatInterpolationSupport = ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; } else { - glslCaps->fFlatInterpolationSupport = + shaderCaps->fFlatInterpolationSupport = ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; // This is the value for GLSL ES 3.0. } if (kGL_GrGLStandard == standard) { - glslCaps->fNoPerspectiveInterpolationSupport = + shaderCaps->fNoPerspectiveInterpolationSupport = ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; } else { if (ctxInfo.hasExtension("GL_NV_shader_noperspective_interpolation")) { - glslCaps->fNoPerspectiveInterpolationSupport = true; - glslCaps->fNoPerspectiveInterpolationExtensionString = + shaderCaps->fNoPerspectiveInterpolationSupport = true; + shaderCaps->fNoPerspectiveInterpolationExtensionString = "GL_NV_shader_noperspective_interpolation"; } } if (kGL_GrGLStandard == standard) { - glslCaps->fMultisampleInterpolationSupport = + shaderCaps->fMultisampleInterpolationSupport = ctxInfo.glslGeneration() >= k400_GrGLSLGeneration; } else { if (ctxInfo.glslGeneration() >= k320es_GrGLSLGeneration) { - glslCaps->fMultisampleInterpolationSupport = true; + shaderCaps->fMultisampleInterpolationSupport = true; } else if (ctxInfo.hasExtension("GL_OES_shader_multisample_interpolation")) { - glslCaps->fMultisampleInterpolationSupport = true; - glslCaps->fMultisampleInterpolationExtensionString = + shaderCaps->fMultisampleInterpolationSupport = true; + shaderCaps->fMultisampleInterpolationExtensionString = "GL_OES_shader_multisample_interpolation"; } } if (kGL_GrGLStandard == standard) { - glslCaps->fSampleVariablesSupport = ctxInfo.glslGeneration() >= k400_GrGLSLGeneration; + shaderCaps->fSampleVariablesSupport = ctxInfo.glslGeneration() >= k400_GrGLSLGeneration; } else { if (ctxInfo.glslGeneration() >= k320es_GrGLSLGeneration) { - glslCaps->fSampleVariablesSupport = true; + shaderCaps->fSampleVariablesSupport = true; } else if (ctxInfo.hasExtension("GL_OES_sample_variables")) { - glslCaps->fSampleVariablesSupport = true; - glslCaps->fSampleVariablesExtensionString = "GL_OES_sample_variables"; + shaderCaps->fSampleVariablesSupport = true; + shaderCaps->fSampleVariablesExtensionString = "GL_OES_sample_variables"; } } - if (glslCaps->fSampleVariablesSupport && + if (shaderCaps->fSampleVariablesSupport && ctxInfo.hasExtension("GL_NV_sample_mask_override_coverage")) { // Pre-361 NVIDIA has a bug with NV_sample_mask_override_coverage. - glslCaps->fSampleMaskOverrideCoverageSupport = + shaderCaps->fSampleMaskOverrideCoverageSupport = kNVIDIA_GrGLDriver != ctxInfo.driver() || ctxInfo.driverVersion() >= GR_GL_DRIVER_VER(361,00); } // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader - glslCaps->fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); + shaderCaps->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(); + shaderCaps->fCanUseAnyFunctionInShader = kImagination_GrGLVendor != ctxInfo.vendor(); - glslCaps->fVersionDeclString = get_glsl_version_decl_string(standard, glslCaps->fGLSLGeneration, - fIsCoreProfile); + shaderCaps->fVersionDeclString = get_glsl_version_decl_string(standard, + shaderCaps->fGLSLGeneration, + fIsCoreProfile); - if (kGLES_GrGLStandard == standard && k110_GrGLSLGeneration == glslCaps->fGLSLGeneration) { - glslCaps->fShaderDerivativeExtensionString = "GL_OES_standard_derivatives"; + if (kGLES_GrGLStandard == standard && k110_GrGLSLGeneration == shaderCaps->fGLSLGeneration) { + shaderCaps->fShaderDerivativeExtensionString = "GL_OES_standard_derivatives"; } // Frag Coords Convention support is not part of ES @@ -797,52 +800,52 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { kGLES_GrGLStandard != standard && (ctxInfo.glslGeneration() >= k150_GrGLSLGeneration || ctxInfo.hasExtension("GL_ARB_fragment_coord_conventions"))) { - glslCaps->fFragCoordConventionsExtensionString = "GL_ARB_fragment_coord_conventions"; + shaderCaps->fFragCoordConventionsExtensionString = "GL_ARB_fragment_coord_conventions"; } if (kGLES_GrGLStandard == standard) { - glslCaps->fSecondaryOutputExtensionString = "GL_EXT_blend_func_extended"; + shaderCaps->fSecondaryOutputExtensionString = "GL_EXT_blend_func_extended"; } if (ctxInfo.hasExtension("GL_OES_EGL_image_external")) { if (ctxInfo.glslGeneration() == k110_GrGLSLGeneration) { - glslCaps->fExternalTextureSupport = true; + shaderCaps->fExternalTextureSupport = true; } else if (ctxInfo.hasExtension("GL_OES_EGL_image_external_essl3") || ctxInfo.hasExtension("OES_EGL_image_external_essl3")) { // At least one driver has been found that has this extension without the "GL_" prefix. - glslCaps->fExternalTextureSupport = true; + shaderCaps->fExternalTextureSupport = true; } } - if (glslCaps->fExternalTextureSupport) { + if (shaderCaps->fExternalTextureSupport) { if (ctxInfo.glslGeneration() == k110_GrGLSLGeneration) { - glslCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_external"; + shaderCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_external"; } else { - glslCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_external_essl3"; + shaderCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_external_essl3"; } } if (kGL_GrGLStandard == standard) { - glslCaps->fTexelFetchSupport = ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; + shaderCaps->fTexelFetchSupport = ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; } else { - glslCaps->fTexelFetchSupport = + shaderCaps->fTexelFetchSupport = ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; // We use this value for GLSL ES 3.0. } - if (glslCaps->fTexelFetchSupport) { + if (shaderCaps->fTexelFetchSupport) { if (kGL_GrGLStandard == standard) { - glslCaps->fTexelBufferSupport = ctxInfo.version() >= GR_GL_VER(3, 1) && + shaderCaps->fTexelBufferSupport = ctxInfo.version() >= GR_GL_VER(3, 1) && ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; } else { if (ctxInfo.version() >= GR_GL_VER(3, 2) && ctxInfo.glslGeneration() >= k320es_GrGLSLGeneration) { - glslCaps->fTexelBufferSupport = true; + shaderCaps->fTexelBufferSupport = true; } else if (ctxInfo.hasExtension("GL_OES_texture_buffer")) { - glslCaps->fTexelBufferSupport = true; - glslCaps->fTexelBufferExtensionString = "GL_OES_texture_buffer"; + shaderCaps->fTexelBufferSupport = true; + shaderCaps->fTexelBufferExtensionString = "GL_OES_texture_buffer"; } else if (ctxInfo.hasExtension("GL_EXT_texture_buffer")) { - glslCaps->fTexelBufferSupport = true; - glslCaps->fTexelBufferExtensionString = "GL_EXT_texture_buffer"; + shaderCaps->fTexelBufferSupport = true; + shaderCaps->fTexelBufferExtensionString = "GL_EXT_texture_buffer"; } } } @@ -850,20 +853,20 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { // The Tegra3 compiler will sometimes never return if we have min(abs(x), 1.0), so we must do // the abs first in a separate expression. if (kTegra3_GrGLRenderer == ctxInfo.renderer()) { - glslCaps->fCanUseMinAndAbsTogether = false; + shaderCaps->fCanUseMinAndAbsTogether = false; } // On Intel GPU there is an issue where it reads the second argument to atan "- %s.x" as an int // thus must us -1.0 * %s.x to work correctly if (kIntel_GrGLVendor == ctxInfo.vendor()) { - glslCaps->fMustForceNegatedAtanParamToFloat = true; + shaderCaps->fMustForceNegatedAtanParamToFloat = true; } // On Adreno devices with framebuffer fetch support, there is a bug where they always return // the original dst color when reading the outColor even after being written to. By using a // local outColor we can work around this bug. - if (glslCaps->fFBFetchSupport && kQualcomm_GrGLVendor == ctxInfo.vendor()) { - glslCaps->fRequiresLocalOutputColorForFBFetch = true; + if (shaderCaps->fFBFetchSupport && kQualcomm_GrGLVendor == ctxInfo.vendor()) { + shaderCaps->fRequiresLocalOutputColorForFBFetch = true; } } @@ -1030,7 +1033,7 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa } void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { - GrShaderCaps* glslCaps = static_cast<GrShaderCaps*>(fShaderCaps.get()); + GrShaderCaps* shaderCaps = static_cast<GrShaderCaps*>(fShaderCaps.get()); // Disabling advanced blend on various platforms with major known issues. We also block Chrome // for now until its own blacklists can be updated. @@ -1043,20 +1046,20 @@ void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced_coherent")) { fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kAutomatic_AdvBlendEqInteraction; + shaderCaps->fAdvBlendEqInteraction = GrShaderCaps::kAutomatic_AdvBlendEqInteraction; } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced_coherent")) { fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kGeneralEnable_AdvBlendEqInteraction; + shaderCaps->fAdvBlendEqInteraction = GrShaderCaps::kGeneralEnable_AdvBlendEqInteraction; } else if (kNVIDIA_GrGLDriver == ctxInfo.driver() && ctxInfo.driverVersion() < GR_GL_DRIVER_VER(337,00)) { // Non-coherent advanced blend has an issue on NVIDIA pre 337.00. return; } else if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced")) { fBlendEquationSupport = kAdvanced_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kAutomatic_AdvBlendEqInteraction; + shaderCaps->fAdvBlendEqInteraction = GrShaderCaps::kAutomatic_AdvBlendEqInteraction; } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced")) { fBlendEquationSupport = kAdvanced_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kGeneralEnable_AdvBlendEqInteraction; + shaderCaps->fAdvBlendEqInteraction = GrShaderCaps::kGeneralEnable_AdvBlendEqInteraction; // TODO: Use kSpecificEnables_AdvBlendEqInteraction if "blend_support_all_equations" is // slow on a particular platform. } else { @@ -1260,7 +1263,7 @@ static GrGLenum shader_type_to_gl_shader(GrShaderType type) { void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* intf, - GrShaderCaps* glslCaps) { + GrShaderCaps* shaderCaps) { if (kGLES_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER(4, 1) || ctxInfo.hasExtension("GL_ARB_ES2_compatibility")) { for (int s = 0; s < kGrShaderTypeCount; ++s) { @@ -1268,7 +1271,7 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, GrShaderType shaderType = static_cast<GrShaderType>(s); GrGLenum glShader = shader_type_to_gl_shader(shaderType); GrShaderCaps::PrecisionInfo* first = nullptr; - glslCaps->fShaderPrecisionVaries = false; + shaderCaps->fShaderPrecisionVaries = false; for (int p = 0; p < kGrSLPrecisionCount; ++p) { GrSLPrecision precision = static_cast<GrSLPrecision>(p); GrGLenum glPrecision = precision_to_gl_float_type(precision); @@ -1276,15 +1279,15 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, GrGLint bits; GR_GL_GetShaderPrecisionFormat(intf, glShader, glPrecision, range, &bits); if (bits) { - glslCaps->fFloatPrecisions[s][p].fLogRangeLow = range[0]; - glslCaps->fFloatPrecisions[s][p].fLogRangeHigh = range[1]; - glslCaps->fFloatPrecisions[s][p].fBits = bits; + shaderCaps->fFloatPrecisions[s][p].fLogRangeLow = range[0]; + shaderCaps->fFloatPrecisions[s][p].fLogRangeHigh = range[1]; + shaderCaps->fFloatPrecisions[s][p].fBits = bits; if (!first) { - first = &glslCaps->fFloatPrecisions[s][p]; + first = &shaderCaps->fFloatPrecisions[s][p]; } - else if (!glslCaps->fShaderPrecisionVaries) { - glslCaps->fShaderPrecisionVaries = - (*first != glslCaps->fFloatPrecisions[s][p]); + else if (!shaderCaps->fShaderPrecisionVaries) { + shaderCaps->fShaderPrecisionVaries = + (*first != shaderCaps->fFloatPrecisions[s][p]); } } } @@ -1293,13 +1296,13 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, } else { // We're on a desktop GL that doesn't have precision info. Assume they're all 32bit float. - glslCaps->fShaderPrecisionVaries = false; + shaderCaps->fShaderPrecisionVaries = false; for (int s = 0; s < kGrShaderTypeCount; ++s) { if (kGeometry_GrShaderType != s) { for (int p = 0; p < kGrSLPrecisionCount; ++p) { - glslCaps->fFloatPrecisions[s][p].fLogRangeLow = 127; - glslCaps->fFloatPrecisions[s][p].fLogRangeHigh = 127; - glslCaps->fFloatPrecisions[s][p].fBits = 23; + shaderCaps->fFloatPrecisions[s][p].fLogRangeLow = 127; + shaderCaps->fFloatPrecisions[s][p].fLogRangeHigh = 127; + shaderCaps->fFloatPrecisions[s][p].fBits = 23; } } } @@ -1308,13 +1311,13 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, // the same as the vertex shader. Only fragment shaders were ever allowed to omit support for // highp. GS was added after GetShaderPrecisionFormat was added to the list of features that // are recommended against. - if (glslCaps->fGeometryShaderSupport) { + if (shaderCaps->fGeometryShaderSupport) { for (int p = 0; p < kGrSLPrecisionCount; ++p) { - glslCaps->fFloatPrecisions[kGeometry_GrShaderType][p] = - glslCaps->fFloatPrecisions[kVertex_GrShaderType][p]; + shaderCaps->fFloatPrecisions[kGeometry_GrShaderType][p] = + shaderCaps->fFloatPrecisions[kVertex_GrShaderType][p]; } } - glslCaps->initSamplerPrecisionTable(); + shaderCaps->initSamplerPrecisionTable(); } bool GrGLCaps::bgraIsInternalFormat() const { @@ -1393,7 +1396,7 @@ bool GrGLCaps::getExternalFormat(GrPixelConfig surfaceConfig, GrPixelConfig memo } void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli, - GrShaderCaps* glslCaps) { + GrShaderCaps* shaderCaps) { /* Comments on renderability of configs on various GL versions. OpenGL < 3.0: @@ -2019,7 +2022,7 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa // swizzle into shader code. if (!this->textureSwizzleSupport()) { for (int i = 0; i < kGrPixelConfigCnt; ++i) { - glslCaps->fConfigTextureSwizzle[i] = fConfigTable[i].fSwizzle; + shaderCaps->fConfigTextureSwizzle[i] = fConfigTable[i].fSwizzle; } } @@ -2031,7 +2034,7 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa GrPixelConfig config = static_cast<GrPixelConfig>(i); if (GrPixelConfigIsAlphaOnly(config) && fConfigTable[i].fFormats.fBaseInternalFormat == GR_GL_RED) { - glslCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA(); + shaderCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA(); } } } diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 155388dd61..5c7e028745 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -356,8 +356,6 @@ public: return fRGBAToBGRAReadbackConversionsAreSlow; } - const GrShaderCaps* glslCaps() const { return fShaderCaps.get(); } - private: enum ExternalFormatUsage { kTexImage_ExternalFormatUsage, @@ -380,11 +378,9 @@ private: void initBlendEqationSupport(const GrGLContextInfo&); void initStencilFormats(const GrGLContextInfo&); // This must be called after initFSAASupport(). - void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli, GrShaderCaps* glslCaps); + void initConfigTable(const GrGLContextInfo&, const GrGLInterface*, GrShaderCaps*); - void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, - const GrGLInterface* intf, - GrShaderCaps* glslCaps); + void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*, GrShaderCaps*); GrGLStandard fStandard; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 7ec2029f99..81fb835356 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -217,8 +217,8 @@ GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context) SkASSERT(ctx); fCaps.reset(SkRef(ctx->caps())); - fHWBoundTextureUniqueIDs.reset(this->glCaps().glslCaps()->maxCombinedSamplers()); - fHWBoundImageStorages.reset(this->glCaps().glslCaps()->maxCombinedImageStorages()); + fHWBoundTextureUniqueIDs.reset(this->caps()->shaderCaps()->maxCombinedSamplers()); + fHWBoundImageStorages.reset(this->caps()->shaderCaps()->maxCombinedImageStorages()); fHWBufferState[kVertex_GrBufferType].fGLTarget = GR_GL_ARRAY_BUFFER; fHWBufferState[kIndex_GrBufferType].fGLTarget = GR_GL_ELEMENT_ARRAY_BUFFER; @@ -236,7 +236,7 @@ GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context) GR_STATIC_ASSERT(6 == SK_ARRAY_COUNT(fHWBufferState)); if (this->caps()->shaderCaps()->texelBufferSupport()) { - fHWBufferTextures.reset(this->glCaps().glslCaps()->maxCombinedSamplers()); + fHWBufferTextures.reset(this->caps()->shaderCaps()->maxCombinedSamplers()); } if (this->glCaps().shaderCaps()->pathRenderingSupport()) { @@ -333,8 +333,8 @@ bool GrGLGpu::createPLSSetupProgram() { return false; } - const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); - const char* version = glslCaps->versionDeclString(); + const GrShaderCaps* shaderCaps = this->caps()->shaderCaps(); + const char* version = shaderCaps->versionDeclString(); GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); GrShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, @@ -345,19 +345,19 @@ bool GrGLGpu::createPLSSetupProgram() { GrShaderVar vTexCoord("v_texCoord", kVec2f_GrSLType, GrShaderVar::kOut_TypeModifier); SkString vshaderTxt(version); - if (glslCaps->noperspectiveInterpolationSupport()) { - if (const char* extension = glslCaps->noperspectiveInterpolationExtensionString()) { + if (shaderCaps->noperspectiveInterpolationSupport()) { + if (const char* extension = shaderCaps->noperspectiveInterpolationExtensionString()) { vshaderTxt.appendf("#extension %s : require\n", extension); } vTexCoord.addModifier("noperspective"); } - aVertex.appendDecl(glslCaps, &vshaderTxt); + aVertex.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); - uTexCoordXform.appendDecl(glslCaps, &vshaderTxt); + uTexCoordXform.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); - uPosXform.appendDecl(glslCaps, &vshaderTxt); + uPosXform.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); - vTexCoord.appendDecl(glslCaps, &vshaderTxt); + vTexCoord.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); vshaderTxt.append( @@ -369,20 +369,20 @@ bool GrGLGpu::createPLSSetupProgram() { ); SkString fshaderTxt(version); - if (glslCaps->noperspectiveInterpolationSupport()) { - if (const char* extension = glslCaps->noperspectiveInterpolationExtensionString()) { + if (shaderCaps->noperspectiveInterpolationSupport()) { + if (const char* extension = shaderCaps->noperspectiveInterpolationExtensionString()) { fshaderTxt.appendf("#extension %s : require\n", extension); } } fshaderTxt.append("#extension "); - fshaderTxt.append(glslCaps->fbFetchExtensionString()); + fshaderTxt.append(shaderCaps->fbFetchExtensionString()); fshaderTxt.append(" : require\n"); fshaderTxt.append("#extension GL_EXT_shader_pixel_local_storage : require\n"); - GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCaps, &fshaderTxt); + GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *shaderCaps, &fshaderTxt); vTexCoord.setTypeModifier(GrShaderVar::kIn_TypeModifier); - vTexCoord.appendDecl(glslCaps, &fshaderTxt); + vTexCoord.appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";"); - uTexture.appendDecl(glslCaps, &fshaderTxt); + uTexture.appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";"); fshaderTxt.appendf( @@ -648,7 +648,7 @@ sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc, // This combination is not supported. return nullptr; } - if (!this->glCaps().glslCaps()->externalTextureSupport()) { + if (!this->caps()->shaderCaps()->externalTextureSupport()) { return nullptr; } } else if (GR_GL_TEXTURE_RECTANGLE == idDesc.fInfo.fTarget) { @@ -2056,7 +2056,7 @@ bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso if (blendInfo.fWriteColor) { // Swizzle the blend to match what the shader will output. - const GrSwizzle& swizzle = this->glCaps().glslCaps()->configOutputSwizzle( + const GrSwizzle& swizzle = this->caps()->shaderCaps()->configOutputSwizzle( pipeline.getRenderTarget()->config()); this->flushBlend(blendInfo, swizzle); } @@ -2843,7 +2843,7 @@ void GrGLGpu::draw(const GrPipeline& pipeline, } void GrGLGpu::stampPLSSetupRect(const SkRect& bounds) { - SkASSERT(this->glCaps().glslCaps()->plsPathRenderingSupport()); + SkASSERT(this->caps()->shaderCaps()->plsPathRenderingSupport()); if (!fPLSSetupProgram.fProgram) { if (!this->createPLSSetupProgram()) { @@ -3728,8 +3728,8 @@ bool GrGLGpu::onCopySurface(GrSurface* dst, const SkIPoint& dstPoint) { // None of our copy methods can handle a swizzle. TODO: Make copySurfaceAsDraw handle the // swizzle. - if (this->glCaps().glslCaps()->configOutputSwizzle(src->config()) != - this->glCaps().glslCaps()->configOutputSwizzle(dst->config())) { + if (this->caps()->shaderCaps()->configOutputSwizzle(src->config()) != + this->caps()->shaderCaps()->configOutputSwizzle(dst->config())) { return false; } // Don't prefer copying as a draw if the dst doesn't already have a FBO object. @@ -3760,7 +3760,7 @@ bool GrGLGpu::onCopySurface(GrSurface* dst, bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { int progIdx = TextureToCopyProgramIdx(srcTex); - const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); + const GrShaderCaps* shaderCaps = this->caps()->shaderCaps(); GrSLType samplerType = srcTex->texturePriv().samplerType(); if (!fCopyProgramArrayBuffer) { @@ -3783,7 +3783,7 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { return false; } - const char* version = glslCaps->versionDeclString(); + const char* version = shaderCaps->versionDeclString(); GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); GrShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, GrShaderVar::kUniform_TypeModifier); @@ -3793,20 +3793,20 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { GrShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut_TypeModifier); SkString vshaderTxt(version); - if (glslCaps->noperspectiveInterpolationSupport()) { - if (const char* extension = glslCaps->noperspectiveInterpolationExtensionString()) { + if (shaderCaps->noperspectiveInterpolationSupport()) { + if (const char* extension = shaderCaps->noperspectiveInterpolationExtensionString()) { vshaderTxt.appendf("#extension %s : require\n", extension); } vTexCoord.addModifier("noperspective"); } - aVertex.appendDecl(glslCaps, &vshaderTxt); + aVertex.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); - uTexCoordXform.appendDecl(glslCaps, &vshaderTxt); + uTexCoordXform.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); - uPosXform.appendDecl(glslCaps, &vshaderTxt); + uPosXform.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); - vTexCoord.appendDecl(glslCaps, &vshaderTxt); + vTexCoord.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); vshaderTxt.append( @@ -3819,21 +3819,21 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { ); SkString fshaderTxt(version); - if (glslCaps->noperspectiveInterpolationSupport()) { - if (const char* extension = glslCaps->noperspectiveInterpolationExtensionString()) { + if (shaderCaps->noperspectiveInterpolationSupport()) { + if (const char* extension = shaderCaps->noperspectiveInterpolationExtensionString()) { fshaderTxt.appendf("#extension %s : require\n", extension); } } if (samplerType == kTextureExternalSampler_GrSLType) { fshaderTxt.appendf("#extension %s : require\n", - glslCaps->externalTextureExtensionString()); + shaderCaps->externalTextureExtensionString()); } - GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCaps, + GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *shaderCaps, &fshaderTxt); vTexCoord.setTypeModifier(GrShaderVar::kIn_TypeModifier); - vTexCoord.appendDecl(glslCaps, &fshaderTxt); + vTexCoord.appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";"); - uTexture.appendDecl(glslCaps, &fshaderTxt); + uTexture.appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";"); fshaderTxt.appendf( "// Copy Program FS\n" @@ -3879,7 +3879,7 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { const bool oddHeight = SkToBool(progIdx & 0x1); const int numTaps = (oddWidth ? 2 : 1) * (oddHeight ? 2 : 1); - const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); + const GrShaderCaps* shaderCaps = this->caps()->shaderCaps(); SkASSERT(!fMipmapPrograms[progIdx].fProgram); GL_CALL_RET(fMipmapPrograms[progIdx].fProgram, CreateProgram()); @@ -3887,7 +3887,7 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { return false; } - const char* version = glslCaps->versionDeclString(); + const char* version = shaderCaps->versionDeclString(); GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); GrShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, GrShaderVar::kUniform_TypeModifier); @@ -3903,8 +3903,8 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { GrShaderVar oFragColor("o_FragColor", kVec4f_GrSLType,GrShaderVar::kOut_TypeModifier); SkString vshaderTxt(version); - if (glslCaps->noperspectiveInterpolationSupport()) { - if (const char* extension = glslCaps->noperspectiveInterpolationExtensionString()) { + if (shaderCaps->noperspectiveInterpolationSupport()) { + if (const char* extension = shaderCaps->noperspectiveInterpolationExtensionString()) { vshaderTxt.appendf("#extension %s : require\n", extension); } vTexCoords[0].addModifier("noperspective"); @@ -3913,12 +3913,12 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { vTexCoords[3].addModifier("noperspective"); } - aVertex.appendDecl(glslCaps, &vshaderTxt); + aVertex.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); - uTexCoordXform.appendDecl(glslCaps, &vshaderTxt); + uTexCoordXform.appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); for (int i = 0; i < numTaps; ++i) { - vTexCoords[i].appendDecl(glslCaps, &vshaderTxt); + vTexCoords[i].appendDecl(shaderCaps, &vshaderTxt); vshaderTxt.append(";"); } @@ -3956,19 +3956,19 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { vshaderTxt.append("}"); SkString fshaderTxt(version); - if (glslCaps->noperspectiveInterpolationSupport()) { - if (const char* extension = glslCaps->noperspectiveInterpolationExtensionString()) { + if (shaderCaps->noperspectiveInterpolationSupport()) { + if (const char* extension = shaderCaps->noperspectiveInterpolationExtensionString()) { fshaderTxt.appendf("#extension %s : require\n", extension); } } - GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCaps, + GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *shaderCaps, &fshaderTxt); for (int i = 0; i < numTaps; ++i) { vTexCoords[i].setTypeModifier(GrShaderVar::kIn_TypeModifier); - vTexCoords[i].appendDecl(glslCaps, &fshaderTxt); + vTexCoords[i].appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";"); } - uTexture.appendDecl(glslCaps, &fshaderTxt); + uTexture.appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";"); fshaderTxt.append( "// Mipmap Program FS\n" @@ -4049,15 +4049,15 @@ bool GrGLGpu::createWireRectProgram() { GrShaderVar uColor("u_color", kVec4f_GrSLType, GrShaderVar::kUniform_TypeModifier); GrShaderVar uRect("u_rect", kVec4f_GrSLType, GrShaderVar::kUniform_TypeModifier); GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); - const char* version = this->glCaps().glslCaps()->versionDeclString(); + const char* version = this->caps()->shaderCaps()->versionDeclString(); // The rect uniform specifies the rectangle in NDC space as a vec4 (left,top,right,bottom). The // program is used with a vbo containing the unit square. Vertices are computed from the rect // uniform using the 4 vbo vertices. SkString vshaderTxt(version); - aVertex.appendDecl(this->glCaps().glslCaps(), &vshaderTxt); + aVertex.appendDecl(this->caps()->shaderCaps(), &vshaderTxt); vshaderTxt.append(";"); - uRect.appendDecl(this->glCaps().glslCaps(), &vshaderTxt); + uRect.appendDecl(this->caps()->shaderCaps(), &vshaderTxt); vshaderTxt.append(";"); vshaderTxt.append( "// Wire Rect Program VS\n" @@ -4072,9 +4072,9 @@ bool GrGLGpu::createWireRectProgram() { SkString fshaderTxt(version); GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, - *this->glCaps().glslCaps(), + *this->caps()->shaderCaps(), &fshaderTxt); - uColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); + uColor.appendDecl(this->caps()->shaderCaps(), &fshaderTxt); fshaderTxt.append(";"); fshaderTxt.appendf( "// Write Rect Program FS\n" diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp index 9bca80c1ec..bf6a5980fb 100644 --- a/src/gpu/gl/GrGLGpuProgramCache.cpp +++ b/src/gpu/gl/GrGLGpuProgramCache.cpp @@ -114,7 +114,7 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(const GrGLGpu* gpu, // Get GrGLProgramDesc GrProgramDesc desc; - if (!GrProgramDesc::Build(&desc, primProc, isPoints, pipeline, *gpu->glCaps().glslCaps())) { + if (!GrProgramDesc::Build(&desc, primProc, isPoints, pipeline, *gpu->caps()->shaderCaps())) { GrCapsDebugf(gpu->caps(), "Failed to gl program descriptor!\n"); return nullptr; } diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index 196ec86628..edce7b1f33 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -16,7 +16,7 @@ static inline GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, GrPixelConfig config, const GrGLGpu* gpu) { if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) { - SkASSERT(gpu->glCaps().glslCaps()->externalTextureSupport()); + SkASSERT(gpu->caps()->shaderCaps()->externalTextureSupport()); SkASSERT(!GrPixelConfigIsSint(config)); return kTextureExternalSampler_GrSLType; } else if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_RECTANGLE) { diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 63e0aeb78d..cc29022456 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -154,7 +154,7 @@ void GrGLProgramBuilder::bindProgramResourceLocations(GrGLuint programID) { GL_CALL(BindFragDataLocation(programID, 0, GrGLSLFragmentShaderBuilder::DeclaredColorOutputName())); } - if (fFS.hasSecondaryOutput() && caps.glslCaps()->mustDeclareFragmentShaderOutput()) { + if (fFS.hasSecondaryOutput() && caps.shaderCaps()->mustDeclareFragmentShaderOutput()) { GL_CALL(BindFragDataLocationIndexed(programID, 0, 1, GrGLSLFragmentShaderBuilder::DeclaredSecondaryColorOutputName())); } diff --git a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp index 81115c5522..bd4921b650 100644 --- a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp +++ b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp @@ -69,7 +69,7 @@ GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx, ? SkSL::Program::kVertex_Kind : SkSL::Program::kFragment_Kind, sksl, - *glCtx.caps()->glslCaps(), + *glCtx.caps()->shaderCaps(), &glsl); #ifdef SK_DEBUG if (!result) { |