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

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

Issue 367643004: Implement NVPR on GLES (Closed) Base URL: https://skia.googlesource.com/skia.git@02-path-program-fragment
Patch Set: rebase 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/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,

Powered by Google App Engine
This is Rietveld 408576698