Skip to content

Commit

Permalink
gpu: Initialize Metal stencil format even if stencil test is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo authored and TheSpydog committed Jan 12, 2025
1 parent 307dac9 commit 9755045
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gpu/metal/SDL_gpu_metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -1121,10 +1121,11 @@ static void METAL_ReleaseGraphicsPipeline(

if (createinfo->target_info.has_depth_stencil_target) {
pipelineDescriptor.depthAttachmentPixelFormat = SDLToMetal_TextureFormat(createinfo->target_info.depth_stencil_format);

if (createinfo->depth_stencil_state.enable_stencil_test) {
if (IsStencilFormat(createinfo->target_info.depth_stencil_format)) {
pipelineDescriptor.stencilAttachmentPixelFormat = SDLToMetal_TextureFormat(createinfo->target_info.depth_stencil_format);
}

if (createinfo->depth_stencil_state.enable_stencil_test) {
frontStencilDescriptor = [MTLStencilDescriptor new];
frontStencilDescriptor.stencilCompareFunction = SDLToMetal_CompareOp[createinfo->depth_stencil_state.front_stencil_state.compare_op];
frontStencilDescriptor.stencilFailureOperation = SDLToMetal_StencilOp[createinfo->depth_stencil_state.front_stencil_state.fail_op];
Expand Down

0 comments on commit 9755045

Please sign in to comment.