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

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: address review comments (rebase to separated patches) 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 84b8c8e9e729ec2ff88abeebe42295ef13af1f18..309f97efe8500744d7a970332ba3d3a4cb720535 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -55,8 +55,12 @@ GrGLPathRendering::GrGLPathRendering(GrGpuGL* gpu, const GrGLInterface* glInterf
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() {
@@ -69,14 +73,18 @@ void GrGLPathRendering::abandonGpuResources() {
void GrGLPathRendering::onResetContext() {
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);
const SkStrokeRec& stroke = path->getStroke();
@@ -160,7 +167,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();
@@ -344,7 +350,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