From be9c4e89187ce8b5c0841b9356f37c5f71310932 Mon Sep 17 00:00:00 2001 From: Roberto Nibali Date: Wed, 8 Jul 2026 13:20:51 +0200 Subject: [PATCH] DXMT: initialize async compile ready flags Initialize the atomic ready flags for shader and pipeline compile work items. The flags are queried before worker completion and waited on by callers, so leaving them default-uninitialized can make a new work item appear ready before a shader or pipeline state exists. Signed-off-by: Roberto Nibali --- src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline.cpp | 7 ++++--- src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_gs.cpp | 4 ++-- src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_tess.cpp | 4 ++-- src/libs/dxmt-0.60/src/d3d11/d3d11_shader.cpp | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline.cpp b/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline.cpp index d15319fea938..e473dc434e31 100644 --- a/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline.cpp +++ b/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline.cpp @@ -18,7 +18,7 @@ class MTLCompiledGraphicsPipeline num_rtvs(pDesc->NumColorAttachments), depth_stencil_format(pDesc->DepthStencilFormat), topology_class(pDesc->TopologyClass), device_(pDevice), - pBlendState(pDesc->BlendState), + ready_(false), pBlendState(pDesc->BlendState), RasterizationEnabled(pDesc->RasterizationEnabled), SampleCount(pDesc->SampleCount) { uint32_t unorm_output_reg_mask = 0; @@ -163,7 +163,8 @@ class MTLCompiledComputePipeline : public ComObject { public: MTLCompiledComputePipeline(MTLD3D11Device *pDevice, ManagedShader shader) - : ComObject(), device_(pDevice) { + : ComObject(), device_(pDevice), + ready_(false) { ComputeShader = shader->get_shader(ShaderVariantDefault{}); } @@ -236,4 +237,4 @@ CreateComputePipeline(MTLD3D11Device *pDevice, ManagedShader ComputeShader) { return pipeline; } -} // namespace dxmt \ No newline at end of file +} // namespace dxmt diff --git a/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_gs.cpp b/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_gs.cpp index 7249009cbfd1..45edf09eb1fe 100644 --- a/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_gs.cpp +++ b/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_gs.cpp @@ -15,7 +15,7 @@ class MTLCompiledGeometryPipeline : ComObject(), num_rtvs(pDesc->NumColorAttachments), depth_stencil_format(pDesc->DepthStencilFormat), device_(pDevice), - pBlendState(pDesc->BlendState), + ready_(false), pBlendState(pDesc->BlendState), RasterizationEnabled(pDesc->RasterizationEnabled), SampleCount(pDesc->SampleCount) { uint32_t unorm_output_reg_mask = 0; @@ -172,4 +172,4 @@ CreateGeometryPipeline(MTLD3D11Device *pDevice, return pipeline; } -} // namespace dxmt \ No newline at end of file +} // namespace dxmt diff --git a/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_tess.cpp b/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_tess.cpp index fcf63278dfcc..a9c6c99aef64 100644 --- a/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_tess.cpp +++ b/src/libs/dxmt-0.60/src/d3d11/d3d11_pipeline_tess.cpp @@ -17,7 +17,7 @@ class MTLCompiledTessellationPipeline num_rtvs(pDesc->NumColorAttachments), depth_stencil_format(pDesc->DepthStencilFormat), topology_class(pDesc->TopologyClass), device_(pDevice), - pBlendState(pDesc->BlendState), + ready_(false), pBlendState(pDesc->BlendState), RasterizationEnabled(pDesc->RasterizationEnabled), SampleCount(pDesc->SampleCount) { uint32_t unorm_output_reg_mask = 0; @@ -223,4 +223,4 @@ CreateTessellationPipeline(MTLD3D11Device *pDevice, return pipeline; } -} // namespace dxmt \ No newline at end of file +} // namespace dxmt diff --git a/src/libs/dxmt-0.60/src/d3d11/d3d11_shader.cpp b/src/libs/dxmt-0.60/src/d3d11/d3d11_shader.cpp index a5edbeac904d..421d1fad09f0 100644 --- a/src/libs/dxmt-0.60/src/d3d11/d3d11_shader.cpp +++ b/src/libs/dxmt-0.60/src/d3d11/d3d11_shader.cpp @@ -11,7 +11,7 @@ class GeneralShaderCompileTask : public CompiledShader { GeneralShaderCompileTask(MTLD3D11Device *pDevice, ManagedShader shader, Proc &&proc) : CompiledShader(), proc(std::forward(proc)), device_(pDevice), - shader_(shader) {} + shader_(shader), ready_(false) {} ~GeneralShaderCompileTask() {} @@ -367,4 +367,4 @@ CreateVariantShader(MTLD3D11Device *pDevice, ManagedShader shader, pDevice, shader, std::move(proc)); } -} // namespace dxmt \ No newline at end of file +} // namespace dxmt