diff --git a/Engine/gapi/metal/mtcommandbuffer.cpp b/Engine/gapi/metal/mtcommandbuffer.cpp index 137d858a..eb054f1f 100644 --- a/Engine/gapi/metal/mtcommandbuffer.cpp +++ b/Engine/gapi/metal/mtcommandbuffer.cpp @@ -313,6 +313,11 @@ void MtCommandBuffer::drawIndexed(const AbstractGraphicsApi::Buffer& ivbo, size_ ioffset*mul,instanceCount,voffset,firstInstance); } +void MtCommandBuffer::drawIndirect(const AbstractGraphicsApi::Buffer& indirect, size_t offset) { + auto& ind = reinterpret_cast(indirect); + encDraw->drawPrimitives(topology, ind.impl.get(), offset); + } + void MtCommandBuffer::dispatchMesh(size_t x, size_t y, size_t z) { // NOTE: for taskless pipeline `localSize` must be zero encDraw->drawMeshThreadgroups(MTL::Size(x,y,z), localSize, localSizeMesh); diff --git a/Engine/gapi/metal/mtcommandbuffer.h b/Engine/gapi/metal/mtcommandbuffer.h index 2435d0fe..d49e83cf 100644 --- a/Engine/gapi/metal/mtcommandbuffer.h +++ b/Engine/gapi/metal/mtcommandbuffer.h @@ -55,6 +55,9 @@ class MtCommandBuffer : public AbstractGraphicsApi::CommandBuffer { void drawIndexed (const AbstractGraphicsApi::Buffer& vbo, size_t stride, size_t voffset, const AbstractGraphicsApi::Buffer &ibo, Detail::IndexClass cls, size_t ioffset, size_t isize, size_t firstInstance, size_t instanceCount) override; + + void drawIndirect(const AbstractGraphicsApi::Buffer& indirect, size_t offset) override; + void dispatchMesh(size_t x, size_t y, size_t z) override; void dispatch (size_t x, size_t y, size_t z) override; diff --git a/Engine/gapi/metal/mtdescriptorarray.cpp b/Engine/gapi/metal/mtdescriptorarray.cpp index 7fa06928..4cfb95e3 100644 --- a/Engine/gapi/metal/mtdescriptorarray.cpp +++ b/Engine/gapi/metal/mtdescriptorarray.cpp @@ -56,6 +56,7 @@ void MtDescriptorArray::set(size_t id, AbstractGraphicsApi::Texture** tex, size_ std::unique_ptr addr(new uint8_t[bufSz]); d.args.reserve(cnt); + d.args.clear(); for(size_t i=0; i(addr.get()); if(tex[i]==nullptr) { @@ -91,6 +92,7 @@ void MtDescriptorArray::set(size_t id, AbstractGraphicsApi::Buffer** buf, size_t std::unique_ptr addr(new spvBufferDescriptor[cnt]); d.args.reserve(cnt); + d.args.clear(); for(size_t i=0; i