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/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;
}