Chromium Code Reviews| Index: src/gpu/gl/GrGpuGL.cpp |
| diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp |
| index 52caf9d3ea31564eb7061f287b04cdc37234df9a..b45f443f9e96ea30c9621dd68e8162a73978ec01 100644 |
| --- a/src/gpu/gl/GrGpuGL.cpp |
| +++ b/src/gpu/gl/GrGpuGL.cpp |
| @@ -136,8 +136,15 @@ GrGpuGL::GrGpuGL(const GrGLContext& ctx, GrContext* context) |
| SkASSERT(ctx.isInitialized()); |
| fCaps.reset(SkRef(ctx.caps())); |
| + if (this->glCaps().pathRenderingSupport()) { |
| + fPathRendering.reset(GrGLPathRendering::Create(glInterface())); |
| + } |
| + |
| fHWBoundTextureUniqueIDs.reset(this->glCaps().maxFragmentTextureUnits()); |
| - fHWPathTexGenSettings.reset(this->glCaps().maxFixedFunctionTextureCoords()); |
| + if (this->glCaps().pathRenderingSupport() && |
| + !this->pathRendering()->caps().fragmentInputGenSupport) { |
|
bsalomon
2014/08/07 21:02:52
Maybe we should move the hw path tex gen settings
Chris Dalton
2014/08/07 23:02:55
The original idea for GrGLPathRendering was to mir
|
| + fHWPathTexGenSettings.reset(this->glCaps().maxFixedFunctionTextureCoords()); |
| + } |
| GrGLClearErr(fGLContext.interface()); |
| if (gPrintStartupSpew) { |
| @@ -164,10 +171,6 @@ GrGpuGL::GrGpuGL(const GrGLContext& ctx, GrContext* context) |
| fLastSuccessfulStencilFmtIdx = 0; |
| fHWProgramID = 0; |
| - |
| - if (this->glCaps().pathRenderingSupport()) { |
| - fPathRendering.reset(GrGLPathRendering::Create(glInterface())); |
| - } |
| } |
| GrGpuGL::~GrGpuGL() { |
| @@ -330,14 +333,19 @@ void GrGpuGL::onResetContext(uint32_t resetBits) { |
| if (this->caps()->pathRenderingSupport()) { |
| fHWProjectionMatrixState.invalidate(); |
| // we don't use the model view matrix. |
|
bsalomon
2014/08/07 21:02:52
Again, I think we should move this state tracking
|
| - GL_CALL(MatrixLoadIdentity(GR_GL_MODELVIEW)); |
| + GrGLenum matrixMode = |
| + this->glStandard() == kGLES_GrGLStandard ? GR_GL_PATH_MODELVIEW : GR_GL_MODELVIEW; |
| + |
| + GL_CALL(MatrixLoadIdentity(matrixMode)); |
| - for (int i = 0; i < this->glCaps().maxFixedFunctionTextureCoords(); ++i) { |
| - fPathRendering->pathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL); |
| - fHWPathTexGenSettings[i].fMode = GR_GL_NONE; |
| - fHWPathTexGenSettings[i].fNumComponents = 0; |
| + if (!this->pathRendering()->caps().fragmentInputGenSupport) { |
| + for (int i = 0; i < this->glCaps().maxFixedFunctionTextureCoords(); ++i) { |
| + fPathRendering->pathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL); |
| + fHWPathTexGenSettings[i].fMode = GR_GL_NONE; |
| + fHWPathTexGenSettings[i].fNumComponents = 0; |
| + } |
| + fHWActivePathTexGenSets = 0; |
| } |
| - fHWActivePathTexGenSets = 0; |
| } |
| fHWPathStencilSettings.invalidate(); |
| } |
| @@ -1894,7 +1902,6 @@ void GrGpuGL::onGpuDrawPath(const GrPath* path, SkPath::FillType fill) { |
| GrGLuint id = static_cast<const GrGLPath*>(path)->pathID(); |
| SkASSERT(NULL != this->drawState()->getRenderTarget()); |
| SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); |
| - SkASSERT(!fCurrentProgram->hasVertexShader()); |
| flushPathStencilSettings(fill); |
| const SkStrokeRec& stroke = path->getStroke(); |
| @@ -1950,7 +1957,6 @@ void GrGpuGL::onGpuDrawPaths(const GrPathRange* pathRange, |
| SkASSERT(this->caps()->pathRenderingSupport()); |
|
bsalomon
2014/08/07 21:02:52
Move whole impl to path rendering class?
|
| SkASSERT(NULL != this->drawState()->getRenderTarget()); |
| SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); |
| - SkASSERT(!fCurrentProgram->hasVertexShader()); |
| GrGLuint baseID = static_cast<const GrGLPathRange*>(pathRange)->basePathID(); |
| @@ -2386,7 +2392,11 @@ void GrGpuGL::setProjectionMatrix(const SkMatrix& matrix, |
| GrGLfloat glMatrix[4 * 4]; |
| fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix); |
| - GL_CALL(MatrixLoadf(GR_GL_PROJECTION, glMatrix)); |
| + |
| + GrGLenum matrixMode = |
|
bsalomon
2014/08/07 21:02:52
Move to PR class?
|
| + this->glStandard() == kGLES_GrGLStandard ? GR_GL_PATH_PROJECTION : GR_GL_PROJECTION; |
| + |
| + GL_CALL(MatrixLoadf(matrixMode, glMatrix)); |
| } |
| void GrGpuGL::enablePathTexGen(int unitIdx, |