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

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

Issue 545693004: Calculate stage stats in GrOptDrawState (Closed) Base URL: https://skia.googlesource.com/skia.git@connectOpt2
Patch Set: 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
Index: src/gpu/gl/GrGLProgramDesc.cpp
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index ea380107d71c2c0f84fe8ba101aa3e69dba70263..f38b72aa8f1dc4ae16b9625e2db92b4b2b4bc1d3 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -15,25 +15,11 @@
#include "SkChecksum.h"
-bool GrGLProgramDesc::GetEffectKeyAndUpdateStats(const GrEffectStage& stage,
- const GrGLCaps& caps,
- bool useExplicitLocalCoords,
- GrEffectKeyBuilder* b,
- uint16_t* effectKeySize,
- bool* setTrueIfReadsDst,
- bool* setTrueIfReadsPos,
- bool* setTrueIfRequiresVertexShader) {
+bool GrGLProgramDesc::GetEffectKey(const GrEffectStage& stage, const GrGLCaps& caps,
+ bool useExplicitLocalCoords, GrEffectKeyBuilder* b,
+ uint16_t* effectKeySize) {
const GrBackendEffectFactory& factory = stage.getEffect()->getFactory();
GrDrawEffect drawEffect(stage, useExplicitLocalCoords);
- if (stage.getEffect()->willReadDstColor()) {
- *setTrueIfReadsDst = true;
- }
- if (stage.getEffect()->willReadFragmentPosition()) {
- *setTrueIfReadsPos = true;
- }
- if (stage.getEffect()->requiresVertexShader()) {
- *setTrueIfRequiresVertexShader = true;
- }
factory.getGLEffectKey(drawEffect, caps, b);
size_t size = b->size();
if (size > SK_MaxU16) {
@@ -73,11 +59,12 @@ bool GrGLProgramDesc::Build(const GrOptDrawState& optState,
bool requiresLocalCoordAttrib = optState.numTotalStages() > 0 &&
optState.hasLocalCoordAttribute();
- bool readsDst = false;
- bool readFragPosition = false;
+ bool readsDst = optState.readsDst();
bsalomon 2014/09/05 15:27:55 remove the vars?
egdaniel 2014/09/08 19:19:49 removed
+ bool readFragPosition = optState.readsFragPosition();
// Provide option for shader programs without vertex shader only when drawing paths.
- bool requiresVertexShader = !GrGpu::IsPathRenderingDrawType(drawType);
+ bool requiresVertexShader =
bsalomon 2014/09/05 15:27:55 I wonder whether this should just be an assert...
egdaniel 2014/09/08 19:19:49 Added assert below On 2014/09/05 15:27:55, bsalom
+ !GrGpu::IsPathRenderingDrawType(drawType) ? true : optState.requiresVertexShader();
int numStages = optState.numTotalStages();
@@ -96,11 +83,10 @@ bool GrGLProgramDesc::Build(const GrOptDrawState& optState,
GrEffectKeyBuilder b(&desc->fKey);
uint16_t effectKeySize;
uint32_t effectOffset = desc->fKey.count();
- effectKeySuccess |= GetEffectKeyAndUpdateStats(
+ effectKeySuccess |= GetEffectKey(
optState.getColorStage(s), gpu->glCaps(),
requiresLocalCoordAttrib, &b,
- &effectKeySize, &readsDst,
- &readFragPosition, &requiresVertexShader);
+ &effectKeySize);
effectKeySuccess |= (effectOffset <= SK_MaxU16);
offsetAndSize[0] = SkToU16(effectOffset);
@@ -115,11 +101,10 @@ bool GrGLProgramDesc::Build(const GrOptDrawState& optState,
GrEffectKeyBuilder b(&desc->fKey);
uint16_t effectKeySize;
uint32_t effectOffset = desc->fKey.count();
- effectKeySuccess |= GetEffectKeyAndUpdateStats(
+ effectKeySuccess |= GetEffectKey(
optState.getCoverageStage(s), gpu->glCaps(),
requiresLocalCoordAttrib, &b,
- &effectKeySize, &readsDst,
- &readFragPosition, &requiresVertexShader);
+ &effectKeySize);
effectKeySuccess |= (effectOffset <= SK_MaxU16);
offsetAndSize[0] = SkToU16(effectOffset);

Powered by Google App Engine
This is Rietveld 408576698