16 : fCommandList(commandList)
17 , fManager(bufferManager)
27 , fPendingBufferBinds(
true) {
35 if (vertices != fVertices || instances != fInstances || fIndices != indices) {
36 if (fPendingCount > 0) {
40 bool willAppendVertices = templateCount == 0;
41 bool isAppendingVertices = fTemplateCount == 0;
42 if (willAppendVertices != isAppendingVertices ||
43 (isAppendingVertices && fVertices != vertices) ||
44 (!isAppendingVertices && fInstances != instances)) {
50 fInstances = instances;
53 fTemplateCount = templateCount;
55 fPendingBufferBinds =
true;
56 }
else if ((templateCount >= 0 && templateCount != fTemplateCount) ||
57 (templateCount < 0 && fTemplateCount >= 0)) {
58 if (fPendingCount > 0) {
61 if ((templateCount == 0) != (fTemplateCount == 0)) {
66 fTemplateCount = templateCount;
74 SkASSERT((fTemplateCount < 0) == (templateCount < 0));
75 SkASSERT(fTemplateCount < 0 || fTemplateCount == templateCount);
81 if (fPendingCount == 0 || fTemplateCount == -1) {
84 if (fPendingBufferBinds) {
86 fPendingBufferBinds =
false;
91 unsigned int realVertexCount;
92 if (fTemplateCount < 0) {
93 realVertexCount = -fTemplateCount - 1;
96 realVertexCount = fTemplateCount;
101 fPendingBase, fPendingCount);
103 fCommandList->
drawInstanced(fPrimitiveType, 0, realVertexCount,
104 fPendingBase, fPendingCount);
109 fCommandList->
drawIndexed(fPrimitiveType, 0, fPendingCount, fPendingBase);
111 fCommandList->
draw(fPrimitiveType, fPendingBase, fPendingCount);
115 fPendingBase += fPendingCount;
void draw(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount)
void drawIndexed(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount, unsigned int baseVertex)
void drawIndexedInstanced(PrimitiveType type, unsigned int baseIndex, unsigned int indexCount, unsigned int baseVertex, unsigned int baseInstance, unsigned int instanceCount)
void bindDrawBuffers(BindBufferInfo vertexAttribs, BindBufferInfo instanceAttribs, BindBufferInfo indices, BindBufferInfo indirect)
void drawInstanced(PrimitiveType type, unsigned int baseVertex, unsigned int vertexCount, unsigned int baseInstance, unsigned int instanceCount)
DrawWriter(DrawPassCommands::List *, DrawBufferManager *)
DrawBufferManager * bufferManager()