2017-06-06 18:27:16 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkTypes.h"
|
|
|
|
#include "tests/Test.h"
|
2017-06-06 18:27:16 +00:00
|
|
|
|
2020-07-06 14:56:46 +00:00
|
|
|
#include "include/gpu/GrDirectContext.h"
|
2020-07-01 16:55:01 +00:00
|
|
|
#include "include/gpu/GrRecordingContext.h"
|
2019-06-18 13:58:02 +00:00
|
|
|
#include "src/gpu/GrColor.h"
|
2020-10-14 15:23:11 +00:00
|
|
|
#include "src/gpu/GrDirectContextPriv.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/gpu/GrGeometryProcessor.h"
|
2019-09-30 16:15:30 +00:00
|
|
|
#include "src/gpu/GrImageInfo.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/gpu/GrMemoryPool.h"
|
|
|
|
#include "src/gpu/GrOpFlushState.h"
|
2019-08-26 15:08:51 +00:00
|
|
|
#include "src/gpu/GrOpsRenderPass.h"
|
2019-10-08 16:32:56 +00:00
|
|
|
#include "src/gpu/GrProgramInfo.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/gpu/GrRecordingContextPriv.h"
|
|
|
|
#include "src/gpu/GrRenderTargetContext.h"
|
|
|
|
#include "src/gpu/GrRenderTargetContextPriv.h"
|
|
|
|
#include "src/gpu/GrResourceProvider.h"
|
|
|
|
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
|
|
|
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
|
|
|
#include "src/gpu/glsl/GrGLSLVarying.h"
|
|
|
|
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
2017-06-06 18:27:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a GPU-backend specific test for dynamic pipeline state. It draws boxes using dynamic
|
|
|
|
* scissor rectangles then reads back the result to verify a successful test.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static constexpr int kScreenSize = 6;
|
|
|
|
static constexpr int kNumMeshes = 4;
|
|
|
|
static constexpr int kScreenSplitX = kScreenSize/2;
|
|
|
|
static constexpr int kScreenSplitY = kScreenSize/2;
|
|
|
|
|
2018-06-26 13:12:38 +00:00
|
|
|
static const SkIRect kDynamicScissors[kNumMeshes] = {
|
|
|
|
SkIRect::MakeLTRB(0, 0, kScreenSplitX, kScreenSplitY),
|
|
|
|
SkIRect::MakeLTRB(0, kScreenSplitY, kScreenSplitX, kScreenSize),
|
|
|
|
SkIRect::MakeLTRB(kScreenSplitX, 0, kScreenSize, kScreenSplitY),
|
|
|
|
SkIRect::MakeLTRB(kScreenSplitX, kScreenSplitY, kScreenSize, kScreenSize),
|
2017-06-06 18:27:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const GrColor kMeshColors[kNumMeshes] {
|
|
|
|
GrColorPackRGBA(255, 0, 0, 255),
|
|
|
|
GrColorPackRGBA(0, 255, 0, 255),
|
|
|
|
GrColorPackRGBA(0, 0, 255, 255),
|
|
|
|
GrColorPackRGBA(0, 0, 0, 255)
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Vertex {
|
|
|
|
float fX;
|
|
|
|
float fY;
|
|
|
|
GrColor fColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
class GrPipelineDynamicStateTestProcessor : public GrGeometryProcessor {
|
|
|
|
public:
|
2019-11-20 21:08:10 +00:00
|
|
|
static GrGeometryProcessor* Make(SkArenaAlloc* arena) {
|
|
|
|
return arena->make<GrPipelineDynamicStateTestProcessor>();
|
2018-06-19 18:33:47 +00:00
|
|
|
}
|
2017-06-06 18:27:16 +00:00
|
|
|
|
|
|
|
const char* name() const override { return "GrPipelineDynamicStateTest Processor"; }
|
|
|
|
|
|
|
|
void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
|
|
|
|
|
|
|
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const final;
|
|
|
|
|
Change how GPs configure attributes
Adds setVertexAttributes and setInstanceAttributes. These take a pointer
to the first attribute, and a count. The count is the total number of
possible attributes, though some may not be initialized. The base class
computes the number of initialized attributes, pre-computes the strides,
and only allows subsequent access to the initialized attributes.
The attributes need to be allocated contiguously. Some GPs place them in
an array, though most just place them as consecutive members, and pass
a pointer to the first one.
Indexed access would be possible, but now it makes more sense to iterate
over all attributes, so enable that, and use range-based for everywhere.
Completely remove the per-attribute offset helper (again - possible, but
not real helpful), and make the stride always available. In many ops,
just use the GP's computed stride, rather than re-computing it.
Bug: skia:
Change-Id: Ie4cccb7969a98ee5a10b373e714fbd702e875b3e
Reviewed-on: https://skia-review.googlesource.com/c/169241
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-12 20:34:00 +00:00
|
|
|
const Attribute& inVertex() const { return kAttributes[0]; }
|
|
|
|
const Attribute& inColor() const { return kAttributes[1]; }
|
2018-06-19 18:33:47 +00:00
|
|
|
|
Change how GPs configure attributes
Adds setVertexAttributes and setInstanceAttributes. These take a pointer
to the first attribute, and a count. The count is the total number of
possible attributes, though some may not be initialized. The base class
computes the number of initialized attributes, pre-computes the strides,
and only allows subsequent access to the initialized attributes.
The attributes need to be allocated contiguously. Some GPs place them in
an array, though most just place them as consecutive members, and pass
a pointer to the first one.
Indexed access would be possible, but now it makes more sense to iterate
over all attributes, so enable that, and use range-based for everywhere.
Completely remove the per-attribute offset helper (again - possible, but
not real helpful), and make the stride always available. In many ops,
just use the GP's computed stride, rather than re-computing it.
Bug: skia:
Change-Id: Ie4cccb7969a98ee5a10b373e714fbd702e875b3e
Reviewed-on: https://skia-review.googlesource.com/c/169241
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-12 20:34:00 +00:00
|
|
|
private:
|
2019-11-20 21:08:10 +00:00
|
|
|
friend class ::SkArenaAlloc; // for access to ctor
|
|
|
|
|
|
|
|
GrPipelineDynamicStateTestProcessor()
|
|
|
|
: INHERITED(kGrPipelineDynamicStateTestProcessor_ClassID) {
|
|
|
|
this->setVertexAttributes(kAttributes, SK_ARRAY_COUNT(kAttributes));
|
|
|
|
}
|
|
|
|
|
Change how GPs configure attributes
Adds setVertexAttributes and setInstanceAttributes. These take a pointer
to the first attribute, and a count. The count is the total number of
possible attributes, though some may not be initialized. The base class
computes the number of initialized attributes, pre-computes the strides,
and only allows subsequent access to the initialized attributes.
The attributes need to be allocated contiguously. Some GPs place them in
an array, though most just place them as consecutive members, and pass
a pointer to the first one.
Indexed access would be possible, but now it makes more sense to iterate
over all attributes, so enable that, and use range-based for everywhere.
Completely remove the per-attribute offset helper (again - possible, but
not real helpful), and make the stride always available. In many ops,
just use the GP's computed stride, rather than re-computing it.
Bug: skia:
Change-Id: Ie4cccb7969a98ee5a10b373e714fbd702e875b3e
Reviewed-on: https://skia-review.googlesource.com/c/169241
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-12 20:34:00 +00:00
|
|
|
static constexpr Attribute kAttributes[] = {
|
|
|
|
{"vertex", kFloat2_GrVertexAttribType, kHalf2_GrSLType},
|
|
|
|
{"color", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType},
|
|
|
|
};
|
2017-06-06 18:27:16 +00:00
|
|
|
|
|
|
|
friend class GLSLPipelineDynamicStateTestProcessor;
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = GrGeometryProcessor;
|
2017-06-06 18:27:16 +00:00
|
|
|
};
|
Change how GPs configure attributes
Adds setVertexAttributes and setInstanceAttributes. These take a pointer
to the first attribute, and a count. The count is the total number of
possible attributes, though some may not be initialized. The base class
computes the number of initialized attributes, pre-computes the strides,
and only allows subsequent access to the initialized attributes.
The attributes need to be allocated contiguously. Some GPs place them in
an array, though most just place them as consecutive members, and pass
a pointer to the first one.
Indexed access would be possible, but now it makes more sense to iterate
over all attributes, so enable that, and use range-based for everywhere.
Completely remove the per-attribute offset helper (again - possible, but
not real helpful), and make the stride always available. In many ops,
just use the GP's computed stride, rather than re-computing it.
Bug: skia:
Change-Id: Ie4cccb7969a98ee5a10b373e714fbd702e875b3e
Reviewed-on: https://skia-review.googlesource.com/c/169241
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-12 20:34:00 +00:00
|
|
|
constexpr GrPrimitiveProcessor::Attribute GrPipelineDynamicStateTestProcessor::kAttributes[];
|
2017-06-06 18:27:16 +00:00
|
|
|
|
|
|
|
class GLSLPipelineDynamicStateTestProcessor : public GrGLSLGeometryProcessor {
|
2020-07-01 19:14:39 +00:00
|
|
|
void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor&) final {}
|
2017-06-06 18:27:16 +00:00
|
|
|
|
|
|
|
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) final {
|
|
|
|
const GrPipelineDynamicStateTestProcessor& mp =
|
|
|
|
args.fGP.cast<GrPipelineDynamicStateTestProcessor>();
|
|
|
|
|
|
|
|
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
|
|
|
|
varyingHandler->emitAttributes(mp);
|
Change how GPs configure attributes
Adds setVertexAttributes and setInstanceAttributes. These take a pointer
to the first attribute, and a count. The count is the total number of
possible attributes, though some may not be initialized. The base class
computes the number of initialized attributes, pre-computes the strides,
and only allows subsequent access to the initialized attributes.
The attributes need to be allocated contiguously. Some GPs place them in
an array, though most just place them as consecutive members, and pass
a pointer to the first one.
Indexed access would be possible, but now it makes more sense to iterate
over all attributes, so enable that, and use range-based for everywhere.
Completely remove the per-attribute offset helper (again - possible, but
not real helpful), and make the stride always available. In many ops,
just use the GP's computed stride, rather than re-computing it.
Bug: skia:
Change-Id: Ie4cccb7969a98ee5a10b373e714fbd702e875b3e
Reviewed-on: https://skia-review.googlesource.com/c/169241
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-12 20:34:00 +00:00
|
|
|
varyingHandler->addPassThroughAttribute(mp.inColor(), args.fOutputColor);
|
2017-06-06 18:27:16 +00:00
|
|
|
|
|
|
|
GrGLSLVertexBuilder* v = args.fVertBuilder;
|
Change how GPs configure attributes
Adds setVertexAttributes and setInstanceAttributes. These take a pointer
to the first attribute, and a count. The count is the total number of
possible attributes, though some may not be initialized. The base class
computes the number of initialized attributes, pre-computes the strides,
and only allows subsequent access to the initialized attributes.
The attributes need to be allocated contiguously. Some GPs place them in
an array, though most just place them as consecutive members, and pass
a pointer to the first one.
Indexed access would be possible, but now it makes more sense to iterate
over all attributes, so enable that, and use range-based for everywhere.
Completely remove the per-attribute offset helper (again - possible, but
not real helpful), and make the stride always available. In many ops,
just use the GP's computed stride, rather than re-computing it.
Bug: skia:
Change-Id: Ie4cccb7969a98ee5a10b373e714fbd702e875b3e
Reviewed-on: https://skia-review.googlesource.com/c/169241
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-12 20:34:00 +00:00
|
|
|
v->codeAppendf("float2 vertex = %s;", mp.inVertex().name());
|
2017-09-20 15:24:15 +00:00
|
|
|
gpArgs->fPositionVar.set(kFloat2_GrSLType, "vertex");
|
2017-06-06 18:27:16 +00:00
|
|
|
|
2018-02-14 20:38:14 +00:00
|
|
|
GrGLSLFPFragmentBuilder* f = args.fFragBuilder;
|
2017-09-18 18:10:39 +00:00
|
|
|
f->codeAppendf("%s = half4(1);", args.fOutputCoverage);
|
2017-06-06 18:27:16 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
GrGLSLPrimitiveProcessor*
|
|
|
|
GrPipelineDynamicStateTestProcessor::createGLSLInstance(const GrShaderCaps&) const {
|
|
|
|
return new GLSLPipelineDynamicStateTestProcessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
class GrPipelineDynamicStateTestOp : public GrDrawOp {
|
|
|
|
public:
|
|
|
|
DEFINE_OP_CLASS_ID
|
|
|
|
|
2020-10-07 20:46:15 +00:00
|
|
|
static GrOp::Owner Make(GrRecordingContext* context,
|
|
|
|
GrScissorTest scissorTest,
|
|
|
|
sk_sp<const GrBuffer> vbuff) {
|
|
|
|
return GrOp::Make<GrPipelineDynamicStateTestOp>(context, scissorTest, std::move(vbuff));
|
2018-06-07 15:05:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2020-10-07 20:46:15 +00:00
|
|
|
friend class GrOp;
|
2018-06-12 14:11:12 +00:00
|
|
|
|
2018-08-15 06:53:25 +00:00
|
|
|
GrPipelineDynamicStateTestOp(GrScissorTest scissorTest, sk_sp<const GrBuffer> vbuff)
|
2020-03-23 18:29:16 +00:00
|
|
|
: INHERITED(ClassID())
|
|
|
|
, fScissorTest(scissorTest)
|
|
|
|
, fVertexBuffer(std::move(vbuff)) {
|
2017-06-06 18:27:16 +00:00
|
|
|
this->setBounds(SkRect::MakeIWH(kScreenSize, kScreenSize),
|
2019-10-01 19:14:44 +00:00
|
|
|
HasAABloat::kNo, IsHairline::kNo);
|
2017-06-06 18:27:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char* name() const override { return "GrPipelineDynamicStateTestOp"; }
|
|
|
|
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
|
2020-03-23 18:29:16 +00:00
|
|
|
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*,
|
|
|
|
bool hasMixedSampledCoverage, GrClampType) override {
|
|
|
|
return GrProcessorSet::EmptySetAnalysis();
|
2017-06-16 14:04:34 +00:00
|
|
|
}
|
2020-03-23 18:29:16 +00:00
|
|
|
void onPrePrepare(GrRecordingContext*,
|
2020-11-19 18:41:26 +00:00
|
|
|
const GrSurfaceProxyView& writeView,
|
2020-03-23 18:29:16 +00:00
|
|
|
GrAppliedClip*,
|
2020-09-11 13:33:54 +00:00
|
|
|
const GrXferProcessor::DstProxyView&,
|
2020-11-20 15:22:43 +00:00
|
|
|
GrXferBarrierFlags renderPassXferBarriers,
|
|
|
|
GrLoadOp colorLoadOp) override {}
|
2017-06-06 18:27:16 +00:00
|
|
|
void onPrepare(GrOpFlushState*) override {}
|
2019-10-08 16:32:56 +00:00
|
|
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
2020-03-23 18:29:16 +00:00
|
|
|
GrPipeline pipeline(fScissorTest, SkBlendMode::kSrc,
|
2020-11-19 18:41:26 +00:00
|
|
|
flushState->drawOpArgs().writeView().swizzle());
|
2020-03-16 15:25:50 +00:00
|
|
|
SkSTArray<kNumMeshes, GrSimpleMesh> meshes;
|
2017-06-06 18:27:16 +00:00
|
|
|
for (int i = 0; i < kNumMeshes; ++i) {
|
2020-03-16 15:25:50 +00:00
|
|
|
GrSimpleMesh& mesh = meshes.push_back();
|
2020-03-13 15:21:12 +00:00
|
|
|
mesh.set(fVertexBuffer, 4, 4 * i);
|
2017-06-06 18:27:16 +00:00
|
|
|
}
|
2019-10-08 16:32:56 +00:00
|
|
|
|
2020-03-23 18:29:16 +00:00
|
|
|
auto geomProc = GrPipelineDynamicStateTestProcessor::Make(flushState->allocator());
|
|
|
|
|
2020-11-20 17:28:45 +00:00
|
|
|
GrProgramInfo programInfo(flushState->writeView(),
|
2020-03-23 18:29:16 +00:00
|
|
|
&pipeline,
|
2020-09-25 18:21:18 +00:00
|
|
|
&GrUserStencilSettings::kUnused,
|
2020-03-23 18:29:16 +00:00
|
|
|
geomProc,
|
2020-09-11 13:33:54 +00:00
|
|
|
GrPrimitiveType::kTriangleStrip, 0,
|
2020-11-20 15:22:43 +00:00
|
|
|
flushState->renderPassBarriers(),
|
|
|
|
flushState->colorLoadOp());
|
2020-03-23 18:29:16 +00:00
|
|
|
|
|
|
|
flushState->bindPipeline(programInfo, SkRect::MakeIWH(kScreenSize, kScreenSize));
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
2020-03-16 23:34:44 +00:00
|
|
|
if (fScissorTest == GrScissorTest::kEnabled) {
|
|
|
|
flushState->setScissorRect(kDynamicScissors[i]);
|
|
|
|
}
|
|
|
|
flushState->drawMesh(meshes[i]);
|
|
|
|
}
|
2017-06-06 18:27:16 +00:00
|
|
|
}
|
|
|
|
|
2018-08-15 06:53:25 +00:00
|
|
|
GrScissorTest fScissorTest;
|
2017-06-06 18:27:16 +00:00
|
|
|
const sk_sp<const GrBuffer> fVertexBuffer;
|
|
|
|
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = GrDrawOp;
|
2017-06-06 18:27:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo) {
|
2020-08-11 16:02:22 +00:00
|
|
|
auto dContext = ctxInfo.directContext();
|
|
|
|
GrResourceProvider* rp = dContext->priv().resourceProvider();
|
2017-06-06 18:27:16 +00:00
|
|
|
|
2020-01-08 16:52:34 +00:00
|
|
|
auto rtc = GrRenderTargetContext::Make(
|
2020-08-11 16:02:22 +00:00
|
|
|
dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
|
2020-01-08 16:52:34 +00:00
|
|
|
{kScreenSize, kScreenSize});
|
2017-06-06 18:27:16 +00:00
|
|
|
if (!rtc) {
|
|
|
|
ERRORF(reporter, "could not create render target context.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr float d = (float) kScreenSize;
|
|
|
|
Vertex vdata[kNumMeshes * 4] = {
|
|
|
|
{0, 0, kMeshColors[0]},
|
|
|
|
{0, d, kMeshColors[0]},
|
|
|
|
{d, 0, kMeshColors[0]},
|
|
|
|
{d, d, kMeshColors[0]},
|
|
|
|
|
|
|
|
{0, 0, kMeshColors[1]},
|
|
|
|
{0, d, kMeshColors[1]},
|
|
|
|
{d, 0, kMeshColors[1]},
|
|
|
|
{d, d, kMeshColors[1]},
|
|
|
|
|
|
|
|
{0, 0, kMeshColors[2]},
|
|
|
|
{0, d, kMeshColors[2]},
|
|
|
|
{d, 0, kMeshColors[2]},
|
|
|
|
{d, d, kMeshColors[2]},
|
|
|
|
|
|
|
|
{0, 0, kMeshColors[3]},
|
|
|
|
{0, d, kMeshColors[3]},
|
|
|
|
{d, 0, kMeshColors[3]},
|
|
|
|
{d, d, kMeshColors[3]}
|
|
|
|
};
|
|
|
|
|
2019-02-07 16:31:24 +00:00
|
|
|
sk_sp<const GrBuffer> vbuff(rp->createBuffer(sizeof(vdata), GrGpuBufferType::kVertex,
|
|
|
|
kDynamic_GrAccessPattern, vdata));
|
2017-06-06 18:27:16 +00:00
|
|
|
if (!vbuff) {
|
|
|
|
ERRORF(reporter, "vbuff is null.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t resultPx[kScreenSize * kScreenSize];
|
|
|
|
|
2018-08-15 06:53:25 +00:00
|
|
|
for (GrScissorTest scissorTest : {GrScissorTest::kEnabled, GrScissorTest::kDisabled}) {
|
2020-05-26 20:57:38 +00:00
|
|
|
rtc->clear(SkPMColor4f::FromBytes_RGBA(0xbaaaaaad));
|
2017-06-06 18:27:16 +00:00
|
|
|
rtc->priv().testingOnly_addDrawOp(
|
2020-08-11 16:02:22 +00:00
|
|
|
GrPipelineDynamicStateTestOp::Make(dContext, scissorTest, vbuff));
|
|
|
|
auto ii = SkImageInfo::Make(kScreenSize, kScreenSize,
|
|
|
|
kRGBA_8888_SkColorType, kPremul_SkAlphaType);
|
|
|
|
rtc->readPixels(dContext, ii, resultPx, 4 * kScreenSize, {0, 0});
|
2017-06-06 18:27:16 +00:00
|
|
|
for (int y = 0; y < kScreenSize; ++y) {
|
|
|
|
for (int x = 0; x < kScreenSize; ++x) {
|
|
|
|
int expectedColorIdx;
|
2018-08-15 06:53:25 +00:00
|
|
|
if (GrScissorTest::kEnabled == scissorTest) {
|
2017-06-06 18:27:16 +00:00
|
|
|
expectedColorIdx = (x < kScreenSplitX ? 0 : 2) + (y < kScreenSplitY ? 0 : 1);
|
|
|
|
} else {
|
|
|
|
expectedColorIdx = kNumMeshes - 1;
|
|
|
|
}
|
|
|
|
uint32_t expected = kMeshColors[expectedColorIdx];
|
|
|
|
uint32_t actual = resultPx[y * kScreenSize + x];
|
|
|
|
if (expected != actual) {
|
|
|
|
ERRORF(reporter, "[scissor=%s] pixel (%i,%i): got 0x%x expected 0x%x",
|
2018-08-15 06:53:25 +00:00
|
|
|
GrScissorTest::kEnabled == scissorTest ? "enabled" : "disabled", x, y,
|
2017-06-06 18:27:16 +00:00
|
|
|
actual, expected);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|