OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "gl/GrGLPathRendering.h" | 8 #include "gl/GrGLPathRendering.h" |
9 #include "gl/GrGLNameAllocator.h" | 9 #include "gl/GrGLNameAllocator.h" |
10 #include "gl/GrGLUtil.h" | 10 #include "gl/GrGLUtil.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 void GrGLPathRendering::abandonGpuResources() { | 83 void GrGLPathRendering::abandonGpuResources() { |
84 fPathNameAllocator.reset(NULL); | 84 fPathNameAllocator.reset(NULL); |
85 } | 85 } |
86 | 86 |
87 void GrGLPathRendering::resetContext() { | 87 void GrGLPathRendering::resetContext() { |
88 fHWProjectionMatrixState.invalidate(); | 88 fHWProjectionMatrixState.invalidate(); |
89 // we don't use the model view matrix. | 89 // we don't use the model view matrix. |
90 GrGLenum matrixMode = | 90 GrGLenum matrixMode = |
91 fGpu->glStandard() == kGLES_GrGLStandard ? GR_GL_PATH_MODELVIEW : GR_GL_
MODELVIEW; | 91 fGpu->glCaps().nvprSupport() == GrGLCaps::kNormal_NvprSupport ? GR_G
L_PATH_MODELVIEW : |
| 92 GR_G
L_MODELVIEW; |
92 GL_CALL(MatrixLoadIdentity(matrixMode)); | 93 GL_CALL(MatrixLoadIdentity(matrixMode)); |
93 | 94 |
94 if (!caps().fragmentInputGenSupport) { | 95 if (!caps().fragmentInputGenSupport) { |
95 for (int i = 0; i < fGpu->glCaps().maxFixedFunctionTextureCoords(); ++i)
{ | 96 for (int i = 0; i < fGpu->glCaps().maxFixedFunctionTextureCoords(); ++i)
{ |
96 GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL)); | 97 GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL)); |
97 fHWPathTexGenSettings[i].fMode = GR_GL_NONE; | 98 fHWPathTexGenSettings[i].fMode = GR_GL_NONE; |
98 fHWPathTexGenSettings[i].fNumComponents = 0; | 99 fHWPathTexGenSettings[i].fNumComponents = 0; |
99 } | 100 } |
100 fHWActivePathTexGenSets = 0; | 101 fHWActivePathTexGenSets = 0; |
101 } | 102 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 return; | 350 return; |
350 } | 351 } |
351 | 352 |
352 fHWProjectionMatrixState.fViewMatrix = matrix; | 353 fHWProjectionMatrixState.fViewMatrix = matrix; |
353 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; | 354 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; |
354 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; | 355 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; |
355 | 356 |
356 GrGLfloat glMatrix[4 * 4]; | 357 GrGLfloat glMatrix[4 * 4]; |
357 fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix); | 358 fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix); |
358 GrGLenum matrixMode = | 359 GrGLenum matrixMode = |
359 fGpu->glStandard() == kGLES_GrGLStandard ? GR_GL_PATH_PROJECTION : GR_G
L_PROJECTION; | 360 fGpu->glCaps().nvprSupport() == GrGLCaps::kNormal_NvprSupport ? GR_
GL_PATH_PROJECTION : |
| 361 GR_
GL_PROJECTION; |
360 GL_CALL(MatrixLoadf(matrixMode, glMatrix)); | 362 GL_CALL(MatrixLoadf(matrixMode, glMatrix)); |
361 } | 363 } |
362 | 364 |
363 GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) { | 365 GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) { |
364 if (range > 1) { | 366 if (range > 1) { |
365 GrGLuint name; | 367 GrGLuint name; |
366 GL_CALL_RET(name, GenPaths(range)); | 368 GL_CALL_RET(name, GenPaths(range)); |
367 return name; | 369 return name; |
368 } | 370 } |
369 | 371 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 reference, mask, coverMode,
transformType, | 470 reference, mask, coverMode,
transformType, |
469 transformValues)); | 471 transformValues)); |
470 return; | 472 return; |
471 } | 473 } |
472 | 474 |
473 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 475 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
474 reference, mask, transformType, transform
Values)); | 476 reference, mask, transformType, transform
Values)); |
475 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 477 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
476 coverMode, transformType, transformValues))
; | 478 coverMode, transformType, transformValues))
; |
477 } | 479 } |
OLD | NEW |