Reland "Remove ability to sample textures in vertex or geometry shaders."
This reverts commit 6e2625d9ae89f6709a606bcf1a15b35741393e02.
Reason for revert: Chrome fix has landed. This should work now.
Original change's description:
> Revert "Remove ability to sample textures in vertex or geometry shaders."
>
> This reverts commit d50d6579d1c00de65b947c0531fa04c043729e49.
>
> Reason for revert: chromes test gles test context is broken. Need to fix that then reland this
>
> Original change's description:
> > Remove ability to sample textures in vertex or geometry shaders.
> >
> > Bug: skia:
> > Change-Id: I69cd07a4bbe4879e855fb4aa6289a049adf4e059
> > Reviewed-on: https://skia-review.googlesource.com/c/160021
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com
>
> Change-Id: I309dfa5f7118cb8d7280aaf6a88e1df232bd7099
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/c/160163
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:
Change-Id: Id2b5bdf883dbd0236f847649a30d15a492ab481e
Reviewed-on: https://skia-review.googlesource.com/c/160461
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrPrimitiveProcessor.cpp b/src/gpu/GrPrimitiveProcessor.cpp
index 6d2b1e9..9e0e161 100644
--- a/src/gpu/GrPrimitiveProcessor.cpp
+++ b/src/gpu/GrPrimitiveProcessor.cpp
@@ -105,40 +105,34 @@
GrPrimitiveProcessor::TextureSampler::TextureSampler(GrTextureType textureType,
GrPixelConfig config,
- const GrSamplerState& samplerState,
- GrShaderFlags visibility) {
- this->reset(textureType, config, samplerState, visibility);
+ const GrSamplerState& samplerState) {
+ this->reset(textureType, config, samplerState);
}
GrPrimitiveProcessor::TextureSampler::TextureSampler(GrTextureType textureType,
GrPixelConfig config,
GrSamplerState::Filter filterMode,
- GrSamplerState::WrapMode wrapXAndY,
- GrShaderFlags visibility) {
- this->reset(textureType, config, filterMode, wrapXAndY, visibility);
+ GrSamplerState::WrapMode wrapXAndY) {
+ this->reset(textureType, config, filterMode, wrapXAndY);
}
void GrPrimitiveProcessor::TextureSampler::reset(GrTextureType textureType,
GrPixelConfig config,
- const GrSamplerState& samplerState,
- GrShaderFlags visibility) {
+ const GrSamplerState& samplerState) {
SkASSERT(kUnknown_GrPixelConfig != config);
fSamplerState = samplerState;
fSamplerState.setFilterMode(clamp_filter(textureType, samplerState.filter()));
fTextureType = textureType;
fConfig = config;
- fVisibility = visibility;
}
void GrPrimitiveProcessor::TextureSampler::reset(GrTextureType textureType,
GrPixelConfig config,
GrSamplerState::Filter filterMode,
- GrSamplerState::WrapMode wrapXAndY,
- GrShaderFlags visibility) {
+ GrSamplerState::WrapMode wrapXAndY) {
SkASSERT(kUnknown_GrPixelConfig != config);
filterMode = clamp_filter(textureType, filterMode);
fSamplerState = GrSamplerState(wrapXAndY, filterMode);
fTextureType = textureType;
fConfig = config;
- fVisibility = visibility;
}
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index d51a075..2ae28dd 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -202,27 +202,23 @@
public:
TextureSampler() = default;
- TextureSampler(GrTextureType, GrPixelConfig, const GrSamplerState&, GrShaderFlags visibility);
+ TextureSampler(GrTextureType, GrPixelConfig, const GrSamplerState&);
explicit TextureSampler(GrTextureType, GrPixelConfig,
GrSamplerState::Filter = GrSamplerState::Filter::kNearest,
- GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
+ GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp);
TextureSampler(const TextureSampler&) = delete;
TextureSampler& operator=(const TextureSampler&) = delete;
- void reset(GrTextureType, GrPixelConfig, const GrSamplerState&,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
+ void reset(GrTextureType, GrPixelConfig, const GrSamplerState&);
void reset(GrTextureType, GrPixelConfig,
GrSamplerState::Filter = GrSamplerState::Filter::kNearest,
- GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
+ GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp);
GrTextureType textureType() const { return fTextureType; }
GrPixelConfig config() const { return fConfig; }
- GrShaderFlags visibility() const { return fVisibility; }
const GrSamplerState& samplerState() const { return fSamplerState; }
bool isInitialized() const { return fConfig != kUnknown_GrPixelConfig; }
@@ -231,7 +227,6 @@
GrSamplerState fSamplerState;
GrTextureType fTextureType = GrTextureType::k2D;
GrPixelConfig fConfig = kUnknown_GrPixelConfig;
- GrShaderFlags fVisibility = kNone_GrShaderFlags;
};
const GrPrimitiveProcessor::TextureSampler& GrPrimitiveProcessor::IthTextureSampler(int i) {
diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp
index fb12dcf..c0b9eb5 100644
--- a/src/gpu/GrShaderCaps.cpp
+++ b/src/gpu/GrShaderCaps.cpp
@@ -64,10 +64,7 @@
fFBFetchColorName = nullptr;
fFBFetchExtensionString = nullptr;
fImageLoadStoreExtensionString = nullptr;
- fMaxVertexSamplers = 0;
- fMaxGeometrySamplers = 0;
fMaxFragmentSamplers = 0;
- fMaxCombinedSamplers = 0;
fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction;
}
@@ -124,10 +121,7 @@
writer->appendBool("float == fp32", fFloatIs32Bits);
writer->appendBool("half == fp32", fHalfIs32Bits);
- writer->appendS32("Max VS Samplers", fMaxVertexSamplers);
- writer->appendS32("Max GS Samplers", fMaxGeometrySamplers);
writer->appendS32("Max FS Samplers", fMaxFragmentSamplers);
- writer->appendS32("Max Combined Samplers", fMaxFragmentSamplers);
writer->appendString("Advanced blend equation interaction",
kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
diff --git a/src/gpu/GrShaderCaps.h b/src/gpu/GrShaderCaps.h
index 0d348a0..b0836c4 100644
--- a/src/gpu/GrShaderCaps.h
+++ b/src/gpu/GrShaderCaps.h
@@ -209,14 +209,8 @@
return fImageLoadStoreExtensionString;
}
- int maxVertexSamplers() const { return fMaxVertexSamplers; }
-
- int maxGeometrySamplers() const { return fMaxGeometrySamplers; }
-
int maxFragmentSamplers() const { return fMaxFragmentSamplers; }
- int maxCombinedSamplers() const { return fMaxCombinedSamplers; }
-
/**
* Given a texture's config, this determines what swizzle must be appended to accesses to the
* texture in generated shader code. Swizzling may be implemented in texture parameters or a
@@ -293,10 +287,7 @@
const char* fFBFetchColorName;
const char* fFBFetchExtensionString;
- int fMaxVertexSamplers;
- int fMaxGeometrySamplers;
int fMaxFragmentSamplers;
- int fMaxCombinedSamplers;
size_t fDisableImageMultitexturingDstRectAreaThreshold;
diff --git a/src/gpu/ccpr/GrCCPathProcessor.cpp b/src/gpu/ccpr/GrCCPathProcessor.cpp
index 4a9a8aa..c3c50c2 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPathProcessor.cpp
@@ -83,7 +83,7 @@
const SkMatrix& viewMatrixIfUsingLocalCoords)
: INHERITED(kGrCCPathProcessor_ClassID)
, fAtlasAccess(atlas->textureType(), atlas->config(), GrSamplerState::Filter::kNearest,
- GrSamplerState::WrapMode::kClamp, kFragment_GrShaderFlag)
+ GrSamplerState::WrapMode::kClamp)
, fAtlasSize(atlas->isize())
, fAtlasOrigin(atlas->origin()) {
// TODO: Can we just assert that atlas has GrCCAtlas::kTextureOrigin and remove fAtlasOrigin?
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 4dc03a3..70b3f9b 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -360,16 +360,8 @@
// Protect ourselves against tracking huge amounts of texture state.
static const uint8_t kMaxSaneSamplers = 32;
GrGLint maxSamplers;
- GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &maxSamplers);
- shaderCaps->fMaxVertexSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers);
- if (shaderCaps->fGeometryShaderSupport) {
- GR_GL_GetIntegerv(gli, GR_GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &maxSamplers);
- shaderCaps->fMaxGeometrySamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers);
- }
GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &maxSamplers);
shaderCaps->fMaxFragmentSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers);
- GR_GL_GetIntegerv(gli, GR_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxSamplers);
- shaderCaps->fMaxCombinedSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers);
// 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
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 3777dee..3bc7d3a 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -210,7 +210,7 @@
SkASSERT(fGLContext);
fCaps = sk_ref_sp(fGLContext->caps());
- fHWBoundTextureUniqueIDs.reset(this->caps()->shaderCaps()->maxCombinedSamplers());
+ fHWBoundTextureUniqueIDs.reset(this->caps()->shaderCaps()->maxFragmentSamplers());
fHWBufferState[kVertex_GrBufferType].fGLTarget = GR_GL_ARRAY_BUFFER;
fHWBufferState[kIndex_GrBufferType].fGLTarget = GR_GL_ELEMENT_ARRAY_BUFFER;
diff --git a/src/gpu/gl/GrGLUniformHandler.cpp b/src/gpu/gl/GrGLUniformHandler.cpp
index 0d57a14..7551e9a 100644
--- a/src/gpu/gl/GrGLUniformHandler.cpp
+++ b/src/gpu/gl/GrGLUniformHandler.cpp
@@ -61,13 +61,11 @@
return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1);
}
-GrGLSLUniformHandler::SamplerHandle GrGLUniformHandler::addSampler(uint32_t visibility,
- GrSwizzle swizzle,
+GrGLSLUniformHandler::SamplerHandle GrGLUniformHandler::addSampler(GrSwizzle swizzle,
GrTextureType type,
GrSLPrecision precision,
const char* name) {
SkASSERT(name && strlen(name));
- SkASSERT(0 != visibility);
SkString mangleName;
char prefix = 'u';
@@ -79,7 +77,7 @@
sampler.fVariable.setPrecision(precision);
sampler.fVariable.setName(mangleName);
sampler.fLocation = -1;
- sampler.fVisibility = visibility;
+ sampler.fVisibility = kFragment_GrShaderFlag;
fSamplerSwizzles.push_back(swizzle);
SkASSERT(fSamplers.count() == fSamplerSwizzles.count());
return GrGLSLUniformHandler::SamplerHandle(fSamplers.count() - 1);
diff --git a/src/gpu/gl/GrGLUniformHandler.h b/src/gpu/gl/GrGLUniformHandler.h
index 1bf8553..2442716 100644
--- a/src/gpu/gl/GrGLUniformHandler.h
+++ b/src/gpu/gl/GrGLUniformHandler.h
@@ -39,8 +39,7 @@
int arrayCount,
const char** outName) override;
- SamplerHandle addSampler(uint32_t visibility, GrSwizzle, GrTextureType, GrSLPrecision,
- const char* name) override;
+ SamplerHandle addSampler(GrSwizzle, GrTextureType, GrSLPrecision, const char* name) override;
const GrShaderVar& samplerVariable(SamplerHandle handle) const override {
return fSamplers[handle.toIndex()].fVariable;
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 7b7b18d..f56f389 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -31,8 +31,6 @@
, fDesc(desc)
, fGeometryProcessor(nullptr)
, fXferProcessor(nullptr)
- , fNumVertexSamplers(0)
- , fNumGeometrySamplers(0)
, fNumFragmentSamplers(0) {}
void GrGLSLProgramBuilder::addFeature(GrShaderFlags shaders,
@@ -101,8 +99,7 @@
SkString name;
name.printf("TextureSampler_%d", i);
const auto& sampler = proc.textureSampler(i);
- texSamplers[i] = this->emitSampler(sampler.textureType(), sampler.config(), name.c_str(),
- sampler.visibility());
+ texSamplers[i] = this->emitSampler(sampler.textureType(), sampler.config(), name.c_str());
}
GrGLSLPrimitiveProcessor::FPCoordTransformHandler transformHandler(fPipeline,
@@ -184,7 +181,7 @@
const auto& sampler = subFP->textureSampler(i);
GrTextureType textureType = sampler.peekTexture()->texturePriv().textureType();
texSamplers.emplace_back(this->emitSampler(textureType, sampler.peekTexture()->config(),
- name.c_str(), kFragment_GrShaderFlag));
+ name.c_str()));
}
}
@@ -241,7 +238,7 @@
SkString name("DstTextureSampler");
dstTextureSamplerHandle =
this->emitSampler(dstTexture->texturePriv().textureType(), dstTexture->config(),
- "DstTextureSampler", kFragment_GrShaderFlag);
+ "DstTextureSampler");
dstTextureOrigin = fPipeline.dstTextureProxy()->origin();
SkASSERT(dstTexture->texturePriv().textureType() != GrTextureType::kExternal);
}
@@ -264,27 +261,13 @@
fFS.codeAppend("}");
}
-void GrGLSLProgramBuilder::updateSamplerCounts(GrShaderFlags visibility) {
- if (visibility & kVertex_GrShaderFlag) {
- ++fNumVertexSamplers;
- }
- if (visibility & kGeometry_GrShaderFlag) {
- SkASSERT(this->primitiveProcessor().willUseGeoShader());
- ++fNumGeometrySamplers;
- }
- if (visibility & kFragment_GrShaderFlag) {
- ++fNumFragmentSamplers;
- }
-}
-
GrGLSLProgramBuilder::SamplerHandle GrGLSLProgramBuilder::emitSampler(GrTextureType textureType,
GrPixelConfig config,
- const char* name,
- GrShaderFlags visibility) {
- this->updateSamplerCounts(visibility);
+ const char* name) {
+ ++fNumFragmentSamplers;
GrSLPrecision precision = GrSLSamplerPrecision(config);
GrSwizzle swizzle = this->shaderCaps()->configTextureSwizzle(config);
- return this->uniformHandler()->addSampler(visibility, swizzle, textureType, precision, name);
+ return this->uniformHandler()->addSampler(swizzle, textureType, precision, name);
}
void GrGLSLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) {
@@ -305,24 +288,10 @@
bool GrGLSLProgramBuilder::checkSamplerCounts() {
const GrShaderCaps& shaderCaps = *this->shaderCaps();
- if (fNumVertexSamplers > shaderCaps.maxVertexSamplers()) {
- GrCapsDebugf(this->caps(), "Program would use too many vertex samplers\n");
- return false;
- }
- if (fNumGeometrySamplers > shaderCaps.maxGeometrySamplers()) {
- GrCapsDebugf(this->caps(), "Program would use too many geometry samplers\n");
- return false;
- }
if (fNumFragmentSamplers > shaderCaps.maxFragmentSamplers()) {
GrCapsDebugf(this->caps(), "Program would use too many fragment samplers\n");
return false;
}
- // If the same sampler is used in two different shaders, it counts as two combined samplers.
- int numCombinedSamplers = fNumVertexSamplers + fNumGeometrySamplers + fNumFragmentSamplers;
- if (numCombinedSamplers > shaderCaps.maxCombinedSamplers()) {
- GrCapsDebugf(this->caps(), "Program would use too many combined samplers\n");
- return false;
- }
return true;
}
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index 073cfc6..4e7c1ec 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -139,10 +139,8 @@
SkString output,
SkTArray<std::unique_ptr<GrGLSLFragmentProcessor>>*);
void emitAndInstallXferProc(const SkString& colorIn, const SkString& coverageIn);
- SamplerHandle emitSampler(GrTextureType, GrPixelConfig, const char* name,
- GrShaderFlags visibility);
+ SamplerHandle emitSampler(GrTextureType, GrPixelConfig, const char* name);
void emitFSOutputSwizzle(bool hasSecondaryOutput);
- void updateSamplerCounts(GrShaderFlags visibility);
bool checkSamplerCounts();
#ifdef SK_DEBUG
@@ -152,8 +150,6 @@
#endif
// These are used to check that we don't excede the allowable number of resources in a shader.
- int fNumVertexSamplers;
- int fNumGeometrySamplers;
int fNumFragmentSamplers;
SkSTArray<4, GrShaderVar> fTransformedCoordVars;
};
diff --git a/src/gpu/glsl/GrGLSLUniformHandler.h b/src/gpu/glsl/GrGLSLUniformHandler.h
index 26681c1..180bf6f 100644
--- a/src/gpu/glsl/GrGLSLUniformHandler.h
+++ b/src/gpu/glsl/GrGLSLUniformHandler.h
@@ -97,8 +97,7 @@
virtual const GrShaderVar& samplerVariable(SamplerHandle) const = 0;
virtual GrSwizzle samplerSwizzle(SamplerHandle) const = 0;
- virtual SamplerHandle addSampler(uint32_t visibility, GrSwizzle, GrTextureType, GrSLPrecision,
- const char* name) = 0;
+ virtual SamplerHandle addSampler(GrSwizzle, GrTextureType, GrSLPrecision, const char* name) = 0;
virtual UniformHandle internalAddUniformArray(uint32_t visibility,
GrSLType type,
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index 1ea339b..278dea3 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -27,7 +27,6 @@
fShaderCaps->fGeometryShaderSupport = options.fGeometryShaderSupport;
fShaderCaps->fIntegerSupport = options.fIntegerSupport;
fShaderCaps->fFlatInterpolationSupport = options.fFlatInterpolationSupport;
- fShaderCaps->fMaxVertexSamplers = options.fMaxVertexSamplers;
fShaderCaps->fMaxFragmentSamplers = options.fMaxFragmentSamplers;
fShaderCaps->fShaderDerivativeSupport = options.fShaderDerivativeSupport;
diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm
index 74186f7..a8c8c02 100644
--- a/src/gpu/mtl/GrMtlCaps.mm
+++ b/src/gpu/mtl/GrMtlCaps.mm
@@ -340,10 +340,7 @@
// Metal supports unsigned integers.
shaderCaps->fUnsignedSupport = true;
- shaderCaps->fMaxVertexSamplers =
shaderCaps->fMaxFragmentSamplers = 16;
- // For now just cap at the per stage max. If we hit this limit we can come back to adjust this
- shaderCaps->fMaxCombinedSamplers = shaderCaps->fMaxVertexSamplers;
}
void GrMtlCaps::initConfigTable() {
diff --git a/src/gpu/mtl/GrMtlPipelineState.h b/src/gpu/mtl/GrMtlPipelineState.h
index 45a1d5a..0ea0ccc 100644
--- a/src/gpu/mtl/GrMtlPipelineState.h
+++ b/src/gpu/mtl/GrMtlPipelineState.h
@@ -95,10 +95,8 @@
struct SamplerBindings {
id<MTLSamplerState> fSampler;
id<MTLTexture> fTexture;
- GrShaderFlags fVisibility;
- SamplerBindings(const GrSamplerState& state, GrTexture* texture, GrShaderFlags flags,
- GrMtlGpu*);
+ SamplerBindings(const GrSamplerState& state, GrTexture* texture, GrMtlGpu*);
};
GrMtlGpu* fGpu;
diff --git a/src/gpu/mtl/GrMtlPipelineState.mm b/src/gpu/mtl/GrMtlPipelineState.mm
index 6b4ed26..018f3df 100644
--- a/src/gpu/mtl/GrMtlPipelineState.mm
+++ b/src/gpu/mtl/GrMtlPipelineState.mm
@@ -22,10 +22,8 @@
GrMtlPipelineState::SamplerBindings::SamplerBindings(const GrSamplerState& state,
GrTexture* texture,
- GrShaderFlags flags,
GrMtlGpu* gpu)
- : fTexture(static_cast<GrMtlTexture*>(texture)->mtlTexture())
- , fVisibility(flags) {
+ : fTexture(static_cast<GrMtlTexture*>(texture)->mtlTexture()) {
// TODO: use resource provider to get sampler.
std::unique_ptr<GrMtlSampler> sampler(
GrMtlSampler::Create(gpu, state, texture->texturePriv().maxMipMapLevel()));
@@ -73,7 +71,7 @@
for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
const auto& sampler = primProc.textureSampler(i);
auto texture = static_cast<GrMtlTexture*>(primProcTextures[i]->peekTexture());
- fSamplerBindings.emplace_back(sampler.samplerState(), texture, sampler.visibility(), fGpu);
+ fSamplerBindings.emplace_back(sampler.samplerState(), texture, fGpu);
}
GrFragmentProcessor::Iter iter(pipeline);
@@ -84,8 +82,7 @@
glslFP->setData(fDataManager, *fp);
for (int i = 0; i < fp->numTextureSamplers(); ++i) {
const auto& sampler = fp->textureSampler(i);
- fSamplerBindings.emplace_back(sampler.samplerState(), sampler.peekTexture(),
- kFragment_GrShaderFlag, fGpu);
+ fSamplerBindings.emplace_back(sampler.samplerState(), sampler.peekTexture(), fGpu);
}
fp = iter.next();
glslFP = glslIter.next();
@@ -102,7 +99,6 @@
if (GrTextureProxy* dstTextureProxy = pipeline.dstTextureProxy()) {
fSamplerBindings.emplace_back(GrSamplerState::ClampNearest(),
dstTextureProxy->peekTexture(),
- kFragment_GrShaderFlag,
fGpu);
}
@@ -126,18 +122,10 @@
}
SkASSERT(fNumSamplers == fSamplerBindings.count());
for (int index = 0; index < fNumSamplers; ++index) {
- if (fSamplerBindings[index].fVisibility & kVertex_GrShaderFlag) {
- [renderCmdEncoder setVertexTexture: fSamplerBindings[index].fTexture
- atIndex: index];
- [renderCmdEncoder setVertexSamplerState: fSamplerBindings[index].fSampler
- atIndex: index];
- }
- if (fSamplerBindings[index].fVisibility & kFragment_GrShaderFlag) {
- [renderCmdEncoder setFragmentTexture: fSamplerBindings[index].fTexture
- atIndex: index];
- [renderCmdEncoder setFragmentSamplerState: fSamplerBindings[index].fSampler
- atIndex: index];
- }
+ [renderCmdEncoder setFragmentTexture: fSamplerBindings[index].fTexture
+ atIndex: index];
+ [renderCmdEncoder setFragmentSamplerState: fSamplerBindings[index].fSampler
+ atIndex: index];
}
}
diff --git a/src/gpu/mtl/GrMtlUniformHandler.h b/src/gpu/mtl/GrMtlUniformHandler.h
index 4ee5a36..4a66f22 100644
--- a/src/gpu/mtl/GrMtlUniformHandler.h
+++ b/src/gpu/mtl/GrMtlUniformHandler.h
@@ -59,8 +59,7 @@
int arrayCount,
const char** outName) override;
- SamplerHandle addSampler(uint32_t visibility,
- GrSwizzle swizzle,
+ SamplerHandle addSampler(GrSwizzle swizzle,
GrTextureType type,
GrSLPrecision precision,
const char* name) override;
diff --git a/src/gpu/mtl/GrMtlUniformHandler.mm b/src/gpu/mtl/GrMtlUniformHandler.mm
index 5a7c52a..d6e2c98 100644
--- a/src/gpu/mtl/GrMtlUniformHandler.mm
+++ b/src/gpu/mtl/GrMtlUniformHandler.mm
@@ -249,16 +249,11 @@
return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1);
}
-GrGLSLUniformHandler::SamplerHandle GrMtlUniformHandler::addSampler(uint32_t visibility,
- GrSwizzle swizzle,
+GrGLSLUniformHandler::SamplerHandle GrMtlUniformHandler::addSampler(GrSwizzle swizzle,
GrTextureType type,
GrSLPrecision precision,
const char* name) {
SkASSERT(name && strlen(name));
- // For now asserting the the visibility is either only vertex, geometry, or fragment
- SkASSERT(kVertex_GrShaderFlag == visibility ||
- kFragment_GrShaderFlag == visibility ||
- kGeometry_GrShaderFlag == visibility);
SkString mangleName;
char prefix = 'u';
fProgramBuilder->nameVariable(&mangleName, prefix, name, true);
@@ -271,7 +266,7 @@
SkString layoutQualifier;
layoutQualifier.appendf("binding=%d", fSamplers.count() - 1);
info.fVariable.addLayoutQualifier(layoutQualifier.c_str());
- info.fVisibility = visibility;
+ info.fVisibility = kFragment_GrShaderFlag;
info.fUBOffset = 0;
fSamplerSwizzles.push_back(swizzle);
SkASSERT(fSamplerSwizzles.count() == fSamplers.count());
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index b2d7db5..fb40013 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -515,16 +515,10 @@
// SPIR-V supports unsigned integers.
shaderCaps->fUnsignedSupport = true;
- shaderCaps->fMaxVertexSamplers =
- shaderCaps->fMaxGeometrySamplers =
shaderCaps->fMaxFragmentSamplers = SkTMin(
SkTMin(properties.limits.maxPerStageDescriptorSampledImages,
properties.limits.maxPerStageDescriptorSamplers),
(uint32_t)INT_MAX);
- shaderCaps->fMaxCombinedSamplers = SkTMin(
- SkTMin(properties.limits.maxDescriptorSetSampledImages,
- properties.limits.maxDescriptorSetSamplers),
- (uint32_t)INT_MAX);
}
bool stencil_format_supported(const GrVkInterface* interface,
diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp
index 0f25be8..1052cb9 100644
--- a/src/gpu/vk/GrVkUniformHandler.cpp
+++ b/src/gpu/vk/GrVkUniformHandler.cpp
@@ -254,16 +254,11 @@
return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1);
}
-GrGLSLUniformHandler::SamplerHandle GrVkUniformHandler::addSampler(uint32_t visibility,
- GrSwizzle swizzle,
+GrGLSLUniformHandler::SamplerHandle GrVkUniformHandler::addSampler(GrSwizzle swizzle,
GrTextureType type,
GrSLPrecision precision,
const char* name) {
SkASSERT(name && strlen(name));
- // For now asserting the the visibility is either only vertex, geometry, or fragment
- SkASSERT(kVertex_GrShaderFlag == visibility ||
- kFragment_GrShaderFlag == visibility ||
- kGeometry_GrShaderFlag == visibility);
SkString mangleName;
char prefix = 'u';
fProgramBuilder->nameVariable(&mangleName, prefix, name, true);
@@ -276,7 +271,7 @@
SkString layoutQualifier;
layoutQualifier.appendf("set=%d, binding=%d", kSamplerDescSet, fSamplers.count() - 1);
info.fVariable.addLayoutQualifier(layoutQualifier.c_str());
- info.fVisibility = visibility;
+ info.fVisibility = kFragment_GrShaderFlag;
info.fUBOffset = 0;
fSamplerSwizzles.push_back(swizzle);
SkASSERT(fSamplerSwizzles.count() == fSamplers.count());
diff --git a/src/gpu/vk/GrVkUniformHandler.h b/src/gpu/vk/GrVkUniformHandler.h
index d79b1b3..4333c86 100644
--- a/src/gpu/vk/GrVkUniformHandler.h
+++ b/src/gpu/vk/GrVkUniformHandler.h
@@ -64,8 +64,7 @@
int arrayCount,
const char** outName) override;
- SamplerHandle addSampler(uint32_t visibility,
- GrSwizzle swizzle,
+ SamplerHandle addSampler(GrSwizzle swizzle,
GrTextureType type,
GrSLPrecision precision,
const char* name) override;