aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/glsl
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
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')
-rw-r--r--src/gpu/glsl/GrGLSL.cpp4
-rw-r--r--src/gpu/glsl/GrGLSLFragmentProcessor.cpp4
-rw-r--r--src/gpu/glsl/GrGLSLFragmentProcessor.h13
-rw-r--r--src/gpu/glsl/GrGLSLPrimitiveProcessor.h4
-rw-r--r--src/gpu/glsl/GrGLSLProgramBuilder.cpp74
-rw-r--r--src/gpu/glsl/GrGLSLProgramBuilder.h18
-rw-r--r--src/gpu/glsl/GrGLSLShaderBuilder.cpp10
-rw-r--r--src/gpu/glsl/GrGLSLShaderBuilder.h6
-rw-r--r--src/gpu/glsl/GrGLSLUniformHandler.h6
-rw-r--r--src/gpu/glsl/GrGLSLXferProcessor.h1
10 files changed, 13 insertions, 127 deletions
diff --git a/src/gpu/glsl/GrGLSL.cpp b/src/gpu/glsl/GrGLSL.cpp
index 1c13eccfed..07e36db5f7 100644
--- a/src/gpu/glsl/GrGLSL.cpp
+++ b/src/gpu/glsl/GrGLSL.cpp
@@ -109,10 +109,6 @@ const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t) {
return "texture2D";
case kSampler_GrSLType:
return "sampler";
- case kImageStorage2D_GrSLType:
- return "image2D";
- case kIImageStorage2D_GrSLType:
- return "iimage2D";
}
SK_ABORT("Unknown shader var type.");
return ""; // suppress warning
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
index ac2de139b0..8f92002ea5 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
@@ -49,7 +49,6 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu
TransformedCoordVars coordVars = args.fTransformedCoords.childInputs(childIndex);
TextureSamplers textureSamplers = args.fTexSamplers.childInputs(childIndex);
TexelBuffers texelBuffers = args.fTexelBuffers.childInputs(childIndex);
- ImageStorages imageStorages = args.fImageStorages.childInputs(childIndex);
EmitArgs childArgs(fragBuilder,
args.fUniformHandler,
args.fShaderCaps,
@@ -58,8 +57,7 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu
inputColor,
coordVars,
textureSamplers,
- texelBuffers,
- imageStorages);
+ texelBuffers);
this->childProcessor(childIndex)->emitCode(childArgs);
fragBuilder->codeAppend("}\n");
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h
index 68bd1f24c4..74cfc4e044 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.h
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h
@@ -31,7 +31,6 @@ public:
using UniformHandle = GrGLSLUniformHandler::UniformHandle;
using SamplerHandle = GrGLSLUniformHandler::SamplerHandle;
using TexelBufferHandle = GrGLSLUniformHandler::TexelBufferHandle;
- using ImageStorageHandle = GrGLSLUniformHandler::ImageStorageHandle;
private:
/**
@@ -75,8 +74,6 @@ public:
&GrResourceIOProcessor::numTextureSamplers>;
using TexelBuffers = BuilderInputProvider<TexelBufferHandle, 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
@@ -102,9 +99,6 @@ public:
@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.
- @param imageStorages Contains one entry for each ImageStorageAccess of the GrProcessor.
- These can be passed to the builder to emit image loads and stores
- in the generated code.
*/
struct EmitArgs {
EmitArgs(GrGLSLFPFragmentBuilder* fragBuilder,
@@ -115,8 +109,7 @@ public:
const char* inputColor,
const TransformedCoordVars& transformedCoordVars,
const TextureSamplers& textureSamplers,
- const TexelBuffers& texelBuffers,
- const ImageStorages& imageStorages)
+ const TexelBuffers& texelBuffers)
: fFragBuilder(fragBuilder)
, fUniformHandler(uniformHandler)
, fShaderCaps(caps)
@@ -125,8 +118,7 @@ public:
, fInputColor(inputColor)
, fTransformedCoords(transformedCoordVars)
, fTexSamplers(textureSamplers)
- , fTexelBuffers(texelBuffers)
- , fImageStorages(imageStorages) {}
+ , fTexelBuffers(texelBuffers) {}
GrGLSLFPFragmentBuilder* fFragBuilder;
GrGLSLUniformHandler* fUniformHandler;
const GrShaderCaps* fShaderCaps;
@@ -136,7 +128,6 @@ public:
const TransformedCoordVars& fTransformedCoords;
const TextureSamplers& fTexSamplers;
const TexelBuffers& fTexelBuffers;
- const ImageStorages& fImageStorages;
};
virtual void emitCode(EmitArgs&) = 0;
diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
index c4f3115f5a..30ca14387d 100644
--- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
+++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
@@ -30,7 +30,6 @@ public:
using UniformHandle = GrGLSLProgramDataManager::UniformHandle;
using SamplerHandle = GrGLSLUniformHandler::SamplerHandle;
using TexelBufferHandle = GrGLSLUniformHandler::TexelBufferHandle;
- using ImageStorageHandle = GrGLSLUniformHandler::ImageStorageHandle;
/**
* This class provides access to the GrCoordTransforms across all GrFragmentProcessors in a
@@ -78,7 +77,6 @@ public:
const char* rtAdjustName,
const SamplerHandle* texSamplers,
const TexelBufferHandle* texelBuffers,
- const ImageStorageHandle* imageStorages,
FPCoordTransformHandler* transformHandler)
: fVertBuilder(vertBuilder)
, fGeomBuilder(geomBuilder)
@@ -92,7 +90,6 @@ public:
, fRTAdjustName(rtAdjustName)
, fTexSamplers(texSamplers)
, fTexelBuffers(texelBuffers)
- , fImageStorages(imageStorages)
, fFPCoordTransformHandler(transformHandler) {}
GrGLSLVertexBuilder* fVertBuilder;
GrGLSLGeometryBuilder* fGeomBuilder;
@@ -106,7 +103,6 @@ public:
const char* fRTAdjustName;
const SamplerHandle* fTexSamplers;
const TexelBufferHandle* fTexelBuffers;
- const ImageStorageHandle* fImageStorages;
FPCoordTransformHandler* fFPCoordTransformHandler;
};
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());
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index 83a437f84f..ac2d4965b5 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -31,7 +31,6 @@ public:
using UniformHandle = GrGLSLUniformHandler::UniformHandle;
using SamplerHandle = GrGLSLUniformHandler::SamplerHandle;
using TexelBufferHandle = GrGLSLUniformHandler::TexelBufferHandle;
- using ImageStorageHandle = GrGLSLUniformHandler::ImageStorageHandle;
virtual ~GrGLSLProgramBuilder() {}
@@ -57,10 +56,6 @@ public:
return this->uniformHandler()->texelBufferVariable(handle);
}
- const GrShaderVar& imageStorageVariable(ImageStorageHandle handle) const {
- return this->uniformHandler()->imageStorageVariable(handle);
- }
-
// Handles for program uniforms (other than per-effect uniforms)
struct BuiltinUniformHandles {
UniformHandle fRTAdjustmentUni;
@@ -156,19 +151,15 @@ private:
const SkString& input,
SkString output);
void emitAndInstallXferProc(const SkString& colorIn, const SkString& coverageIn);
- void emitSamplersAndImageStorages(const GrResourceIOProcessor& processor,
- SkTArray<SamplerHandle>* outTexSamplerHandles,
- SkTArray<TexelBufferHandle>* outTexelBufferHandles,
- SkTArray<ImageStorageHandle>* outImageStorageHandles);
+ void emitSamplers(const GrResourceIOProcessor& processor,
+ SkTArray<SamplerHandle>* outTexSamplerHandles,
+ SkTArray<TexelBufferHandle>* outTexelBufferHandles);
SamplerHandle emitSampler(GrSLType samplerType, GrPixelConfig, const char* name,
GrShaderFlags visibility);
TexelBufferHandle emitTexelBuffer(GrPixelConfig, const char* name, GrShaderFlags visibility);
- ImageStorageHandle emitImageStorage(const GrResourceIOProcessor::ImageStorageAccess&,
- const char* name);
void emitFSOutputSwizzle(bool hasSecondaryOutput);
void updateSamplerCounts(GrShaderFlags visibility);
bool checkSamplerCounts();
- bool checkImageStorageCounts();
#ifdef SK_DEBUG
void verify(const GrPrimitiveProcessor&);
@@ -181,9 +172,6 @@ private:
int fNumVertexSamplers;
int fNumGeometrySamplers;
int fNumFragmentSamplers;
- int fNumVertexImageStorages;
- int fNumGeometryImageStorages;
- int fNumFragmentImageStorages;
SkSTArray<4, GrShaderVar> fTransformedCoordVars;
};
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
index 750df63a79..4bf6602495 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
@@ -213,16 +213,6 @@ void GrGLSLShaderBuilder::appendTexelFetch(TexelBufferHandle texelBufferHandle,
this->appendTexelFetch(&this->code(), texelBufferHandle, coordExpr);
}
-void GrGLSLShaderBuilder::appendImageStorageLoad(SkString* out, ImageStorageHandle handle,
- const char* coordExpr) {
- const GrShaderVar& imageStorage = fProgramBuilder->imageStorageVariable(handle);
- out->appendf("imageLoad(%s, %s)", imageStorage.c_str(), coordExpr);
-}
-
-void GrGLSLShaderBuilder::appendImageStorageLoad(ImageStorageHandle handle, const char* coordExpr) {
- this->appendImageStorageLoad(&this->code(), handle, 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 9ac6ab7626..070862547d 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.h
@@ -27,7 +27,6 @@ public:
using SamplerHandle = GrGLSLUniformHandler::SamplerHandle;
using TexelBufferHandle = GrGLSLUniformHandler::TexelBufferHandle;
- using ImageStorageHandle = GrGLSLUniformHandler::ImageStorageHandle;
/** 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
@@ -74,11 +73,6 @@ public:
/** Version of above that appends the result to the shader code instead.*/
void appendTexelFetch(TexelBufferHandle, const char* coordExpr);
- /** Creates a string of shader code that performs an image load. */
- void appendImageStorageLoad(SkString* out, ImageStorageHandle, const char* coordExpr);
- /** Version of above that appends the result to the shader code instead. */
- void appendImageStorageLoad(ImageStorageHandle, const char* coordExpr);
-
/**
* Adds a constant declaration to the top of the shader.
*/
diff --git a/src/gpu/glsl/GrGLSLUniformHandler.h b/src/gpu/glsl/GrGLSLUniformHandler.h
index 84bbfa104c..e1511c2578 100644
--- a/src/gpu/glsl/GrGLSLUniformHandler.h
+++ b/src/gpu/glsl/GrGLSLUniformHandler.h
@@ -21,7 +21,6 @@ public:
using UniformHandle = GrGLSLProgramDataManager::UniformHandle;
GR_DEFINE_RESOURCE_HANDLE_CLASS(SamplerHandle);
GR_DEFINE_RESOURCE_HANDLE_CLASS(TexelBufferHandle);
- GR_DEFINE_RESOURCE_HANDLE_CLASS(ImageStorageHandle);
/** 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
@@ -90,11 +89,6 @@ private:
virtual TexelBufferHandle addTexelBuffer(uint32_t visibility, GrSLPrecision,
const char* name) = 0;
- virtual const GrShaderVar& imageStorageVariable(ImageStorageHandle) const = 0;
- virtual ImageStorageHandle addImageStorage(uint32_t visibility, GrSLType type,
- GrImageStorageFormat, GrSLMemoryModel, GrSLRestrict,
- GrIOType, const char* name) = 0;
-
virtual UniformHandle internalAddUniformArray(uint32_t visibility,
GrSLType type,
GrSLPrecision precision,
diff --git a/src/gpu/glsl/GrGLSLXferProcessor.h b/src/gpu/glsl/GrGLSLXferProcessor.h
index 763fcfa87d..10658a9f5c 100644
--- a/src/gpu/glsl/GrGLSLXferProcessor.h
+++ b/src/gpu/glsl/GrGLSLXferProcessor.h
@@ -24,7 +24,6 @@ public:
virtual ~GrGLSLXferProcessor() {}
using SamplerHandle = GrGLSLUniformHandler::SamplerHandle;
- using ImageStorageHandle = GrGLSLUniformHandler::ImageStorageHandle;
struct EmitArgs {
EmitArgs(GrGLSLXPFragmentBuilder* fragBuilder,