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

Unified Diff: tests/GLProgramsTest.cpp

Issue 586793002: Change GrGLProgramDesc header to have DoPathRendering flag instead of RequiresVertexShader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cast to bool 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/GrGLProgramBuilder.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 7fc084fb1ff0bde390c7dc6b15197a039b15c56e..0574bfc9374f77c0450fee32081ed2e131c50dca 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -35,15 +35,19 @@ static void get_stage_stats(const GrEffectStage stage, bool* readsDst,
}
bool GrGLProgramDesc::setRandom(SkRandom* random,
- const GrGpuGL* gpu,
+ GrGpuGL* gpu,
const GrRenderTarget* dstRenderTarget,
const GrTexture* dstCopyTexture,
const GrEffectStage* geometryProcessor,
const GrEffectStage* stages[],
int numColorStages,
int numCoverageStages,
- int currAttribIndex) {
- bool useLocalCoords = random->nextBool() && currAttribIndex < GrDrawState::kMaxVertexAttribCnt;
+ int currAttribIndex,
+ GrGpu::DrawType drawType) {
+ bool isPathRendering = GrGpu::IsPathRenderingDrawType(drawType);
+ bool useLocalCoords = !isPathRendering &&
+ random->nextBool() &&
+ currAttribIndex < GrDrawState::kMaxVertexAttribCnt;
int numStages = numColorStages + numCoverageStages;
fKey.reset();
@@ -110,12 +114,10 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
// if the effects have used up all off the available attributes,
// don't try to use color or coverage attributes as input
do {
- uint32_t colorRand = random->nextULessThan(2);
- header->fColorInput = (0 == colorRand) ? GrGLProgramDesc::kAttribute_ColorInput :
- GrGLProgramDesc::kUniform_ColorInput;
- } while (GrDrawState::kMaxVertexAttribCnt <= currAttribIndex &&
+ header->fColorInput = static_cast<GrGLProgramDesc::ColorInput>(
+ random->nextULessThan(kColorInputCnt));
+ } while ((GrDrawState::kMaxVertexAttribCnt <= currAttribIndex || isPathRendering) &&
kAttribute_ColorInput == header->fColorInput);
-
header->fColorAttributeIndex = (header->fColorInput == kAttribute_ColorInput) ?
currAttribIndex++ :
-1;
@@ -123,7 +125,7 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
do {
header->fCoverageInput = static_cast<GrGLProgramDesc::ColorInput>(
random->nextULessThan(kColorInputCnt));
- } while (GrDrawState::kMaxVertexAttribCnt <= currAttribIndex &&
+ } while ((GrDrawState::kMaxVertexAttribCnt <= currAttribIndex || isPathRendering) &&
kAttribute_ColorInput == header->fCoverageInput);
header->fCoverageAttributeIndex = (header->fCoverageInput == kAttribute_ColorInput) ?
currAttribIndex++ :
@@ -153,10 +155,8 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
header->fFragPosKey = 0;
}
- header->fRequiresVertexShader = vertexShader ||
- useLocalCoords ||
- kAttribute_ColorInput == header->fColorInput ||
- kAttribute_ColorInput == header->fCoverageInput;
+ header->fUseFragShaderOnly = isPathRendering && gpu->glPathRendering()->texturingMode() ==
+ GrGLPathRendering::FixedFunction_TexturingMode;
header->fHasGeometryProcessor = vertexShader;
CoverageOutput coverageOutput;
@@ -248,12 +248,13 @@ bool GrGpuGL::programUnitTest(int maxStages) {
SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages);
- bool useFixedFunctionPathRendering = this->glCaps().pathRenderingSupport() &&
- this->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunction_TexturingMode &&
- random.nextBool();
+ bool usePathRendering = this->glCaps().pathRenderingSupport() && random.nextBool();
+
+ GrGpu::DrawType drawType = usePathRendering ? GrGpu::kDrawPath_DrawType :
+ GrGpu::kDrawPoints_DrawType;
SkAutoTDelete<GrEffectStage> geometryProcessor;
- bool hasGeometryProcessor = useFixedFunctionPathRendering ? false : random.nextBool();
+ bool hasGeometryProcessor = usePathRendering ? false : random.nextBool();
if (hasGeometryProcessor) {
while (true) {
SkAutoTUnref<const GrEffect> effect(GrEffectTestFactory::CreateStage(
@@ -306,7 +307,8 @@ bool GrGpuGL::programUnitTest(int maxStages) {
// If adding this effect would exceed the max texture coord set count then generate a
// new random effect.
- if (useFixedFunctionPathRendering) {
+ if (usePathRendering && this->glPathRendering()->texturingMode() ==
+ GrGLPathRendering::FixedFunction_TexturingMode) {;
int numTransforms = effect->numTransforms();
if (currTextureCoordSet + numTransforms > this->glCaps().maxFixedFunctionTextureCoords()) {
continue;
@@ -327,7 +329,8 @@ bool GrGpuGL::programUnitTest(int maxStages) {
stages.get(),
numColorStages,
numCoverageStages,
- currAttribIndex)) {
+ currAttribIndex,
+ drawType)) {
return false;
}
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698