diff options
author | Brian Salomon <bsalomon@google.com> | 2018-07-12 14:53:49 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-13 00:45:54 +0000 |
commit | 662ea4baba570d2f21a7b33d268204e9bdfa7fb9 (patch) | |
tree | 71da861d0d9b8f014e7f09f89b122480e067e8c0 /src/gpu/glsl | |
parent | 13ac194dbf9968d356e580b85420f1314f453a10 (diff) |
Remove texel buffer support.
Change-Id: Ia6f21afe714208979a5bc384e436b28ea2b9a297
Reviewed-on: https://skia-review.googlesource.com/141051
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/glsl')
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentProcessor.cpp | 4 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentProcessor.h | 13 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLPrimitiveProcessor.h | 4 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLProgramBuilder.cpp | 39 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLProgramBuilder.h | 10 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLShaderBuilder.cpp | 14 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLShaderBuilder.h | 10 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLUniformHandler.h | 5 |
8 files changed, 8 insertions, 91 deletions
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp index 8f92002ea5..49b518fe0d 100644 --- a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp +++ b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp @@ -48,7 +48,6 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu fragBuilder->getMangleString().c_str(), childProc.name()); TransformedCoordVars coordVars = args.fTransformedCoords.childInputs(childIndex); TextureSamplers textureSamplers = args.fTexSamplers.childInputs(childIndex); - TexelBuffers texelBuffers = args.fTexelBuffers.childInputs(childIndex); EmitArgs childArgs(fragBuilder, args.fUniformHandler, args.fShaderCaps, @@ -56,8 +55,7 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu outputColor, inputColor, coordVars, - textureSamplers, - texelBuffers); + textureSamplers); this->childProcessor(childIndex)->emitCode(childArgs); fragBuilder->codeAppend("}\n"); diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h index 1b12fb60d5..8f903755ea 100644 --- a/src/gpu/glsl/GrGLSLFragmentProcessor.h +++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h @@ -30,7 +30,6 @@ public: using UniformHandle = GrGLSLUniformHandler::UniformHandle; using SamplerHandle = GrGLSLUniformHandler::SamplerHandle; - using TexelBufferHandle = GrGLSLUniformHandler::TexelBufferHandle; private: /** @@ -72,8 +71,6 @@ public: &GrFragmentProcessor::numCoordTransforms>; using TextureSamplers = BuilderInputProvider<SamplerHandle, GrResourceIOProcessor, &GrResourceIOProcessor::numTextureSamplers>; - using TexelBuffers = BuilderInputProvider<TexelBufferHandle, GrResourceIOProcessor, - &GrResourceIOProcessor::numBuffers>; /** Called when the program stage should insert its code into the shaders. The code in each shader will be in its own block ({}) and so locally scoped names will not collide across @@ -96,9 +93,6 @@ public: @param texSamplers Contains one entry for each TextureSampler of the GrProcessor. These can be passed to the builder to emit texture reads in the generated code. - @param bufferSamplers Contains one entry for each BufferAccess of the GrProcessor. These - can be passed to the builder to emit buffer reads in the generated - code. */ struct EmitArgs { EmitArgs(GrGLSLFPFragmentBuilder* fragBuilder, @@ -108,8 +102,7 @@ public: const char* outputColor, const char* inputColor, const TransformedCoordVars& transformedCoordVars, - const TextureSamplers& textureSamplers, - const TexelBuffers& texelBuffers) + const TextureSamplers& textureSamplers) : fFragBuilder(fragBuilder) , fUniformHandler(uniformHandler) , fShaderCaps(caps) @@ -117,8 +110,7 @@ public: , fOutputColor(outputColor) , fInputColor(inputColor) , fTransformedCoords(transformedCoordVars) - , fTexSamplers(textureSamplers) - , fTexelBuffers(texelBuffers) {} + , fTexSamplers(textureSamplers) {} GrGLSLFPFragmentBuilder* fFragBuilder; GrGLSLUniformHandler* fUniformHandler; const GrShaderCaps* fShaderCaps; @@ -127,7 +119,6 @@ public: const char* fInputColor; const TransformedCoordVars& fTransformedCoords; const TextureSamplers& fTexSamplers; - const TexelBuffers& fTexelBuffers; }; virtual void emitCode(EmitArgs&) = 0; diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h index 613ae0748b..73a1aa0d7b 100644 --- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h +++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h @@ -29,7 +29,6 @@ public: using UniformHandle = GrGLSLProgramDataManager::UniformHandle; using SamplerHandle = GrGLSLUniformHandler::SamplerHandle; - using TexelBufferHandle = GrGLSLUniformHandler::TexelBufferHandle; /** * This class provides access to the GrCoordTransforms across all GrFragmentProcessors in a @@ -76,7 +75,6 @@ public: const char* outputCoverage, const char* rtAdjustName, const SamplerHandle* texSamplers, - const TexelBufferHandle* texelBuffers, FPCoordTransformHandler* transformHandler) : fVertBuilder(vertBuilder) , fGeomBuilder(geomBuilder) @@ -89,7 +87,6 @@ public: , fOutputCoverage(outputCoverage) , fRTAdjustName(rtAdjustName) , fTexSamplers(texSamplers) - , fTexelBuffers(texelBuffers) , fFPCoordTransformHandler(transformHandler) {} GrGLSLVertexBuilder* fVertBuilder; GrGLSLGeometryBuilder* fGeomBuilder; @@ -102,7 +99,6 @@ public: const char* fOutputCoverage; const char* fRTAdjustName; const SamplerHandle* fTexSamplers; - const TexelBufferHandle* fTexelBuffers; FPCoordTransformHandler* fFPCoordTransformHandler; }; diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp index 19600a27e5..6f05eba0f6 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp @@ -97,8 +97,7 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr fGeometryProcessor.reset(proc.createGLSLInstance(*this->shaderCaps())); SkSTArray<4, SamplerHandle> texSamplers(proc.numTextureSamplers()); - SkSTArray<2, TexelBufferHandle> texelBuffers(proc.numBuffers()); - this->emitSamplers(proc, &texSamplers, &texelBuffers); + this->emitSamplers(proc, &texSamplers); GrGLSLPrimitiveProcessor::FPCoordTransformHandler transformHandler(fPipeline, &fTransformedCoordVars); @@ -113,7 +112,6 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr outputCoverage->c_str(), rtAdjustName, texSamplers.begin(), - texelBuffers.begin(), &transformHandler); fGeometryProcessor->emitCode(args); @@ -171,16 +169,14 @@ SkString GrGLSLProgramBuilder::emitAndInstallFragProc( GrGLSLFragmentProcessor* fragProc = fp.createGLSLInstance(); SkSTArray<4, SamplerHandle> textureSamplerArray(fp.numTextureSamplers()); - SkSTArray<2, TexelBufferHandle> texelBufferArray(fp.numBuffers()); GrFragmentProcessor::Iter iter(&fp); while (const GrFragmentProcessor* subFP = iter.next()) { - this->emitSamplers(*subFP, &textureSamplerArray, &texelBufferArray); + this->emitSamplers(*subFP, &textureSamplerArray); } const GrShaderVar* coordVars = fTransformedCoordVars.begin() + transformedCoordVarsIdx; GrGLSLFragmentProcessor::TransformedCoordVars coords(&fp, coordVars); GrGLSLFragmentProcessor::TextureSamplers textureSamplers(&fp, textureSamplerArray.begin()); - GrGLSLFragmentProcessor::TexelBuffers texelBuffers(&fp, texelBufferArray.begin()); GrGLSLFragmentProcessor::EmitArgs args(&fFS, this->uniformHandler(), this->shaderCaps(), @@ -188,8 +184,7 @@ SkString GrGLSLProgramBuilder::emitAndInstallFragProc( output.c_str(), input.c_str(), coords, - textureSamplers, - texelBuffers); + textureSamplers); fragProc->emitCode(args); @@ -257,8 +252,7 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const SkString& colorIn, void GrGLSLProgramBuilder::emitSamplers( const GrResourceIOProcessor& processor, - SkTArray<SamplerHandle>* outTexSamplerHandles, - SkTArray<TexelBufferHandle>* outTexelBufferHandles) { + SkTArray<SamplerHandle>* outTexSamplerHandles) { SkString name; int numTextureSamplers = processor.numTextureSamplers(); for (int t = 0; t < numTextureSamplers; ++t) { @@ -268,24 +262,6 @@ void GrGLSLProgramBuilder::emitSamplers( outTexSamplerHandles->emplace_back(this->emitSampler( samplerType, sampler.peekTexture()->config(), name.c_str(), sampler.visibility())); } - if (int numBuffers = processor.numBuffers()) { - SkASSERT(this->shaderCaps()->texelBufferSupport()); - GrShaderFlags texelBufferVisibility = kNone_GrShaderFlags; - - for (int b = 0; b < numBuffers; ++b) { - const GrResourceIOProcessor::BufferAccess& access = processor.bufferAccess(b); - name.printf("TexelBuffer_%d", outTexelBufferHandles->count()); - outTexelBufferHandles->emplace_back( - this->emitTexelBuffer(access.texelConfig(), name.c_str(), access.visibility())); - texelBufferVisibility |= access.visibility(); - } - - if (const char* extension = this->shaderCaps()->texelBufferExtensionString()) { - this->addFeature(texelBufferVisibility, - 1 << GrGLSLShaderBuilder::kTexelBuffer_GLSLPrivateFeature, - extension); - } - } } void GrGLSLProgramBuilder::updateSamplerCounts(GrShaderFlags visibility) { @@ -311,13 +287,6 @@ GrGLSLProgramBuilder::SamplerHandle GrGLSLProgramBuilder::emitSampler(GrSLType s return this->uniformHandler()->addSampler(visibility, swizzle, samplerType, precision, name); } -GrGLSLProgramBuilder::TexelBufferHandle GrGLSLProgramBuilder::emitTexelBuffer( - GrPixelConfig config, const char* name, GrShaderFlags visibility) { - this->updateSamplerCounts(visibility); - GrSLPrecision precision = GrSLSamplerPrecision(config); - return this->uniformHandler()->addTexelBuffer(visibility, precision, name); -} - void GrGLSLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) { // Swizzle the fragment shader outputs if necessary. GrSwizzle swizzle; diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h index c53cf19da8..b1ccec8deb 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.h +++ b/src/gpu/glsl/GrGLSLProgramBuilder.h @@ -28,7 +28,6 @@ class GrGLSLProgramBuilder { public: using UniformHandle = GrGLSLUniformHandler::UniformHandle; using SamplerHandle = GrGLSLUniformHandler::SamplerHandle; - using TexelBufferHandle = GrGLSLUniformHandler::TexelBufferHandle; virtual ~GrGLSLProgramBuilder() {} @@ -50,10 +49,6 @@ public: return this->uniformHandler()->samplerSwizzle(handle); } - const GrShaderVar& texelBufferVariable(TexelBufferHandle handle) const { - return this->uniformHandler()->texelBufferVariable(handle); - } - // Used to add a uniform for the RenderTarget height (used for frag position) without mangling // the name of the uniform inside of a stage. void addRTHeightUniform(const char* name); @@ -141,11 +136,9 @@ private: SkTArray<std::unique_ptr<GrGLSLFragmentProcessor>>*); void emitAndInstallXferProc(const SkString& colorIn, const SkString& coverageIn); void emitSamplers(const GrResourceIOProcessor& processor, - SkTArray<SamplerHandle>* outTexSamplerHandles, - SkTArray<TexelBufferHandle>* outTexelBufferHandles); + SkTArray<SamplerHandle>* outTexSamplerHandles); SamplerHandle emitSampler(GrSLType samplerType, GrPixelConfig, const char* name, GrShaderFlags visibility); - TexelBufferHandle emitTexelBuffer(GrPixelConfig, const char* name, GrShaderFlags visibility); void emitFSOutputSwizzle(bool hasSecondaryOutput); void updateSamplerCounts(GrShaderFlags visibility); bool checkSamplerCounts(); @@ -157,7 +150,6 @@ private: #endif // These are used to check that we don't excede the allowable number of resources in a shader. - // The sampler counts include both normal texure samplers as well as texel buffers. int fNumVertexSamplers; int fNumGeometrySamplers; int fNumFragmentSamplers; diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp index e2b1c559bc..73ac6e91df 100644 --- a/src/gpu/glsl/GrGLSLShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp @@ -194,20 +194,6 @@ void GrGLSLShaderBuilder::appendColorGamutXform(const char* srcColor, this->codeAppend(xform.c_str()); } -void GrGLSLShaderBuilder::appendTexelFetch(SkString* out, - TexelBufferHandle texelBufferHandle, - const char* coordExpr) const { - const GrShaderVar& texelBuffer = fProgramBuilder->texelBufferVariable(texelBufferHandle); - SkASSERT(fProgramBuilder->shaderCaps()->texelFetchSupport()); - - out->appendf("texelFetch(%s, %s)", texelBuffer.c_str(), coordExpr); -} - -void GrGLSLShaderBuilder::appendTexelFetch(TexelBufferHandle texelBufferHandle, - const char* coordExpr) { - this->appendTexelFetch(&this->code(), texelBufferHandle, coordExpr); -} - bool GrGLSLShaderBuilder::addFeature(uint32_t featureBit, const char* extensionName) { if (featureBit & fFeaturesAddedMask) { return false; diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h index b13773b8a9..538300d95a 100644 --- a/src/gpu/glsl/GrGLSLShaderBuilder.h +++ b/src/gpu/glsl/GrGLSLShaderBuilder.h @@ -26,7 +26,6 @@ public: virtual ~GrGLSLShaderBuilder() {} using SamplerHandle = GrGLSLUniformHandler::SamplerHandle; - using TexelBufferHandle = GrGLSLUniformHandler::TexelBufferHandle; /** Appends a 2D texture sample with projection if necessary. coordType must either be Vec2f or Vec3f. The latter is interpreted as projective texture coords. The vec length and swizzle @@ -65,14 +64,6 @@ public: /** Version of above that appends the result to the shader code instead. */ void appendColorGamutXform(const char* srcColor, GrGLSLColorSpaceXformHelper* colorXformHelper); - /** Fetches an unfiltered texel from a sampler at integer coordinates. coordExpr must match the - dimensionality of the sampler and must be within the sampler's range. coordExpr is emitted - exactly once, so expressions like "idx++" are acceptable. */ - void appendTexelFetch(SkString* out, TexelBufferHandle, const char* coordExpr) const; - - /** Version of above that appends the result to the shader code instead.*/ - void appendTexelFetch(TexelBufferHandle, const char* coordExpr); - /** * Adds a constant declaration to the top of the shader. */ @@ -169,7 +160,6 @@ protected: kFragCoordConventions_GLSLPrivateFeature, kBlendEquationAdvanced_GLSLPrivateFeature, kBlendFuncExtended_GLSLPrivateFeature, - kTexelBuffer_GLSLPrivateFeature, kFramebufferFetch_GLSLPrivateFeature, kNoPerspectiveInterpolation_GLSLPrivateFeature, kLastGLSLPrivateFeature = kNoPerspectiveInterpolation_GLSLPrivateFeature diff --git a/src/gpu/glsl/GrGLSLUniformHandler.h b/src/gpu/glsl/GrGLSLUniformHandler.h index 4c52d3cf09..8e077e4eec 100644 --- a/src/gpu/glsl/GrGLSLUniformHandler.h +++ b/src/gpu/glsl/GrGLSLUniformHandler.h @@ -32,7 +32,6 @@ public: using UniformHandle = GrGLSLProgramDataManager::UniformHandle; GR_DEFINE_RESOURCE_HANDLE_CLASS(SamplerHandle); - GR_DEFINE_RESOURCE_HANDLE_CLASS(TexelBufferHandle); /** Add a uniform variable to the current program, that has visibility in one or more shaders. visibility is a bitfield of GrShaderFlag values indicating from which shaders the uniform @@ -99,10 +98,6 @@ private: virtual SamplerHandle addSampler(uint32_t visibility, GrSwizzle, GrSLType, GrSLPrecision, const char* name) = 0; - virtual const GrShaderVar& texelBufferVariable(TexelBufferHandle) const = 0; - virtual TexelBufferHandle addTexelBuffer(uint32_t visibility, GrSLPrecision, - const char* name) = 0; - virtual UniformHandle internalAddUniformArray(uint32_t visibility, GrSLType type, GrSLPrecision precision, |