Flutter Engine
The Flutter Engine
Functions
PrimitiveProcessorTest.cpp File Reference
#include "include/core/SkColorSpace.h"
#include "include/core/SkRect.h"
#include "include/core/SkString.h"
#include "include/core/SkSurfaceProps.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrDirectContext.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/base/SkArenaAlloc.h"
#include "src/core/SkPointPriv.h"
#include "src/core/SkSLTypeShared.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/ganesh/GrAppliedClip.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrGeometryProcessor.h"
#include "src/gpu/ganesh/GrGpu.h"
#include "src/gpu/ganesh/GrOpFlushState.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/GrPipeline.h"
#include "src/gpu/ganesh/GrProcessorSet.h"
#include "src/gpu/ganesh/GrProgramInfo.h"
#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLVarying.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelper.h"
#include "tests/CtsEnforcement.h"
#include "tests/Test.h"
#include <cstddef>
#include <memory>
#include <utility>

Go to the source code of this file.

Functions

 DEF_GANESH_TEST_FOR_ALL_CONTEXTS (VertexAttributeCount, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
 

Function Documentation

◆ DEF_GANESH_TEST_FOR_ALL_CONTEXTS()

DEF_GANESH_TEST_FOR_ALL_CONTEXTS ( VertexAttributeCount  ,
reporter  ,
ctxInfo  ,
CtsEnforcement::kApiLevel_T   
)

Definition at line 200 of file PrimitiveProcessorTest.cpp.

203 {
204 auto dContext = ctxInfo.directContext();
205#if GR_GPU_STATS
206 GrGpu* gpu = dContext->priv().getGpu();
207#endif
208
209 auto sdc = skgpu::ganesh::SurfaceDrawContext::Make(dContext,
211 nullptr,
213 {1, 1},
215 /*label=*/{});
216 if (!sdc) {
217 ERRORF(reporter, "Could not create render target context.");
218 return;
219 }
220 int attribCnt = dContext->priv().caps()->maxVertexAttributes();
221 if (!attribCnt) {
222 ERRORF(reporter, "No attributes allowed?!");
223 return;
224 }
225 dContext->flushAndSubmit();
226 dContext->priv().resetGpuStats();
227#if GR_GPU_STATS
228 REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 0);
229 REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 0);
230#endif
231 // Adding discard to appease vulkan validation warning about loading uninitialized data on draw
232 sdc->discard();
233
234 GrPaint grPaint;
235 // This one should succeed.
236 sdc->addDrawOp(Op::Make(dContext, attribCnt));
237 dContext->flushAndSubmit();
238#if GR_GPU_STATS
239 REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 1);
240 REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 0);
241#endif
242 dContext->priv().resetGpuStats();
243 sdc->addDrawOp(Op::Make(dContext, attribCnt + 1));
244 dContext->flushAndSubmit();
245#if GR_GPU_STATS
246 REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 0);
247 REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 1);
248#endif
249}
reporter
Definition: FontMgrTest.cpp:39
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
#define ERRORF(r,...)
Definition: Test.h:293
Definition: GrGpu.h:62
Stats * stats()
Definition: GrGpu.h:551
static std::unique_ptr< SurfaceDrawContext > Make(GrRecordingContext *, GrColorType, sk_sp< GrSurfaceProxy >, sk_sp< SkColorSpace >, GrSurfaceOrigin, const SkSurfaceProps &)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)