Remove redundant caps field from GrProcessorTestData
Change-Id: Ic31338f08d1bd5b55ffab75d30c0f54436c8b917 Reviewed-on: https://skia-review.googlesource.com/7510 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
39728d331a
commit
9ae32a2024
@ -45,12 +45,10 @@ sk_sp<GrFragmentProcessor> MakeChildFP(GrProcessorTestData*);
|
||||
struct GrProcessorTestData {
|
||||
GrProcessorTestData(SkRandom* random,
|
||||
GrContext* context,
|
||||
const GrCaps* caps,
|
||||
const GrRenderTargetContext* renderTargetContext,
|
||||
GrTexture* textures[2])
|
||||
: fRandom(random)
|
||||
, fContext(context)
|
||||
, fCaps(caps)
|
||||
, fRenderTargetContext(renderTargetContext) {
|
||||
fTextures[0] = textures[0];
|
||||
fTextures[1] = textures[1];
|
||||
@ -60,7 +58,6 @@ struct GrProcessorTestData {
|
||||
}
|
||||
SkRandom* fRandom;
|
||||
GrContext* fContext;
|
||||
const GrCaps* fCaps;
|
||||
const GrRenderTargetContext* fRenderTargetContext;
|
||||
GrTexture* fTextures[2];
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "GrBezierEffect.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrShaderCaps.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "glsl/GrGLSLGeometryProcessor.h"
|
||||
@ -265,8 +265,8 @@ sk_sp<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
static_cast<GrPrimitiveEdgeType>(
|
||||
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
|
||||
gp = GrConicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
|
||||
edgeType, *d->fCaps,
|
||||
GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool());
|
||||
edgeType, *d->fContext->caps(), GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool());
|
||||
} while (nullptr == gp);
|
||||
return gp;
|
||||
}
|
||||
@ -464,10 +464,8 @@ sk_sp<GrGeometryProcessor> GrQuadEffect::TestCreate(GrProcessorTestData* d) {
|
||||
do {
|
||||
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
|
||||
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
|
||||
gp = GrQuadEffect::Make(GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
edgeType, *d->fCaps,
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
gp = GrQuadEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), edgeType,
|
||||
*d->fContext->caps(), GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool());
|
||||
} while (nullptr == gp);
|
||||
return gp;
|
||||
@ -687,8 +685,8 @@ sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
GrPrimitiveEdgeType edgeType =
|
||||
static_cast<GrPrimitiveEdgeType>(
|
||||
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
|
||||
gp = GrCubicEffect::Make(GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom), edgeType, *d->fCaps);
|
||||
gp = GrCubicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
|
||||
edgeType, *d->fContext->caps());
|
||||
} while (nullptr == gp);
|
||||
return gp;
|
||||
}
|
||||
|
@ -656,10 +656,11 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect);
|
||||
|
||||
sk_sp<GrGeometryProcessor> QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
|
||||
// Doesn't work without derivative instructions.
|
||||
return d->fCaps->shaderCaps()->shaderDerivativeSupport() ?
|
||||
QuadEdgeEffect::Make(GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool()) : nullptr;
|
||||
return d->fContext->caps()->shaderCaps()->shaderDerivativeSupport()
|
||||
? QuadEdgeEffect::Make(GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool())
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -327,8 +327,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
|
||||
std::unique_ptr<GrDrawOp> op(GrRandomDrawOp(&random, context));
|
||||
SkASSERT(op);
|
||||
|
||||
GrProcessorTestData ptd(&random, context, context->caps(),
|
||||
renderTargetContext.get(), dummyTextures);
|
||||
GrProcessorTestData ptd(&random, context, renderTargetContext.get(), dummyTextures);
|
||||
set_random_color_coverage_stages(&grPaint, &ptd, maxStages);
|
||||
set_random_xpf(&grPaint, &ptd);
|
||||
bool snapToCenters = set_random_state(&grPaint, &random);
|
||||
@ -362,8 +361,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
|
||||
for (int j = 0; j < 10; ++j) {
|
||||
std::unique_ptr<GrDrawOp> op(GrRandomDrawOp(&random, context));
|
||||
SkASSERT(op);
|
||||
GrProcessorTestData ptd(&random, context, context->caps(),
|
||||
renderTargetContext.get(), dummyTextures);
|
||||
GrProcessorTestData ptd(&random, context, renderTargetContext.get(), dummyTextures);
|
||||
GrPaint grPaint;
|
||||
grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user