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

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

Issue 582963002: Solo gp (Closed) Base URL: https://skia.googlesource.com/skia.git@no_peb
Patch Set: fix Created 6 years, 3 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
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 "builders/GrGLFullProgramBuilder.h"
10 #include "builders/GrGLFragmentOnlyProgramBuilder.h" 11 #include "builders/GrGLFragmentOnlyProgramBuilder.h"
11 #include "builders/GrGLFullProgramBuilder.h"
12 #include "GrAllocator.h" 12 #include "GrAllocator.h"
13 #include "GrEffect.h" 13 #include "GrProcessor.h"
14 #include "GrCoordTransform.h" 14 #include "GrCoordTransform.h"
15 #include "GrGLEffect.h" 15 #include "GrGLProcessor.h"
16 #include "GrGpuGL.h" 16 #include "GrGpuGL.h"
17 #include "GrGLPathRendering.h" 17 #include "GrGLPathRendering.h"
18 #include "GrGLShaderVar.h" 18 #include "GrGLShaderVar.h"
19 #include "GrGLSL.h" 19 #include "GrGLSL.h"
20 #include "GrOptDrawState.h" 20 #include "GrOptDrawState.h"
21 #include "SkXfermode.h" 21 #include "SkXfermode.h"
22 22
23 #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X) 23 #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X)
24 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X) 24 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X)
25 25
26 GrGLProgram* GrGLProgram::Create(GrGpuGL* gpu, 26 GrGLProgram* GrGLProgram::Create(GrGpuGL* gpu,
27 const GrGLProgramDesc& desc, 27 const GrGLProgramDesc& desc,
28 const GrEffectStage* geometryProcessor, 28 const GrGeometryStage* geometryProcessor,
29 const GrEffectStage* colorStages[], 29 const GrFragmentStage* colorStages[],
30 const GrEffectStage* coverageStages[]) { 30 const GrFragmentStage* coverageStages[]) {
31 SkAutoTDelete<GrGLProgramBuilder> builder; 31 SkAutoTDelete<GrGLProgramBuilder> builder;
32 if (!desc.getHeader().fRequiresVertexShader && 32 if (!desc.getHeader().fRequiresVertexShader &&
33 gpu->glCaps().pathRenderingSupport() && 33 gpu->glCaps().pathRenderingSupport() &&
34 gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunct ion_TexturingMode) { 34 gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunct ion_TexturingMode) {
35 SkASSERT(NULL == geometryProcessor); 35 SkASSERT(NULL == geometryProcessor);
36 builder.reset(SkNEW_ARGS(GrGLFragmentOnlyProgramBuilder, (gpu, desc))); 36 builder.reset(SkNEW_ARGS(GrGLFragmentOnlyProgramBuilder, (gpu, desc)));
37 } else { 37 } else {
38 builder.reset(SkNEW_ARGS(GrGLFullProgramBuilder, (gpu, desc))); 38 builder.reset(SkNEW_ARGS(GrGLFullProgramBuilder, (gpu, desc)));
39 } 39 }
40 if (builder->genProgram(geometryProcessor, colorStages, coverageStages)) { 40 if (builder->genProgram(geometryProcessor, colorStages, coverageStages)) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 fGeometryProcessor->initSamplers(fProgramDataManager, &texUnitIdx); 106 fGeometryProcessor->initSamplers(fProgramDataManager, &texUnitIdx);
107 } 107 }
108 fColorEffects->initSamplers(fProgramDataManager, &texUnitIdx); 108 fColorEffects->initSamplers(fProgramDataManager, &texUnitIdx);
109 fCoverageEffects->initSamplers(fProgramDataManager, &texUnitIdx); 109 fCoverageEffects->initSamplers(fProgramDataManager, &texUnitIdx);
110 } 110 }
111 111
112 /////////////////////////////////////////////////////////////////////////////// 112 ///////////////////////////////////////////////////////////////////////////////
113 113
114 void GrGLProgram::setData(const GrOptDrawState& optState, 114 void GrGLProgram::setData(const GrOptDrawState& optState,
115 GrGpu::DrawType drawType, 115 GrGpu::DrawType drawType,
116 const GrEffectStage* geometryProcessor, 116 const GrGeometryStage* geometryProcessor,
117 const GrEffectStage* colorStages[], 117 const GrFragmentStage* colorStages[],
118 const GrEffectStage* coverageStages[], 118 const GrFragmentStage* coverageStages[],
119 const GrDeviceCoordTexture* dstCopy, 119 const GrDeviceCoordTexture* dstCopy,
120 SharedGLState* sharedState) { 120 SharedGLState* sharedState) {
121 GrColor color = optState.getColor(); 121 GrColor color = optState.getColor();
122 GrColor coverage = optState.getCoverageColor(); 122 GrColor coverage = optState.getCoverageColor();
123 123
124 this->setColor(optState, color, sharedState); 124 this->setColor(optState, color, sharedState);
125 this->setCoverage(optState, coverage, sharedState); 125 this->setCoverage(optState, coverage, sharedState);
126 this->setMatrixAndRenderTargetHeight(drawType, optState); 126 this->setMatrixAndRenderTargetHeight(drawType, optState);
127 127
128 if (dstCopy) { 128 if (dstCopy) {
(...skipping 12 matching lines...) Expand all
141 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid()); 141 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
142 } 142 }
143 } else { 143 } else {
144 SkASSERT(!fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()); 144 SkASSERT(!fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid());
145 SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid()); 145 SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid());
146 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid()); 146 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
147 } 147 }
148 148
149 if (fGeometryProcessor.get()) { 149 if (fGeometryProcessor.get()) {
150 SkASSERT(geometryProcessor); 150 SkASSERT(geometryProcessor);
151 fGeometryProcessor->setData(fGpu, drawType, fProgramDataManager, &geomet ryProcessor); 151 fGeometryProcessor->setData(fGpu, drawType, fProgramDataManager, geometr yProcessor);
152 } 152 }
153 fColorEffects->setData(fGpu, drawType, fProgramDataManager, colorStages); 153 fColorEffects->setData(fGpu, drawType, fProgramDataManager, colorStages);
154 fCoverageEffects->setData(fGpu, drawType, fProgramDataManager, coverageStage s); 154 fCoverageEffects->setData(fGpu, drawType, fProgramDataManager, coverageStage s);
155 155
156 // PathTexGen state applies to the the fixed function vertex shader. For 156 // PathTexGen state applies to the the fixed function vertex shader. For
157 // custom shaders, it's ignored, so we don't need to change the texgen 157 // custom shaders, it's ignored, so we don't need to change the texgen
158 // settings in that case. 158 // settings in that case.
159 if (!fHasVertexShader) { 159 if (!fHasVertexShader) {
160 fGpu->glPathRendering()->flushPathTexGenSettings(fTexCoordSetCnt); 160 fGpu->glPathRendering()->flushPathTexGenSettings(fTexCoordSetCnt);
161 } 161 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 GrGLfloat viewMatrix[3 * 3]; 265 GrGLfloat viewMatrix[3 * 3];
266 fMatrixState.getGLMatrix<3>(viewMatrix); 266 fMatrixState.getGLMatrix<3>(viewMatrix);
267 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v iewMatrix); 267 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v iewMatrix);
268 268
269 GrGLfloat rtAdjustmentVec[4]; 269 GrGLfloat rtAdjustmentVec[4];
270 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); 270 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec);
271 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r tAdjustmentVec); 271 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r tAdjustmentVec);
272 } 272 }
273 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698