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

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

Issue 299943002: separate view matrix from rt adjustment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase on tot: Created 6 years, 6 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/GrGLShaderBuilder.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 fDstCopyTexUnit = -1; 46 fDstCopyTexUnit = -1;
47 47
48 fColor = GrColor_ILLEGAL; 48 fColor = GrColor_ILLEGAL;
49 49
50 if (fDesc.getHeader().fHasVertexCode || 50 if (fDesc.getHeader().fHasVertexCode ||
51 !fGpu->shouldUseFixedFunctionTexturing()) { 51 !fGpu->shouldUseFixedFunctionTexturing()) {
52 GrGLFullShaderBuilder fullBuilder(fGpu, fUniformManager, fDesc); 52 GrGLFullShaderBuilder fullBuilder(fGpu, fUniformManager, fDesc);
53 if (this->genProgram(&fullBuilder, colorStages, coverageStages)) { 53 if (this->genProgram(&fullBuilder, colorStages, coverageStages)) {
54 fUniformHandles.fViewMatrixUni = fullBuilder.getViewMatrixUniform(); 54 fUniformHandles.fViewMatrixUni = fullBuilder.getViewMatrixUniform();
55 fUniformHandles.fRTAdjustmentUni = fullBuilder.getRTAdjustmentVecUni form();
55 fHasVertexShader = true; 56 fHasVertexShader = true;
56 } 57 }
57 } else { 58 } else {
58 GrGLFragmentOnlyShaderBuilder fragmentOnlyBuilder(fGpu, fUniformManager, fDesc); 59 GrGLFragmentOnlyShaderBuilder fragmentOnlyBuilder(fGpu, fUniformManager, fDesc);
59 if (this->genProgram(&fragmentOnlyBuilder, colorStages, coverageStages)) { 60 if (this->genProgram(&fragmentOnlyBuilder, colorStages, coverageStages)) {
60 fNumTexCoordSets = fragmentOnlyBuilder.getNumTexCoordSets(); 61 fNumTexCoordSets = fragmentOnlyBuilder.getNumTexCoordSets();
61 } 62 }
62 } 63 }
63 } 64 }
64 65
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 size.set(rt->width(), rt->height()); 323 size.set(rt->width(), rt->height());
323 324
324 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. 325 // Load the RT height uniform if it is needed to y-flip gl_FragCoord.
325 if (fUniformHandles.fRTHeightUni.isValid() && 326 if (fUniformHandles.fRTHeightUni.isValid() &&
326 fMatrixState.fRenderTargetSize.fHeight != size.fHeight) { 327 fMatrixState.fRenderTargetSize.fHeight != size.fHeight) {
327 fUniformManager.set1f(fUniformHandles.fRTHeightUni, SkIntToScalar(size.f Height)); 328 fUniformManager.set1f(fUniformHandles.fRTHeightUni, SkIntToScalar(size.f Height));
328 } 329 }
329 330
330 if (!fHasVertexShader) { 331 if (!fHasVertexShader) {
331 SkASSERT(!fUniformHandles.fViewMatrixUni.isValid()); 332 SkASSERT(!fUniformHandles.fViewMatrixUni.isValid());
333 SkASSERT(!fUniformHandles.fRTAdjustmentUni.isValid());
332 fGpu->setProjectionMatrix(drawState.getViewMatrix(), size, rt->origin()) ; 334 fGpu->setProjectionMatrix(drawState.getViewMatrix(), size, rt->origin()) ;
333 } else if (fMatrixState.fRenderTargetOrigin != rt->origin() || 335 } else if (fMatrixState.fRenderTargetOrigin != rt->origin() ||
334 fMatrixState.fRenderTargetSize != size || 336 fMatrixState.fRenderTargetSize != size ||
335 !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix()) ) { 337 !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix()) ) {
336 SkASSERT(fUniformHandles.fViewMatrixUni.isValid()); 338 SkASSERT(fUniformHandles.fViewMatrixUni.isValid());
337 339
338 fMatrixState.fViewMatrix = drawState.getViewMatrix(); 340 fMatrixState.fViewMatrix = drawState.getViewMatrix();
339 fMatrixState.fRenderTargetSize = size; 341 fMatrixState.fRenderTargetSize = size;
340 fMatrixState.fRenderTargetOrigin = rt->origin(); 342 fMatrixState.fRenderTargetOrigin = rt->origin();
341 343
342 GrGLfloat viewMatrix[3 * 3]; 344 GrGLfloat viewMatrix[3 * 3];
343 fMatrixState.getGLMatrix<3>(viewMatrix); 345 fMatrixState.getGLMatrix<3>(viewMatrix);
344 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix); 346 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix);
347
348 GrGLfloat rtAdjustmentVec[4];
349 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec);
350 fUniformManager.set4fv(fUniformHandles.fRTAdjustmentUni, 1, rtAdjustment Vec);
345 } 351 }
346 } 352 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698