Move makeDraw(Indexed)IndirectSpace into GrMeshDrawOp::Target
Change-Id: I9e7e483d2baf24c8c87f22b9658969b9dbed72f9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289458 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
537dc05d41
commit
b8d7e00098
@ -131,11 +131,11 @@ public:
|
||||
sk_sp<const GrBuffer>*, int* startIndex,
|
||||
int* actualIndexCount) final;
|
||||
GrDrawIndirectCommand* makeDrawIndirectSpace(int drawCount, sk_sp<const GrBuffer>* buffer,
|
||||
size_t* offset) {
|
||||
size_t* offset) override {
|
||||
return fDrawIndirectPool.makeSpace(drawCount, buffer, offset);
|
||||
}
|
||||
GrDrawIndexedIndirectCommand* makeDrawIndexedIndirectSpace(
|
||||
int drawCount, sk_sp<const GrBuffer>* buffer, size_t* offset) {
|
||||
int drawCount, sk_sp<const GrBuffer>* buffer, size_t* offset) override {
|
||||
return fDrawIndirectPool.makeIndexedSpace(drawCount, buffer, offset);
|
||||
}
|
||||
void putBackIndices(int indexCount) final;
|
||||
|
@ -184,6 +184,21 @@ public:
|
||||
sk_sp<const GrBuffer>*, int* startIndex,
|
||||
int* actualIndexCount) = 0;
|
||||
|
||||
/**
|
||||
* Makes space for elements in a draw-indirect buffer. Upon success, the returned pointer is a
|
||||
* CPU mapping where the data should be written.
|
||||
*/
|
||||
virtual GrDrawIndirectCommand* makeDrawIndirectSpace(int drawCount,
|
||||
sk_sp<const GrBuffer>* buffer,
|
||||
size_t* offsetInBytes) = 0;
|
||||
|
||||
/**
|
||||
* Makes space for elements in a draw-indexed-indirect buffer. Upon success, the returned
|
||||
* pointer is a CPU mapping where the data should be written.
|
||||
*/
|
||||
virtual GrDrawIndexedIndirectCommand* makeDrawIndexedIndirectSpace(
|
||||
int drawCount, sk_sp<const GrBuffer>* buffer, size_t* offsetInBytes) = 0;
|
||||
|
||||
/** Helpers for ops which over-allocate and then return excess data to the pool. */
|
||||
virtual void putBackIndices(int indices) = 0;
|
||||
virtual void putBackVertices(int vertices, size_t vertexStride) = 0;
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
}
|
||||
template<typename T> sk_sp<const GrBuffer> makeVertexBuffer(const T* data, int count);
|
||||
|
||||
GrOpFlushState* state() { return fState; }
|
||||
GrMeshDrawOp::Target* target() { return fState; }
|
||||
|
||||
sk_sp<const GrBuffer> fIndexBuffer;
|
||||
sk_sp<const GrBuffer> fIndexBuffer2;
|
||||
@ -331,16 +331,20 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrMeshTest, reporter, ctxInfo) {
|
||||
// Make helper->fDrawIndirectBufferOffset nonzero.
|
||||
sk_sp<const GrBuffer> dummyBuff;
|
||||
size_t dummyOffset;
|
||||
helper->state()->makeDrawIndirectSpace(29, &dummyBuff, &dummyOffset);
|
||||
drawIndexedIndirect = helper->state()->makeDrawIndexedIndirectSpace(
|
||||
// Make a superfluous call to makeDrawIndirectSpace in order to test
|
||||
// "offsetInBytes!=0" for the actual call to makeDrawIndexedIndirectSpace.
|
||||
helper->target()->makeDrawIndirectSpace(29, &dummyBuff, &dummyOffset);
|
||||
drawIndexedIndirect = helper->target()->makeDrawIndexedIndirectSpace(
|
||||
kBoxCountY, &helper->fDrawIndirectBuffer,
|
||||
&helper->fDrawIndirectBufferOffset);
|
||||
} else {
|
||||
// Make helper->fDrawIndirectBufferOffset nonzero.
|
||||
sk_sp<const GrBuffer> dummyBuff;
|
||||
size_t dummyOffset;
|
||||
helper->state()->makeDrawIndexedIndirectSpace(7, &dummyBuff, &dummyOffset);
|
||||
drawIndirect = helper->state()->makeDrawIndirectSpace(
|
||||
// Make a superfluous call to makeDrawIndexedIndirectSpace in order to test
|
||||
// "offsetInBytes!=0" for the actual call to makeDrawIndirectSpace.
|
||||
helper->target()->makeDrawIndexedIndirectSpace(7, &dummyBuff, &dummyOffset);
|
||||
drawIndirect = helper->target()->makeDrawIndirectSpace(
|
||||
kBoxCountY, &helper->fDrawIndirectBuffer,
|
||||
&helper->fDrawIndirectBufferOffset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user