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

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

Issue 23537028: Enable vertexless shading when path rendering is supported (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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
« src/gpu/gl/GrGpuGL.cpp ('K') | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL_program.cpp
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 159d6d804a611c6fd0c424baabefa8a0c81dfbef..26ad9b8f159fa59be32960ea068e5bc2157e5997 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -202,28 +202,6 @@ void GrGpuGL::abandonResources(){
#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
-void GrGpuGL::flushPathStencilMatrix() {
- const SkMatrix& viewMatrix = this->getDrawState().getViewMatrix();
- const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
- SkISize size;
- size.set(rt->width(), rt->height());
- const SkMatrix& vm = this->getDrawState().getViewMatrix();
-
- if (fHWProjectionMatrixState.fRenderTargetOrigin != rt->origin() ||
- !fHWProjectionMatrixState.fViewMatrix.cheapEqualTo(viewMatrix) ||
- fHWProjectionMatrixState.fRenderTargetSize!= size) {
-
- fHWProjectionMatrixState.fViewMatrix = vm;
- fHWProjectionMatrixState.fRenderTargetSize = size;
- fHWProjectionMatrixState.fRenderTargetOrigin = rt->origin();
-
- GrGLfloat projectionMatrix[4 * 4];
- fHWProjectionMatrixState.getGLMatrix<4>(projectionMatrix);
- GL_CALL(MatrixMode(GR_GL_PROJECTION));
- GL_CALL(LoadMatrixf(projectionMatrix));
- }
-}
-
bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstCopy) {
const GrDrawState& drawState = this->getDrawState();
@@ -231,7 +209,10 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
SkASSERT(NULL != drawState.getRenderTarget());
if (kStencilPath_DrawType == type) {
- this->flushPathStencilMatrix();
+ const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
+ SkISize size;
+ size.set(rt->width(), rt->height());
+ this->setProjectionMatrix(drawState.getViewMatrix(), size, rt->origin());
} else {
this->flushMiscFixedFunctionState();
@@ -352,24 +333,40 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
GrGLAttribArrayState* attribState =
fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf);
- uint32_t usedAttribArraysMask = 0;
- const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs();
- int vertexAttribCount = this->getDrawState().getVertexAttribCount();
- for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
- ++vertexAttribIndex, ++vertexAttrib) {
-
- usedAttribArraysMask |= (1 << vertexAttribIndex);
- GrVertexAttribType attribType = vertexAttrib->fType;
- attribState->set(this,
- vertexAttribIndex,
- vbuf,
- GrGLAttribTypeToLayout(attribType).fCount,
- GrGLAttribTypeToLayout(attribType).fType,
- GrGLAttribTypeToLayout(attribType).fNormalized,
- stride,
- reinterpret_cast<GrGLvoid*>(
- vertexOffsetInBytes + vertexAttrib->fOffset));
- }
+ if (!fCurrentProgram->hasVertexShader()) {
+ int posIdx = this->getDrawState().positionAttributeIndex();
+ const GrVertexAttrib* vertexArray = this->getDrawState().getVertexAttribs() + posIdx;
+ GrVertexAttribType vertexArrayType = vertexArray->fType;
+ SkASSERT(!GrGLAttribTypeToLayout(vertexArrayType).fNormalized);
+ SkASSERT(GrGLAttribTypeToLayout(vertexArrayType).fCount == 2);
+ attribState->setFixedFunctionVertexArray(this,
+ vbuf,
+ 2,
+ GrGLAttribTypeToLayout(vertexArrayType).fType,
+ stride,
+ reinterpret_cast<GrGLvoid*>(
+ vertexOffsetInBytes + vertexArray->fOffset));
+ attribState->disableUnusedArrays(this, 0, true);
+ } else {
+ uint32_t usedAttribArraysMask = 0;
+ const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs();
+ int vertexAttribCount = this->getDrawState().getVertexAttribCount();
+ for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
+ ++vertexAttribIndex, ++vertexAttrib) {
+
+ usedAttribArraysMask |= (1 << vertexAttribIndex);
+ GrVertexAttribType attribType = vertexAttrib->fType;
+ attribState->set(this,
+ vertexAttribIndex,
+ vbuf,
+ GrGLAttribTypeToLayout(attribType).fCount,
+ GrGLAttribTypeToLayout(attribType).fType,
+ GrGLAttribTypeToLayout(attribType).fNormalized,
+ stride,
+ reinterpret_cast<GrGLvoid*>(
+ vertexOffsetInBytes + vertexAttrib->fOffset));
+ }
- attribState->disableUnusedArrays(this, usedAttribArraysMask, false);
+ attribState->disableUnusedArrays(this, usedAttribArraysMask, false);
+ }
}
« src/gpu/gl/GrGpuGL.cpp ('K') | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698