Skip to content

Commit

Permalink
[Metal] Fixed caching of compute PSO in MTCommandContext.
Browse files Browse the repository at this point in the history
- Compute PSO was not reset in ResetComputeEncoderState().
- Also fixed Mapping example for Metal backend.
  • Loading branch information
LukasBanana committed Jun 6, 2024
1 parent e964264 commit 151580e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions examples/Cpp/Mapping/Example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ class Example_Mapping : public ExampleBase
// Create graphics pipeline
LLGL::GraphicsPipelineDescriptor pipelineDesc;
{
pipelineDesc.vertexShader = shaderPipeline.vs;
pipelineDesc.fragmentShader = shaderPipeline.ps;
pipelineDesc.pipelineLayout = pipelineLayout;
pipelineDesc.primitiveTopology = LLGL::PrimitiveTopology::TriangleStrip;
pipelineDesc.vertexShader = shaderPipeline.vs;
pipelineDesc.fragmentShader = shaderPipeline.ps;
pipelineDesc.pipelineLayout = pipelineLayout;
pipelineDesc.primitiveTopology = LLGL::PrimitiveTopology::TriangleStrip;
pipelineDesc.rasterizer.multiSampleEnabled = (GetSampleCount() > 1);
}
pipeline = renderer->CreatePipelineState(pipelineDesc);
}
Expand Down
3 changes: 2 additions & 1 deletion sources/Renderer/Metal/Command/MTCommandContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,8 @@ static NSUInteger GetTessFactorSizeForPatchType(const MTLPatchType patchType)

void MTCommandContext::ResetComputeEncoderState()
{
computeEncoderState_.computeResourceHeap = nullptr;
computeEncoderState_.computePSO = nullptr;
computeEncoderState_.computeResourceHeap = nullptr;
}

void MTCommandContext::ResetContextState()
Expand Down

0 comments on commit 151580e

Please sign in to comment.