OLD | NEW |
---|---|
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 | 8 |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 #include "GrGLNameAllocator.h" | 10 #include "GrGLNameAllocator.h" |
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1847 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face); | 1847 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face); |
1848 GL_CALL(StencilFillPath(id, fillMode, writeMask)); | 1848 GL_CALL(StencilFillPath(id, fillMode, writeMask)); |
1849 } | 1849 } |
1850 | 1850 |
1851 void GrGpuGL::onGpuDrawPath(const GrPath* path, SkPath::FillType fill) { | 1851 void GrGpuGL::onGpuDrawPath(const GrPath* path, SkPath::FillType fill) { |
1852 SkASSERT(this->caps()->pathRenderingSupport()); | 1852 SkASSERT(this->caps()->pathRenderingSupport()); |
1853 | 1853 |
1854 GrGLuint id = static_cast<const GrGLPath*>(path)->pathID(); | 1854 GrGLuint id = static_cast<const GrGLPath*>(path)->pathID(); |
1855 SkASSERT(NULL != this->drawState()->getRenderTarget()); | 1855 SkASSERT(NULL != this->drawState()->getRenderTarget()); |
1856 SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); | 1856 SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); |
1857 SkASSERT(!fCurrentProgram->hasVertexShader()); | |
1858 | 1857 |
1859 flushPathStencilSettings(fill); | 1858 flushPathStencilSettings(fill); |
1860 const SkStrokeRec& stroke = path->getStroke(); | 1859 const SkStrokeRec& stroke = path->getStroke(); |
1861 | 1860 |
1862 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(fill) ; | 1861 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(fill) ; |
1863 SkASSERT(!fHWPathStencilSettings.isTwoSided()); | 1862 SkASSERT(!fHWPathStencilSettings.isTwoSided()); |
1864 GrGLenum fillMode = | 1863 GrGLenum fillMode = |
1865 gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.pass Op(GrStencilSettings::kFront_Face)); | 1864 gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.pass Op(GrStencilSettings::kFront_Face)); |
1866 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face); | 1865 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face); |
1867 | 1866 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1900 } | 1899 } |
1901 } | 1900 } |
1902 | 1901 |
1903 void GrGpuGL::onGpuDrawPaths(int pathCount, const GrPath** paths, | 1902 void GrGpuGL::onGpuDrawPaths(int pathCount, const GrPath** paths, |
1904 const SkMatrix* transforms, | 1903 const SkMatrix* transforms, |
1905 SkPath::FillType fill, | 1904 SkPath::FillType fill, |
1906 SkStrokeRec::Style stroke) { | 1905 SkStrokeRec::Style stroke) { |
1907 SkASSERT(this->caps()->pathRenderingSupport()); | 1906 SkASSERT(this->caps()->pathRenderingSupport()); |
1908 SkASSERT(NULL != this->drawState()->getRenderTarget()); | 1907 SkASSERT(NULL != this->drawState()->getRenderTarget()); |
1909 SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); | 1908 SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); |
1910 SkASSERT(!fCurrentProgram->hasVertexShader()); | |
1911 SkASSERT(stroke != SkStrokeRec::kHairline_Style); | 1909 SkASSERT(stroke != SkStrokeRec::kHairline_Style); |
1912 | 1910 |
1913 SkAutoMalloc pathData(pathCount * sizeof(GrGLuint)); | 1911 SkAutoMalloc pathData(pathCount * sizeof(GrGLuint)); |
1914 SkAutoMalloc transformData(pathCount * sizeof(GrGLfloat) * 6); | 1912 SkAutoMalloc transformData(pathCount * sizeof(GrGLfloat) * 6); |
1915 GrGLfloat* transformValues = | 1913 GrGLfloat* transformValues = |
1916 reinterpret_cast<GrGLfloat*>(transformData.get()); | 1914 reinterpret_cast<GrGLfloat*>(transformData.get()); |
1917 GrGLuint* pathIDs = reinterpret_cast<GrGLuint*>(pathData.get()); | 1915 GrGLuint* pathIDs = reinterpret_cast<GrGLuint*>(pathData.get()); |
1918 | 1916 |
1919 for (int i = 0; i < pathCount; ++i) { | 1917 for (int i = 0; i < pathCount; ++i) { |
1920 SkASSERT(transforms[i].asAffine(NULL)); | 1918 SkASSERT(transforms[i].asAffine(NULL)); |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2392 matrix.cheapEqualTo(fHWProjectionMatrixState.fViewMatrix)) { | 2390 matrix.cheapEqualTo(fHWProjectionMatrixState.fViewMatrix)) { |
2393 return; | 2391 return; |
2394 } | 2392 } |
2395 | 2393 |
2396 fHWProjectionMatrixState.fViewMatrix = matrix; | 2394 fHWProjectionMatrixState.fViewMatrix = matrix; |
2397 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; | 2395 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; |
2398 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; | 2396 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; |
2399 | 2397 |
2400 GrGLfloat glMatrix[4 * 4]; | 2398 GrGLfloat glMatrix[4 * 4]; |
2401 fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix); | 2399 fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix); |
2402 GL_CALL(MatrixLoadf(GR_GL_PROJECTION, glMatrix)); | 2400 |
2401 GrGLenum matrixMode = | |
2402 this->glStandard() == kGLES_GrGLStandard ? GR_GL_PATH_PROJECTION : GR_GL _PROJECTION; | |
2403 | |
2404 GL_CALL(MatrixLoadf(matrixMode, glMatrix)); | |
2403 } | 2405 } |
2404 | 2406 |
2405 void GrGpuGL::enablePathTexGen(int unitIdx, | 2407 void GrGpuGL::enablePathTexGen(int unitIdx, |
2406 PathTexGenComponents components, | 2408 PathTexGenComponents components, |
2407 const GrGLfloat* coefficients) { | 2409 const GrGLfloat* coefficients) { |
2408 SkASSERT(this->glCaps().pathRenderingSupport()); | 2410 SkASSERT(this->glCaps().pathRenderingSupport()); |
2409 SkASSERT(components >= kS_PathTexGenComponents && | 2411 SkASSERT(components >= kS_PathTexGenComponents && |
2410 components <= kSTR_PathTexGenComponents); | 2412 components <= kSTR_PathTexGenComponents); |
2411 SkASSERT(this->glCaps().maxFixedFunctionTextureCoords() >= unitIdx); | 2413 SkASSERT(this->glCaps().maxFixedFunctionTextureCoords() >= unitIdx); |
2412 | 2414 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2472 SkASSERT(0 != fHWPathTexGenSettings[i].fNumComponents); | 2474 SkASSERT(0 != fHWPathTexGenSettings[i].fNumComponents); |
2473 | 2475 |
2474 this->setTextureUnit(i); | 2476 this->setTextureUnit(i); |
2475 GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL)); | 2477 GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL)); |
2476 fHWPathTexGenSettings[i].fNumComponents = 0; | 2478 fHWPathTexGenSettings[i].fNumComponents = 0; |
2477 } | 2479 } |
2478 | 2480 |
2479 fHWActivePathTexGenSets = numUsedTexCoordSets; | 2481 fHWActivePathTexGenSets = numUsedTexCoordSets; |
2480 } | 2482 } |
2481 | 2483 |
2484 void GrGpuGL::setProgramPathFragmentInputGen(int fragmentInputLocation, | |
2485 size_t components, | |
2486 const GrGLfloat* coefficients) { | |
2487 GL_CALL(ProgramPathFragmentInputGen(fHWProgramID, | |
Kimmo Kinnunen
2014/07/01 13:01:21
If we consider the role of GrGpuGL to contain func
| |
2488 fragmentInputLocation, | |
2489 GR_GL_OBJECT_LINEAR, | |
2490 components, | |
2491 coefficients)); | |
2492 } | |
2493 | |
2482 void GrGpuGL::flushMiscFixedFunctionState() { | 2494 void GrGpuGL::flushMiscFixedFunctionState() { |
2483 | 2495 |
2484 const GrDrawState& drawState = this->getDrawState(); | 2496 const GrDrawState& drawState = this->getDrawState(); |
2485 | 2497 |
2486 if (drawState.isDitherState()) { | 2498 if (drawState.isDitherState()) { |
2487 if (kYes_TriState != fHWDitherEnabled) { | 2499 if (kYes_TriState != fHWDitherEnabled) { |
2488 GL_CALL(Enable(GR_GL_DITHER)); | 2500 GL_CALL(Enable(GR_GL_DITHER)); |
2489 fHWDitherEnabled = kYes_TriState; | 2501 fHWDitherEnabled = kYes_TriState; |
2490 } | 2502 } |
2491 } else { | 2503 } else { |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3015 this->setVertexArrayID(gpu, 0); | 3027 this->setVertexArrayID(gpu, 0); |
3016 } | 3028 } |
3017 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3029 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3018 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3030 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3019 fDefaultVertexArrayAttribState.resize(attrCount); | 3031 fDefaultVertexArrayAttribState.resize(attrCount); |
3020 } | 3032 } |
3021 attribState = &fDefaultVertexArrayAttribState; | 3033 attribState = &fDefaultVertexArrayAttribState; |
3022 } | 3034 } |
3023 return attribState; | 3035 return attribState; |
3024 } | 3036 } |
OLD | NEW |