From 4bd8922ba30188dff4afd282aaedf132aa7cc85e Mon Sep 17 00:00:00 2001 From: Try Date: Sat, 4 Mar 2023 23:26:06 +0100 Subject: [PATCH] mesh-shader cleanup #38 --- Engine/gapi/vulkan/vcommandbuffer.cpp | 1 + Engine/gapi/vulkan/vmeshlethelper.cpp | 4 ++-- Engine/gapi/vulkan/vpipeline.cpp | 6 +++--- Engine/gapi/vulkan/vpipelinelay.cpp | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Engine/gapi/vulkan/vcommandbuffer.cpp b/Engine/gapi/vulkan/vcommandbuffer.cpp index 4535461c..38fe3fa7 100644 --- a/Engine/gapi/vulkan/vcommandbuffer.cpp +++ b/Engine/gapi/vulkan/vcommandbuffer.cpp @@ -1104,6 +1104,7 @@ void VMeshCommandBuffer::dispatchMesh(size_t x, size_t y, size_t z) { if(px.meshPipeline()==VK_NULL_HANDLE) return; + assert(z==1); // abused as drawId auto& ms = *device.meshHelper; if(meshIndirectId==0) { diff --git a/Engine/gapi/vulkan/vmeshlethelper.cpp b/Engine/gapi/vulkan/vmeshlethelper.cpp index cd96b221..6c590a43 100644 --- a/Engine/gapi/vulkan/vmeshlethelper.cpp +++ b/Engine/gapi/vulkan/vmeshlethelper.cpp @@ -128,8 +128,8 @@ void VMeshletHelper::initRP(VkCommandBuffer impl) { uint32_t indSize = (desc[0].z ) & 0x3FF; - //uint32_t ibo[3*3] = {}; - //compacted.read(ibo,0,sizeof(ibo)); + // uint32_t ibo[3*3] = {}; + // compacted.read(ibo,0,sizeof(ibo)); // float vbo[11*3] = {}; // uint32_t vboI[11*3] = {}; diff --git a/Engine/gapi/vulkan/vpipeline.cpp b/Engine/gapi/vulkan/vpipeline.cpp index 8dca37f8..f210ce41 100644 --- a/Engine/gapi/vulkan/vpipeline.cpp +++ b/Engine/gapi/vulkan/vpipeline.cpp @@ -84,7 +84,7 @@ VPipeline::VPipeline(VDevice& device, const RenderState& st, Topology tp, vkAssert(vkCreateComputePipelines(device.device.impl, VK_NULL_HANDLE, 1, &info, nullptr, &meshCompuePipeline)); // cancel native mesh shading - pushStageFlags &= ~VK_SHADER_STAGE_MESH_BIT_NV; + pushStageFlags &= ~VK_SHADER_STAGE_MESH_BIT_EXT; pushStageFlags |= VK_SHADER_STAGE_VERTEX_BIT; } } @@ -204,11 +204,11 @@ VkPipelineLayout VPipeline::initLayout(VDevice& dev, const VPipelineLay& uboLay, if(uboLay.msHelper!=VK_NULL_HANDLE) { if(isMeshCompPass) { - if((pushStageFlags&VK_SHADER_STAGE_MESH_BIT_NV)==VK_SHADER_STAGE_MESH_BIT_NV) { + if((pushStageFlags&VK_SHADER_STAGE_MESH_BIT_EXT)==VK_SHADER_STAGE_MESH_BIT_EXT) { pushStageFlags = VK_SHADER_STAGE_COMPUTE_BIT; } } else { - pushStageFlags &= ~VK_SHADER_STAGE_MESH_BIT_NV; + pushStageFlags &= ~VK_SHADER_STAGE_MESH_BIT_EXT; pushStageFlags |= VK_SHADER_STAGE_VERTEX_BIT; } } diff --git a/Engine/gapi/vulkan/vpipelinelay.cpp b/Engine/gapi/vulkan/vpipelinelay.cpp index d0f7bbd4..91139734 100644 --- a/Engine/gapi/vulkan/vpipelinelay.cpp +++ b/Engine/gapi/vulkan/vpipelinelay.cpp @@ -75,8 +75,8 @@ VkDescriptorSetLayout VPipelineLay::create(uint32_t runtimeArraySz) const { b.descriptorCount = e.runtimeSized ? runtimeArraySz : e.arraySize; b.descriptorType = nativeFormat(e.cls); b.stageFlags = nativeFormat(e.stage); - if((b.stageFlags&VK_SHADER_STAGE_MESH_BIT_NV)==VK_SHADER_STAGE_MESH_BIT_NV && dev.props.meshlets.meshShaderEmulated) { - b.stageFlags &= ~VK_SHADER_STAGE_MESH_BIT_NV; + if((b.stageFlags&VK_SHADER_STAGE_MESH_BIT_EXT)==VK_SHADER_STAGE_MESH_BIT_EXT && dev.props.meshlets.meshShaderEmulated) { + b.stageFlags &= ~VK_SHADER_STAGE_MESH_BIT_EXT; b.stageFlags |= VK_SHADER_STAGE_VERTEX_BIT; b.stageFlags |= VK_SHADER_STAGE_COMPUTE_BIT; }