Skip to content

Commit 1e6c1f7

Browse files
PipelineStateWebGPU: fixed check for whether the pipeline state is being created asynchronously
1 parent 712ab31 commit 1e6c1f7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Graphics/GraphicsEngineWebGPU/src/PipelineStateWebGPUImpl.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ struct PipelineStateWebGPUImpl::AsyncPipelineBuilder : public ObjectBase<IObject
328328
void PipelineStateWebGPUImpl::InitializePipeline(const GraphicsPipelineStateCreateInfo& CreateInfo)
329329
{
330330
TShaderStages ShaderStages = InitInternalObjects(CreateInfo);
331-
if (!m_AsyncInitializer)
331+
// NB: it is not safe to check m_AsyncInitializer here as, first, it is set after the async task is started,
332+
// and second, it is not atomic or protected by mutex.
333+
if ((CreateInfo.Flags & PSO_CREATE_FLAG_ASYNCHRONOUS) == 0)
332334
{
333335
InitializeWebGPURenderPipeline(ShaderStages);
334336
}
@@ -342,7 +344,9 @@ void PipelineStateWebGPUImpl::InitializePipeline(const GraphicsPipelineStateCrea
342344
void PipelineStateWebGPUImpl::InitializePipeline(const ComputePipelineStateCreateInfo& CreateInfo)
343345
{
344346
TShaderStages ShaderStages = InitInternalObjects(CreateInfo);
345-
if (!m_AsyncInitializer)
347+
// NB: it is not safe to check m_AsyncInitializer here as, first, it is set after the async task is started,
348+
// and second, it is not atomic or protected by mutex.
349+
if ((CreateInfo.Flags & PSO_CREATE_FLAG_ASYNCHRONOUS) == 0)
346350
{
347351
InitializeWebGPUComputePipeline(ShaderStages);
348352
}

0 commit comments

Comments
 (0)