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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase 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
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/gpu/gl/GrGLProgramDesc.cpp » ('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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 } 94 }
95 95
96 void GrGLProgram::initSamplerUniforms() { 96 void GrGLProgram::initSamplerUniforms() {
97 GL_CALL(UseProgram(fProgramID)); 97 GL_CALL(UseProgram(fProgramID));
98 GrGLint texUnitIdx = 0; 98 GrGLint texUnitIdx = 0;
99 if (fBuiltinUniformHandles.fDstCopySamplerUni.isValid()) { 99 if (fBuiltinUniformHandles.fDstCopySamplerUni.isValid()) {
100 fProgramDataManager.setSampler(fBuiltinUniformHandles.fDstCopySamplerUni , texUnitIdx); 100 fProgramDataManager.setSampler(fBuiltinUniformHandles.fDstCopySamplerUni , texUnitIdx);
101 fDstCopyTexUnit = texUnitIdx++; 101 fDstCopyTexUnit = texUnitIdx++;
102 } 102 }
103 if (NULL != fGeometryProcessor.get()) { 103 if (fGeometryProcessor.get()) {
104 fGeometryProcessor->initSamplers(fProgramDataManager, &texUnitIdx); 104 fGeometryProcessor->initSamplers(fProgramDataManager, &texUnitIdx);
105 } 105 }
106 fColorEffects->initSamplers(fProgramDataManager, &texUnitIdx); 106 fColorEffects->initSamplers(fProgramDataManager, &texUnitIdx);
107 fCoverageEffects->initSamplers(fProgramDataManager, &texUnitIdx); 107 fCoverageEffects->initSamplers(fProgramDataManager, &texUnitIdx);
108 } 108 }
109 109
110 /////////////////////////////////////////////////////////////////////////////// 110 ///////////////////////////////////////////////////////////////////////////////
111 111
112 void GrGLProgram::setData(GrGpu::DrawType drawType, 112 void GrGLProgram::setData(GrGpu::DrawType drawType,
113 GrDrawState::BlendOptFlags blendOpts, 113 GrDrawState::BlendOptFlags blendOpts,
(...skipping 14 matching lines...) Expand all
128 coverage = drawState.getCoverageColor(); 128 coverage = drawState.getCoverageColor();
129 } else { 129 } else {
130 color = drawState.getColor(); 130 color = drawState.getColor();
131 coverage = drawState.getCoverageColor(); 131 coverage = drawState.getCoverageColor();
132 } 132 }
133 133
134 this->setColor(drawState, color, sharedState); 134 this->setColor(drawState, color, sharedState);
135 this->setCoverage(drawState, coverage, sharedState); 135 this->setCoverage(drawState, coverage, sharedState);
136 this->setMatrixAndRenderTargetHeight(drawType, drawState); 136 this->setMatrixAndRenderTargetHeight(drawType, drawState);
137 137
138 if (NULL != dstCopy) { 138 if (dstCopy) {
139 if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) { 139 if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) {
140 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyTopLeftUni, 140 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyTopLeftUni,
141 static_cast<GrGLfloat>(dstCopy->offset(). fX), 141 static_cast<GrGLfloat>(dstCopy->offset(). fX),
142 static_cast<GrGLfloat>(dstCopy->offset(). fY)); 142 static_cast<GrGLfloat>(dstCopy->offset(). fY));
143 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyScaleUni, 143 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyScaleUni,
144 1.f / dstCopy->texture()->width(), 144 1.f / dstCopy->texture()->width(),
145 1.f / dstCopy->texture()->height()); 145 1.f / dstCopy->texture()->height());
146 GrGLTexture* texture = static_cast<GrGLTexture*>(dstCopy->texture()) ; 146 GrGLTexture* texture = static_cast<GrGLTexture*>(dstCopy->texture()) ;
147 static GrTextureParams kParams; // the default is clamp, nearest fil tering. 147 static GrTextureParams kParams; // the default is clamp, nearest fil tering.
148 fGpu->bindTexture(fDstCopyTexUnit, kParams, texture); 148 fGpu->bindTexture(fDstCopyTexUnit, kParams, texture);
149 } else { 149 } else {
150 SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid()); 150 SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid());
151 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid()); 151 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
152 } 152 }
153 } else { 153 } else {
154 SkASSERT(!fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()); 154 SkASSERT(!fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid());
155 SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid()); 155 SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid());
156 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid()); 156 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
157 } 157 }
158 158
159 if (NULL != fGeometryProcessor.get()) { 159 if (fGeometryProcessor.get()) {
160 SkASSERT(NULL != geometryProcessor); 160 SkASSERT(geometryProcessor);
161 fGeometryProcessor->setData(fGpu, drawType,fProgramDataManager, geometry Processor); 161 fGeometryProcessor->setData(fGpu, drawType,fProgramDataManager, geometry Processor);
162 } 162 }
163 fColorEffects->setData(fGpu, drawType,fProgramDataManager, colorStages); 163 fColorEffects->setData(fGpu, drawType,fProgramDataManager, colorStages);
164 fCoverageEffects->setData(fGpu, drawType,fProgramDataManager, coverageStages ); 164 fCoverageEffects->setData(fGpu, drawType,fProgramDataManager, coverageStages );
165 165
166 // PathTexGen state applies to the the fixed function vertex shader. For 166 // PathTexGen state applies to the the fixed function vertex shader. For
167 // custom shaders, it's ignored, so we don't need to change the texgen 167 // custom shaders, it's ignored, so we don't need to change the texgen
168 // settings in that case. 168 // settings in that case.
169 if (!fHasVertexShader) { 169 if (!fHasVertexShader) {
170 fGpu->glPathRendering()->flushPathTexGenSettings(fTexCoordSetCnt); 170 fGpu->glPathRendering()->flushPathTexGenSettings(fTexCoordSetCnt);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 GrGLfloat viewMatrix[3 * 3]; 275 GrGLfloat viewMatrix[3 * 3];
276 fMatrixState.getGLMatrix<3>(viewMatrix); 276 fMatrixState.getGLMatrix<3>(viewMatrix);
277 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v iewMatrix); 277 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v iewMatrix);
278 278
279 GrGLfloat rtAdjustmentVec[4]; 279 GrGLfloat rtAdjustmentVec[4];
280 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); 280 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec);
281 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r tAdjustmentVec); 281 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r tAdjustmentVec);
282 } 282 }
283 } 283 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698