diff options
author | Brian Salomon <bsalomon@google.com> | 2017-04-04 10:15:51 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-04 15:27:44 +0000 |
commit | ab015efc48c462ffdffebb45c02cd19efb254983 (patch) | |
tree | 0b120fe0e4238f89f7e4bb73a88a00301ecf1378 /src/gpu/glsl | |
parent | 19aff5dd5cd83141f12c234c4255a35f63e564cd (diff) |
Move the ability to access textures, buffers, and image storages out from GrProcessor.
GrXferProcessor can no longer use this functionality so it is moved to a new intermediate class inherited by GrFragmentProcessor and GrPrimitiveProcessor.
Change-Id: I4f30c89bdceb2d77b602bf0646107e0780881c26
Reviewed-on: https://skia-review.googlesource.com/11202
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/glsl')
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentProcessor.h | 15 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLProgramBuilder.cpp | 11 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLProgramBuilder.h | 5 |
3 files changed, 16 insertions, 15 deletions
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h index 7a8d51ca83..1cf0d1d000 100644 --- a/src/gpu/glsl/GrGLSLFragmentProcessor.h +++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h @@ -70,12 +70,12 @@ private: public: using TransformedCoordVars = BuilderInputProvider<GrShaderVar, GrFragmentProcessor, &GrFragmentProcessor::numCoordTransforms>; - using TextureSamplers = BuilderInputProvider<SamplerHandle, GrProcessor, - &GrProcessor::numTextureSamplers>; - using BufferSamplers = BuilderInputProvider<SamplerHandle, GrProcessor, - &GrProcessor::numBuffers>; - using ImageStorages = BuilderInputProvider<ImageStorageHandle, GrProcessor, - &GrProcessor::numImageStorages>; + using TextureSamplers = BuilderInputProvider<SamplerHandle, GrResourceIOProcessor, + &GrResourceIOProcessor::numTextureSamplers>; + using BufferSamplers = BuilderInputProvider<SamplerHandle, GrResourceIOProcessor, + &GrResourceIOProcessor::numBuffers>; + using ImageStorages = BuilderInputProvider<ImageStorageHandle, GrResourceIOProcessor, + &GrResourceIOProcessor::numImageStorages>; /** 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 @@ -194,8 +194,7 @@ protected: uniform variables required by the shaders created in emitCode(). The GrFragmentProcessor parameter is guaranteed to be of the same type that created this GrGLSLFragmentProcessor and to have an identical processor key as the one that created this GrGLSLFragmentProcessor. */ - // TODO update this to pass in GrFragmentProcessor - virtual void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) {} + virtual void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) {} private: void internalEmitChild(int, const char*, const char*, EmitArgs&); diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp index 4cd4fd6ec5..12e7ca2c1d 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp @@ -264,14 +264,14 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrGLSLExpr4& colorIn, } void GrGLSLProgramBuilder::emitSamplersAndImageStorages( - const GrProcessor& processor, + const GrResourceIOProcessor& processor, SkTArray<SamplerHandle>* outTexSamplerHandles, SkTArray<SamplerHandle>* outBufferSamplerHandles, SkTArray<ImageStorageHandle>* outImageStorageHandles) { SkString name; int numTextureSamplers = processor.numTextureSamplers(); for (int t = 0; t < numTextureSamplers; ++t) { - const GrProcessor::TextureSampler& sampler = processor.textureSampler(t); + const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(t); name.printf("TextureSampler_%d", outTexSamplerHandles->count()); GrSLType samplerType = sampler.texture()->texturePriv().samplerType(); if (kTextureExternalSampler_GrSLType == samplerType) { @@ -291,7 +291,7 @@ void GrGLSLProgramBuilder::emitSamplersAndImageStorages( GrShaderFlags texelBufferVisibility = kNone_GrShaderFlags; for (int b = 0; b < numBuffers; ++b) { - const GrProcessor::BufferAccess& access = processor.bufferAccess(b); + const GrResourceIOProcessor::BufferAccess& access = processor.bufferAccess(b); name.printf("BufferSampler_%d", outBufferSamplerHandles->count()); outBufferSamplerHandles->emplace_back( this->emitSampler(kBufferSampler_GrSLType, access.texelConfig(), name.c_str(), @@ -307,7 +307,8 @@ void GrGLSLProgramBuilder::emitSamplersAndImageStorages( } int numImageStorages = processor.numImageStorages(); for (int i = 0; i < numImageStorages; ++i) { - const GrProcessor::ImageStorageAccess& imageStorageAccess = processor.imageStorageAccess(i); + const GrResourceIOProcessor::ImageStorageAccess& imageStorageAccess = + processor.imageStorageAccess(i); name.printf("Image_%d", outImageStorageHandles->count()); outImageStorageHandles->emplace_back( this->emitImageStorage(imageStorageAccess, name.c_str())); @@ -334,7 +335,7 @@ GrGLSLProgramBuilder::SamplerHandle GrGLSLProgramBuilder::emitSampler(GrSLType s } GrGLSLProgramBuilder::ImageStorageHandle GrGLSLProgramBuilder::emitImageStorage( - const GrProcessor::ImageStorageAccess& access, const char* name) { + const GrResourceIOProcessor::ImageStorageAccess& access, const char* name) { if (access.visibility() & kVertex_GrShaderFlag) { ++fNumVertexImageStorages; } diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h index 2d2ab47a5e..147eb98c98 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.h +++ b/src/gpu/glsl/GrGLSLProgramBuilder.h @@ -153,13 +153,14 @@ private: const GrGLSLExpr4& input, GrGLSLExpr4* output); void emitAndInstallXferProc(const GrGLSLExpr4& colorIn, const GrGLSLExpr4& coverageIn); - void emitSamplersAndImageStorages(const GrProcessor& processor, + void emitSamplersAndImageStorages(const GrResourceIOProcessor& processor, SkTArray<SamplerHandle>* outTexSamplerHandles, SkTArray<SamplerHandle>* outBufferSamplerHandles, SkTArray<ImageStorageHandle>* outImageStorageHandles); SamplerHandle emitSampler(GrSLType samplerType, GrPixelConfig, const char* name, GrShaderFlags visibility); - ImageStorageHandle emitImageStorage(const GrProcessor::ImageStorageAccess&, const char* name); + ImageStorageHandle emitImageStorage(const GrResourceIOProcessor::ImageStorageAccess&, + const char* name); void emitFSOutputSwizzle(bool hasSecondaryOutput); bool checkSamplerCounts(); bool checkImageStorageCounts(); |