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>
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 29803c3..99bd22e 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 c67bb44..0929d89 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -211,7 +211,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;