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

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

Issue 504203004: Attach GrOptDrawState into shader building pipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@opt2
Patch Set: Rebase Created 6 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
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLProgramDesc.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 1ad05eb9c902cab578bd75dc3b7356237e9b424b..112cecd99537d98687b90d04a45f0c432e38966a 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -4,7 +4,6 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
#include "GrGLProgram.h"
#include "GrAllocator.h"
@@ -15,6 +14,7 @@
#include "GrGLPathRendering.h"
#include "GrGLShaderVar.h"
#include "GrGLSL.h"
+#include "GrOptDrawState.h"
#include "SkXfermode.h"
#define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X)
@@ -108,31 +108,19 @@ void GrGLProgram::initSamplerUniforms() {
///////////////////////////////////////////////////////////////////////////////
-void GrGLProgram::setData(GrGpu::DrawType drawType,
- GrDrawState::BlendOptFlags blendOpts,
+void GrGLProgram::setData(const GrOptDrawState& optState,
+ GrGpu::DrawType drawType,
const GrEffectStage* geometryProcessor,
const GrEffectStage* colorStages[],
const GrEffectStage* coverageStages[],
const GrDeviceCoordTexture* dstCopy,
SharedGLState* sharedState) {
- const GrDrawState& drawState = fGpu->getDrawState();
-
- GrColor color;
- GrColor coverage;
- if (blendOpts & GrDrawState::kEmitTransBlack_BlendOptFlag) {
- color = 0;
- coverage = 0;
- } else if (blendOpts & GrDrawState::kEmitCoverage_BlendOptFlag) {
- color = 0xffffffff;
- coverage = drawState.getCoverageColor();
- } else {
- color = drawState.getColor();
- coverage = drawState.getCoverageColor();
- }
+ GrColor color = optState.getColor();
+ GrColor coverage = optState.getCoverageColor();
- this->setColor(drawState, color, sharedState);
- this->setCoverage(drawState, coverage, sharedState);
- this->setMatrixAndRenderTargetHeight(drawType, drawState);
+ this->setColor(optState, color, sharedState);
+ this->setCoverage(optState, coverage, sharedState);
+ this->setMatrixAndRenderTargetHeight(drawType, optState);
if (dstCopy) {
if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) {
@@ -170,11 +158,11 @@ void GrGLProgram::setData(GrGpu::DrawType drawType,
}
}
-void GrGLProgram::setColor(const GrDrawState& drawState,
+void GrGLProgram::setColor(const GrOptDrawState& optState,
GrColor color,
SharedGLState* sharedState) {
const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader();
- if (!drawState.hasColorVertexAttribute() || drawState.canIgnoreColorAttribute()) {
+ if (!optState.hasColorVertexAttribute()) {
switch (header.fColorInput) {
case GrGLProgramDesc::kAttribute_ColorInput:
SkASSERT(-1 != header.fColorAttributeIndex);
@@ -209,11 +197,11 @@ void GrGLProgram::setColor(const GrDrawState& drawState,
}
}
-void GrGLProgram::setCoverage(const GrDrawState& drawState,
+void GrGLProgram::setCoverage(const GrOptDrawState& optState,
GrColor coverage,
SharedGLState* sharedState) {
const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader();
- if (!drawState.hasCoverageVertexAttribute()) {
+ if (!optState.hasCoverageVertexAttribute()) {
switch (header.fCoverageInput) {
case GrGLProgramDesc::kAttribute_ColorInput:
if (sharedState->fConstAttribCoverage != coverage ||
@@ -248,8 +236,8 @@ void GrGLProgram::setCoverage(const GrDrawState& drawState,
}
void GrGLProgram::setMatrixAndRenderTargetHeight(GrGpu::DrawType drawType,
- const GrDrawState& drawState) {
- const GrRenderTarget* rt = drawState.getRenderTarget();
+ const GrOptDrawState& optState) {
+ const GrRenderTarget* rt = optState.getRenderTarget();
SkISize size;
size.set(rt->width(), rt->height());
@@ -261,13 +249,13 @@ void GrGLProgram::setMatrixAndRenderTargetHeight(GrGpu::DrawType drawType,
}
if (GrGpu::IsPathRenderingDrawType(drawType)) {
- fGpu->glPathRendering()->setProjectionMatrix(drawState.getViewMatrix(), size, rt->origin());
+ fGpu->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), size, rt->origin());
} else if (fMatrixState.fRenderTargetOrigin != rt->origin() ||
fMatrixState.fRenderTargetSize != size ||
- !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix())) {
+ !fMatrixState.fViewMatrix.cheapEqualTo(optState.getViewMatrix())) {
SkASSERT(fBuiltinUniformHandles.fViewMatrixUni.isValid());
- fMatrixState.fViewMatrix = drawState.getViewMatrix();
+ fMatrixState.fViewMatrix = optState.getViewMatrix();
fMatrixState.fRenderTargetSize = size;
fMatrixState.fRenderTargetOrigin = rt->origin();
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698