From 8d49d93bb33a9594a9e4a9c12e3261f47d151218 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Mon, 21 May 2012 21:40:12 +0000 Subject: [PATCH] Stop Tracking const vertex attrib color and coverage using GrDrawState Review URL: http://codereview.appspot.com/6219056/ git-svn-id: http://skia.googlecode.com/svn/trunk@4022 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/gl/GrGpuGL.cpp | 2 -- src/gpu/gl/GrGpuGLShaders.cpp | 10 ++++++---- src/gpu/gl/GrGpuGLShaders.h | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 6fa9584..b6bfd65 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -493,8 +493,6 @@ void GrGpuGL::onResetContext() { fHWBlendState.invalidate(); - fHWDrawState.setColor(GrColor_ILLEGAL); - fHWDrawState.setViewMatrix(GrMatrix::InvalidMatrix()); for (int s = 0; s < GrDrawState::kNumStages; ++s) { diff --git a/src/gpu/gl/GrGpuGLShaders.cpp b/src/gpu/gl/GrGpuGLShaders.cpp index 7687a14..32f021f 100644 --- a/src/gpu/gl/GrGpuGLShaders.cpp +++ b/src/gpu/gl/GrGpuGLShaders.cpp @@ -382,6 +382,8 @@ void GrGpuGLShaders::onResetContext() { } fHWProgramID = 0; + fHWConstAttribColor = GrColor_ILLEGAL; + fHWConstAttribCoverage = GrColor_ILLEGAL; } void GrGpuGLShaders::flushViewMatrix() { @@ -607,7 +609,7 @@ void GrGpuGLShaders::flushColor(GrColor color) { if (this->getVertexLayout() & kColor_VertexLayoutBit) { // color will be specified per-vertex as an attribute // invalidate the const vertex attrib color - fHWDrawState.setColor(GrColor_ILLEGAL); + fHWConstAttribColor = GrColor_ILLEGAL; } else { switch (desc.fColorInput) { case ProgramDesc::kAttribute_ColorInput: @@ -617,7 +619,7 @@ void GrGpuGLShaders::flushColor(GrColor color) { float c[] = GR_COLOR_TO_VEC4(color); GL_CALL(VertexAttrib4fv(GrGLProgram::ColorAttributeIdx(), c)); - fHWDrawState.setColor(color); + fHWConstAttribColor = color; } break; case ProgramDesc::kUniform_ColorInput: @@ -657,7 +659,7 @@ void GrGpuGLShaders::flushCoverage(GrColor coverage) { if (this->getVertexLayout() & kCoverage_VertexLayoutBit) { // coverage will be specified per-vertex as an attribute // invalidate the const vertex attrib coverage - fHWDrawState.setCoverage4(GrColor_ILLEGAL); + fHWConstAttribCoverage = GrColor_ILLEGAL; } else { switch (desc.fCoverageInput) { case ProgramDesc::kAttribute_ColorInput: @@ -667,7 +669,7 @@ void GrGpuGLShaders::flushCoverage(GrColor coverage) { float c[] = GR_COLOR_TO_VEC4(coverage); GL_CALL(VertexAttrib4fv(GrGLProgram::CoverageAttributeIdx(), c)); - fHWDrawState.setCoverage(coverage); + fHWConstAttribCoverage = coverage; } break; case ProgramDesc::kUniform_ColorInput: diff --git a/src/gpu/gl/GrGpuGLShaders.h b/src/gpu/gl/GrGpuGLShaders.h index cb72e2a..f16fa02 100644 --- a/src/gpu/gl/GrGpuGLShaders.h +++ b/src/gpu/gl/GrGpuGLShaders.h @@ -81,7 +81,11 @@ private: ProgramCache* fProgramCache; CachedData* fProgramData; + GrGLuint fHWProgramID; + GrColor fHWConstAttribColor; + GrColor fHWConstAttribCoverage; + GrGLProgram fCurrentProgram; // If we get rid of fixed function subclass this should move // to the GLCaps struct in parent class -- 2.7.4