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

Unified Diff: tests/GLProgramsTest.cpp

Issue 554833002: Calculate Primary and Secondary output types in the GrOptDrawState (Closed) Base URL: https://skia.googlesource.com/skia.git@optReadDst
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/builders/GrGLVertexShaderBuilder.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/GLProgramsTest.cpp
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 0574bfc9374f77c0450fee32081ed2e131c50dca..e4d9675bff246927dc48e4e48d76b047906a2229 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -14,6 +14,7 @@
#include "GrBackendEffectFactory.h"
#include "GrContextFactory.h"
+#include "GrOptDrawState.h"
#include "effects/GrConfigConversionEffect.h"
#include "gl/GrGLPathRendering.h"
#include "gl/GrGpuGL.h"
@@ -159,16 +160,25 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
GrGLPathRendering::FixedFunction_TexturingMode;
header->fHasGeometryProcessor = vertexShader;
- CoverageOutput coverageOutput;
- bool illegalCoverageOutput;
- do {
- coverageOutput = static_cast<CoverageOutput>(random->nextULessThan(kCoverageOutputCnt));
- illegalCoverageOutput = (!gpu->caps()->dualSourceBlendingSupport() &&
- CoverageOutputUsesSecondaryOutput(coverageOutput)) ||
- (!dstRead && kCombineWithDst_CoverageOutput == coverageOutput);
- } while (illegalCoverageOutput);
+ GrOptDrawState::PrimaryOutputType primaryOutput;
+ GrOptDrawState::SecondaryOutputType secondaryOutput;
+ if (!dstRead) {
+ primaryOutput = GrOptDrawState::kModulate_PrimaryOutputType;
+ } else {
+ primaryOutput = static_cast<GrOptDrawState::PrimaryOutputType>(
+ random->nextULessThan(GrOptDrawState::kPrimaryOutputTypeCnt));
+ }
- header->fCoverageOutput = coverageOutput;
+ if (GrOptDrawState::kCombineWithDst_PrimaryOutputType == primaryOutput ||
+ !gpu->caps()->dualSourceBlendingSupport()) {
+ secondaryOutput = GrOptDrawState::kNone_SecondaryOutputType;
+ } else {
+ secondaryOutput = static_cast<GrOptDrawState::SecondaryOutputType>(
+ random->nextULessThan(GrOptDrawState::kSecondaryOutputTypeCnt));
+ }
+
+ header->fPrimaryOutputType = primaryOutput;
+ header->fSecondaryOutputType = secondaryOutput;
this->finalize();
return true;
@@ -249,7 +259,7 @@ bool GrGpuGL::programUnitTest(int maxStages) {
SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages);
bool usePathRendering = this->glCaps().pathRenderingSupport() && random.nextBool();
-
+
GrGpu::DrawType drawType = usePathRendering ? GrGpu::kDrawPath_DrawType :
GrGpu::kDrawPoints_DrawType;
« no previous file with comments | « src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698