aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/glsl/GrGLSLProgramBuilder.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-11-15 14:28:33 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-15 20:06:12 +0000
commit559f556d9d70ef9d1202e436a56d48364b279ac6 (patch)
tree0371c13e6ed17e351066f1be46f4053e72c63365 /src/gpu/glsl/GrGLSLProgramBuilder.cpp
parent33d17cbb003975fff895954435183756f9893c17 (diff)
Remove support for image load/store
This isn't used and has become a maintenance burden. Change-Id: I5f3af8f91e5c4f073fe4ea30e0a7f1f61efeea47 Reviewed-on: https://skia-review.googlesource.com/70640 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/glsl/GrGLSLProgramBuilder.cpp')
-rw-r--r--src/gpu/glsl/GrGLSLProgramBuilder.cpp74
1 files changed, 7 insertions, 67 deletions
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 07d6d209a6..6f8d1be736 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -32,10 +32,7 @@ GrGLSLProgramBuilder::GrGLSLProgramBuilder(const GrPipeline& pipeline,
, fXferProcessor(nullptr)
, fNumVertexSamplers(0)
, fNumGeometrySamplers(0)
- , fNumFragmentSamplers(0)
- , fNumVertexImageStorages(0)
- , fNumGeometryImageStorages(0)
- , fNumFragmentImageStorages(0) {
+ , fNumFragmentSamplers(0) {
}
void GrGLSLProgramBuilder::addFeature(GrShaderFlags shaders,
@@ -65,7 +62,7 @@ bool GrGLSLProgramBuilder::emitAndInstallProcs() {
this->emitAndInstallXferProc(inputColor, inputCoverage);
this->emitFSOutputSwizzle(this->pipeline().getXferProcessor().hasSecondaryOutput());
- return this->checkSamplerCounts() && this->checkImageStorageCounts();
+ return this->checkSamplerCounts();
}
void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& proc,
@@ -98,8 +95,7 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
SkSTArray<4, SamplerHandle> texSamplers(proc.numTextureSamplers());
SkSTArray<2, TexelBufferHandle> texelBuffers(proc.numBuffers());
- SkSTArray<2, ImageStorageHandle> imageStorages(proc.numImageStorages());
- this->emitSamplersAndImageStorages(proc, &texSamplers, &texelBuffers, &imageStorages);
+ this->emitSamplers(proc, &texSamplers, &texelBuffers);
GrGLSLPrimitiveProcessor::FPCoordTransformHandler transformHandler(fPipeline,
&fTransformedCoordVars);
@@ -115,7 +111,6 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
rtAdjustName,
texSamplers.begin(),
texelBuffers.begin(),
- imageStorages.begin(),
&transformHandler);
fGeometryProcessor->emitCode(args);
@@ -165,18 +160,15 @@ SkString GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor&
SkSTArray<4, SamplerHandle> textureSamplerArray(fp.numTextureSamplers());
SkSTArray<2, TexelBufferHandle> texelBufferArray(fp.numBuffers());
- SkSTArray<2, ImageStorageHandle> imageStorageArray(fp.numImageStorages());
GrFragmentProcessor::Iter iter(&fp);
while (const GrFragmentProcessor* subFP = iter.next()) {
- this->emitSamplersAndImageStorages(*subFP, &textureSamplerArray, &texelBufferArray,
- &imageStorageArray);
+ this->emitSamplers(*subFP, &textureSamplerArray, &texelBufferArray);
}
const GrShaderVar* coordVars = fTransformedCoordVars.begin() + transformedCoordVarsIdx;
GrGLSLFragmentProcessor::TransformedCoordVars coords(&fp, coordVars);
GrGLSLFragmentProcessor::TextureSamplers textureSamplers(&fp, textureSamplerArray.begin());
GrGLSLFragmentProcessor::TexelBuffers texelBuffers(&fp, texelBufferArray.begin());
- GrGLSLFragmentProcessor::ImageStorages imageStorages(&fp, imageStorageArray.begin());
GrGLSLFragmentProcessor::EmitArgs args(&fFS,
this->uniformHandler(),
this->shaderCaps(),
@@ -185,8 +177,7 @@ SkString GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor&
input.c_str(),
coords,
textureSamplers,
- texelBuffers,
- imageStorages);
+ texelBuffers);
fragProc->emitCode(args);
@@ -252,11 +243,10 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const SkString& colorIn,
fFS.codeAppend("}");
}
-void GrGLSLProgramBuilder::emitSamplersAndImageStorages(
+void GrGLSLProgramBuilder::emitSamplers(
const GrResourceIOProcessor& processor,
SkTArray<SamplerHandle>* outTexSamplerHandles,
- SkTArray<TexelBufferHandle>* outTexelBufferHandles,
- SkTArray<ImageStorageHandle>* outImageStorageHandles) {
+ SkTArray<TexelBufferHandle>* outTexelBufferHandles) {
SkString name;
int numTextureSamplers = processor.numTextureSamplers();
for (int t = 0; t < numTextureSamplers; ++t) {
@@ -293,14 +283,6 @@ void GrGLSLProgramBuilder::emitSamplersAndImageStorages(
extension);
}
}
- int numImageStorages = processor.numImageStorages();
- for (int i = 0; i < numImageStorages; ++i) {
- const GrResourceIOProcessor::ImageStorageAccess& imageStorageAccess =
- processor.imageStorageAccess(i);
- name.printf("Image_%d", outImageStorageHandles->count());
- outImageStorageHandles->emplace_back(
- this->emitImageStorage(imageStorageAccess, name.c_str()));
- }
}
void GrGLSLProgramBuilder::updateSamplerCounts(GrShaderFlags visibility) {
@@ -333,24 +315,6 @@ GrGLSLProgramBuilder::TexelBufferHandle GrGLSLProgramBuilder::emitTexelBuffer(
return this->uniformHandler()->addTexelBuffer(visibility, precision, name);
}
-GrGLSLProgramBuilder::ImageStorageHandle GrGLSLProgramBuilder::emitImageStorage(
- const GrResourceIOProcessor::ImageStorageAccess& access, const char* name) {
- if (access.visibility() & kVertex_GrShaderFlag) {
- ++fNumVertexImageStorages;
- }
- if (access.visibility() & kGeometry_GrShaderFlag) {
- SkASSERT(this->primitiveProcessor().willUseGeoShader());
- ++fNumGeometryImageStorages;
- }
- if (access.visibility() & kFragment_GrShaderFlag) {
- ++fNumFragmentImageStorages;
- }
- GrSLType uniformType = access.proxy()->imageStorageType();
- return this->uniformHandler()->addImageStorage(access.visibility(), uniformType,
- access.format(), access.memoryModel(),
- access.restrict(), access.ioType(), name);
-}
-
void GrGLSLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) {
// Swizzle the fragment shader outputs if necessary.
GrSwizzle swizzle;
@@ -390,30 +354,6 @@ bool GrGLSLProgramBuilder::checkSamplerCounts() {
return true;
}
-bool GrGLSLProgramBuilder::checkImageStorageCounts() {
- const GrShaderCaps& shaderCaps = *this->shaderCaps();
- if (fNumVertexImageStorages > shaderCaps.maxVertexImageStorages()) {
- GrCapsDebugf(this->caps(), "Program would use too many vertex images\n");
- return false;
- }
- if (fNumGeometryImageStorages > shaderCaps.maxGeometryImageStorages()) {
- GrCapsDebugf(this->caps(), "Program would use too many geometry images\n");
- return false;
- }
- if (fNumFragmentImageStorages > shaderCaps.maxFragmentImageStorages()) {
- GrCapsDebugf(this->caps(), "Program would use too many fragment images\n");
- return false;
- }
- // If the same image is used in two different shaders, it counts as two combined images.
- int numCombinedImages = fNumVertexImageStorages + fNumGeometryImageStorages +
- fNumFragmentImageStorages;
- if (numCombinedImages > shaderCaps.maxCombinedImageStorages()) {
- GrCapsDebugf(this->caps(), "Program would use too many combined images\n");
- return false;
- }
- return true;
-}
-
#ifdef SK_DEBUG
void GrGLSLProgramBuilder::verify(const GrPrimitiveProcessor& gp) {
SkASSERT(fFS.usedProcessorFeatures() == gp.requiredFeatures());