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

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

Issue 827973002: ViewMatrix uniform upload moved to GeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@vm-on-gp
Patch Set: feedback inc Created 6 years 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
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgram.cpp
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 60d97a296976985ff5149a2d01dffbca2df7a85e..9400e54b12c8a40a5082e0cb1616f8d717896a8f 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -132,7 +132,7 @@ void GrGLProgram::bindTextures(const GrGLInstalledProc* ip, const GrProcessor& p
///////////////////////////////////////////////////////////////////////////////
void GrGLProgram::setData(const GrOptDrawState& optState) {
- this->setMatrixAndRenderTargetHeight(optState);
+ this->setRenderTargetState(optState);
const GrDeviceCoordTexture* dstCopy = optState.getDstCopy();
if (dstCopy) {
@@ -205,37 +205,29 @@ void GrGLProgram::didSetData(GrGpu::DrawType drawType) {
SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType));
}
-void GrGLProgram::setMatrixAndRenderTargetHeight(const GrOptDrawState& optState) {
+void GrGLProgram::setRenderTargetState(const GrOptDrawState& optState) {
// Load the RT height uniform if it is needed to y-flip gl_FragCoord.
if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
- fMatrixState.fRenderTargetSize.fHeight != optState.getRenderTarget()->height()) {
+ fRenderTargetState.fRenderTargetSize.fHeight != optState.getRenderTarget()->height()) {
fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni,
SkIntToScalar(optState.getRenderTarget()->height()));
}
// call subclasses to set the actual view matrix
- this->onSetMatrixAndRenderTargetHeight(optState);
+ this->onSetRenderTargetState(optState);
}
-void GrGLProgram::onSetMatrixAndRenderTargetHeight(const GrOptDrawState& optState) {
+void GrGLProgram::onSetRenderTargetState(const GrOptDrawState& optState) {
const GrRenderTarget* rt = optState.getRenderTarget();
SkISize size;
size.set(rt->width(), rt->height());
- if (fMatrixState.fRenderTargetOrigin != rt->origin() ||
- fMatrixState.fRenderTargetSize != size ||
- !fMatrixState.fViewMatrix.cheapEqualTo(optState.getViewMatrix())) {
- SkASSERT(fBuiltinUniformHandles.fViewMatrixUni.isValid());
-
- fMatrixState.fViewMatrix = optState.getViewMatrix();
- fMatrixState.fRenderTargetSize = size;
- fMatrixState.fRenderTargetOrigin = rt->origin();
-
- GrGLfloat viewMatrix[3 * 3];
- fMatrixState.getGLMatrix<3>(viewMatrix);
- fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, viewMatrix);
+ if (fRenderTargetState.fRenderTargetOrigin != rt->origin() ||
+ fRenderTargetState.fRenderTargetSize != size) {
+ fRenderTargetState.fRenderTargetSize = size;
+ fRenderTargetState.fRenderTargetOrigin = rt->origin();
GrGLfloat rtAdjustmentVec[4];
- fMatrixState.getRTAdjustmentVec(rtAdjustmentVec);
+ fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec);
fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, rtAdjustmentVec);
}
}
@@ -254,12 +246,13 @@ GrGLNvprProgramBase::GrGLNvprProgramBase(GrGLGpu* gpu,
xferProcessor, fragmentProcessors) {
}
-void GrGLNvprProgramBase::onSetMatrixAndRenderTargetHeight(const GrOptDrawState& optState) {
+void GrGLNvprProgramBase::onSetRenderTargetState(const GrOptDrawState& optState) {
SkASSERT(GrGpu::IsPathRenderingDrawType(optState.drawType()));
const GrRenderTarget* rt = optState.getRenderTarget();
SkISize size;
size.set(rt->width(), rt->height());
- fGpu->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), size, rt->origin());
+ fGpu->glPathRendering()->setProjectionMatrix(optState.getPrimitiveProcessor()->viewMatrix(),
+ size, rt->origin());
}
/////////////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698