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

Unified Diff: tests/GLProgramsTest.cpp

Issue 582963002: Solo gp (Closed) Base URL: https://skia.googlesource.com/skia.git@no_peb
Patch Set: fix 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: tests/GLProgramsTest.cpp
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 7fc084fb1ff0bde390c7dc6b15197a039b15c56e..a9253ebcfec68c5e623adc195f7df3062e575ee7 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -12,7 +12,7 @@
#if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
-#include "GrBackendEffectFactory.h"
+#include "GrBackendProcessorFactory.h"
#include "GrContextFactory.h"
#include "effects/GrConfigConversionEffect.h"
#include "gl/GrGLPathRendering.h"
@@ -21,25 +21,22 @@
#include "SkRandom.h"
#include "Test.h"
-static void get_stage_stats(const GrEffectStage stage, bool* readsDst,
+static void get_stage_stats(const GrFragmentStage stage, bool* readsDst,
bool* readsFragPosition, bool* requiresVertexShader) {
- if (stage.getEffect()->willReadDstColor()) {
+ if (stage.getFragmentProcessor()->willReadDstColor()) {
*readsDst = true;
}
- if (stage.getEffect()->willReadFragmentPosition()) {
+ if (stage.getProcessor()->willReadFragmentPosition()) {
*readsFragPosition = true;
}
- if (stage.getEffect()->requiresVertexShader()) {
- *requiresVertexShader = true;
- }
}
bool GrGLProgramDesc::setRandom(SkRandom* random,
const GrGpuGL* gpu,
const GrRenderTarget* dstRenderTarget,
const GrTexture* dstCopyTexture,
- const GrEffectStage* geometryProcessor,
- const GrEffectStage* stages[],
+ const GrGeometryStage* geometryProcessor,
+ const GrFragmentStage* stages[],
int numColorStages,
int numCoverageStages,
int currAttribIndex) {
@@ -59,7 +56,7 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
bool vertexShader = SkToBool(geometryProcessor);
int offset = 0;
if (geometryProcessor) {
- const GrEffectStage* stage = geometryProcessor;
+ const GrGeometryStage* stage = geometryProcessor;
uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() +
kEffectKeyOffsetsAndLengthOffset +
offset * 2 * sizeof(uint16_t));
@@ -68,20 +65,21 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
fKey.reset();
return false;
}
- GrEffectKeyBuilder b(&fKey);
+ GrProcessorKeyBuilder b(&fKey);
uint16_t effectKeySize;
- if (!GetEffectKey(*stage, gpu->glCaps(), useLocalCoords, &b, &effectKeySize)) {
+ if (!GetProcessorKey(*stage, gpu->glCaps(), useLocalCoords, &b, &effectKeySize)) {
fKey.reset();
return false;
}
- get_stage_stats(*stage, &dstRead, &fragPos, &vertexShader);
+ vertexShader = true;
+ fragPos = stage->getProcessor()->willReadFragmentPosition();
offsetAndSize[0] = effectKeyOffset;
offsetAndSize[1] = effectKeySize;
offset++;
}
for (int s = 0; s < numStages; ++s, ++offset) {
- const GrEffectStage* stage = stages[s];
+ const GrFragmentStage* stage = stages[s];
uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() +
kEffectKeyOffsetsAndLengthOffset +
offset * 2 * sizeof(uint16_t));
@@ -90,9 +88,9 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
fKey.reset();
return false;
}
- GrEffectKeyBuilder b(&fKey);
+ GrProcessorKeyBuilder b(&fKey);
uint16_t effectKeySize;
- if (!GetEffectKey(*stages[s], gpu->glCaps(), useLocalCoords, &b, &effectKeySize)) {
+ if (!GetProcessorKey(*stages[s], gpu->glCaps(), useLocalCoords, &b, &effectKeySize)) {
fKey.reset();
return false;
}
@@ -180,8 +178,8 @@ bool GrGLProgramDesc::setRandom(SkRandom* random,
// than two attributes.
GrVertexAttrib genericVertexAttribs[] = {
{ kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding },
- { kVec2f_GrVertexAttribType, 0, kEffect_GrVertexAttribBinding },
- { kVec2f_GrVertexAttribType, 0, kEffect_GrVertexAttribBinding }
+ { kVec2f_GrVertexAttribType, 0, kGeometryProcessor_GrVertexAttribBinding },
+ { kVec2f_GrVertexAttribType, 0, kGeometryProcessor_GrVertexAttribBinding }
};
/*
@@ -246,36 +244,30 @@ bool GrGpuGL::programUnitTest(int maxStages) {
int numColorStages = random.nextULessThan(numStages + 1);
int numCoverageStages = numStages - numColorStages;
- SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages);
+ SkAutoSTMalloc<8, const GrFragmentStage*> stages(numStages);
bool useFixedFunctionPathRendering = this->glCaps().pathRenderingSupport() &&
this->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunction_TexturingMode &&
random.nextBool();
- SkAutoTDelete<GrEffectStage> geometryProcessor;
- bool hasGeometryProcessor = useFixedFunctionPathRendering ? false : random.nextBool();
+ SkAutoTDelete<GrGeometryStage> geometryProcessor;
+ bool hasGeometryProcessor = false;//useFixedFunctionPathRendering ? false : random.nextBool();
if (hasGeometryProcessor) {
while (true) {
- SkAutoTUnref<const GrEffect> effect(GrEffectTestFactory::CreateStage(
- &random,
- this->getContext(),
- *this->caps(),
- dummyTextures));
+ SkAutoTUnref<const GrGeometryProcessor> effect(
+ GrProcessorTestFactory<GrGeometryProcessor>::CreateStage(&random, this->getContext(), *this->caps(),
+ dummyTextures));
SkASSERT(effect);
// Only geometryProcessor can use vertex shader
- if (!effect->requiresVertexShader()) {
- continue;
- }
-
- GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, (effect.get()));
+ GrGeometryStage* stage = SkNEW_ARGS(GrGeometryStage, (effect.get()));
geometryProcessor.reset(stage);
// we have to set dummy vertex attribs
- const GrEffect::VertexAttribArray& v = effect->getVertexAttribs();
+ const GrGeometryProcessor::VertexAttribArray& v = effect->getVertexAttribs();
int numVertexAttribs = v.count();
- SkASSERT(GrEffect::kMaxVertexAttribs == 2 &&
- GrEffect::kMaxVertexAttribs >= numVertexAttribs);
+ SkASSERT(GrGeometryProcessor::kMaxVertexAttribs == 2 &&
+ GrGeometryProcessor::kMaxVertexAttribs >= numVertexAttribs);
size_t runningStride = GrVertexAttribTypeSize(genericVertexAttribs[0].fType);
for (int i = 0; i < numVertexAttribs; i++) {
genericVertexAttribs[i + 1].fOffset = runningStride;
@@ -292,18 +284,14 @@ bool GrGpuGL::programUnitTest(int maxStages) {
}
}
for (int s = 0; s < numStages;) {
- SkAutoTUnref<const GrEffect> effect(GrEffectTestFactory::CreateStage(
+ SkAutoTUnref<const GrFragmentProcessor> effect(
+ GrProcessorTestFactory<GrFragmentProcessor>::CreateStage(
&random,
this->getContext(),
*this->caps(),
dummyTextures));
SkASSERT(effect);
- // Only geometryProcessor can use vertex shader
- if (effect->requiresVertexShader()) {
- continue;
- }
-
// If adding this effect would exceed the max texture coord set count then generate a
// new random effect.
if (useFixedFunctionPathRendering) {
@@ -313,7 +301,7 @@ bool GrGpuGL::programUnitTest(int maxStages) {
}
currTextureCoordSet += numTransforms;
}
- GrEffectStage* stage = SkNEW_ARGS(GrEffectStage, (effect.get()));
+ GrFragmentStage* stage = SkNEW_ARGS(GrFragmentStage, (effect.get()));
stages[s] = stage;
++s;

Powered by Google App Engine
This is Rietveld 408576698