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

Unified Diff: src/gpu/gl/GrGLPathRendering.cpp

Issue 367643004: Implement NVPR on GLES (Closed) Base URL: https://skia.googlesource.com/skia.git@02-path-program-fragment
Patch Set: rebse Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLPathRendering.cpp
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 135eb16866d9ad7f91d8ea4ee261fc56b5db6c7b..337e83e81172b3cc5b04a2aabb790741a95abd03 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -54,8 +54,12 @@ GrGLPathRendering::GrGLPathRendering(GrGpuGL* gpu)
NULL != glInterface->fFunctions.fStencilThenCoverFillPathInstanced &&
NULL != glInterface->fFunctions.fStencilThenCoverStrokePathInstanced;
fCaps.fragmentInputGenSupport =
+ kGLES_GrGLStandard == glInterface->fStandard &&
NULL != glInterface->fFunctions.fProgramPathFragmentInputGen;
- fHWPathTexGenSettings.reset(fGpu->glCaps().maxFixedFunctionTextureCoords());
+
+ if (!fCaps.fragmentInputGenSupport) {
+ fHWPathTexGenSettings.reset(fGpu->glCaps().maxFixedFunctionTextureCoords());
+ }
}
GrGLPathRendering::~GrGLPathRendering() {
@@ -68,14 +72,18 @@ void GrGLPathRendering::abandonGpuResources() {
void GrGLPathRendering::resetContext() {
fHWProjectionMatrixState.invalidate();
// we don't use the model view matrix.
- GL_CALL(MatrixLoadIdentity(GR_GL_MODELVIEW));
-
- for (int i = 0; i < fGpu->glCaps().maxFixedFunctionTextureCoords(); ++i) {
- GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL));
- fHWPathTexGenSettings[i].fMode = GR_GL_NONE;
- fHWPathTexGenSettings[i].fNumComponents = 0;
+ GrGLenum matrixMode =
+ fGpu->glStandard() == kGLES_GrGLStandard ? GR_GL_PATH_MODELVIEW : GR_GL_MODELVIEW;
+ GL_CALL(MatrixLoadIdentity(matrixMode));
+
+ if (!caps().fragmentInputGenSupport) {
+ for (int i = 0; i < fGpu->glCaps().maxFixedFunctionTextureCoords(); ++i) {
+ GL_CALL(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();
}
@@ -105,7 +113,6 @@ void GrGLPathRendering::drawPath(const GrPath* path, SkPath::FillType fill) {
GrGLuint id = static_cast<const GrGLPath*>(path)->pathID();
SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
SkASSERT(NULL != fGpu->drawState()->getRenderTarget()->getStencilBuffer());
- SkASSERT(!fGpu->fCurrentProgram->hasVertexShader());
this->flushPathStencilSettings(fill);
SkASSERT(!fHWPathStencilSettings.isTwoSided());
@@ -162,7 +169,6 @@ void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, const uint32_t i
SkASSERT(fGpu->caps()->pathRenderingSupport());
SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
SkASSERT(NULL != fGpu->drawState()->getRenderTarget()->getStencilBuffer());
- SkASSERT(!fGpu->fCurrentProgram->hasVertexShader());
GrGLuint baseID = static_cast<const GrGLPathRange*>(pathRange)->basePathID();
@@ -347,7 +353,9 @@ void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix,
GrGLfloat glMatrix[4 * 4];
fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix);
- GL_CALL(MatrixLoadf(GR_GL_PROJECTION, glMatrix));
+ GrGLenum matrixMode =
+ fGpu->glStandard() == kGLES_GrGLStandard ? GR_GL_PATH_PROJECTION : GR_GL_PROJECTION;
+ GL_CALL(MatrixLoadf(matrixMode, glMatrix));
}
GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) {

Powered by Google App Engine
This is Rietveld 408576698