Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VK_NV_mesh_shader -> VK_EXT_mesh_shader #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/Vulkan-Headers
Submodule Vulkan-Headers updated 35 files
+32 −0 .github/ISSUE_TEMPLATE/bug_report.md
+3 −0 BUILD.gn
+5 −28 README.md
+84 −82 include/vk_video/vulkan_video_codec_h264std.h
+11 −34 include/vk_video/vulkan_video_codec_h264std_decode.h
+38 −11 include/vk_video/vulkan_video_codec_h264std_encode.h
+226 −143 include/vk_video/vulkan_video_codec_h265std.h
+13 −8 include/vk_video/vulkan_video_codec_h265std_decode.h
+67 −45 include/vk_video/vulkan_video_codec_h265std_encode.h
+0 −1 include/vulkan/vulkan.h
+5,421 −4,944 include/vulkan/vulkan.hpp
+1 −1 include/vulkan/vulkan_android.h
+329 −328 include/vulkan/vulkan_beta.h
+1,888 −176 include/vulkan/vulkan_core.h
+3,060 −19,804 include/vulkan/vulkan_enums.hpp
+7,357 −0 include/vulkan/vulkan_format_traits.hpp
+10,091 −9,797 include/vulkan/vulkan_funcs.hpp
+4,620 −5,240 include/vulkan/vulkan_handles.hpp
+2,933 −2,137 include/vulkan/vulkan_hash.hpp
+140 −1 include/vulkan/vulkan_metal.h
+7,528 −7,779 include/vulkan/vulkan_raii.hpp
+6,105 −0 include/vulkan/vulkan_static_assertions.hpp
+36,465 −34,423 include/vulkan/vulkan_structs.hpp
+8,177 −0 include/vulkan/vulkan_to_string.hpp
+105 −20 registry/cgenerator.py
+166 −41 registry/generator.py
+18 −24 registry/genvk.py
+352 −0 registry/profiles/VP_KHR_roadmap_2022.json
+59 −64 registry/reg.py
+102 −15 registry/spec_tools/conventions.py
+1 −1 registry/spec_tools/util.py
+24,029 −8,523 registry/validusage.json
+1,182 −0 registry/video.xml
+3,187 −1,122 registry/vk.xml
+25 −23 registry/vkconventions.py
2 changes: 2 additions & 0 deletions src/Core/CommandList/CommandList.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class CommandList : public QueryInterface
uint32_t stride) = 0;
virtual void Dispatch(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z) = 0;
virtual void DispatchIndirect(const std::shared_ptr<Resource>& argument_buffer, uint64_t argument_buffer_offset) = 0;
[[deprecated("Use DispatchMesh(x, y, z) instead.")]]
virtual void DispatchMesh(uint32_t thread_group_count_x) = 0;
virtual void DispatchMesh(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z) = 0;
virtual void DispatchRays(const RayTracingShaderTables& shader_tables, uint32_t width, uint32_t height, uint32_t depth) = 0;
virtual void ResourceBarrier(const std::vector<ResourceBarrierDesc>& barriers) = 0;
virtual void UAVResourceBarrier(const std::shared_ptr<Resource>& resource) = 0;
Expand Down
5 changes: 5 additions & 0 deletions src/Core/CommandList/DXCommandList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ void DXCommandList::DispatchMesh(uint32_t thread_group_count_x)
m_command_list6->DispatchMesh(thread_group_count_x, 1, 1);
}

void DXCommandList::DispatchMesh(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z)
{
m_command_list6->DispatchMesh(thread_group_count_x, thread_group_count_y, thread_group_count_z);
}

static D3D12_GPU_VIRTUAL_ADDRESS GetVirtualAddress(const RayTracingShaderTable& table)
{
if (!table.resource)
Expand Down
1 change: 1 addition & 0 deletions src/Core/CommandList/DXCommandList.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class DXCommandList : public CommandList
void Dispatch(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z) override;
void DispatchIndirect(const std::shared_ptr<Resource>& argument_buffer, uint64_t argument_buffer_offset) override;
void DispatchMesh(uint32_t thread_group_count_x) override;
void DispatchMesh(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z) override;
void DispatchRays(const RayTracingShaderTables& shader_tables, uint32_t width, uint32_t height, uint32_t depth) override;
void ResourceBarrier(const std::vector<ResourceBarrierDesc>& barriers) override;
void UAVResourceBarrier(const std::shared_ptr<Resource>& resource) override;
Expand Down
1 change: 1 addition & 0 deletions src/Core/CommandList/MTCommandList.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class MTCommandList : public CommandList
void Dispatch(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z) override;
void DispatchIndirect(const std::shared_ptr<Resource>& argument_buffer, uint64_t argument_buffer_offset) override;
void DispatchMesh(uint32_t thread_group_count_x) override;
void DispatchMesh(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z) override;
void DispatchRays(const RayTracingShaderTables& shader_tables, uint32_t width, uint32_t height, uint32_t depth) override;
void ResourceBarrier(const std::vector<ResourceBarrierDesc>& barriers) override;
void UAVResourceBarrier(const std::shared_ptr<Resource>& resource) override;
Expand Down
5 changes: 5 additions & 0 deletions src/Core/CommandList/MTCommandList.mm
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ static MTLCullMode ConvertCullMode(CullMode cull_mode)
assert(false);
}

void MTCommandList::DispatchMesh(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z)
{
assert(false);
}

void MTCommandList::DispatchRays(const RayTracingShaderTables& shader_tables, uint32_t width, uint32_t height, uint32_t depth)
{
assert(false);
Expand Down
9 changes: 8 additions & 1 deletion src/Core/CommandList/VKCommandList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,14 @@ void VKCommandList::DispatchIndirect(const std::shared_ptr<Resource>& argument_b
void VKCommandList::DispatchMesh(uint32_t thread_group_count_x)
{
#ifndef USE_STATIC_MOLTENVK
m_command_list->drawMeshTasksNV(thread_group_count_x, 0);
m_command_list->drawMeshTasksEXT(thread_group_count_x, 1, 1);
#endif
}

void VKCommandList::DispatchMesh(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z)
{
#ifndef USE_STATIC_MOLTENVK
m_command_list->drawMeshTasksEXT(thread_group_count_x, thread_group_count_y, thread_group_count_z);
#endif
}

Expand Down
1 change: 1 addition & 0 deletions src/Core/CommandList/VKCommandList.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class VKCommandList : public CommandList
void Dispatch(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z) override;
void DispatchIndirect(const std::shared_ptr<Resource>& argument_buffer, uint64_t argument_buffer_offset) override;
void DispatchMesh(uint32_t thread_group_count_x) override;
void DispatchMesh(uint32_t thread_group_count_x, uint32_t thread_group_count_y, uint32_t thread_group_count_z) override;
void DispatchRays(const RayTracingShaderTables& shader_tables, uint32_t width, uint32_t height, uint32_t depth) override;
void ResourceBarrier(const std::vector<ResourceBarrierDesc>& barriers) override;
void UAVResourceBarrier(const std::shared_ptr<Resource>& resource) override;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Device/VKDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ VKDevice::VKDevice(VKAdapter& adapter)
VK_KHR_MAINTENANCE1_EXTENSION_NAME,
VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME,
VK_EXT_MEMORY_BUDGET_EXTENSION_NAME,
VK_NV_MESH_SHADER_EXTENSION_NAME,
VK_EXT_MESH_SHADER_EXTENSION_NAME,
VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME,
};

Expand All @@ -127,7 +127,7 @@ VKDevice::VKDevice(VKAdapter& adapter)
m_is_variable_rate_shading_supported = true;
if (std::string(extension.extensionName.data()) == VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME)
m_is_dxr_supported = true;
if (std::string(extension.extensionName.data()) == VK_NV_MESH_SHADER_EXTENSION_NAME)
if (std::string(extension.extensionName.data()) == VK_EXT_MESH_SHADER_EXTENSION_NAME)
m_is_mesh_shading_supported = true;
if (std::string(extension.extensionName.data()) == VK_KHR_RAY_QUERY_EXTENSION_NAME)
m_is_ray_query_supported = true;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/HLSLCompiler/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ std::vector<uint8_t> Compile(const ShaderDesc& shader, ShaderBlobType blob_type)
if (blob_type == ShaderBlobType::kSPIRV)
{
arguments.emplace_back(L"-spirv");
arguments.emplace_back(L"-fspv-target-env=vulkan1.2");
arguments.emplace_back(L"-fspv-target-env=vulkan1.3");
arguments.emplace_back(L"-fspv-extension=KHR");
arguments.emplace_back(L"-fspv-extension=SPV_NV_mesh_shader");
arguments.emplace_back(L"-fspv-extension=SPV_EXT_mesh_shader");
Copy link
Owner

@andrejnau andrejnau Oct 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, DirectXShaderCompiler does not support SPV_EXT_mesh_shader.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.
I think this pr should remain pending.

arguments.emplace_back(L"-fspv-extension=SPV_EXT_descriptor_indexing");
arguments.emplace_back(L"-fspv-extension=SPV_EXT_shader_viewport_index_layer");
arguments.emplace_back(L"-fspv-extension=SPV_GOOGLE_hlsl_functionality1");
Expand Down
6 changes: 5 additions & 1 deletion src/Core/Pipeline/VKComputePipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ VKComputePipeline::VKComputePipeline(VKDevice& device, const ComputePipelineDesc
assert(m_shader_stage_create_info.size() == 1);
pipeline_info.stage = m_shader_stage_create_info.front();
pipeline_info.layout = m_pipeline_layout;
m_pipeline = m_device.GetDevice().createComputePipelineUnique({}, pipeline_info);
auto resultValue = m_device.GetDevice().createComputePipelineUnique({}, pipeline_info);
if (resultValue.result == vk::Result::eSuccess)
m_pipeline = std::move(resultValue.value);
else
assert(false);
}

PipelineType VKComputePipeline::GetPipelineType() const
Expand Down
6 changes: 5 additions & 1 deletion src/Core/Pipeline/VKGraphicsPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ VKGraphicsPipeline::VKGraphicsPipeline(VKDevice& device, const GraphicsPipelineD
pipeline_info.renderPass = GetRenderPass();
pipeline_info.pDynamicState = &pipelineDynamicStateCreateInfo;

m_pipeline = m_device.GetDevice().createGraphicsPipelineUnique({}, pipeline_info);
auto resultValue = m_device.GetDevice().createGraphicsPipelineUnique({}, pipeline_info);
if (resultValue.result == vk::Result::eSuccess)
m_pipeline = std::move(resultValue.value);
else
assert(false);
}

PipelineType VKGraphicsPipeline::GetPipelineType() const
Expand Down
6 changes: 5 additions & 1 deletion src/Core/Pipeline/VKRayTracingPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ VKRayTracingPipeline::VKRayTracingPipeline(VKDevice& device, const RayTracingPip
ray_pipeline_info.layout = m_pipeline_layout;

#ifndef USE_STATIC_MOLTENVK
m_pipeline = m_device.GetDevice().createRayTracingPipelineKHRUnique({}, {}, ray_pipeline_info);
auto resultValue = m_device.GetDevice().createRayTracingPipelineKHRUnique({}, {}, ray_pipeline_info);
if (resultValue.result == vk::Result::eSuccess)
m_pipeline = std::move(resultValue.value);
else
assert(false);
#endif
}

Expand Down