From 6088af7eb264a6f166e6c6d8777b2b122e9fdfdc Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Thu, 26 Sep 2024 12:14:19 +0200 Subject: [PATCH] fixes --- YONGQUESTIONS.txt | 10 ---------- src/vulkan/vk-pipeline.cpp | 8 -------- src/wgpu/wgpu-command-queue.cpp | 15 ++++++++++++++- src/wgpu/wgpu-pipeline.cpp | 2 +- tests/test-instanced-draw.cpp | 1 - 5 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 YONGQUESTIONS.txt diff --git a/YONGQUESTIONS.txt b/YONGQUESTIONS.txt deleted file mode 100644 index 37484706..00000000 --- a/YONGQUESTIONS.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Pipeline refactor -- can we remove runtime specialization? we have to! -- specialize() doesn't lead to a program layout that can be used - -Shader program -- can we always create shader program from a "linked program" -- we cannot just have a single linked program passed in -- d3d12 has support for "libraries" where we have individual entry points with different specializations -- how should the interface to create shader programs look like? diff --git a/src/vulkan/vk-pipeline.cpp b/src/vulkan/vk-pipeline.cpp index 216ee407..92d84fdb 100644 --- a/src/vulkan/vk-pipeline.cpp +++ b/src/vulkan/vk-pipeline.cpp @@ -209,14 +209,6 @@ Result PipelineImpl::createVKGraphicsPipeline() dynamicStates.push_back(VK_DYNAMIC_STATE_SCISSOR); dynamicStates.push_back(VK_DYNAMIC_STATE_STENCIL_REFERENCE); dynamicStates.push_back(VK_DYNAMIC_STATE_BLEND_CONSTANTS); - // It's not valid to specify VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT when - // the pipeline contains a mesh shader. - if (!m_program->isMeshShaderProgram() && - m_device->m_api.m_extendedFeatures.extendedDynamicStateFeatures.extendedDynamicState) - - { - dynamicStates.push_back(VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT); - } VkPipelineDynamicStateCreateInfo dynamicStateInfo = {}; dynamicStateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; dynamicStateInfo.dynamicStateCount = (uint32_t)dynamicStates.size(); diff --git a/src/wgpu/wgpu-command-queue.cpp b/src/wgpu/wgpu-command-queue.cpp index 6059e911..fe5f145f 100644 --- a/src/wgpu/wgpu-command-queue.cpp +++ b/src/wgpu/wgpu-command-queue.cpp @@ -33,7 +33,20 @@ Result CommandQueueImpl::getNativeHandle(NativeHandle* outHandle) void CommandQueueImpl::waitOnHost() { - // m_device->m_ctx.api.wgpuQueueOnSubmittedWorkDone(m_queue, nullptr, nullptr); + // Wait for the command buffer to finish executing + // TODO: we should switch to the new async API + { + WGPUQueueWorkDoneStatus status = WGPUQueueWorkDoneStatus_Unknown; + m_device->m_ctx.api.wgpuQueueOnSubmittedWorkDone( + m_queue, + [](WGPUQueueWorkDoneStatus status, void* userdata) { *(WGPUQueueWorkDoneStatus*)userdata = status; }, + &status + ); + while (status == WGPUQueueWorkDoneStatus_Unknown) + { + m_device->m_ctx.api.wgpuDeviceTick(m_device->m_ctx.device); + } + } } Result CommandQueueImpl::waitForFenceValuesOnDevice(GfxCount fenceCount, IFence** fences, uint64_t* waitValues) diff --git a/src/wgpu/wgpu-pipeline.cpp b/src/wgpu/wgpu-pipeline.cpp index b5c6fc0f..f7208954 100644 --- a/src/wgpu/wgpu-pipeline.cpp +++ b/src/wgpu/wgpu-pipeline.cpp @@ -135,7 +135,7 @@ Result PipelineImpl::createRenderPipeline() Result PipelineImpl::createComputePipeline() { ShaderProgramImpl* program = static_cast(m_program.get()); - ShaderProgramImpl::Module* computeModule = program->findModule(SlangStage::SLANG_STAGE_FRAGMENT); + ShaderProgramImpl::Module* computeModule = program->findModule(SlangStage::SLANG_STAGE_COMPUTE); if (!computeModule) { return SLANG_FAIL; diff --git a/tests/test-instanced-draw.cpp b/tests/test-instanced-draw.cpp index 4cd6f35b..4f1a1642 100644 --- a/tests/test-instanced-draw.cpp +++ b/tests/test-instanced-draw.cpp @@ -510,7 +510,6 @@ TEST_CASE("draw-instanced") DeviceType::D3D12, DeviceType::Vulkan, DeviceType::Metal, - DeviceType::WGPU, } ); }