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

Side by Side Diff: src/gpu/gl/GrGLProgram.cpp

Issue 1896013003: Revert of Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLProgramDataManager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLProgram.h" 8 #include "GrGLProgram.h"
9 9
10 #include "GrAllocator.h" 10 #include "GrAllocator.h"
(...skipping 13 matching lines...) Expand all
24 #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X) 24 #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X)
25 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X) 25 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X)
26 26
27 //////////////////////////////////////////////////////////////////////////////// /////////////////// 27 //////////////////////////////////////////////////////////////////////////////// ///////////////////
28 28
29 GrGLProgram::GrGLProgram(GrGLGpu* gpu, 29 GrGLProgram::GrGLProgram(GrGLGpu* gpu,
30 const GrProgramDesc& desc, 30 const GrProgramDesc& desc,
31 const BuiltinUniformHandles& builtinUniforms, 31 const BuiltinUniformHandles& builtinUniforms,
32 GrGLuint programID, 32 GrGLuint programID,
33 const UniformInfoArray& uniforms, 33 const UniformInfoArray& uniforms,
34 const SkTArray<GrGLSampler>& samplers,
35 const VaryingInfoArray& pathProcVaryings, 34 const VaryingInfoArray& pathProcVaryings,
36 GrGLSLPrimitiveProcessor* geometryProcessor, 35 GrGLSLPrimitiveProcessor* geometryProcessor,
37 GrGLSLXferProcessor* xferProcessor, 36 GrGLSLXferProcessor* xferProcessor,
38 const GrGLSLFragProcs& fragmentProcessors) 37 const GrGLSLFragProcs& fragmentProcessors,
38 SkTArray<UniformHandle>* passSamplerUniforms)
39 : fBuiltinUniformHandles(builtinUniforms) 39 : fBuiltinUniformHandles(builtinUniforms)
40 , fProgramID(programID) 40 , fProgramID(programID)
41 , fGeometryProcessor(geometryProcessor) 41 , fGeometryProcessor(geometryProcessor)
42 , fXferProcessor(xferProcessor) 42 , fXferProcessor(xferProcessor)
43 , fFragmentProcessors(fragmentProcessors) 43 , fFragmentProcessors(fragmentProcessors)
44 , fDesc(desc) 44 , fDesc(desc)
45 , fGpu(gpu) 45 , fGpu(gpu)
46 , fProgramDataManager(gpu, programID, uniforms, pathProcVaryings) { 46 , fProgramDataManager(gpu, programID, uniforms, pathProcVaryings) {
47 fSamplerUniforms.swap(passSamplerUniforms);
47 // Assign texture units to sampler uniforms one time up front. 48 // Assign texture units to sampler uniforms one time up front.
48 GL_CALL(UseProgram(fProgramID)); 49 GL_CALL(UseProgram(fProgramID));
49 fProgramDataManager.setSamplers(samplers); 50 for (int i = 0; i < fSamplerUniforms.count(); i++) {
51 fProgramDataManager.setSampler(fSamplerUniforms[i], i);
52 }
50 } 53 }
51 54
52 GrGLProgram::~GrGLProgram() { 55 GrGLProgram::~GrGLProgram() {
53 if (fProgramID) { 56 if (fProgramID) {
54 GL_CALL(DeleteProgram(fProgramID)); 57 GL_CALL(DeleteProgram(fProgramID));
55 } 58 }
56 for (int i = 0; i < fFragmentProcessors.count(); ++i) { 59 for (int i = 0; i < fFragmentProcessors.count(); ++i) {
57 delete fFragmentProcessors[i]; 60 delete fFragmentProcessors[i];
58 } 61 }
59 } 62 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const GrTextureAccess& access = processor.textureAccess(i); 142 const GrTextureAccess& access = processor.textureAccess(i);
140 fGpu->bindTexture((*nextSamplerIdx)++, access.getParams(), 143 fGpu->bindTexture((*nextSamplerIdx)++, access.getParams(),
141 allowSRGBInputs, static_cast<GrGLTexture*>(access.getT exture())); 144 allowSRGBInputs, static_cast<GrGLTexture*>(access.getT exture()));
142 } 145 }
143 for (int i = 0; i < processor.numBuffers(); ++i) { 146 for (int i = 0; i < processor.numBuffers(); ++i) {
144 const GrBufferAccess& access = processor.bufferAccess(i); 147 const GrBufferAccess& access = processor.bufferAccess(i);
145 fGpu->bindTexelBuffer((*nextSamplerIdx)++, access.offsetInBytes(), acces s.texelConfig(), 148 fGpu->bindTexelBuffer((*nextSamplerIdx)++, access.offsetInBytes(), acces s.texelConfig(),
146 static_cast<GrGLBuffer*>(access.buffer())); 149 static_cast<GrGLBuffer*>(access.buffer()));
147 } 150 }
148 } 151 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLProgramDataManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698