From 94efbf51f5a88d9e8aa961d3fbe38c5e335d6108 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Tue, 29 Nov 2016 13:43:05 -0500 Subject: Merge GrGLSLCaps into GrShaderCaps GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5121 Change-Id: If8d13638f80f42161cbc766a2666c5789e5772c8 Reviewed-on: https://skia-review.googlesource.com/5121 Reviewed-by: Ethan Nicholas Commit-Queue: Brian Salomon --- src/gpu/gl/GrGLCaps.cpp | 22 +++++++++++----------- src/gpu/gl/GrGLCaps.h | 9 ++++----- src/gpu/gl/GrGLGLSL.cpp | 2 +- src/gpu/gl/GrGLGLSL.h | 2 +- src/gpu/gl/GrGLGpu.cpp | 11 +++++------ src/gpu/gl/GrGLTexture.cpp | 2 +- src/gpu/gl/GrGLUniformHandler.cpp | 6 +++--- src/gpu/gl/builders/GrGLProgramBuilder.cpp | 6 +----- src/gpu/gl/builders/GrGLProgramBuilder.h | 3 +-- 9 files changed, 28 insertions(+), 35 deletions(-) (limited to 'src/gpu/gl') diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index c4f7560be4..c47763583c 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -11,7 +11,7 @@ #include "GrContextOptions.h" #include "GrGLContext.h" #include "GrGLRenderTarget.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "instanced/GLInstancedRendering.h" #include "SkTSearch.h" #include "SkTSort.h" @@ -54,7 +54,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag; - fShaderCaps.reset(new GrGLSLCaps(contextOptions)); + fShaderCaps.reset(new GrShaderCaps(contextOptions)); this->init(contextOptions, ctxInfo, glInterface); } @@ -254,7 +254,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, // This must be called after fCoreProfile is set on the GrGLCaps this->initGLSL(ctxInfo); - GrGLSLCaps* glslCaps = static_cast(fShaderCaps.get()); + GrShaderCaps* glslCaps = static_cast(fShaderCaps.get()); glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli); @@ -688,7 +688,7 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { * Caps specific to GrGLSLCaps **************************************************************************/ - GrGLSLCaps* glslCaps = static_cast(fShaderCaps.get()); + GrShaderCaps* glslCaps = fShaderCaps.get(); glslCaps->fGLSLGeneration = ctxInfo.glslGeneration(); if (kGLES_GrGLStandard == standard) { if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { @@ -1030,7 +1030,7 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa } void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { - GrGLSLCaps* glslCaps = static_cast(fShaderCaps.get()); + GrShaderCaps* glslCaps = static_cast(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 +1043,20 @@ void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced_coherent")) { fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kAutomatic_AdvBlendEqInteraction; + glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kAutomatic_AdvBlendEqInteraction; } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced_coherent")) { fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kGeneralEnable_AdvBlendEqInteraction; + glslCaps->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 = GrGLSLCaps::kAutomatic_AdvBlendEqInteraction; + glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kAutomatic_AdvBlendEqInteraction; } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced")) { fBlendEquationSupport = kAdvanced_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kGeneralEnable_AdvBlendEqInteraction; + glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kGeneralEnable_AdvBlendEqInteraction; // TODO: Use kSpecificEnables_AdvBlendEqInteraction if "blend_support_all_equations" is // slow on a particular platform. } else { @@ -1260,7 +1260,7 @@ static GrGLenum shader_type_to_gl_shader(GrShaderType type) { void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* intf, - GrGLSLCaps* glslCaps) { + GrShaderCaps* glslCaps) { 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) { @@ -1393,7 +1393,7 @@ bool GrGLCaps::getExternalFormat(GrPixelConfig surfaceConfig, GrPixelConfig memo } void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli, - GrGLSLCaps* glslCaps) { + GrShaderCaps* glslCaps) { /* Comments on renderability of configs on various GL versions. OpenGL < 3.0: diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 63843a5fc2..155388dd61 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -11,16 +11,15 @@ #include -#include "glsl/GrGLSL.h" #include "GrCaps.h" #include "GrGLStencilAttachment.h" #include "GrSwizzle.h" #include "SkChecksum.h" #include "SkTHash.h" #include "SkTArray.h" +#include "../private/GrGLSL.h" class GrGLContextInfo; -class GrGLSLCaps; class GrGLRenderTarget; /** @@ -357,7 +356,7 @@ public: return fRGBAToBGRAReadbackConversionsAreSlow; } - const GrGLSLCaps* glslCaps() const { return reinterpret_cast(fShaderCaps.get()); } + const GrShaderCaps* glslCaps() const { return fShaderCaps.get(); } private: enum ExternalFormatUsage { @@ -381,11 +380,11 @@ private: void initBlendEqationSupport(const GrGLContextInfo&); void initStencilFormats(const GrGLContextInfo&); // This must be called after initFSAASupport(). - void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli, GrGLSLCaps* glslCaps); + void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli, GrShaderCaps* glslCaps); void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* intf, - GrGLSLCaps* glslCaps); + GrShaderCaps* glslCaps); GrGLStandard fStandard; diff --git a/src/gpu/gl/GrGLGLSL.cpp b/src/gpu/gl/GrGLGLSL.cpp index 7813eabfb8..7ceb639ee0 100644 --- a/src/gpu/gl/GrGLGLSL.cpp +++ b/src/gpu/gl/GrGLGLSL.cpp @@ -5,10 +5,10 @@ * found in the LICENSE file. */ -#include "GrGLGLSL.h" #include "GrGLContext.h" #include "GrGLUtil.h" #include "SkString.h" +#include "../private/GrGLSL.h" bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation) { SkASSERT(generation); diff --git a/src/gpu/gl/GrGLGLSL.h b/src/gpu/gl/GrGLGLSL.h index 31e2de7d74..88bb273d92 100644 --- a/src/gpu/gl/GrGLGLSL.h +++ b/src/gpu/gl/GrGLGLSL.h @@ -9,10 +9,10 @@ #define GrGLInitGLSL_DEFINED #include "gl/GrGLInterface.h" -#include "glsl/GrGLSL.h" #include "GrColor.h" #include "GrTypesPriv.h" #include "SkString.h" +#include "../private/GrGLSL.h" class GrGLContextInfo; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 8f81ccc826..7ec2029f99 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -7,7 +7,6 @@ #include "GrGLGpu.h" #include "GrGLBuffer.h" -#include "GrGLGLSL.h" #include "GrGLGpuCommandBuffer.h" #include "GrGLStencilAttachment.h" #include "GrGLTextureRenderTarget.h" @@ -17,12 +16,11 @@ #include "GrPipeline.h" #include "GrPLSGeometryProcessor.h" #include "GrRenderTargetPriv.h" +#include "GrShaderCaps.h" #include "GrSurfacePriv.h" #include "GrTexturePriv.h" #include "GrTypes.h" #include "builders/GrGLShaderStringBuilder.h" -#include "glsl/GrGLSL.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLPLSPathRendering.h" #include "instanced/GLInstancedRendering.h" #include "SkMakeUnique.h" @@ -31,6 +29,7 @@ #include "SkStrokeRec.h" #include "SkTemplates.h" #include "SkTypes.h" +#include "../private/GrGLSL.h" #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) @@ -334,7 +333,7 @@ bool GrGLGpu::createPLSSetupProgram() { return false; } - const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); + const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); const char* version = glslCaps->versionDeclString(); GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); @@ -3761,7 +3760,7 @@ bool GrGLGpu::onCopySurface(GrSurface* dst, bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { int progIdx = TextureToCopyProgramIdx(srcTex); - const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); + const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); GrSLType samplerType = srcTex->texturePriv().samplerType(); if (!fCopyProgramArrayBuffer) { @@ -3880,7 +3879,7 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { const bool oddHeight = SkToBool(progIdx & 0x1); const int numTaps = (oddWidth ? 2 : 1) * (oddHeight ? 2 : 1); - const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); + const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); SkASSERT(!fMipmapPrograms[progIdx].fProgram); GL_CALL_RET(fMipmapPrograms[progIdx].fProgram, CreateProgram()); diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index 4a4f00bc0b..196ec86628 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -7,7 +7,7 @@ #include "GrGLTexture.h" #include "GrGLGpu.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "SkTraceMemoryDump.h" #define GPUGL static_cast(this->getGpu()) diff --git a/src/gpu/gl/GrGLUniformHandler.cpp b/src/gpu/gl/GrGLUniformHandler.cpp index 81755d552a..021a865358 100644 --- a/src/gpu/gl/GrGLUniformHandler.cpp +++ b/src/gpu/gl/GrGLUniformHandler.cpp @@ -110,19 +110,19 @@ GrGLSLUniformHandler::ImageStorageHandle GrGLUniformHandler::addImageStorage( void GrGLUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const { for (int i = 0; i < fUniforms.count(); ++i) { if (fUniforms[i].fVisibility & visibility) { - fUniforms[i].fVariable.appendDecl(fProgramBuilder->glslCaps(), out); + fUniforms[i].fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";"); } } for (int i = 0; i < fSamplers.count(); ++i) { if (fSamplers[i].fVisibility & visibility) { - fSamplers[i].fVariable.appendDecl(fProgramBuilder->glslCaps(), out); + fSamplers[i].fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";\n"); } } for (int i = 0; i < fImageStorages.count(); ++i) { if (fImageStorages[i].fVisibility & visibility) { - fImageStorages[i].fVariable.appendDecl(fProgramBuilder->glslCaps(), out); + fImageStorages[i].fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";"); } } diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index a774570b68..63e0aeb78d 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -11,6 +11,7 @@ #include "GrCoordTransform.h" #include "GrGLProgramBuilder.h" #include "GrProgramDesc.h" +#include "GrShaderCaps.h" #include "GrSwizzle.h" #include "GrTexture.h" #include "SkTraceEvent.h" @@ -18,7 +19,6 @@ #include "gl/GrGLProgram.h" #include "gl/GrGLSLPrettyPrint.h" #include "gl/builders/GrGLShaderStringBuilder.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -66,10 +66,6 @@ const GrCaps* GrGLProgramBuilder::caps() const { return fGpu->caps(); } -const GrGLSLCaps* GrGLProgramBuilder::glslCaps() const { - return fGpu->ctxInfo().caps()->glslCaps(); -} - bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader, GrGLuint programId, GrGLenum type, diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h index 253f9e6328..a88f278b93 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.h +++ b/src/gpu/gl/builders/GrGLProgramBuilder.h @@ -19,7 +19,7 @@ class GrFragmentProcessor; class GrGLContextInfo; class GrProgramDesc; class GrGLSLShaderBuilder; -class GrGLSLCaps; +class GrShaderCaps; class GrGLProgramBuilder : public GrGLSLProgramBuilder { public: @@ -36,7 +36,6 @@ public: GrGLGpu*); const GrCaps* caps() const override; - const GrGLSLCaps* glslCaps() const override; GrGLGpu* gpu() const { return fGpu; } -- cgit v1.2.3