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

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

Issue 827973002: ViewMatrix uniform upload moved to GeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@vm-on-gp
Patch Set: more cleanup Created 5 years, 11 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 "GrAllocator.h" 10 #include "GrAllocator.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && 210 if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
211 fMatrixState.fRenderTargetSize.fHeight != optState.getRenderTarget()->he ight()) { 211 fMatrixState.fRenderTargetSize.fHeight != optState.getRenderTarget()->he ight()) {
212 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, 212 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni,
213 SkIntToScalar(optState.getRenderTarget()->hei ght())); 213 SkIntToScalar(optState.getRenderTarget()->hei ght()));
214 } 214 }
215 215
216 // call subclasses to set the actual view matrix 216 // call subclasses to set the actual view matrix
217 this->onSetMatrixAndRenderTargetHeight(optState); 217 this->onSetMatrixAndRenderTargetHeight(optState);
218 } 218 }
219 219
220 void GrGLProgram::onSetMatrixAndRenderTargetHeight(const GrOptDrawState& optStat e) { 220 void GrGLProgram::onSetMatrixAndRenderTargetHeight(const GrOptDrawState& optStat e) {
bsalomon 2014/12/30 13:19:38 onSetRenderTargetState?
221 const GrRenderTarget* rt = optState.getRenderTarget(); 221 const GrRenderTarget* rt = optState.getRenderTarget();
222 SkISize size; 222 SkISize size;
223 size.set(rt->width(), rt->height()); 223 size.set(rt->width(), rt->height());
224 if (fMatrixState.fRenderTargetOrigin != rt->origin() || 224 if (fMatrixState.fRenderTargetOrigin != rt->origin() ||
225 fMatrixState.fRenderTargetSize != size || 225 fMatrixState.fRenderTargetSize != size) {
226 !fMatrixState.fViewMatrix.cheapEqualTo(optState.getViewMatrix())) {
227 SkASSERT(fBuiltinUniformHandles.fViewMatrixUni.isValid());
228
229 fMatrixState.fViewMatrix = optState.getViewMatrix();
230 fMatrixState.fRenderTargetSize = size; 226 fMatrixState.fRenderTargetSize = size;
231 fMatrixState.fRenderTargetOrigin = rt->origin(); 227 fMatrixState.fRenderTargetOrigin = rt->origin();
232 228
233 GrGLfloat viewMatrix[3 * 3];
234 fMatrixState.getGLMatrix<3>(viewMatrix);
235 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v iewMatrix);
236
237 GrGLfloat rtAdjustmentVec[4]; 229 GrGLfloat rtAdjustmentVec[4];
238 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); 230 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec);
239 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r tAdjustmentVec); 231 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r tAdjustmentVec);
240 } 232 }
241 } 233 }
242 234
243 //////////////////////////////////////////////////////////////////////////////// ///////// 235 //////////////////////////////////////////////////////////////////////////////// /////////
244 236
245 GrGLNvprProgramBase::GrGLNvprProgramBase(GrGLGpu* gpu, 237 GrGLNvprProgramBase::GrGLNvprProgramBase(GrGLGpu* gpu,
246 const GrProgramDesc& desc, 238 const GrProgramDesc& desc,
247 const BuiltinUniformHandles& builtinUni forms, 239 const BuiltinUniformHandles& builtinUni forms,
248 GrGLuint programID, 240 GrGLuint programID,
249 const UniformInfoArray& uniforms, 241 const UniformInfoArray& uniforms,
250 GrGLInstalledGeoProc* primProc, 242 GrGLInstalledGeoProc* primProc,
251 GrGLInstalledXferProc* xferProcessor, 243 GrGLInstalledXferProc* xferProcessor,
252 GrGLInstalledFragProcs* fragmentProcess ors) 244 GrGLInstalledFragProcs* fragmentProcess ors)
253 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, 245 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc,
254 xferProcessor, fragmentProcessors) { 246 xferProcessor, fragmentProcessors) {
255 } 247 }
256 248
257 void GrGLNvprProgramBase::onSetMatrixAndRenderTargetHeight(const GrOptDrawState& optState) { 249 void GrGLNvprProgramBase::onSetMatrixAndRenderTargetHeight(const GrOptDrawState& optState) {
258 SkASSERT(GrGpu::IsPathRenderingDrawType(optState.drawType())); 250 SkASSERT(GrGpu::IsPathRenderingDrawType(optState.drawType()));
259 const GrRenderTarget* rt = optState.getRenderTarget(); 251 const GrRenderTarget* rt = optState.getRenderTarget();
260 SkISize size; 252 SkISize size;
261 size.set(rt->width(), rt->height()); 253 size.set(rt->width(), rt->height());
262 fGpu->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), size, rt->origin()); 254 fGpu->glPathRendering()->setProjectionMatrix(optState.getPrimitiveProcessor( )->viewMatrix(),
255 size, rt->origin());
263 } 256 }
264 257
265 //////////////////////////////////////////////////////////////////////////////// ///////// 258 //////////////////////////////////////////////////////////////////////////////// /////////
266 259
267 GrGLNvprProgram::GrGLNvprProgram(GrGLGpu* gpu, 260 GrGLNvprProgram::GrGLNvprProgram(GrGLGpu* gpu,
268 const GrProgramDesc& desc, 261 const GrProgramDesc& desc,
269 const BuiltinUniformHandles& builtinUniforms, 262 const BuiltinUniformHandles& builtinUniforms,
270 GrGLuint programID, 263 GrGLuint programID,
271 const UniformInfoArray& uniforms, 264 const UniformInfoArray& uniforms,
272 GrGLInstalledGeoProc* primProc, 265 GrGLInstalledGeoProc* primProc,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 for (int t = 0; t < numTransforms; ++t) { 339 for (int t = 0; t < numTransforms; ++t) {
347 const SkMatrix& transform = get_transform_matrix(proc, t, localMatrix); 340 const SkMatrix& transform = get_transform_matrix(proc, t, localMatrix);
348 GrGLPathRendering::PathTexGenComponents components = 341 GrGLPathRendering::PathTexGenComponents components =
349 GrGLPathRendering::kST_PathTexGenComponents; 342 GrGLPathRendering::kST_PathTexGenComponents;
350 if (proc.isPerspectiveCoordTransform(t)) { 343 if (proc.isPerspectiveCoordTransform(t)) {
351 components = GrGLPathRendering::kSTR_PathTexGenComponents; 344 components = GrGLPathRendering::kSTR_PathTexGenComponents;
352 } 345 }
353 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t ransform); 346 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t ransform);
354 } 347 }
355 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698