diff options
author | Brian Salomon <bsalomon@google.com> | 2017-11-15 14:28:33 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-15 20:06:12 +0000 |
commit | 559f556d9d70ef9d1202e436a56d48364b279ac6 (patch) | |
tree | 0371c13e6ed17e351066f1be46f4053e72c63365 /src/gpu | |
parent | 33d17cbb003975fff895954435183756f9893c17 (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')
35 files changed, 24 insertions, 550 deletions
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 89a31717df..4294c9fae6 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -133,10 +133,6 @@ void GrResourceIOProcessor::addBufferAccess(const BufferAccess* access) { fBufferAccesses.push_back(access); } -void GrResourceIOProcessor::addImageStorageAccess(const ImageStorageAccess* access) { - fImageStorageAccesses.push_back(access); -} - void GrResourceIOProcessor::addPendingIOs() const { for (const auto& sampler : fTextureSamplers) { sampler->programProxy()->markPendingIO(); @@ -144,9 +140,6 @@ void GrResourceIOProcessor::addPendingIOs() const { for (const auto& buffer : fBufferAccesses) { buffer->programBuffer()->markPendingIO(); } - for (const auto& imageStorage : fImageStorageAccesses) { - imageStorage->programProxy()->markPendingIO(); - } } void GrResourceIOProcessor::removeRefs() const { @@ -156,9 +149,6 @@ void GrResourceIOProcessor::removeRefs() const { for (const auto& buffer : fBufferAccesses) { buffer->programBuffer()->removeRef(); } - for (const auto& imageStorage : fImageStorageAccesses) { - imageStorage->programProxy()->removeRef(); - } } void GrResourceIOProcessor::pendingIOComplete() const { @@ -168,9 +158,6 @@ void GrResourceIOProcessor::pendingIOComplete() const { for (const auto& buffer : fBufferAccesses) { buffer->programBuffer()->pendingIOComplete(); } - for (const auto& imageStorage : fImageStorageAccesses) { - imageStorage->programProxy()->pendingIOComplete(); - } } bool GrResourceIOProcessor::instantiate(GrResourceProvider* resourceProvider) const { @@ -182,19 +169,12 @@ bool GrResourceIOProcessor::instantiate(GrResourceProvider* resourceProvider) co // MDB TODO: instantiate 'fBufferAccesses' here as well - for (const auto& imageStorage : fImageStorageAccesses) { - if (!imageStorage->instantiate(resourceProvider)) { - return false; - } - } - return true; } bool GrResourceIOProcessor::hasSameSamplersAndAccesses(const GrResourceIOProcessor& that) const { if (this->numTextureSamplers() != that.numTextureSamplers() || - this->numBuffers() != that.numBuffers() || - this->numImageStorages() != that.numImageStorages()) { + this->numBuffers() != that.numBuffers()) { return false; } for (int i = 0; i < this->numTextureSamplers(); ++i) { @@ -207,11 +187,6 @@ bool GrResourceIOProcessor::hasSameSamplersAndAccesses(const GrResourceIOProcess return false; } } - for (int i = 0; i < this->numImageStorages(); ++i) { - if (this->imageStorageAccess(i) != that.imageStorageAccess(i)) { - return false; - } - } return true; } @@ -249,37 +224,3 @@ void GrResourceIOProcessor::TextureSampler::reset(sk_sp<GrTextureProxy> proxy, fSamplerState = GrSamplerState(wrapXAndY, filterMode); fVisibility = visibility; } - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -GrResourceIOProcessor::ImageStorageAccess::ImageStorageAccess(sk_sp<GrTextureProxy> proxy, - GrIOType ioType, - GrSLMemoryModel memoryModel, - GrSLRestrict restrict, - GrShaderFlags visibility) - : fProxyRef(std::move(proxy), ioType) { - SkASSERT(fProxyRef.get()); - - fMemoryModel = memoryModel; - fRestrict = restrict; - fVisibility = visibility; - // We currently infer this from the config. However, we could allow the client to specify - // a format that is different but compatible with the config. - switch (fProxyRef.get()->config()) { - case kRGBA_8888_GrPixelConfig: - fFormat = GrImageStorageFormat::kRGBA8; - break; - case kRGBA_8888_sint_GrPixelConfig: - fFormat = GrImageStorageFormat::kRGBA8i; - break; - case kRGBA_half_GrPixelConfig: - fFormat = GrImageStorageFormat::kRGBA16f; - break; - case kRGBA_float_GrPixelConfig: - fFormat = GrImageStorageFormat::kRGBA32f; - break; - default: - SK_ABORT("Config is not (yet) supported as image storage."); - break; - } -} diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h index cd11ac4ac2..cafc713a62 100644 --- a/src/gpu/GrProcessor.h +++ b/src/gpu/GrProcessor.h @@ -227,7 +227,6 @@ class GrResourceIOProcessor : public GrProcessor { public: class TextureSampler; class BufferAccess; - class ImageStorageAccess; int numTextureSamplers() const { return fTextureSamplers.count(); } @@ -241,14 +240,6 @@ public: numBuffers(). */ const BufferAccess& bufferAccess(int index) const { return *fBufferAccesses[index]; } - int numImageStorages() const { return fImageStorageAccesses.count(); } - - /** Returns the access object for the image at index. index must be valid according to - numImages(). */ - const ImageStorageAccess& imageStorageAccess(int index) const { - return *fImageStorageAccesses[index]; - } - bool instantiate(GrResourceProvider* resourceProvider) const; protected: @@ -256,14 +247,13 @@ protected: : INHERITED(classID) {} /** - * Subclasses call these from their constructor to register sampler/image sources. The processor + * Subclasses call these from their constructor to register sampler sources. The processor * subclass manages the lifetime of the objects (these functions only store pointers). The * TextureSampler and/or BufferAccess instances are typically member fields of the GrProcessor * subclass. These must only be called from the constructor because GrProcessors are immutable. */ void addTextureSampler(const TextureSampler*); void addBufferAccess(const BufferAccess*); - void addImageStorageAccess(const ImageStorageAccess*); bool hasSameSamplersAndAccesses(const GrResourceIOProcessor&) const; @@ -275,7 +265,6 @@ protected: private: SkSTArray<4, const TextureSampler*, true> fTextureSamplers; SkSTArray<1, const BufferAccess*, true> fBufferAccesses; - SkSTArray<1, const ImageStorageAccess*, true> fImageStorageAccesses; typedef GrProcessor INHERITED; }; @@ -408,65 +397,4 @@ private: typedef SkNoncopyable INHERITED; }; -/** - * This is used by a GrProcessor to access a texture using image load/store in its shader code. - * ImageStorageAccesses don't perform any coord manipulation to account for texture origin. - * Currently the format of the load/store data in the shader is inferred from the texture config, - * though it could be made explicit. - */ -class GrResourceIOProcessor::ImageStorageAccess { -public: - ImageStorageAccess(sk_sp<GrTextureProxy>, GrIOType, GrSLMemoryModel, GrSLRestrict, - GrShaderFlags visibility = kFragment_GrShaderFlag); - /** - * This copy constructor is used by GrFragmentProcessor::clone() implementations. The copy - * always takes a new ref on the surface proxy as the new fragment processor will not yet be - * in pending execution state. - */ - explicit ImageStorageAccess(const ImageStorageAccess& that) - : fProxyRef(sk_ref_sp(that.fProxyRef.get()), that.fProxyRef.ioType()) - , fVisibility(that.fVisibility) - , fFormat(that.fFormat) - , fMemoryModel(that.fMemoryModel) - , fRestrict(that.fRestrict) {} - - ImageStorageAccess& operator=(const ImageStorageAccess&) = delete; - - bool operator==(const ImageStorageAccess& that) const { - return this->proxy() == that.proxy() && fVisibility == that.fVisibility; - } - - bool operator!=(const ImageStorageAccess& that) const { return !(*this == that); } - - GrTextureProxy* proxy() const { return fProxyRef.get()->asTextureProxy(); } - GrShaderFlags visibility() const { return fVisibility; } - GrIOType ioType() const { return fProxyRef.ioType(); } - GrImageStorageFormat format() const { return fFormat; } - GrSLMemoryModel memoryModel() const { return fMemoryModel; } - GrSLRestrict restrict() const { return fRestrict; } - - // 'instantiate' should only ever be called at flush time. - bool instantiate(GrResourceProvider* resourceProvider) const { - return SkToBool(fProxyRef.get()->instantiate(resourceProvider)); - } - // 'peekTexture' should only ever be called after a successful 'instantiate' call - GrTexture* peekTexture() const { - SkASSERT(fProxyRef.get()->priv().peekTexture()); - return fProxyRef.get()->priv().peekTexture(); - } - - /** - * For internal use by GrProcessor. - */ - const GrSurfaceProxyRef* programProxy() const { return &fProxyRef; } - -private: - GrSurfaceProxyRef fProxyRef; - GrShaderFlags fVisibility; - GrImageStorageFormat fFormat; - GrSLMemoryModel fMemoryModel; - GrSLRestrict fRestrict; - typedef SkNoncopyable INHERITED; -}; - #endif diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp index f40c6b666c..a32e0cc28b 100644 --- a/src/gpu/GrProgramDesc.cpp +++ b/src/gpu/GrProgramDesc.cpp @@ -37,12 +37,6 @@ static inline uint16_t image_storage_or_sampler_uniform_type_key(GrSLType type ) case kBufferSampler_GrSLType: value = 4; break; - case kImageStorage2D_GrSLType: - value = 5; - break; - case kIImageStorage2D_GrSLType: - value = 6; - break; default: break; @@ -61,18 +55,11 @@ static uint16_t sampler_key(GrSLType samplerType, GrPixelConfig config, GrShader (caps.samplerPrecision(config, visibility) << (8 + kSamplerOrImageTypeKeyBits))); } -static uint16_t storage_image_key(const GrResourceIOProcessor::ImageStorageAccess& imageAccess) { - GrSLType type = imageAccess.proxy()->imageStorageType(); - return image_storage_or_sampler_uniform_type_key(type) | - (int)imageAccess.format() << kSamplerOrImageTypeKeyBits; -} - static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrResourceIOProcessor& proc, const GrShaderCaps& caps) { int numTextureSamplers = proc.numTextureSamplers(); int numBuffers = proc.numBuffers(); - int numImageStorages = proc.numImageStorages(); - int numUniforms = numTextureSamplers + numBuffers + numImageStorages; + int numUniforms = numTextureSamplers + numBuffers; // Need two bytes per key. int word32Count = (numUniforms + 1) / 2; if (0 == word32Count) { @@ -92,9 +79,6 @@ static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrResourc k16[j] = sampler_key(kBufferSampler_GrSLType, access.texelConfig(), access.visibility(), caps); } - for (int i = 0; i < numImageStorages; ++i, ++j) { - k16[j] = storage_image_key(proc.imageStorageAccess(i)); - } // zero the last 16 bits if the number of uniforms for samplers and image storages is odd. if (numUniforms & 0x1) { k16[numUniforms] = 0; diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp index 0a612db335..d4f4475da2 100644 --- a/src/gpu/GrShaderCaps.cpp +++ b/src/gpu/GrShaderCaps.cpp @@ -91,10 +91,6 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { fMaxGeometrySamplers = 0; fMaxFragmentSamplers = 0; fMaxCombinedSamplers = 0; - fMaxVertexImageStorages = 0; - fMaxGeometryImageStorages = 0; - fMaxFragmentImageStorages = 0; - fMaxCombinedImageStorages = 0; fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction; #if GR_TEST_UTILS @@ -175,10 +171,6 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const { writer->appendS32("Max GS Samplers", fMaxGeometrySamplers); writer->appendS32("Max FS Samplers", fMaxFragmentSamplers); writer->appendS32("Max Combined Samplers", fMaxFragmentSamplers); - writer->appendS32("Max VS Image Storages", fMaxVertexImageStorages); - writer->appendS32("Max GS Image Storages", fMaxGeometryImageStorages); - writer->appendS32("Max FS Image Storages", fMaxFragmentImageStorages); - writer->appendS32("Max Combined Image Storages", fMaxFragmentImageStorages); writer->appendString("Advanced blend equation interaction", kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]); writer->appendBool("Disable image multitexturing", fDisableImageMultitexturing); diff --git a/src/gpu/GrShaderVar.cpp b/src/gpu/GrShaderVar.cpp index fcc05c0f7a..4d6c6581a1 100644 --- a/src/gpu/GrShaderVar.cpp +++ b/src/gpu/GrShaderVar.cpp @@ -21,51 +21,6 @@ static const char* type_modifier_string(GrShaderVar::TypeModifier t) { return ""; } -void GrShaderVar::setImageStorageFormat(GrImageStorageFormat format) { - const char* formatStr = nullptr; - switch (format) { - case GrImageStorageFormat::kRGBA8: - formatStr = "rgba8"; - break; - case GrImageStorageFormat::kRGBA8i: - formatStr = "rgba8i"; - break; - case GrImageStorageFormat::kRGBA16f: - formatStr = "rgba16f"; - break; - case GrImageStorageFormat::kRGBA32f: - formatStr = "rgba32f"; - break; - } - this->addLayoutQualifier(formatStr); - SkASSERT(formatStr); -} - -void GrShaderVar::setMemoryModel(GrSLMemoryModel model) { - switch (model) { - case GrSLMemoryModel::kNone: - return; - case GrSLMemoryModel::kCoherent: - this->addModifier("coherent"); - return; - case GrSLMemoryModel::kVolatile: - this->addModifier("volatile"); - return; - } - SK_ABORT("Unknown memory model."); -} - -void GrShaderVar::setRestrict(GrSLRestrict restrict) { - switch (restrict) { - case GrSLRestrict::kNo: - return; - case GrSLRestrict::kYes: - this->addModifier("restrict"); - return; - } - SK_ABORT("Unknown restrict."); -} - void GrShaderVar::setIOType(GrIOType ioType) { switch (ioType) { case kRW_GrIOType: diff --git a/src/gpu/GrShaderVar.h b/src/gpu/GrShaderVar.h index 29e056c332..0f22085b08 100644 --- a/src/gpu/GrShaderVar.h +++ b/src/gpu/GrShaderVar.h @@ -283,12 +283,6 @@ public: } } - void setImageStorageFormat(GrImageStorageFormat format); - - void setMemoryModel(GrSLMemoryModel); - - void setRestrict(GrSLRestrict); - void setIOType(GrIOType); void addModifier(const char* modifier) { diff --git a/src/gpu/GrTexturePriv.h b/src/gpu/GrTexturePriv.h index fc474ed0b5..ad69d3133c 100644 --- a/src/gpu/GrTexturePriv.h +++ b/src/gpu/GrTexturePriv.h @@ -44,14 +44,6 @@ public: return fTexture->fMaxMipMapLevel; } - GrSLType imageStorageType() const { - if (GrPixelConfigIsSint(fTexture->config())) { - return kIImageStorage2D_GrSLType; - } else { - return kImageStorage2D_GrSLType; - } - } - GrSLType samplerType() const { return fTexture->fSamplerType; } /** The filter used is clamped to this value in GrProcessor::TextureSampler. */ diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index f245d0f551..14ede4fdc1 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -358,42 +358,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, GR_GL_GetIntegerv(gli, GR_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxSamplers); shaderCaps->fMaxCombinedSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers); - if (kGL_GrGLStandard == standard) { - shaderCaps->fImageLoadStoreSupport = ctxInfo.version() >= GR_GL_VER(4, 2); - if (!shaderCaps->fImageLoadStoreSupport && - ctxInfo.hasExtension("GL_ARB_shader_image_load_store")) { - shaderCaps->fImageLoadStoreSupport = true; - shaderCaps->fImageLoadStoreExtensionString = "GL_ARB_shader_image_load_store"; - } - } else { - shaderCaps->fImageLoadStoreSupport = ctxInfo.version() >= GR_GL_VER(3, 1); - } - if (shaderCaps->fImageLoadStoreSupport) { - // Protect ourselves against tracking huge amounts of image state. - static constexpr int kMaxSaneImages = 4; - GrGLint maxUnits; - GR_GL_GetIntegerv(gli, GR_GL_MAX_IMAGE_UNITS, &maxUnits); - GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_IMAGE_UNIFORMS, - &shaderCaps->fMaxVertexImageStorages); - if (shaderCaps->fGeometryShaderSupport) { - GR_GL_GetIntegerv(gli, GR_GL_MAX_GEOMETRY_IMAGE_UNIFORMS, - &shaderCaps->fMaxGeometryImageStorages); - } - GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_IMAGE_UNIFORMS, - &shaderCaps->fMaxFragmentImageStorages); - GR_GL_GetIntegerv(gli, GR_GL_MAX_COMBINED_IMAGE_UNIFORMS, - &shaderCaps->fMaxCombinedImageStorages); - // We use one unit for every image uniform - shaderCaps->fMaxCombinedImageStorages = SkTMin(SkTMin(shaderCaps->fMaxCombinedImageStorages, - maxUnits), kMaxSaneImages); - shaderCaps->fMaxVertexImageStorages = SkTMin(maxUnits, - shaderCaps->fMaxVertexImageStorages); - shaderCaps->fMaxGeometryImageStorages = SkTMin(maxUnits, - shaderCaps->fMaxGeometryImageStorages); - shaderCaps->fMaxFragmentImageStorages = SkTMin(maxUnits, - shaderCaps->fMaxFragmentImageStorages); - } - // SGX and Mali GPUs that are based on a tiled-deferred architecture that have trouble with // frequently changing VBOs. We've measured a performance increase using non-VBO vertex // data for dynamic content on these GPUs. Perhaps we should read the renderer string and @@ -2243,24 +2207,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, } } - // We currently only support images on rgba textures formats. We could add additional formats - // if desired. The shader builder would have to be updated to add swizzles where appropriate - // (e.g. where we use GL_RED textures to implement alpha configs). - if (this->shaderCaps()->imageLoadStoreSupport()) { - fConfigTable[kRGBA_8888_sint_GrPixelConfig].fFlags |= - ConfigInfo::kCanUseAsImageStorage_Flag; - // In OpenGL ES a texture may only be used with BindImageTexture if it has been made - // immutable via TexStorage. We create non-integer textures as mutable textures using - // TexImage because we may lazily add MIP levels. Thus, on ES we currently disable image - // storage support for non-integer textures. - if (kGL_GrGLStandard == ctxInfo.standard()) { - fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseAsImageStorage_Flag; - fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= - ConfigInfo::kCanUseAsImageStorage_Flag; - fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseAsImageStorage_Flag; - } - } - for (int i = 0; i < kGrPixelConfigCnt; ++i) { if (ConfigInfo::kRenderableWithMSAA_Flag & fConfigTable[i].fFlags) { if ((kGL_GrGLStandard == ctxInfo.standard() && diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 2c82c4c021..923b3f416d 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -134,9 +134,6 @@ public: return this->isConfigRenderable(config, false); } - bool canConfigBeImageStorage(GrPixelConfig config) const override { - return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kCanUseAsImageStorage_Flag); - } bool canConfigBeFBOColorAttachment(GrPixelConfig config) const { return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kFBOColorAttachment_Flag); } @@ -568,7 +565,6 @@ private: kFBOColorAttachment_Flag = 0x10, kCanUseTexStorage_Flag = 0x20, kCanUseWithTexelBuffer_Flag = 0x40, - kCanUseAsImageStorage_Flag = 0x80, }; uint32_t fFlags; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index ad13516ce6..c69b9243ed 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -223,7 +223,6 @@ GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context) fCaps.reset(SkRef(ctx->caps())); fHWBoundTextureUniqueIDs.reset(this->caps()->shaderCaps()->maxCombinedSamplers()); - fHWBoundImageStorages.reset(this->caps()->shaderCaps()->maxCombinedImageStorages()); fHWBufferState[kVertex_GrBufferType].fGLTarget = GR_GL_ARRAY_BUFFER; fHWBufferState[kIndex_GrBufferType].fGLTarget = GR_GL_ELEMENT_ARRAY_BUFFER; @@ -451,10 +450,6 @@ void GrGLGpu::onResetContext(uint32_t resetBits) { SkASSERT(this->caps()->shaderCaps()->texelBufferSupport()); fHWBufferTextures[b].fKnownBound = false; } - for (int i = 0; i < fHWBoundImageStorages.count(); ++i) { - SkASSERT(this->caps()->shaderCaps()->imageLoadStoreSupport()); - fHWBoundImageStorages[i].fTextureUniqueID.makeInvalid(); - } } if (resetBits & kBlend_GrGLBackendState) { @@ -3182,27 +3177,6 @@ void GrGLGpu::bindTexelBuffer(int unitIdx, GrPixelConfig texelConfig, GrGLBuffer } } -void GrGLGpu::bindImageStorage(int unitIdx, GrIOType ioType, GrGLTexture *texture) { - SkASSERT(texture); - if (texture->uniqueID() != fHWBoundImageStorages[unitIdx].fTextureUniqueID || - ioType != fHWBoundImageStorages[unitIdx].fIOType) { - GrGLenum access = GR_GL_READ_ONLY; - switch (ioType) { - case kRead_GrIOType: - access = GR_GL_READ_ONLY; - break; - case kWrite_GrIOType: - access = GR_GL_WRITE_ONLY; - break; - case kRW_GrIOType: - access = GR_GL_READ_WRITE; - break; - } - GrGLenum format = this->glCaps().getImageFormat(texture->config()); - GL_CALL(BindImageTexture(unitIdx, texture->textureID(), 0, GR_GL_FALSE, 0, access, format)); - } -} - void GrGLGpu::generateMipmaps(const GrSamplerState& params, bool allowSRGBInputs, GrGLTexture* texture, GrSurfaceOrigin textureOrigin) { SkASSERT(texture); diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index 227409edd3..4d8b056bc7 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -64,8 +64,6 @@ public: void bindTexelBuffer(int unitIdx, GrPixelConfig, GrGLBuffer*); - void bindImageStorage(int unitIdx, GrIOType, GrGLTexture *); - void generateMipmaps(const GrSamplerState& params, bool allowSRGBInputs, GrGLTexture* texture, GrSurfaceOrigin textureOrigin); @@ -592,12 +590,6 @@ private: TriState fHWSRGBFramebuffer; SkTArray<GrGpuResource::UniqueID, true> fHWBoundTextureUniqueIDs; - struct Image { - GrGpuResource::UniqueID fTextureUniqueID; - GrIOType fIOType; - }; - SkTArray<Image, true> fHWBoundImageStorages; - struct BufferTexture { BufferTexture() : fTextureID(0), fKnownBound(false), fAttachedBufferUniqueID(SK_InvalidUniqueID), diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 04b2138a7f..7257638e1d 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -32,7 +32,6 @@ GrGLProgram::GrGLProgram(GrGLGpu* gpu, const UniformInfoArray& uniforms, const UniformInfoArray& textureSamplers, const UniformInfoArray& texelBuffers, - const UniformInfoArray& imageStorages, const VaryingInfoArray& pathProcVaryings, std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor, std::unique_ptr<GrGLSLXferProcessor> xferProcessor, @@ -51,7 +50,6 @@ GrGLProgram::GrGLProgram(GrGLGpu* gpu, GL_CALL(UseProgram(fProgramID)); fProgramDataManager.setSamplerUniforms(textureSamplers, 0); fProgramDataManager.setSamplerUniforms(texelBuffers, fNumTextureSamplers); - fProgramDataManager.setImageStorages(imageStorages); } GrGLProgram::~GrGLProgram() { @@ -77,18 +75,15 @@ void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline // We must bind to texture units in the same order in which we set the uniforms in // GrGLProgramDataManager. That is first all texture samplers and then texel buffers. - // ImageStorages are bound to their own image units so they are tracked separately. // Within each group we will bind them in primProc, fragProcs, XP order. int nextTexSamplerIdx = 0; int nextTexelBufferIdx = fNumTextureSamplers; - int nextImageStorageIdx = 0; fGeometryProcessor->setData(fProgramDataManager, primProc, GrFragmentProcessor::CoordTransformIter(pipeline)); this->bindTextures(primProc, pipeline.getAllowSRGBInputs(), &nextTexSamplerIdx, - &nextTexelBufferIdx, &nextImageStorageIdx); + &nextTexelBufferIdx); - this->setFragmentData(primProc, pipeline, &nextTexSamplerIdx, &nextTexelBufferIdx, - &nextImageStorageIdx); + this->setFragmentData(primProc, pipeline, &nextTexSamplerIdx, &nextTexelBufferIdx); const GrXferProcessor& xp = pipeline.getXferProcessor(); SkIPoint offset; @@ -117,8 +112,7 @@ void GrGLProgram::generateMipmaps(const GrPrimitiveProcessor& primProc, void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline, int* nextTexSamplerIdx, - int* nextTexelBufferIdx, - int* nextImageStorageIdx) { + int* nextTexelBufferIdx) { GrFragmentProcessor::Iter iter(pipeline); GrGLSLFragmentProcessor::Iter glslIter(fFragmentProcessors.begin(), fFragmentProcessors.count()); @@ -127,7 +121,7 @@ void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, while (fp && glslFP) { glslFP->setData(fProgramDataManager, *fp); this->bindTextures(*fp, pipeline.getAllowSRGBInputs(), nextTexSamplerIdx, - nextTexelBufferIdx, nextImageStorageIdx); + nextTexelBufferIdx); fp = iter.next(); glslFP = glslIter.next(); } @@ -168,8 +162,7 @@ void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, void GrGLProgram::bindTextures(const GrResourceIOProcessor& processor, bool allowSRGBInputs, int* nextTexSamplerIdx, - int* nextTexelBufferIdx, - int* nextImageStorageIdx) { + int* nextTexelBufferIdx) { for (int i = 0; i < processor.numTextureSamplers(); ++i) { const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i); fGpu->bindTexture((*nextTexSamplerIdx)++, sampler.samplerState(), allowSRGBInputs, @@ -181,11 +174,6 @@ void GrGLProgram::bindTextures(const GrResourceIOProcessor& processor, fGpu->bindTexelBuffer((*nextTexelBufferIdx)++, access.texelConfig(), static_cast<GrGLBuffer*>(access.buffer())); } - for (int i = 0; i < processor.numImageStorages(); ++i) { - const GrResourceIOProcessor::ImageStorageAccess& access = processor.imageStorageAccess(i); - fGpu->bindImageStorage((*nextImageStorageIdx)++, access.ioType(), - static_cast<GrGLTexture *>(access.peekTexture())); - } } void GrGLProgram::generateMipmaps(const GrResourceIOProcessor& processor, bool allowSRGBInputs) { diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index 96ff10f05d..781baa4aba 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -113,7 +113,6 @@ protected: const UniformInfoArray& uniforms, const UniformInfoArray& textureSamplers, const UniformInfoArray& texelBuffers, - const UniformInfoArray& imageStorages, const VaryingInfoArray&, // used for NVPR only currently std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor, std::unique_ptr<GrGLSLXferProcessor> xferProcessor, @@ -121,14 +120,14 @@ protected: // A helper to loop over effects, set the transforms (via subclass) and bind textures void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&, int* nextTexSamplerIdx, - int* nextTexelBufferIdx, int* nextImageStorageIdx); + int* nextTexelBufferIdx); // Helper for setData() that sets the view matrix and loads the render target height uniform void setRenderTargetState(const GrPrimitiveProcessor&, const GrRenderTargetProxy*); // Helper for setData() that binds textures and texel buffers to the appropriate texture units void bindTextures(const GrResourceIOProcessor&, bool allowSRGBInputs, int* nextSamplerIdx, - int* nextTexelBufferIdx, int* nextImageStorageIdx); + int* nextTexelBufferIdx); // Helper for generateMipmaps() that ensures mipmaps are up to date void generateMipmaps(const GrResourceIOProcessor&, bool allowSRGBInputs); @@ -149,7 +148,6 @@ protected: int fNumTextureSamplers; int fNumTexelBuffers; - int fNumImageStorages; friend class GrGLProgramBuilder; diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp index ab8dee6306..689b291a9f 100644 --- a/src/gpu/gl/GrGLProgramDataManager.cpp +++ b/src/gpu/gl/GrGLProgramDataManager.cpp @@ -61,16 +61,6 @@ void GrGLProgramDataManager::setSamplerUniforms(const UniformInfoArray& samplers } } -void GrGLProgramDataManager::setImageStorages(const UniformInfoArray& images) const { - for (int i = 0; i < images.count(); ++i) { - const UniformInfo& image = images[i]; - SkASSERT(image.fVisibility); - if (kUnusedUniform != image.fLocation) { - GR_GL_CALL(fGpu->glInterface(), Uniform1i(image.fLocation, i)); - } - } -} - void GrGLProgramDataManager::set1i(UniformHandle u, int32_t i) const { const Uniform& uni = fUniforms[u.toIndex()]; SkASSERT(uni.fType == kInt_GrSLType || uni.fType == kShort_GrSLType); diff --git a/src/gpu/gl/GrGLProgramDataManager.h b/src/gpu/gl/GrGLProgramDataManager.h index 6b4e4d99bb..f756a2a2e9 100644 --- a/src/gpu/gl/GrGLProgramDataManager.h +++ b/src/gpu/gl/GrGLProgramDataManager.h @@ -46,7 +46,6 @@ public: const VaryingInfoArray&); void setSamplerUniforms(const UniformInfoArray& samplers, int startUnit) const; - void setImageStorages(const UniformInfoArray& images) const; /** Functions for uploading uniform values. The varities ending in v can be used to upload to an * array of uniforms. arrayCount must be <= the array count of the uniform. diff --git a/src/gpu/gl/GrGLUniformHandler.cpp b/src/gpu/gl/GrGLUniformHandler.cpp index 914f8bc6c5..b3b4b9f6b5 100644 --- a/src/gpu/gl/GrGLUniformHandler.cpp +++ b/src/gpu/gl/GrGLUniformHandler.cpp @@ -96,31 +96,6 @@ GrGLSLUniformHandler::TexelBufferHandle GrGLUniformHandler::addTexelBuffer(uint3 return GrGLSLUniformHandler::TexelBufferHandle(fTexelBuffers.count() - 1); } -GrGLSLUniformHandler::ImageStorageHandle GrGLUniformHandler::addImageStorage( - uint32_t visibility, GrSLType type, GrImageStorageFormat format, GrSLMemoryModel model, - GrSLRestrict restrict, GrIOType ioType, const char* name) { - SkASSERT(name && strlen(name)); - SkASSERT(0 != visibility); - SkString mangleName; - char prefix = 'u'; - fProgramBuilder->nameVariable(&mangleName, prefix, name, true); - - UniformInfo& imageStorage = fImageStorages.push_back(); - imageStorage.fVariable.setName(mangleName); - - SkASSERT(GrSLTypeIsImageStorage(type)); - imageStorage.fVariable.setType(type); - imageStorage.fVariable.setTypeModifier(GrShaderVar::kUniform_TypeModifier); - imageStorage.fVariable.setImageStorageFormat(format); - imageStorage.fVariable.setMemoryModel(model); - imageStorage.fVariable.setRestrict(restrict); - imageStorage.fVariable.setIOType(ioType); - imageStorage.fVariable.setPrecision(kHigh_GrSLPrecision); - imageStorage.fLocation = -1; - imageStorage.fVisibility = visibility; - return GrGLSLUniformHandler::ImageStorageHandle(fImageStorages.count() - 1); -} - void GrGLUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const { for (int i = 0; i < fUniforms.count(); ++i) { if (fUniforms[i].fVisibility & visibility) { @@ -140,12 +115,6 @@ void GrGLUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out->append(";\n"); } } - for (int i = 0; i < fImageStorages.count(); ++i) { - if (fImageStorages[i].fVisibility & visibility) { - fImageStorages[i].fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); - out->append(";"); - } - } } void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps& caps) { @@ -164,11 +133,6 @@ void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps fTexelBuffers[i].fVariable.c_str())); fTexelBuffers[i].fLocation = currUniform; } - for (int i = 0; i < fImageStorages.count(); ++i, ++currUniform) { - GL_CALL(BindUniformLocation(programID, currUniform, - fImageStorages[i].fVariable.c_str())); - fImageStorages[i].fLocation = currUniform; - } } } @@ -191,12 +155,6 @@ void GrGLUniformHandler::getUniformLocations(GrGLuint programID, const GrGLCaps& fTexelBuffers[i].fVariable.c_str())); fTexelBuffers[i].fLocation = location; } - for (int i = 0; i < fImageStorages.count(); ++i) { - GrGLint location; - GL_CALL_RET(location, GetUniformLocation(programID, - fImageStorages[i].fVariable.c_str())); - fImageStorages[i].fLocation = location; - } } } diff --git a/src/gpu/gl/GrGLUniformHandler.h b/src/gpu/gl/GrGLUniformHandler.h index d029691b84..74d24bb7b2 100644 --- a/src/gpu/gl/GrGLUniformHandler.h +++ b/src/gpu/gl/GrGLUniformHandler.h @@ -30,8 +30,7 @@ private: : INHERITED(program) , fUniforms(kUniformsPerBlock) , fSamplers(kUniformsPerBlock) - , fTexelBuffers(kUniformsPerBlock) - , fImageStorages(kUniformsPerBlock) {} + , fTexelBuffers(kUniformsPerBlock) {} UniformHandle internalAddUniformArray(uint32_t visibility, GrSLType type, @@ -59,14 +58,6 @@ private: return fTexelBuffers[handle.toIndex()].fVariable; } - ImageStorageHandle addImageStorage(uint32_t visibility, GrSLType, GrImageStorageFormat, - GrSLMemoryModel, GrSLRestrict, GrIOType, - const char* name) override; - - const GrShaderVar& imageStorageVariable(ImageStorageHandle handle) const override { - return fImageStorages[handle.toIndex()].fVariable; - } - void appendUniformDecls(GrShaderFlags visibility, SkString*) const override; // Manually set uniform locations for all our uniforms. @@ -84,7 +75,6 @@ private: UniformInfoArray fSamplers; SkTArray<GrSwizzle> fSamplerSwizzles; UniformInfoArray fTexelBuffers; - UniformInfoArray fImageStorages; friend class GrGLProgramBuilder; diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 4bc4202297..3867d1bef4 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -369,7 +369,6 @@ GrGLProgram* GrGLProgramBuilder::createProgram(GrGLuint programID) { fUniformHandler.fUniforms, fUniformHandler.fSamplers, fUniformHandler.fTexelBuffers, - fUniformHandler.fImageStorages, fVaryingHandler.fPathProcVaryingInfos, std::move(fGeometryProcessor), std::move(fXferProcessor), 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, diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h index 9f279689c7..c4b9449a05 100644 --- a/src/gpu/mock/GrMockCaps.h +++ b/src/gpu/mock/GrMockCaps.h @@ -45,7 +45,6 @@ public: return false; } - bool canConfigBeImageStorage(GrPixelConfig) const override { return false; } bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc, bool* rectsMustMatch, bool* disallowSubrect) const override { return false; diff --git a/src/gpu/mtl/GrMtlCaps.h b/src/gpu/mtl/GrMtlCaps.h index 75bb2e7125..3f2adf8f7d 100644 --- a/src/gpu/mtl/GrMtlCaps.h +++ b/src/gpu/mtl/GrMtlCaps.h @@ -43,8 +43,6 @@ public: return true; } - bool canConfigBeImageStorage(GrPixelConfig) const override { return false; } - #if 0 /** * Returns both a supported and most prefered stencil format to use in draws. diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h index ad514953b9..1a6e1bd32a 100644 --- a/src/gpu/vk/GrVkCaps.h +++ b/src/gpu/vk/GrVkCaps.h @@ -43,8 +43,6 @@ public: return true; } - bool canConfigBeImageStorage(GrPixelConfig) const override { return false; } - bool isConfigTexturableLinearly(GrPixelConfig config) const { return SkToBool(ConfigInfo::kTextureable_Flag & fConfigTable[config].fLinearFlags); } diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp index 17197750ab..1dbc4909ce 100644 --- a/src/gpu/vk/GrVkPipelineState.cpp +++ b/src/gpu/vk/GrVkPipelineState.cpp @@ -209,8 +209,6 @@ static void append_texture_bindings( const GrResourceIOProcessor& processor, SkTArray<const GrResourceIOProcessor::TextureSampler*>* textureBindings, SkTArray<const GrResourceIOProcessor::BufferAccess*>* bufferAccesses) { - // We don't support image storages in VK. - SkASSERT(!processor.numImageStorages()); if (int numTextureSamplers = processor.numTextureSamplers()) { const GrResourceIOProcessor::TextureSampler** bindings = textureBindings->push_back_n(numTextureSamplers); diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp index d9c25198a9..040926e314 100644 --- a/src/gpu/vk/GrVkUniformHandler.cpp +++ b/src/gpu/vk/GrVkUniformHandler.cpp @@ -72,8 +72,6 @@ uint32_t grsltype_to_alignment_mask(GrSLType type) { case kBufferSampler_GrSLType: case kTexture2D_GrSLType: case kSampler_GrSLType: - case kImageStorage2D_GrSLType: - case kIImageStorage2D_GrSLType: break; } SK_ABORT("Unexpected type"); @@ -144,8 +142,6 @@ static inline uint32_t grsltype_to_vk_size(GrSLType type) { case kBufferSampler_GrSLType: case kTexture2D_GrSLType: case kSampler_GrSLType: - case kImageStorage2D_GrSLType: - case kIImageStorage2D_GrSLType: break; } SK_ABORT("Unexpected type"); diff --git a/src/gpu/vk/GrVkUniformHandler.h b/src/gpu/vk/GrVkUniformHandler.h index f6dcbbbd8e..ebe9041789 100644 --- a/src/gpu/vk/GrVkUniformHandler.h +++ b/src/gpu/vk/GrVkUniformHandler.h @@ -88,19 +88,6 @@ private: return fTexelBuffers[handle.toIndex()].fVisibility; } - ImageStorageHandle addImageStorage(uint32_t visibility, GrSLType, GrImageStorageFormat, - GrSLMemoryModel, GrSLRestrict, GrIOType, - const char* name) override { - SK_ABORT("Image storages not implemented for Vulkan."); - return 0; - } - - const GrShaderVar& imageStorageVariable(ImageStorageHandle handle) const override { - SK_ABORT("Image storages not implemented for Vulkan."); - static const GrShaderVar* gVar = nullptr; - return *gVar; - } - void appendUniformDecls(GrShaderFlags, SkString*) const override; bool hasGeometryUniforms() const { return fCurrentGeometryUBOOffset > 0; } diff --git a/src/gpu/vk/GrVkVaryingHandler.cpp b/src/gpu/vk/GrVkVaryingHandler.cpp index ff56a39ce1..307ea53c69 100644 --- a/src/gpu/vk/GrVkVaryingHandler.cpp +++ b/src/gpu/vk/GrVkVaryingHandler.cpp @@ -70,10 +70,6 @@ static inline int grsltype_to_location_size(GrSLType type) { return 0; case kSampler_GrSLType: return 0; - case kImageStorage2D_GrSLType: - return 0; - case kIImageStorage2D_GrSLType: - return 0; } SK_ABORT("Unexpected type"); return -1; |