Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 1782583002: Add support for vertex and geometry shader textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: better rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLCaps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLProgramBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 9f4291513c7d6bda0a682646e291e05ef61df566..1c5cf25eb78903b02f2d000e7b56814c2cbb64d2 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -40,9 +40,7 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
GrGLSLExpr4 inputColor;
GrGLSLExpr4 inputCoverage;
- if (!builder.emitAndInstallProcs(&inputColor,
- &inputCoverage,
- gpu->glCaps().maxFragmentTextureUnits())) {
+ if (!builder.emitAndInstallProcs(&inputColor, &inputCoverage)) {
builder.cleanupFragmentProcessors();
return nullptr;
}
@@ -55,7 +53,6 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp
GrGLProgramBuilder::GrGLProgramBuilder(GrGLGpu* gpu, const DrawArgs& args)
: INHERITED(args)
, fGpu(gpu)
- , fSamplerUniforms(4)
, fVaryingHandler(this)
, fUniformHandler(this) {
}
@@ -68,39 +65,6 @@ const GrGLSLCaps* GrGLProgramBuilder::glslCaps() const {
return fGpu->ctxInfo().caps()->glslCaps();
}
-static GrSLType get_sampler_type(const GrTextureAccess& access) {
- GrGLTexture* glTexture = static_cast<GrGLTexture*>(access.getTexture());
- if (glTexture->target() == GR_GL_TEXTURE_EXTERNAL) {
- return kSamplerExternal_GrSLType;
- } else if (glTexture->target() == GR_GL_TEXTURE_RECTANGLE) {
- return kSampler2DRect_GrSLType;
- } else {
- SkASSERT(glTexture->target() == GR_GL_TEXTURE_2D);
- return kSampler2D_GrSLType;
- }
-}
-
-void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor,
- GrGLSLTextureSampler::TextureSamplerArray* outSamplers) {
- int numTextures = processor.numTextures();
- UniformHandle* localSamplerUniforms = fSamplerUniforms.push_back_n(numTextures);
- SkString name;
- for (int t = 0; t < numTextures; ++t) {
- name.printf("Sampler%d", t);
- GrSLType samplerType = get_sampler_type(processor.textureAccess(t));
- localSamplerUniforms[t] = fUniformHandler.addUniform(kFragment_GrShaderFlag, samplerType,
- kDefault_GrSLPrecision, name.c_str());
- outSamplers->emplace_back(localSamplerUniforms[t], processor.textureAccess(t));
- if (kSamplerExternal_GrSLType == samplerType) {
- const char* externalFeatureString = this->glslCaps()->externalTextureExtensionString();
- // We shouldn't ever create a GrGLTexture that requires external sampler type
- SkASSERT(externalFeatureString);
- fFS.addFeature(1 << GrGLSLFragmentShaderBuilder::kExternalTexture_GLSLPrivateFeature,
- externalFeatureString);
- }
- }
-}
-
bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader,
GrGLuint programId,
GrGLenum type,
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698