diff options
45 files changed, 49 insertions, 866 deletions
diff --git a/gn/gpu.gni b/gn/gpu.gni index 91184fbeaf..b47fda9b12 100644 --- a/gn/gpu.gni +++ b/gn/gpu.gni @@ -603,8 +603,6 @@ skia_vk_sources = [ "$_src/gpu/vk/GrVkSemaphore.h", "$_src/gpu/vk/GrVkStencilAttachment.cpp", "$_src/gpu/vk/GrVkStencilAttachment.h", - "$_src/gpu/vk/GrVkTexelBuffer.cpp", - "$_src/gpu/vk/GrVkTexelBuffer.h", "$_src/gpu/vk/GrVkTexture.cpp", "$_src/gpu/vk/GrVkTexture.h", "$_src/gpu/vk/GrVkTextureRenderTarget.cpp", diff --git a/include/gpu/mock/GrMockTypes.h b/include/gpu/mock/GrMockTypes.h index 2d559a95a5..21037b17e6 100644 --- a/include/gpu/mock/GrMockTypes.h +++ b/include/gpu/mock/GrMockTypes.h @@ -62,7 +62,6 @@ struct GrMockOptions { // GrShaderCaps options. bool fGeometryShaderSupport = false; - bool fTexelBufferSupport = false; bool fIntegerSupport = false; bool fFlatInterpolationSupport = false; int fMaxVertexSamplers = 0; diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp index 93e1c7fa8b..d4006e7eef 100644 --- a/src/gpu/GrFragmentProcessor.cpp +++ b/src/gpu/GrFragmentProcessor.cpp @@ -20,7 +20,7 @@ bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that) const { if (this->classID() != that.classID() || - !this->hasSameSamplersAndAccesses(that)) { + !this->hasSameSamplers(that)) { return false; } if (!this->hasSameTransforms(that)) { diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index f2b810252f..1be97cf7c0 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -132,35 +132,22 @@ void GrResourceIOProcessor::addTextureSampler(const TextureSampler* access) { fTextureSamplers.push_back(access); } -void GrResourceIOProcessor::addBufferAccess(const BufferAccess* access) { - fBufferAccesses.push_back(access); -} - void GrResourceIOProcessor::addPendingIOs() const { for (const auto& sampler : fTextureSamplers) { sampler->programProxy()->markPendingIO(); } - for (const auto& buffer : fBufferAccesses) { - buffer->programBuffer()->markPendingIO(); - } } void GrResourceIOProcessor::removeRefs() const { for (const auto& sampler : fTextureSamplers) { sampler->programProxy()->removeRef(); } - for (const auto& buffer : fBufferAccesses) { - buffer->programBuffer()->removeRef(); - } } void GrResourceIOProcessor::pendingIOComplete() const { for (const auto& sampler : fTextureSamplers) { sampler->programProxy()->pendingIOComplete(); } - for (const auto& buffer : fBufferAccesses) { - buffer->programBuffer()->pendingIOComplete(); - } } bool GrResourceIOProcessor::instantiate(GrResourceProvider* resourceProvider) const { @@ -170,14 +157,11 @@ bool GrResourceIOProcessor::instantiate(GrResourceProvider* resourceProvider) co } } - // MDB TODO: instantiate 'fBufferAccesses' here as well - return true; } -bool GrResourceIOProcessor::hasSameSamplersAndAccesses(const GrResourceIOProcessor& that) const { - if (this->numTextureSamplers() != that.numTextureSamplers() || - this->numBuffers() != that.numBuffers()) { +bool GrResourceIOProcessor::hasSameSamplers(const GrResourceIOProcessor& that) const { + if (this->numTextureSamplers() != that.numTextureSamplers()) { return false; } for (int i = 0; i < this->numTextureSamplers(); ++i) { @@ -185,11 +169,6 @@ bool GrResourceIOProcessor::hasSameSamplersAndAccesses(const GrResourceIOProcess return false; } } - for (int i = 0; i < this->numBuffers(); ++i) { - if (this->bufferAccess(i) != that.bufferAccess(i)) { - return false; - } - } return true; } diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h index f8b336d9fb..696ed0a96d 100644 --- a/src/gpu/GrProcessor.h +++ b/src/gpu/GrProcessor.h @@ -197,7 +197,6 @@ private: class GrResourceIOProcessor : public GrProcessor { public: class TextureSampler; - class BufferAccess; int numTextureSamplers() const { return fTextureSamplers.count(); } @@ -205,12 +204,6 @@ public: numTextureSamplers(). */ const TextureSampler& textureSampler(int index) const { return *fTextureSamplers[index]; } - int numBuffers() const { return fBufferAccesses.count(); } - - /** Returns the access pattern for the buffer at index. index must be valid according to - numBuffers(). */ - const BufferAccess& bufferAccess(int index) const { return *fBufferAccesses[index]; } - bool instantiate(GrResourceProvider* resourceProvider) const; protected: @@ -219,13 +212,12 @@ protected: /** * 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. + * TextureSampler 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*); - bool hasSameSamplersAndAccesses(const GrResourceIOProcessor&) const; + bool hasSameSamplers(const GrResourceIOProcessor&) const; // These methods can be used by derived classes that also derive from GrProgramElement. void addPendingIOs() const; @@ -234,7 +226,6 @@ protected: private: SkSTArray<4, const TextureSampler*, true> fTextureSamplers; - SkSTArray<1, const BufferAccess*, true> fBufferAccesses; typedef GrProcessor INHERITED; }; @@ -310,61 +301,4 @@ private: GrShaderFlags fVisibility; }; -/** - * Used to represent a texel buffer that will be read in a GrResourceIOProcessor. It holds a - * GrBuffer along with an associated offset and texel config. - */ -class GrResourceIOProcessor::BufferAccess { -public: - BufferAccess() = default; - BufferAccess(GrPixelConfig texelConfig, GrBuffer* buffer, - GrShaderFlags visibility = kFragment_GrShaderFlag) { - this->reset(texelConfig, buffer, visibility); - } - /** - * This copy constructor is used by GrFragmentProcessor::clone() implementations. The copy - * always takes a new ref on the buffer proxy as the new fragment processor will not yet be - * in pending execution state. - */ - explicit BufferAccess(const BufferAccess& that) { - this->reset(that.fTexelConfig, that.fBuffer.get(), that.fVisibility); - } - - BufferAccess& operator=(const BufferAccess&) = delete; - - /** - * Must be initialized before adding to a GrProcessor's buffer access list. - */ - void reset(GrPixelConfig texelConfig, GrBuffer* buffer, - GrShaderFlags visibility = kFragment_GrShaderFlag) { - fTexelConfig = texelConfig; - fBuffer.set(SkRef(buffer), kRead_GrIOType); - fVisibility = visibility; - } - - bool operator==(const BufferAccess& that) const { - return fTexelConfig == that.fTexelConfig && - this->buffer() == that.buffer() && - fVisibility == that.fVisibility; - } - - bool operator!=(const BufferAccess& that) const { return !(*this == that); } - - GrPixelConfig texelConfig() const { return fTexelConfig; } - GrBuffer* buffer() const { return fBuffer.get(); } - GrShaderFlags visibility() const { return fVisibility; } - - /** - * For internal use by GrProcessor. - */ - const GrGpuResourceRef* programBuffer() const { return &fBuffer;} - -private: - GrPixelConfig fTexelConfig; - GrTGpuResourceRef<GrBuffer> fBuffer; - GrShaderFlags fVisibility; - - typedef SkNoncopyable INHERITED; -}; - #endif diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp index e5da3be6ee..d2dce7c4e5 100644 --- a/src/gpu/GrProgramDesc.cpp +++ b/src/gpu/GrProgramDesc.cpp @@ -58,10 +58,8 @@ static uint16_t sampler_key(GrSLType samplerType, GrPixelConfig config, GrShader static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrResourceIOProcessor& proc, const GrShaderCaps& caps) { int numTextureSamplers = proc.numTextureSamplers(); - int numBuffers = proc.numBuffers(); - int numUniforms = numTextureSamplers + numBuffers; // Need two bytes per key. - int word32Count = (numUniforms + 1) / 2; + int word32Count = (numTextureSamplers + 1) / 2; if (0 == word32Count) { return; } @@ -74,14 +72,9 @@ static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrResourc k16[j] = sampler_key(tex->texturePriv().samplerType(), tex->config(), sampler.visibility(), caps); } - for (int i = 0; i < numBuffers; ++i, ++j) { - const GrResourceIOProcessor::BufferAccess& access = proc.bufferAccess(i); - k16[j] = sampler_key(kBufferSampler_GrSLType, access.texelConfig(), access.visibility(), - caps); - } - // zero the last 16 bits if the number of uniforms for samplers and image storages is odd. - if (numUniforms & 0x1) { - k16[numUniforms] = 0; + // zero the last 16 bits if the number of uniforms for samplers is odd. + if (numTextureSamplers & 0x1) { + k16[numTextureSamplers] = 0; } } diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp index 486909e028..10f04813ca 100644 --- a/src/gpu/GrShaderCaps.cpp +++ b/src/gpu/GrShaderCaps.cpp @@ -22,7 +22,6 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { fDstReadInShaderSupport = false; fDualSourceBlendingSupport = false; fIntegerSupport = false; - fTexelBufferSupport = false; fImageLoadStoreSupport = false; fDropsTileOnZeroDivide = false; fFBFetchSupport = false; @@ -44,7 +43,6 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { fPreferFlatInterpolation = false; fNoPerspectiveInterpolationSupport = false; fExternalTextureSupport = false; - fTexelFetchSupport = false; fVertexIDSupport = false; fFPManipulationSupport = false; fFloatIs32Bits = true; @@ -58,7 +56,6 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { fSecondaryOutputExtensionString = nullptr; fExternalTextureExtensionString = nullptr; fSecondExternalTextureExtensionString = nullptr; - fTexelBufferExtensionString = nullptr; fNoPerspectiveInterpolationExtensionString = nullptr; fFBFetchColorName = nullptr; fFBFetchExtensionString = nullptr; @@ -84,7 +81,6 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const { writer->appendBool("Dst Read In Shader Support", fDstReadInShaderSupport); writer->appendBool("Dual Source Blending Support", fDualSourceBlendingSupport); writer->appendBool("Integer Support", fIntegerSupport); - writer->appendBool("Texel Buffer Support", fTexelBufferSupport); writer->appendBool("Image Load Store Support", fImageLoadStoreSupport); static const char* kAdvBlendEqInteractionStr[] = { @@ -118,7 +114,6 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const { writer->appendBool("Prefer flat interpolation", fPreferFlatInterpolation); writer->appendBool("No perspective interpolation support", fNoPerspectiveInterpolationSupport); writer->appendBool("External texture support", fExternalTextureSupport); - writer->appendBool("texelFetch support", fTexelFetchSupport); writer->appendBool("sk_VertexID support", fVertexIDSupport); writer->appendBool("Floating point manipulation support", fFPManipulationSupport); writer->appendBool("float == fp32", fFloatIs32Bits); diff --git a/src/gpu/GrShaderCaps.h b/src/gpu/GrShaderCaps.h index e16c9f6d5b..7985a741c9 100644 --- a/src/gpu/GrShaderCaps.h +++ b/src/gpu/GrShaderCaps.h @@ -48,7 +48,6 @@ public: bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } bool integerSupport() const { return fIntegerSupport; } - bool texelBufferSupport() const { return fTexelBufferSupport; } int imageLoadStoreSupport() const { return fImageLoadStoreSupport; } /** @@ -76,8 +75,6 @@ public: bool externalTextureSupport() const { return fExternalTextureSupport; } - bool texelFetchSupport() const { return fTexelFetchSupport; } - bool vertexIDSupport() const { return fVertexIDSupport; } // frexp, ldexp, etc. @@ -190,11 +187,6 @@ public: return fSecondExternalTextureExtensionString; } - const char* texelBufferExtensionString() const { - SkASSERT(this->texelBufferSupport()); - return fTexelBufferExtensionString; - } - const char* noperspectiveInterpolationExtensionString() const { SkASSERT(this->noperspectiveInterpolationSupport()); return fNoPerspectiveInterpolationExtensionString; @@ -250,7 +242,6 @@ private: bool fDstReadInShaderSupport : 1; bool fDualSourceBlendingSupport : 1; bool fIntegerSupport : 1; - bool fTexelBufferSupport : 1; bool fImageLoadStoreSupport : 1; bool fDropsTileOnZeroDivide : 1; bool fFBFetchSupport : 1; @@ -260,7 +251,6 @@ private: bool fPreferFlatInterpolation : 1; bool fNoPerspectiveInterpolationSupport : 1; bool fExternalTextureSupport : 1; - bool fTexelFetchSupport : 1; bool fVertexIDSupport : 1; bool fFPManipulationSupport : 1; bool fFloatIs32Bits : 1; @@ -289,7 +279,6 @@ private: const char* fSecondaryOutputExtensionString; const char* fExternalTextureExtensionString; const char* fSecondExternalTextureExtensionString; - const char* fTexelBufferExtensionString; const char* fNoPerspectiveInterpolationExtensionString; const char* fImageLoadStoreExtensionString; diff --git a/src/gpu/gl/GrGLBuffer.cpp b/src/gpu/gl/GrGLBuffer.cpp index 074dc662bf..6f47bbb1dd 100644 --- a/src/gpu/gl/GrGLBuffer.cpp +++ b/src/gpu/gl/GrGLBuffer.cpp @@ -139,7 +139,6 @@ void GrGLBuffer::onRelease() { GL_CALL(DeleteBuffers(1, &fBufferID)); fBufferID = 0; fGLSizeInBytes = 0; - this->glGpu()->notifyBufferReleased(this); } fMapPtr = nullptr; VALIDATE(); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index f120b6d09d..8525a7b2b5 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -786,31 +786,6 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli } if (kGL_GrGLStandard == standard) { - shaderCaps->fTexelFetchSupport = ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; - } else { - shaderCaps->fTexelFetchSupport = - ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; // We use this value for GLSL ES 3.0. - } - - if (shaderCaps->fTexelFetchSupport) { - if (kGL_GrGLStandard == standard) { - shaderCaps->fTexelBufferSupport = ctxInfo.version() >= GR_GL_VER(3, 1) && - ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; - } else { - if (ctxInfo.version() >= GR_GL_VER(3, 2) && - ctxInfo.glslGeneration() >= k320es_GrGLSLGeneration) { - shaderCaps->fTexelBufferSupport = true; - } else if (ctxInfo.hasExtension("GL_OES_texture_buffer")) { - shaderCaps->fTexelBufferSupport = true; - shaderCaps->fTexelBufferExtensionString = "GL_OES_texture_buffer"; - } else if (ctxInfo.hasExtension("GL_EXT_texture_buffer")) { - shaderCaps->fTexelBufferSupport = true; - shaderCaps->fTexelBufferExtensionString = "GL_EXT_texture_buffer"; - } - } - } - - if (kGL_GrGLStandard == standard) { shaderCaps->fVertexIDSupport = true; } else { // Desktop GLSL 3.30 == ES GLSL 3.00. @@ -1396,8 +1371,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, ctxInfo.hasExtension("GL_EXT_texture_storage"); } - bool texelBufferSupport = this->shaderCaps()->texelBufferSupport(); - bool textureRedSupport = false; if (!disableTextureRedForMesa) { @@ -1436,9 +1409,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, if (texStorageSupported) { fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; } - if (texelBufferSupport) { - fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; - } fConfigTable[kRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); fConfigTable[kRGB_888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGB; @@ -1678,9 +1648,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, if (texStorageSupported) { fConfigTable[kRGBA_1010102_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; } - if (texelBufferSupport) { - fConfigTable[kRGBA_1010102_GrPixelConfig].fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; - } fConfigTable[kRGBA_1010102_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); bool alpha8IsValidForGL = kGL_GrGLStandard == standard && @@ -1718,10 +1685,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, if (textureRedSupport) { redInfo.fFlags |= ConfigInfo::kTextureable_Flag | allRenderFlags; - if (texelBufferSupport) { - redInfo.fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; - } - fConfigTable[kAlpha_8_GrPixelConfig] = redInfo; } else { redInfo.fFlags = 0; @@ -1768,9 +1731,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, } if (textureRedSupport) { - if (texelBufferSupport) { - grayRedInfo.fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; - } fConfigTable[kGray_8_GrPixelConfig] = grayRedInfo; } else { grayRedInfo.fFlags = 0; @@ -1830,9 +1790,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, if (texStorageSupported) { fConfigTable[fpconfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; } - if (texelBufferSupport) { - fConfigTable[fpconfig].fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; - } fConfigTable[fpconfig].fSwizzle = GrSwizzle::RGBA(); } @@ -1860,10 +1817,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, if (texStorageSupported && !isCommandBufferES2) { redHalf.fFlags |= ConfigInfo::kCanUseTexStorage_Flag; } - - if (texelBufferSupport) { - redHalf.fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; - } } fConfigTable[kAlpha_half_GrPixelConfig] = redHalf; @@ -1888,9 +1841,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, if (texStorageSupported) { fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; } - if (texelBufferSupport) { - fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag; - } fConfigTable[kRGBA_half_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); // Bulk populate the texture internal/external formats here and then deal with exceptions below. diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index b9c19c7c65..75bc4801e2 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -133,10 +133,6 @@ public: return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kCanUseTexStorage_Flag); } - bool canUseConfigWithTexelBuffer(GrPixelConfig config) const { - return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kCanUseWithTexelBuffer_Flag); - } - /** Returns the mapping between GrPixelConfig components and GL internal format components. */ const GrSwizzle& configSwizzle(GrPixelConfig config) const { return fConfigTable[config].fSwizzle; @@ -595,7 +591,6 @@ private: still attach it to a FBO for blitting or reading pixels. */ kFBOColorAttachment_Flag = 0x8, kCanUseTexStorage_Flag = 0x10, - kCanUseWithTexelBuffer_Flag = 0x20, }; uint32_t fFlags; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 58aad4d18e..18ff4c670f 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -207,7 +207,6 @@ GrGLGpu::GrGLGpu(std::unique_ptr<GrGLContext> ctx, GrContext* context) , fTempSrcFBOID(0) , fTempDstFBOID(0) , fStencilClearFBOID(0) - , fHWMaxUsedBufferTextureUnit(-1) , fHWMinSampleShading(0.0) { SkASSERT(fGLContext); fCaps = sk_ref_sp(fGLContext->caps()); @@ -232,10 +231,6 @@ GrGLGpu::GrGLGpu(std::unique_ptr<GrGLContext> ctx, GrContext* context) } GR_STATIC_ASSERT(6 == SK_ARRAY_COUNT(fHWBufferState)); - if (this->caps()->shaderCaps()->texelBufferSupport()) { - fHWBufferTextures.reset(this->caps()->shaderCaps()->maxCombinedSamplers()); - } - if (this->glCaps().shaderCaps()->pathRenderingSupport()) { fPathRendering.reset(new GrGLPathRendering(this)); } @@ -438,10 +433,6 @@ void GrGLGpu::onResetContext(uint32_t resetBits) { for (int s = 0; s < fHWBoundTextureUniqueIDs.count(); ++s) { fHWBoundTextureUniqueIDs[s].makeInvalid(); } - for (int b = 0; b < fHWBufferTextures.count(); ++b) { - SkASSERT(this->caps()->shaderCaps()->texelBufferSupport()); - fHWBufferTextures[b].fKnownBound = false; - } } if (resetBits & kBlend_GrGLBackendState) { @@ -1834,32 +1825,6 @@ GrGLenum GrGLGpu::bindBuffer(GrBufferType type, const GrBuffer* buffer) { return bufferState.fGLTarget; } - -void GrGLGpu::notifyBufferReleased(const GrGLBuffer* buffer) { - if (buffer->hasAttachedToTexture()) { - // Detach this buffer from any textures to ensure the underlying memory is freed. - GrGpuResource::UniqueID uniqueID = buffer->uniqueID(); - for (int i = fHWMaxUsedBufferTextureUnit; i >= 0; --i) { - auto& buffTex = fHWBufferTextures[i]; - if (uniqueID != buffTex.fAttachedBufferUniqueID) { - continue; - } - if (i == fHWMaxUsedBufferTextureUnit) { - --fHWMaxUsedBufferTextureUnit; - } - - this->setTextureUnit(i); - if (!buffTex.fKnownBound) { - SkASSERT(buffTex.fTextureID); - GL_CALL(BindTexture(GR_GL_TEXTURE_BUFFER, buffTex.fTextureID)); - buffTex.fKnownBound = true; - } - GL_CALL(TexBuffer(GR_GL_TEXTURE_BUFFER, - this->glCaps().configSizedInternalFormat(buffTex.fTexelConfig), 0)); - } - } -} - void GrGLGpu::disableScissor() { if (kNo_TriState != fHWScissorSettings.fEnabled) { GL_CALL(Disable(GR_GL_SCISSOR_TEST)); @@ -2801,50 +2766,6 @@ void GrGLGpu::bindTexture(int unitIdx, const GrSamplerState& samplerState, GrGLT texture->setCachedTexParams(newTexParams, this->getResetTimestamp()); } -void GrGLGpu::bindTexelBuffer(int unitIdx, GrPixelConfig texelConfig, GrGLBuffer* buffer) { - SkASSERT(this->glCaps().canUseConfigWithTexelBuffer(texelConfig)); - SkASSERT(unitIdx >= 0 && unitIdx < fHWBufferTextures.count()); - - BufferTexture& buffTex = fHWBufferTextures[unitIdx]; - - if (!buffTex.fKnownBound) { - if (!buffTex.fTextureID) { - GL_CALL(GenTextures(1, &buffTex.fTextureID)); - if (!buffTex.fTextureID) { - return; - } - } - - this->setTextureUnit(unitIdx); - GL_CALL(BindTexture(GR_GL_TEXTURE_BUFFER, buffTex.fTextureID)); - - buffTex.fKnownBound = true; - } - - if (buffer->uniqueID() != buffTex.fAttachedBufferUniqueID || - buffTex.fTexelConfig != texelConfig) { - - this->setTextureUnit(unitIdx); - GL_CALL(TexBuffer(GR_GL_TEXTURE_BUFFER, - this->glCaps().configSizedInternalFormat(texelConfig), - buffer->bufferID())); - - buffTex.fTexelConfig = texelConfig; - buffTex.fAttachedBufferUniqueID = buffer->uniqueID(); - - if (this->glCaps().textureSwizzleSupport() && - this->glCaps().configSwizzle(texelConfig) != buffTex.fSwizzle) { - GrGLenum glSwizzle[4]; - get_tex_param_swizzle(texelConfig, this->glCaps(), glSwizzle); - this->setTextureSwizzle(unitIdx, GR_GL_TEXTURE_BUFFER, glSwizzle); - buffTex.fSwizzle = this->glCaps().configSwizzle(texelConfig); - } - - buffer->setHasAttachedToTexture(); - fHWMaxUsedBufferTextureUnit = SkTMax(unitIdx, fHWMaxUsedBufferTextureUnit); - } -} - void GrGLGpu::setTextureSwizzle(int unitIdx, GrGLenum target, const GrGLenum swizzle[]) { this->setTextureUnit(unitIdx); if (this->glStandard() == kGLES_GrGLStandard) { diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index 5817b56687..78ae024306 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -56,8 +56,6 @@ public: // Used by GrGLProgram to configure OpenGL state. void bindTexture(int unitIdx, const GrSamplerState& samplerState, GrGLTexture* texture); - void bindTexelBuffer(int unitIdx, GrPixelConfig, GrGLBuffer*); - // These functions should be used to bind GL objects. They track the GL state and skip redundant // bindings. Making the equivalent glBind calls directly will confuse the state tracking. void bindVertexArray(GrGLuint id) { @@ -76,9 +74,6 @@ public: // If the caller wishes to bind an index buffer to a specific VAO, it can call glBind directly. GrGLenum bindBuffer(GrBufferType type, const GrBuffer*); - // Called by GrGLBuffer after its buffer object has been destroyed. - void notifyBufferReleased(const GrGLBuffer*); - // The GrGLGpuRTCommandBuffer does not buffer up draws before submitting them to the gpu. // Thus this is the implementation of the draw call for the corresponding passthrough function // on GrGLRTGpuCommandBuffer. @@ -573,21 +568,6 @@ private: GrGLuint fBoundDrawFramebuffer = 0; - struct BufferTexture { - BufferTexture() : fTextureID(0), fKnownBound(false), - fAttachedBufferUniqueID(SK_InvalidUniqueID), - fSwizzle(GrSwizzle::RGBA()) {} - - GrGLuint fTextureID; - bool fKnownBound; - GrPixelConfig fTexelConfig; - GrGpuResource::UniqueID fAttachedBufferUniqueID; - GrSwizzle fSwizzle; - }; - - SkTArray<BufferTexture, true> fHWBufferTextures; - int fHWMaxUsedBufferTextureUnit; - // EXT_raster_multisample. TriState fHWRasterMultisampleEnabled; int fHWNumRasterSamples; diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 2a876d0851..52d53bde95 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -31,7 +31,6 @@ GrGLProgram::GrGLProgram( GrGLuint programID, const UniformInfoArray& uniforms, const UniformInfoArray& textureSamplers, - const UniformInfoArray& texelBuffers, const VaryingInfoArray& pathProcVaryings, std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor, std::unique_ptr<GrGLSLXferProcessor> xferProcessor, @@ -55,12 +54,10 @@ GrGLProgram::GrGLProgram( , fInstanceStride(instanceStride) , fGpu(gpu) , fProgramDataManager(gpu, programID, uniforms, pathProcVaryings) - , fNumTextureSamplers(textureSamplers.count()) - , fNumTexelBuffers(texelBuffers.count()) { + , fNumTextureSamplers(textureSamplers.count()) { // Assign texture units to sampler uniforms one time up front. GL_CALL(UseProgram(fProgramID)); fProgramDataManager.setSamplerUniforms(textureSamplers, 0); - fProgramDataManager.setSamplerUniforms(texelBuffers, fNumTextureSamplers); } GrGLProgram::~GrGLProgram() { @@ -82,15 +79,14 @@ void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline // of GLProgram determine how to set coord transforms // 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. - // Within each group we will bind them in primProc, fragProcs, XP order. + // GrGLProgramDataManager. That is, we bind textures for processors in this order: + // primProc, fragProcs, XP. int nextTexSamplerIdx = 0; - int nextTexelBufferIdx = fNumTextureSamplers; fPrimitiveProcessor->setData(fProgramDataManager, primProc, GrFragmentProcessor::CoordTransformIter(pipeline)); - this->bindTextures(primProc, &nextTexSamplerIdx, &nextTexelBufferIdx); + this->bindTextures(primProc, &nextTexSamplerIdx); - this->setFragmentData(primProc, pipeline, &nextTexSamplerIdx, &nextTexelBufferIdx); + this->setFragmentData(primProc, pipeline, &nextTexSamplerIdx); const GrXferProcessor& xp = pipeline.getXferProcessor(); SkIPoint offset; @@ -102,7 +98,6 @@ void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline static_cast<GrGLTexture*>(dstTexture)); } SkASSERT(nextTexSamplerIdx == fNumTextureSamplers); - SkASSERT(nextTexelBufferIdx == fNumTextureSamplers + fNumTexelBuffers); } void GrGLProgram::generateMipmaps(const GrPrimitiveProcessor& primProc, @@ -117,15 +112,14 @@ void GrGLProgram::generateMipmaps(const GrPrimitiveProcessor& primProc, void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline, - int* nextTexSamplerIdx, - int* nextTexelBufferIdx) { + int* nextTexSamplerIdx) { GrFragmentProcessor::Iter iter(pipeline); GrGLSLFragmentProcessor::Iter glslIter(fFragmentProcessors.get(), fFragmentProcessorCnt); const GrFragmentProcessor* fp = iter.next(); GrGLSLFragmentProcessor* glslFP = glslIter.next(); while (fp && glslFP) { glslFP->setData(fProgramDataManager, *fp); - this->bindTextures(*fp, nextTexSamplerIdx, nextTexelBufferIdx); + this->bindTextures(*fp, nextTexSamplerIdx); fp = iter.next(); glslFP = glslIter.next(); } @@ -164,18 +158,12 @@ void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, } void GrGLProgram::bindTextures(const GrResourceIOProcessor& processor, - int* nextTexSamplerIdx, - int* nextTexelBufferIdx) { + int* nextTexSamplerIdx) { for (int i = 0; i < processor.numTextureSamplers(); ++i) { const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i); fGpu->bindTexture((*nextTexSamplerIdx)++, sampler.samplerState(), static_cast<GrGLTexture*>(sampler.peekTexture())); } - for (int i = 0; i < processor.numBuffers(); ++i) { - const GrResourceIOProcessor::BufferAccess& access = processor.bufferAccess(i); - fGpu->bindTexelBuffer((*nextTexelBufferIdx)++, access.texelConfig(), - static_cast<GrGLBuffer*>(access.buffer())); - } } void GrGLProgram::generateMipmaps(const GrResourceIOProcessor& processor) { diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index ca4eddce4b..a8a3391adc 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -51,7 +51,6 @@ public: GrGLuint programID, const UniformInfoArray& uniforms, const UniformInfoArray& textureSamplers, - const UniformInfoArray& texelBuffers, const VaryingInfoArray&, // used for NVPR only currently std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor, std::unique_ptr<GrGLSLXferProcessor> xferProcessor, @@ -141,14 +140,13 @@ public: private: // A helper to loop over effects, set the transforms (via subclass) and bind textures - void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&, int* nextTexSamplerIdx, - int* nextTexelBufferIdx); + void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&, int* nextTexSamplerIdx); // 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&, int* nextSamplerIdx, int* nextTexelBufferIdx); + // Helper for setData() that binds textures to the appropriate texture units + void bindTextures(const GrResourceIOProcessor&, int* nextSamplerIdx); // Helper for generateMipmaps() that ensures mipmaps are up to date void generateMipmaps(const GrResourceIOProcessor&); @@ -174,7 +172,6 @@ private: GrGLProgramDataManager fProgramDataManager; int fNumTextureSamplers; - int fNumTexelBuffers; typedef SkRefCnt INHERITED; }; diff --git a/src/gpu/gl/GrGLUniformHandler.cpp b/src/gpu/gl/GrGLUniformHandler.cpp index 39392f996b..81b1ee69ac 100644 --- a/src/gpu/gl/GrGLUniformHandler.cpp +++ b/src/gpu/gl/GrGLUniformHandler.cpp @@ -86,26 +86,6 @@ GrGLSLUniformHandler::SamplerHandle GrGLUniformHandler::addSampler(uint32_t visi return GrGLSLUniformHandler::SamplerHandle(fSamplers.count() - 1); } -GrGLSLUniformHandler::TexelBufferHandle GrGLUniformHandler::addTexelBuffer(uint32_t visibility, - GrSLPrecision precision, - const char* name) { - SkASSERT(name && strlen(name)); - SkASSERT(0 != visibility); - - SkString mangleName; - char prefix = 'u'; - fProgramBuilder->nameVariable(&mangleName, prefix, name, true); - - UniformInfo& texelBuffer = fTexelBuffers.push_back(); - texelBuffer.fVariable.setType(kBufferSampler_GrSLType); - texelBuffer.fVariable.setTypeModifier(GrShaderVar::kUniform_TypeModifier); - texelBuffer.fVariable.setPrecision(precision); - texelBuffer.fVariable.setName(mangleName); - texelBuffer.fLocation = -1; - texelBuffer.fVisibility = visibility; - return GrGLSLUniformHandler::TexelBufferHandle(fTexelBuffers.count() - 1); -} - void GrGLUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const { for (int i = 0; i < fUniforms.count(); ++i) { if (fUniforms[i].fVisibility & visibility) { @@ -119,12 +99,6 @@ void GrGLUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out->append(";\n"); } } - for (int i = 0; i < fTexelBuffers.count(); ++i) { - if (fTexelBuffers[i].fVisibility & visibility) { - fTexelBuffers[i].fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); - out->append(";\n"); - } - } } void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps& caps) { @@ -138,11 +112,6 @@ void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps GL_CALL(BindUniformLocation(programID, currUniform, fSamplers[i].fVariable.c_str())); fSamplers[i].fLocation = currUniform; } - for (int i = 0; i < fTexelBuffers.count(); ++i, ++currUniform) { - GL_CALL(BindUniformLocation(programID, currUniform, - fTexelBuffers[i].fVariable.c_str())); - fTexelBuffers[i].fLocation = currUniform; - } } } @@ -159,12 +128,6 @@ void GrGLUniformHandler::getUniformLocations(GrGLuint programID, const GrGLCaps& GL_CALL_RET(location, GetUniformLocation(programID, fSamplers[i].fVariable.c_str())); fSamplers[i].fLocation = location; } - for (int i = 0; i < fTexelBuffers.count(); ++i) { - GrGLint location; - GL_CALL_RET(location, GetUniformLocation(programID, - fTexelBuffers[i].fVariable.c_str())); - fTexelBuffers[i].fLocation = location; - } } } diff --git a/src/gpu/gl/GrGLUniformHandler.h b/src/gpu/gl/GrGLUniformHandler.h index 74d24bb7b2..d3aa2f8358 100644 --- a/src/gpu/gl/GrGLUniformHandler.h +++ b/src/gpu/gl/GrGLUniformHandler.h @@ -29,8 +29,7 @@ private: explicit GrGLUniformHandler(GrGLSLProgramBuilder* program) : INHERITED(program) , fUniforms(kUniformsPerBlock) - , fSamplers(kUniformsPerBlock) - , fTexelBuffers(kUniformsPerBlock) {} + , fSamplers(kUniformsPerBlock) {} UniformHandle internalAddUniformArray(uint32_t visibility, GrSLType type, @@ -51,13 +50,6 @@ private: return fSamplerSwizzles[handle.toIndex()]; } - TexelBufferHandle addTexelBuffer(uint32_t visibility, GrSLPrecision, - const char* name) override; - - const GrShaderVar& texelBufferVariable(TexelBufferHandle handle) const override { - return fTexelBuffers[handle.toIndex()].fVariable; - } - void appendUniformDecls(GrShaderFlags visibility, SkString*) const override; // Manually set uniform locations for all our uniforms. @@ -74,7 +66,6 @@ private: UniformInfoArray fUniforms; UniformInfoArray fSamplers; SkTArray<GrSwizzle> fSamplerSwizzles; - UniformInfoArray fTexelBuffers; friend class GrGLProgramBuilder; diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 524ffa4e8c..f65ea5b044 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -423,7 +423,6 @@ GrGLProgram* GrGLProgramBuilder::createProgram(GrGLuint programID) { programID, fUniformHandler.fUniforms, fUniformHandler.fSamplers, - fUniformHandler.fTexelBuffers, fVaryingHandler.fPathProcVaryingInfos, std::move(fGeometryProcessor), std::move(fXferProcessor), 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, diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h index 3f301ea51c..1ea339bb26 100644 --- a/src/gpu/mock/GrMockCaps.h +++ b/src/gpu/mock/GrMockCaps.h @@ -25,7 +25,6 @@ public: fShaderCaps.reset(new GrShaderCaps(contextOptions)); fShaderCaps->fGeometryShaderSupport = options.fGeometryShaderSupport; - fShaderCaps->fTexelBufferSupport = options.fTexelBufferSupport; fShaderCaps->fIntegerSupport = options.fIntegerSupport; fShaderCaps->fFlatInterpolationSupport = options.fFlatInterpolationSupport; fShaderCaps->fMaxVertexSamplers = options.fMaxVertexSamplers; diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm index 1bb3fb26bf..d3dc54369a 100644 --- a/src/gpu/mtl/GrMtlCaps.mm +++ b/src/gpu/mtl/GrMtlCaps.mm @@ -235,8 +235,6 @@ void GrMtlCaps::initShaderCaps() { shaderCaps->fDstReadInShaderSupport = shaderCaps->fFBFetchSupport; shaderCaps->fIntegerSupport = true; - shaderCaps->fTexelBufferSupport = false; - shaderCaps->fTexelFetchSupport = false; shaderCaps->fVertexIDSupport = false; shaderCaps->fImageLoadStoreSupport = false; diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 58a7778b5e..8181569af3 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -392,8 +392,6 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint shaderCaps->fDualSourceBlendingSupport = SkToBool(featureFlags & kDualSrcBlend_GrVkFeatureFlag); shaderCaps->fIntegerSupport = true; - shaderCaps->fTexelBufferSupport = true; - shaderCaps->fTexelFetchSupport = true; shaderCaps->fVertexIDSupport = true; shaderCaps->fFPManipulationSupport = true; diff --git a/src/gpu/vk/GrVkDescriptorSetManager.cpp b/src/gpu/vk/GrVkDescriptorSetManager.cpp index 7d70b337df..b032584378 100644 --- a/src/gpu/vk/GrVkDescriptorSetManager.cpp +++ b/src/gpu/vk/GrVkDescriptorSetManager.cpp @@ -29,15 +29,9 @@ GrVkDescriptorSetManager* GrVkDescriptorSetManager::CreateUniformManager(GrVkGpu GrVkDescriptorSetManager* GrVkDescriptorSetManager::CreateSamplerManager( GrVkGpu* gpu, VkDescriptorType type, const GrVkUniformHandler& uniformHandler) { SkSTArray<4, uint32_t> visibilities; - if (VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER == type) { - for (int i = 0 ; i < uniformHandler.numSamplers(); ++i) { - visibilities.push_back(uniformHandler.samplerVisibility(i)); - } - } else { - SkASSERT(type == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER); - for (int i = 0 ; i < uniformHandler.numTexelBuffers(); ++i) { - visibilities.push_back(uniformHandler.texelBufferVisibility(i)); - } + SkASSERT(type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); + for (int i = 0 ; i < uniformHandler.numSamplers(); ++i) { + visibilities.push_back(uniformHandler.samplerVisibility(i)); } return CreateSamplerManager(gpu, type, visibilities); } @@ -103,24 +97,14 @@ bool GrVkDescriptorSetManager::isCompatible(VkDescriptorType type, return false; } - if (type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) { - if (fBindingVisibilities.count() != uniHandler->numSamplers()) { - return false; - } - for (int i = 0; i < uniHandler->numSamplers(); ++i) { - if (uniHandler->samplerVisibility(i) != fBindingVisibilities[i]) { - return false; - } - } - } else if (VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER == type) { - if (fBindingVisibilities.count() != uniHandler->numTexelBuffers()) { + SkASSERT(type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); + if (fBindingVisibilities.count() != uniHandler->numSamplers()) { + return false; + } + for (int i = 0; i < uniHandler->numSamplers(); ++i) { + if (uniHandler->samplerVisibility(i) != fBindingVisibilities[i]) { return false; } - for (int i = 0; i < uniHandler->numTexelBuffers(); ++i) { - if (uniHandler->texelBufferVisibility(i) != fBindingVisibilities[i]) { - return false; - } - } } return true; } diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 689966a61c..36d65a9215 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -27,7 +27,6 @@ #include "GrVkRenderPass.h" #include "GrVkResourceProvider.h" #include "GrVkSemaphore.h" -#include "GrVkTexelBuffer.h" #include "GrVkTexture.h" #include "GrVkTextureRenderTarget.h" #include "GrVkTransferBuffer.h" @@ -276,11 +275,6 @@ GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter kStream_GrAccessPattern == accessPattern); buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite_Type); break; - case kTexel_GrBufferType: - SkASSERT(kDynamic_GrAccessPattern == accessPattern || - kStatic_GrAccessPattern == accessPattern); - buff = GrVkTexelBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); - break; case kDrawIndirect_GrBufferType: SK_ABORT("DrawIndirect Buffers not supported in vulkan backend."); return nullptr; diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp index 84aa68248c..9080128bef 100644 --- a/src/gpu/vk/GrVkPipelineState.cpp +++ b/src/gpu/vk/GrVkPipelineState.cpp @@ -21,7 +21,6 @@ #include "GrVkPipeline.h" #include "GrVkPipelineLayout.h" #include "GrVkSampler.h" -#include "GrVkTexelBuffer.h" #include "GrVkTexture.h" #include "GrVkUniformBuffer.h" #include "SkMipMap.h" @@ -34,13 +33,11 @@ GrVkPipelineState::GrVkPipelineState( GrVkPipeline* pipeline, VkPipelineLayout layout, const GrVkDescriptorSetManager::Handle& samplerDSHandle, - const GrVkDescriptorSetManager::Handle& texelBufferDSHandle, const GrGLSLBuiltinUniformHandles& builtinUniformHandles, const UniformInfoArray& uniforms, uint32_t geometryUniformSize, uint32_t fragmentUniformSize, uint32_t numSamplers, - uint32_t numTexelBuffers, std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor, std::unique_ptr<GrGLSLXferProcessor> xferProcessor, std::unique_ptr<std::unique_ptr<GrGLSLFragmentProcessor>[]> fragmentProcessors, @@ -49,9 +46,7 @@ GrVkPipelineState::GrVkPipelineState( , fPipelineLayout(new GrVkPipelineLayout(layout)) , fUniformDescriptorSet(nullptr) , fSamplerDescriptorSet(nullptr) - , fTexelBufferDescriptorSet(nullptr) , fSamplerDSHandle(samplerDSHandle) - , fTexelBufferDSHandle(texelBufferDSHandle) , fBuiltinUniformHandles(builtinUniformHandles) , fGeometryProcessor(std::move(geometryProcessor)) , fXferProcessor(std::move(xferProcessor)) @@ -61,8 +56,6 @@ GrVkPipelineState::GrVkPipelineState( fSamplers.setReserve(numSamplers); fTextureViews.setReserve(numSamplers); fTextures.setReserve(numSamplers); - fBufferViews.setReserve(numTexelBuffers); - fTexelBuffers.setReserve(numTexelBuffers); fDescriptorSets[0] = VK_NULL_HANDLE; fDescriptorSets[1] = VK_NULL_HANDLE; @@ -72,7 +65,6 @@ GrVkPipelineState::GrVkPipelineState( fFragmentUniformBuffer.reset(GrVkUniformBuffer::Create(gpu, fragmentUniformSize)); fNumSamplers = numSamplers; - fNumTexelBuffers = numTexelBuffers; } GrVkPipelineState::~GrVkPipelineState() { @@ -82,8 +74,6 @@ GrVkPipelineState::~GrVkPipelineState() { SkASSERT(!fSamplers.count()); SkASSERT(!fTextureViews.count()); SkASSERT(!fTextures.count()); - SkASSERT(!fBufferViews.count()); - SkASSERT(!fTexelBuffers.count()); } void GrVkPipelineState::freeTempResources(const GrVkGpu* gpu) { @@ -101,16 +91,6 @@ void GrVkPipelineState::freeTempResources(const GrVkGpu* gpu) { fTextures[i]->unref(gpu); } fTextures.rewind(); - - for (int i = 0; i < fBufferViews.count(); ++i) { - fBufferViews[i]->unref(gpu); - } - fBufferViews.rewind(); - - for (int i = 0; i < fTexelBuffers.count(); ++i) { - fTexelBuffers[i]->unref(gpu); - } - fTexelBuffers.rewind(); } void GrVkPipelineState::freeGPUResources(const GrVkGpu* gpu) { @@ -142,12 +122,6 @@ void GrVkPipelineState::freeGPUResources(const GrVkGpu* gpu) { fSamplerDescriptorSet = nullptr; } - if (fTexelBufferDescriptorSet) { - fTexelBufferDescriptorSet->recycle(const_cast<GrVkGpu*>(gpu)); - fTexelBufferDescriptorSet = nullptr; - } - - this->freeTempResources(gpu); } @@ -180,16 +154,6 @@ void GrVkPipelineState::abandonGPUResources() { } fTextures.rewind(); - for (int i = 0; i < fBufferViews.count(); ++i) { - fBufferViews[i]->unrefAndAbandon(); - } - fBufferViews.rewind(); - - for (int i = 0; i < fTexelBuffers.count(); ++i) { - fTexelBuffers[i]->unrefAndAbandon(); - } - - fTexelBuffers.rewind(); if (fUniformDescriptorSet) { fUniformDescriptorSet->unrefAndAbandon(); fUniformDescriptorSet = nullptr; @@ -199,17 +163,11 @@ void GrVkPipelineState::abandonGPUResources() { fSamplerDescriptorSet->unrefAndAbandon(); fSamplerDescriptorSet = nullptr; } - - if (fTexelBufferDescriptorSet) { - fTexelBufferDescriptorSet->unrefAndAbandon(); - fTexelBufferDescriptorSet = nullptr; - } } static void append_texture_bindings( const GrResourceIOProcessor& processor, - SkTArray<const GrResourceIOProcessor::TextureSampler*>* textureBindings, - SkTArray<const GrResourceIOProcessor::BufferAccess*>* bufferAccesses) { + SkTArray<const GrResourceIOProcessor::TextureSampler*>* textureBindings) { if (int numTextureSamplers = processor.numTextureSamplers()) { const GrResourceIOProcessor::TextureSampler** bindings = textureBindings->push_back_n(numTextureSamplers); @@ -218,14 +176,6 @@ static void append_texture_bindings( bindings[i] = &processor.textureSampler(i); } while (++i < numTextureSamplers); } - if (int numTexelBuffers = processor.numBuffers()) { - const GrResourceIOProcessor::BufferAccess** accesses = - bufferAccesses->push_back_n(numTexelBuffers); - int i = 0; - do { - accesses[i] = &processor.bufferAccess(i); - } while (++i < numTexelBuffers); - } } void GrVkPipelineState::setData(GrVkGpu* gpu, @@ -238,11 +188,10 @@ void GrVkPipelineState::setData(GrVkGpu* gpu, this->setRenderTargetState(pipeline.proxy()); SkSTArray<8, const GrResourceIOProcessor::TextureSampler*> textureBindings; - SkSTArray<8, const GrResourceIOProcessor::BufferAccess*> bufferAccesses; fGeometryProcessor->setData(fDataManager, primProc, GrFragmentProcessor::CoordTransformIter(pipeline)); - append_texture_bindings(primProc, &textureBindings, &bufferAccesses); + append_texture_bindings(primProc, &textureBindings); GrFragmentProcessor::Iter iter(pipeline); GrGLSLFragmentProcessor::Iter glslIter(fFragmentProcessors.get(), fFragmentProcessorCnt); @@ -250,7 +199,7 @@ void GrVkPipelineState::setData(GrVkGpu* gpu, GrGLSLFragmentProcessor* glslFP = glslIter.next(); while (fp && glslFP) { glslFP->setData(fDataManager, *fp); - append_texture_bindings(*fp, &textureBindings, &bufferAccesses); + append_texture_bindings(*fp, &textureBindings); fp = iter.next(); glslFP = glslIter.next(); } @@ -283,17 +232,6 @@ void GrVkPipelineState::setData(GrVkGpu* gpu, this->writeSamplers(gpu, textureBindings); } - if (fNumTexelBuffers) { - if (fTexelBufferDescriptorSet) { - fTexelBufferDescriptorSet->recycle(gpu); - } - fTexelBufferDescriptorSet = - gpu->resourceProvider().getSamplerDescriptorSet(fTexelBufferDSHandle); - int texelBufferDSIdx = GrVkUniformHandler::kTexelBufferDescSet; - fDescriptorSets[texelBufferDSIdx] = fTexelBufferDescriptorSet->descriptorSet(); - this->writeTexelBuffers(gpu, bufferAccesses); - } - if (fGeometryUniformBuffer || fFragmentUniformBuffer) { if (fDataManager.uploadUniformBuffers(gpu, fGeometryUniformBuffer.get(), @@ -417,49 +355,6 @@ void GrVkPipelineState::writeSamplers( } } -void GrVkPipelineState::writeTexelBuffers( - GrVkGpu* gpu, - const SkTArray<const GrResourceIOProcessor::BufferAccess*>& bufferAccesses) { - SkASSERT(fNumTexelBuffers == bufferAccesses.count()); - - for (int i = 0; i < bufferAccesses.count(); ++i) { - GrPixelConfig config = bufferAccesses[i]->texelConfig(); - VkFormat format; - SkAssertResult(GrPixelConfigToVkFormat(config, &format)); - - GrVkTexelBuffer* buffer = static_cast<GrVkTexelBuffer*>(bufferAccesses[i]->buffer()); - - const GrVkBufferView* bufferView = GrVkBufferView::Create(gpu, buffer->buffer(), - format, buffer->offset(), - buffer->size()); - fBufferViews.push(bufferView); - - const GrVkResource* bufferResource = buffer->resource(); - bufferResource->ref(); - fTexelBuffers.push(bufferResource); - - VkWriteDescriptorSet writeInfo; - memset(&writeInfo, 0, sizeof(VkWriteDescriptorSet)); - writeInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - writeInfo.pNext = nullptr; - writeInfo.dstSet = fDescriptorSets[GrVkUniformHandler::kTexelBufferDescSet]; - writeInfo.dstBinding = i; - writeInfo.dstArrayElement = 0; - writeInfo.descriptorCount = 1; - writeInfo.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER; - writeInfo.pImageInfo = nullptr; - writeInfo.pBufferInfo = nullptr; - VkBufferView vkBufferView = bufferView->bufferView(); - writeInfo.pTexelBufferView = &vkBufferView; - - GR_VK_CALL(gpu->vkInterface(), UpdateDescriptorSets(gpu->device(), - 1, - &writeInfo, - 0, - nullptr)); - } -} - void GrVkPipelineState::setRenderTargetState(const GrRenderTargetProxy* proxy) { GrRenderTarget* rt = proxy->priv().peekRenderTarget(); @@ -499,12 +394,6 @@ void GrVkPipelineState::bind(const GrVkGpu* gpu, GrVkCommandBuffer* commandBuffe dsIndex, 1, &fDescriptorSets[dsIndex], 0, nullptr); } - if (fNumTexelBuffers) { - int dsIndex = GrVkUniformHandler::kTexelBufferDescSet; - commandBuffer->bindDescriptorSets(gpu, this, fPipelineLayout, - dsIndex, 1, - &fDescriptorSets[dsIndex], 0, nullptr); - } } void GrVkPipelineState::addUniformResources(GrVkCommandBuffer& commandBuffer) { @@ -514,9 +403,6 @@ void GrVkPipelineState::addUniformResources(GrVkCommandBuffer& commandBuffer) { if (fSamplerDescriptorSet) { commandBuffer.addRecycledResource(fSamplerDescriptorSet); } - if (fTexelBufferDescriptorSet) { - commandBuffer.addRecycledResource(fTexelBufferDescriptorSet); - } if (fGeometryUniformBuffer.get()) { commandBuffer.addRecycledResource(fGeometryUniformBuffer->resource()); @@ -536,12 +422,4 @@ void GrVkPipelineState::addUniformResources(GrVkCommandBuffer& commandBuffer) { for (int i = 0; i < fTextures.count(); ++i) { commandBuffer.addResource(fTextures[i]); } - - for (int i = 0; i < fBufferViews.count(); ++i) { - commandBuffer.addResource(fBufferViews[i]); - } - - for (int i = 0; i < fTexelBuffers.count(); ++i) { - commandBuffer.addResource(fTexelBuffers[i]); - } } diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h index ee948a8519..a3320e5550 100644 --- a/src/gpu/vk/GrVkPipelineState.h +++ b/src/gpu/vk/GrVkPipelineState.h @@ -43,13 +43,11 @@ public: GrVkPipeline* pipeline, VkPipelineLayout layout, const GrVkDescriptorSetManager::Handle& samplerDSHandle, - const GrVkDescriptorSetManager::Handle& texelBufferDSHandle, const GrGLSLBuiltinUniformHandles& builtinUniformHandles, const UniformInfoArray& uniforms, uint32_t geometryUniformSize, uint32_t fragmentUniformSize, uint32_t numSamplers, - uint32_t numTexelBuffers, std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor, std::unique_ptr<GrGLSLXferProcessor> xferProcessor, std::unique_ptr<std::unique_ptr<GrGLSLFragmentProcessor>[]> fragmentProcessors, @@ -78,10 +76,6 @@ private: GrVkGpu* gpu, const SkTArray<const GrResourceIOProcessor::TextureSampler*>& textureBindings); - void writeTexelBuffers( - GrVkGpu* gpu, - const SkTArray<const GrResourceIOProcessor::BufferAccess*>& bufferAccesses); - /** * We use the RT's size and origin to adjust from Skia device space to vulkan normalized device * space and to make device space positions have the correct origin for processors that require @@ -137,10 +131,8 @@ private: const GrVkDescriptorSet* fUniformDescriptorSet; const GrVkDescriptorSet* fSamplerDescriptorSet; - const GrVkDescriptorSet* fTexelBufferDescriptorSet; const GrVkDescriptorSetManager::Handle fSamplerDSHandle; - const GrVkDescriptorSetManager::Handle fTexelBufferDSHandle; std::unique_ptr<GrVkUniformBuffer> fGeometryUniformBuffer; std::unique_ptr<GrVkUniformBuffer> fFragmentUniformBuffer; @@ -150,10 +142,6 @@ private: SkTDArray<const GrVkImageView*> fTextureViews; SkTDArray<const GrVkResource*> fTextures; - // GrVkResource used for TexelBuffers - SkTDArray<const GrVkBufferView*> fBufferViews; - SkTDArray<const GrVkResource*> fTexelBuffers; - // Tracks the current render target uniforms stored in the vertex buffer. RenderTargetState fRenderTargetState; GrGLSLBuiltinUniformHandles fBuiltinUniformHandles; @@ -167,7 +155,6 @@ private: GrVkPipelineStateDataManager fDataManager; int fNumSamplers; - int fNumTexelBuffers; }; #endif diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp index c4c748ba9c..91685c6016 100644 --- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp +++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp @@ -90,7 +90,7 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s GrPrimitiveType primitiveType, const GrVkRenderPass& renderPass, Desc* desc) { - VkDescriptorSetLayout dsLayout[3]; + VkDescriptorSetLayout dsLayout[2]; VkPipelineLayout pipelineLayout; VkShaderModule vertShaderModule = VK_NULL_HANDLE; VkShaderModule geomShaderModule = VK_NULL_HANDLE; @@ -106,19 +106,13 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s dsLayout[GrVkUniformHandler::kSamplerDescSet] = resourceProvider.getSamplerDSLayout(samplerDSHandle); - GrVkDescriptorSetManager::Handle texelBufferDSHandle; - resourceProvider.getSamplerDescriptorSetHandle(VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, - fUniformHandler, &texelBufferDSHandle); - dsLayout[GrVkUniformHandler::kTexelBufferDescSet] = - resourceProvider.getSamplerDSLayout(texelBufferDSHandle); - // Create the VkPipelineLayout VkPipelineLayoutCreateInfo layoutCreateInfo; memset(&layoutCreateInfo, 0, sizeof(VkPipelineLayoutCreateFlags)); layoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; layoutCreateInfo.pNext = 0; layoutCreateInfo.flags = 0; - layoutCreateInfo.setLayoutCount = 3; + layoutCreateInfo.setLayoutCount = 2; layoutCreateInfo.pSetLayouts = dsLayout; layoutCreateInfo.pushConstantRangeCount = 0; layoutCreateInfo.pPushConstantRanges = nullptr; @@ -197,13 +191,11 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s pipeline, pipelineLayout, samplerDSHandle, - texelBufferDSHandle, fUniformHandles, fUniformHandler.fUniforms, fUniformHandler.fCurrentGeometryUBOOffset, fUniformHandler.fCurrentFragmentUBOOffset, (uint32_t)fUniformHandler.numSamplers(), - (uint32_t)fUniformHandler.numTexelBuffers(), std::move(fGeometryProcessor), std::move(fXferProcessor), std::move(fFragmentProcessors), diff --git a/src/gpu/vk/GrVkTexelBuffer.cpp b/src/gpu/vk/GrVkTexelBuffer.cpp deleted file mode 100644 index 501706cfb5..0000000000 --- a/src/gpu/vk/GrVkTexelBuffer.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "GrVkTexelBuffer.h" - -#include "GrVkGpu.h" - -GrVkTexelBuffer::GrVkTexelBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& desc, - const GrVkBuffer::Resource* bufferResource) - : INHERITED(gpu, desc.fSizeInBytes, kTexel_GrBufferType, - kDynamic_GrAccessPattern) - , GrVkBuffer(desc, bufferResource) { - this->registerWithCache(SkBudgeted::kYes); -} - -GrVkTexelBuffer* GrVkTexelBuffer::Create(GrVkGpu* gpu, size_t size, bool dynamic) { - GrVkBuffer::Desc desc; - desc.fDynamic = dynamic; - desc.fType = GrVkBuffer::kTexel_Type; - desc.fSizeInBytes = size; - - const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc); - if (!bufferResource) { - return nullptr; - } - GrVkTexelBuffer* buffer = new GrVkTexelBuffer(gpu, desc, bufferResource); - if (!buffer) { - bufferResource->unref(gpu); - } - return buffer; -} - -void GrVkTexelBuffer::onRelease() { - if (!this->wasDestroyed()) { - this->vkRelease(this->getVkGpu()); - } - - INHERITED::onRelease(); -} - -void GrVkTexelBuffer::onAbandon() { - this->vkAbandon(); - INHERITED::onAbandon(); -} - -void GrVkTexelBuffer::onMap() { - if (!this->wasDestroyed()) { - this->GrBuffer::fMapPtr = this->vkMap(this->getVkGpu()); - } -} - -void GrVkTexelBuffer::onUnmap() { - if (!this->wasDestroyed()) { - this->vkUnmap(this->getVkGpu()); - } -} - -bool GrVkTexelBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) { - if (!this->wasDestroyed()) { - return this->vkUpdateData(this->getVkGpu(), src, srcSizeInBytes); - } else { - return false; - } -} - -GrVkGpu* GrVkTexelBuffer::getVkGpu() const { - SkASSERT(!this->wasDestroyed()); - return static_cast<GrVkGpu*>(this->getGpu()); -} diff --git a/src/gpu/vk/GrVkTexelBuffer.h b/src/gpu/vk/GrVkTexelBuffer.h deleted file mode 100644 index 0ca114d63e..0000000000 --- a/src/gpu/vk/GrVkTexelBuffer.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrVkTexelBuffer_DEFINED -#define GrVkTexelBuffer_DEFINED - -#include "GrBuffer.h" -#include "GrVkBuffer.h" - -class GrVkGpu; - -class GrVkTexelBuffer : public GrBuffer, public GrVkBuffer { -public: - static GrVkTexelBuffer* Create(GrVkGpu* gpu, size_t size, bool dynamic); - -protected: - void onAbandon() override; - void onRelease() override; - -private: - GrVkTexelBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& desc, - const GrVkBuffer::Resource* resource); - - void onMap() override; - void onUnmap() override; - bool onUpdateData(const void* src, size_t srcSizeInBytes) override; - - GrVkGpu* getVkGpu() const; - - typedef GrBuffer INHERITED; -}; - -#endif diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp index 72b350983b..d92d8d2fd6 100644 --- a/src/gpu/vk/GrVkUniformHandler.cpp +++ b/src/gpu/vk/GrVkUniformHandler.cpp @@ -263,32 +263,6 @@ GrGLSLUniformHandler::SamplerHandle GrVkUniformHandler::addSampler(uint32_t visi return GrGLSLUniformHandler::SamplerHandle(fSamplers.count() - 1); } -GrGLSLUniformHandler::TexelBufferHandle GrVkUniformHandler::addTexelBuffer(uint32_t visibility, - GrSLPrecision precision, - const char* name) { - SkASSERT(name && strlen(name)); - SkDEBUGCODE(static const uint32_t kVisMask = kVertex_GrShaderFlag | - kGeometry_GrShaderFlag | - kFragment_GrShaderFlag); - SkASSERT(0 == (~kVisMask & visibility)); - SkASSERT(0 != visibility); - SkString mangleName; - char prefix = 'u'; - fProgramBuilder->nameVariable(&mangleName, prefix, name, true); - - UniformInfo& info = fTexelBuffers.push_back(); - info.fVariable.setType(kBufferSampler_GrSLType); - info.fVariable.setTypeModifier(GrShaderVar::kUniform_TypeModifier); - info.fVariable.setPrecision(precision); - info.fVariable.setName(mangleName); - SkString layoutQualifier; - layoutQualifier.appendf("set=%d, binding=%d", kTexelBufferDescSet, fTexelBuffers.count()- 1); - info.fVariable.addLayoutQualifier(layoutQualifier.c_str()); - info.fVisibility = visibility; - info.fUBOffset = 0; - return GrGLSLUniformHandler::TexelBufferHandle(fTexelBuffers.count() - 1); -} - void GrVkUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const { SkASSERT(kVertex_GrShaderFlag == visibility || kGeometry_GrShaderFlag == visibility || @@ -303,14 +277,6 @@ void GrVkUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* } } - for (int i = 0; i < fTexelBuffers.count(); ++i) { - const UniformInfo& texelBuffer = fTexelBuffers[i]; - if (visibility == texelBuffer.fVisibility) { - texelBuffer.fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); - out->append(";\n"); - } - } - #ifdef SK_DEBUG bool firstGeomOffsetCheck = false; bool firstFragOffsetCheck = false; diff --git a/src/gpu/vk/GrVkUniformHandler.h b/src/gpu/vk/GrVkUniformHandler.h index ebe9041789..7653abea67 100644 --- a/src/gpu/vk/GrVkUniformHandler.h +++ b/src/gpu/vk/GrVkUniformHandler.h @@ -19,7 +19,6 @@ public: enum { kUniformBufferDescSet = 0, kSamplerDescSet = 1, - kTexelBufferDescSet = 2, }; enum { kGeometryBinding = 0, @@ -47,7 +46,6 @@ private: : INHERITED(program) , fUniforms(kUniformsPerBlock) , fSamplers(kUniformsPerBlock) - , fTexelBuffers(kUniformsPerBlock) , fCurrentGeometryUBOOffset(0) , fCurrentFragmentUBOOffset(0) { } @@ -77,17 +75,6 @@ private: return fSamplers[handle.toIndex()].fVisibility; } - TexelBufferHandle addTexelBuffer(uint32_t visibility, GrSLPrecision, - const char* name) override; - - int numTexelBuffers() const { return fTexelBuffers.count(); } - const GrShaderVar& texelBufferVariable(TexelBufferHandle handle) const override { - return fTexelBuffers[handle.toIndex()].fVariable; - } - uint32_t texelBufferVisibility(TexelBufferHandle handle) const { - return fTexelBuffers[handle.toIndex()].fVisibility; - } - void appendUniformDecls(GrShaderFlags, SkString*) const override; bool hasGeometryUniforms() const { return fCurrentGeometryUBOOffset > 0; } @@ -102,7 +89,6 @@ private: UniformInfoArray fUniforms; UniformInfoArray fSamplers; SkTArray<GrSwizzle> fSamplerSwizzles; - UniformInfoArray fTexelBuffers; uint32_t fCurrentGeometryUBOOffset; uint32_t fCurrentFragmentUBOOffset; diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp index 5a54b07333..ba1476e275 100644 --- a/src/sksl/SkSLIRGenerator.cpp +++ b/src/sksl/SkSLIRGenerator.cpp @@ -131,7 +131,6 @@ static void fill_caps(const SKSL_CAPS_CLASS& caps, CAP(flatInterpolationSupport); CAP(noperspectiveInterpolationSupport); CAP(externalTextureSupport); - CAP(texelFetchSupport); CAP(imageLoadStoreSupport); CAP(mustEnableAdvBlendEqs); CAP(mustEnableSpecificAdvBlendEqs); diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp index fcee9aeee0..c8e1255352 100644 --- a/src/sksl/SkSLSPIRVCodeGenerator.cpp +++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp @@ -102,7 +102,6 @@ void SPIRVCodeGenerator::setupIntrinsics() { fIntrinsicMap[String("dFdy")] = std::make_tuple(kSPIRV_IntrinsicKind, SpvOpDPdy, SpvOpUndef, SpvOpUndef, SpvOpUndef); fIntrinsicMap[String("texture")] = SPECIAL(Texture); - fIntrinsicMap[String("texelFetch")] = SPECIAL(TexelFetch); fIntrinsicMap[String("subpassLoad")] = SPECIAL(SubpassLoad); fIntrinsicMap[String("any")] = std::make_tuple(kSPIRV_IntrinsicKind, SpvOpUndef, @@ -833,22 +832,6 @@ SpvId SPIRVCodeGenerator::writeSpecialIntrinsic(const FunctionCall& c, SpecialIn } break; } - case kTexelFetch_SpecialIntrinsic: { - SkASSERT(c.fArguments.size() == 2); - SpvId image = this->nextId(); - this->writeInstruction(SpvOpImage, - this->getImageType(c.fArguments[0]->fType), - image, - this->writeExpression(*c.fArguments[0], out), - out); - this->writeInstruction(SpvOpImageFetch, - this->getType(c.fType), - result, - image, - this->writeExpression(*c.fArguments[1], out), - out); - break; - } case kTexture_SpecialIntrinsic: { SpvOp_ op = SpvOpImageSampleImplicitLod; switch (c.fArguments[0]->fType.dimensions()) { diff --git a/src/sksl/SkSLSPIRVCodeGenerator.h b/src/sksl/SkSLSPIRVCodeGenerator.h index e7bec1e558..fee54ad65c 100644 --- a/src/sksl/SkSLSPIRVCodeGenerator.h +++ b/src/sksl/SkSLSPIRVCodeGenerator.h @@ -96,7 +96,6 @@ private: kMix_SpecialIntrinsic, kMod_SpecialIntrinsic, kSubpassLoad_SpecialIntrinsic, - kTexelFetch_SpecialIntrinsic, kTexture_SpecialIntrinsic, }; diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h index efff74c37a..60979bbd30 100644 --- a/src/sksl/SkSLUtil.h +++ b/src/sksl/SkSLUtil.h @@ -105,10 +105,6 @@ public: return true; } - bool texelFetchSupport() const { - return true; - } - bool imageLoadStoreSupport() const { return true; } @@ -306,7 +302,6 @@ public: result->fExternalTextureSupport = true; result->fFBFetchSupport = false; result->fDropsTileOnZeroDivide = true; - result->fTexelFetchSupport = true; result->fCanUseAnyFunctionInShader = false; return result; } diff --git a/src/sksl/sksl.inc b/src/sksl/sksl.inc index 0d38e73af6..3d7b53a94d 100644 --- a/src/sksl/sksl.inc +++ b/src/sksl/sksl.inc @@ -378,13 +378,10 @@ $gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset, float bi float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset); float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset, float bias); float textureOffset(sampler2DArrayShadow sampler, float4 P, int2 offset); -*/ float4 texelFetch(samplerBuffer sampler, int P); - $gfloat4 texelFetch($gsampler1D sampler, int P, int lod); $gfloat4 texelFetch($gsampler2D sampler, int2 P, int lod); $gfloat4 texelFetch($gsampler2DRect sampler, int2 P); -/* $gfloat4 texelFetch($gsampler3D sampler, int3 P, int lod); $gfloat4 texelFetch($gsampler1DArray sampler, int2 P, int lod); $gfloat4 texelFetch($gsampler2DArray sampler, int3 P, int lod); diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index 4eb735f325..8263615115 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -95,30 +95,23 @@ public: private: TestFP(const SkTArray<sk_sp<GrTextureProxy>>& proxies, const SkTArray<sk_sp<GrBuffer>>& buffers) - : INHERITED(kTestFP_ClassID, kNone_OptimizationFlags), fSamplers(4), fBuffers(4) { + : INHERITED(kTestFP_ClassID, kNone_OptimizationFlags), fSamplers(4) { for (const auto& proxy : proxies) { this->addTextureSampler(&fSamplers.emplace_back(proxy)); } - for (const auto& buffer : buffers) { - this->addBufferAccess(&fBuffers.emplace_back(kRGBA_8888_GrPixelConfig, buffer.get())); - } } TestFP(std::unique_ptr<GrFragmentProcessor> child) - : INHERITED(kTestFP_ClassID, kNone_OptimizationFlags), fSamplers(4), fBuffers(4) { + : INHERITED(kTestFP_ClassID, kNone_OptimizationFlags), fSamplers(4) { this->registerChildProcessor(std::move(child)); } explicit TestFP(const TestFP& that) - : INHERITED(kTestFP_ClassID, that.optimizationFlags()), fSamplers(4), fBuffers(4) { + : INHERITED(kTestFP_ClassID, that.optimizationFlags()), fSamplers(4) { for (int i = 0; i < that.fSamplers.count(); ++i) { fSamplers.emplace_back(that.fSamplers[i]); this->addTextureSampler(&fSamplers.back()); } - for (int i = 0; i < that.fBuffers.count(); ++i) { - fBuffers.emplace_back(that.fBuffers[i]); - this->addBufferAccess(&fBuffers.back()); - } for (int i = 0; i < that.numChildProcessors(); ++i) { this->registerChildProcessor(that.childProcessor(i).clone()); } @@ -141,7 +134,6 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override { return false; } GrTAllocator<TextureSampler> fSamplers; - GrTAllocator<BufferAccess> fBuffers; typedef GrFragmentProcessor INHERITED; }; } @@ -162,7 +154,6 @@ void testingOnly_getIORefCnts(GrTextureProxy* proxy, int* refCnt, int* readCnt, DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); - GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider(); GrSurfaceDesc desc; desc.fWidth = 10; @@ -176,8 +167,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { SkBackingFit::kApprox, 1, 1, kRGBA_8888_GrPixelConfig, nullptr)); { - bool texelBufferSupport = - context->contextPriv().caps()->shaderCaps()->texelBufferSupport(); sk_sp<GrTextureProxy> proxy1 = proxyProvider->createProxy( desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes); sk_sp<GrTextureProxy> proxy2 = proxyProvider->createProxy( @@ -186,18 +175,10 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes); sk_sp<GrTextureProxy> proxy4 = proxyProvider->createProxy( desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes); - sk_sp<GrBuffer> buffer(texelBufferSupport - ? resourceProvider->createBuffer( - 1024, GrBufferType::kTexel_GrBufferType, - GrAccessPattern::kStatic_GrAccessPattern, 0) - : nullptr); { SkTArray<sk_sp<GrTextureProxy>> proxies; SkTArray<sk_sp<GrBuffer>> buffers; proxies.push_back(proxy1); - if (texelBufferSupport) { - buffers.push_back(buffer); - } auto fp = TestFP::Make(std::move(proxies), std::move(buffers)); for (int i = 0; i < parentCnt; ++i) { fp = TestFP::Make(std::move(fp)); @@ -222,13 +203,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { REPORTER_ASSERT(reporter, ioRefMul * 1 == readCnt); REPORTER_ASSERT(reporter, ioRefMul * 0 == writeCnt); - if (texelBufferSupport) { - testingOnly_getIORefCnts(buffer.get(), &refCnt, &readCnt, &writeCnt); - REPORTER_ASSERT(reporter, 1 == refCnt); - REPORTER_ASSERT(reporter, ioRefMul * 1 == readCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == writeCnt); - } - context->flush(); testingOnly_getIORefCnts(proxy1.get(), &refCnt, &readCnt, &writeCnt); @@ -236,29 +210,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { REPORTER_ASSERT(reporter, ioRefMul * 0 == readCnt); REPORTER_ASSERT(reporter, ioRefMul * 0 == writeCnt); - if (texelBufferSupport) { - testingOnly_getIORefCnts(buffer.get(), &refCnt, &readCnt, &writeCnt); - REPORTER_ASSERT(reporter, 1 == refCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == readCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == writeCnt); - } - - if (texelBufferSupport) { - testingOnly_getIORefCnts(proxy2.get(), &refCnt, &readCnt, &writeCnt); - REPORTER_ASSERT(reporter, 1 == refCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == readCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == writeCnt); - - testingOnly_getIORefCnts(proxy3.get(), &refCnt, &readCnt, &writeCnt); - REPORTER_ASSERT(reporter, 1 == refCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == readCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == writeCnt); - - testingOnly_getIORefCnts(proxy4.get(), &refCnt, &readCnt, &writeCnt); - REPORTER_ASSERT(reporter, 1 == refCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == readCnt); - REPORTER_ASSERT(reporter, ioRefMul * 0 == writeCnt); - } } } } diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp index c3577e0c3c..275fb2b017 100644 --- a/tests/SkSLGLSLTest.cpp +++ b/tests/SkSLGLSLTest.cpp @@ -923,8 +923,8 @@ DEF_TEST(SkSLCaps, r) { "int w = 0;" "if (sk_Caps.externalTextureSupport) x = 1;" "if (sk_Caps.fbFetchSupport) y = 1;" - "if (sk_Caps.dropsTileOnZeroDivide && sk_Caps.texelFetchSupport) z = 1;" - "if (sk_Caps.dropsTileOnZeroDivide && sk_Caps.canUseAnyFunctionInShader) w = 1;" + "if (sk_Caps.dropsTileOnZeroDivide) z = 1;" + "if (sk_Caps.canUseAnyFunctionInShader) w = 1;" "sk_FragColor = half4(x, y, z, w);" "}", *SkSL::ShaderCapsFactory::VariousCaps(), |