8#ifndef skgpu_graphite_DrawPassCommands_DEFINED
9#define skgpu_graphite_DrawPassCommands_DEFINED
18namespace DrawPassCommands {
29#define SKGPU_DRAW_PASS_COMMAND_TYPES(M) \
30 M(BindGraphicsPipeline) \
31 M(SetBlendConstants) \
32 M(BindUniformBuffer) \
34 M(BindTexturesAndSamplers) \
39 M(DrawIndexedInstanced) \
41 M(DrawIndexedIndirect)
48#define ACT_AS_PTR(ptr) \
49 operator T*() const { return ptr; } \
50 T* operator->() const { return ptr; }
68#define COMMAND(T, ...) \
70static constexpr Type kType = Type::k##T; \
75 uint32_t fPipelineIndex);
95 uint32_t fVertexCount);
100 uint32_t fBaseVertex);
103 uint32_t fBaseVertex;
104 uint32_t fVertexCount;
105 uint32_t fBaseInstance;
106 uint32_t fInstanceCount);
110 uint32_t fIndexCount;
111 uint32_t fBaseVertex;
112 uint32_t fBaseInstance;
113 uint32_t fInstanceCount);
121#define ASSERT_TRIV_DES(T) static_assert(std::is_trivially_destructible<T>::value);
123#undef ASSERT_TRIV_DES
124#define ASSERT_TRIV_CPY(T) static_assert(std::is_trivially_copyable<T>::value);
126#undef ASSERT_TRIV_CPY
136 this->add<BindGraphicsPipeline>(pipelineIndex);
140 this->add<SetBlendConstants>(this->
copy(blendConstants.data(), 4));
144 this->add<BindUniformBuffer>(
info, slot);
148 std::pair<int*, int*>
152 this->add<BindTexturesAndSamplers>(numTexSamplers, textureIndices, samplerIndices);
153 return {textureIndices, samplerIndices};
157 this->add<SetScissor>(scissor);
164 this->add<BindDrawBuffers>(vertexAttribs, instanceAttribs, indices, indirect);
168 this->add<Draw>(
type, baseVertex, vertexCount);
172 unsigned int indexCount,
unsigned int baseVertex) {
173 this->add<DrawIndexed>(
type, baseIndex, indexCount, baseVertex);
177 unsigned int baseVertex,
unsigned int vertexCount,
178 unsigned int baseInstance,
unsigned int instanceCount) {
179 this->add<DrawInstanced>(
type, baseVertex, vertexCount, baseInstance, instanceCount);
183 unsigned int baseIndex,
unsigned int indexCount,
184 unsigned int baseVertex,
unsigned int baseInstance,
185 unsigned int instanceCount) {
186 this->add<DrawIndexedInstanced>(
type,
195 this->add<DrawIndirect>(
type);
199 this->add<DrawIndexedIndirect>(
type);
207 template <
typename T,
typename... Args>
208 void add(Args&&...
args) {
215 template <
typename T>
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define ASSERT_TRIV_DES(T)
#define SKGPU_DRAW_PASS_COMMAND_TYPES(M)
#define ASSERT_TRIV_CPY(T)
T * makeArrayDefault(size_t count)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
std::pair< Type, void * > Command
void drawIndirect(PrimitiveType type)
void setScissor(SkIRect scissor)
void drawIndexedIndirect(PrimitiveType type)
void draw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount)
void drawIndexed(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount, unsigned int baseVertex)
std::pair< int *, int * > bindDeferredTexturesAndSamplers(int numTexSamplers)
void setBlendConstants(std::array< float, 4 > blendConstants)
void drawIndexedInstanced(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount, unsigned int baseVertex, unsigned int baseInstance, unsigned int instanceCount)
void bindGraphicsPipeline(uint32_t pipelineIndex)
void bindUniformBuffer(BindUniformBufferInfo info, UniformSlot slot)
void bindDrawBuffers(BindBufferInfo vertexAttribs, BindBufferInfo instanceAttribs, BindBufferInfo indices, BindBufferInfo indirect)
SkTBlockList< Command, 16 >::CIter Iter
void drawInstanced(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount, unsigned int baseInstance, unsigned int instanceCount)
static void Draw(SkCanvas *canvas, const SkRect &rect)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
COMMAND(BindGraphicsPipeline, uint32_t fPipelineIndex)