diff --git a/inc/hgl/graph/VKPhysicalDevice.h b/inc/hgl/graph/VKPhysicalDevice.h index 91f0d229..6159b98d 100644 --- a/inc/hgl/graph/VKPhysicalDevice.h +++ b/inc/hgl/graph/VKPhysicalDevice.h @@ -48,6 +48,20 @@ public: const uint32_t GetConstantSize ()const{return properties.limits.maxPushConstantsSize;} + // support != open, so please don't direct use GetFeatures(). + // open any features in CreateDevice()&SetDeviceFeatures() functions. + const bool IsSupportMDI ()const + { + // I found a few device support MDI, but its MaxDrawIndirectCount is 1. + + return (features.multiDrawIndirect&&properties.limits.maxDrawIndirectCount>1); + } + + const uint32_t GetMaxMDICount ()const + { + return properties.limits.maxDrawIndirectCount; + } + public: /** diff --git a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp index 62c2f0c5..af6f6703 100644 --- a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp +++ b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp @@ -170,7 +170,7 @@ void RenderCmdBuffer::DrawIndirect( VkBuffer buffer, uint32_t drawCount, uint32_t stride) { - if(this->dev_attr->physical_device->GetFeatures().multiDrawIndirect) + if(this->dev_attr->physical_device->IsSupportMDI()) vkCmdDrawIndirect(cmd_buf,buffer,offset,drawCount,stride); else for(uint32_t i=0;idev_attr->physical_device->GetFeatures().multiDrawIndirect) + if(this->dev_attr->physical_device->IsSupportMDI()) vkCmdDrawIndexedIndirect(cmd_buf,buffer,offset,drawCount,stride); else for(uint32_t i=0;i