Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU: iOS requires stricter setup for depth stencils #11907

Open
tadashibashi opened this issue Jan 10, 2025 · 1 comment
Open

GPU: iOS requires stricter setup for depth stencils #11907

tadashibashi opened this issue Jan 10, 2025 · 1 comment
Assignees
Milestone

Comments

@tadashibashi
Copy link

tadashibashi commented Jan 10, 2025

Hello, first off I want to say thanks for how awesome the gpu api is. Performance is amazing compared to OpenGL.

So I encountered a cross-platform quirk on iOS where I get a Metal assert about stencil info not being initialized when I'm only working with the depth buffer. On macOS Metal it works fine without setting the SDL_GPUDepthStencilState stencil parts. On iOS setting enable_stencil_test to true, compare_op to always true, and every stencil op in front_stencil_state and back_stencil_state to KEEP fixes it. Maybe some additional docs about this could help, or would it be a good idea to have reasonable defaults set on iOS?

@slouken slouken added this to the 3.2.0 milestone Jan 10, 2025
@flibitijibibo
Copy link
Collaborator

Wonder if we just have to do the same thing for stencil that we did with depth write... here's where the stencil state is checked:

https://github.com/libsdl-org/SDL/blob/main/src/gpu/metal/SDL_gpu_metal.m#L1125-L1143

Though I also noticed that these values are NULL and not nil, which might make a difference? (I'm not an Objective-C expert, sorry...)

https://github.com/libsdl-org/SDL/blob/main/src/gpu/metal/SDL_gpu_metal.m#L1080-L1081

So either the initialized value is wrong or we just have to unconditionally initialize the front/back stencil descriptors. Spydog should be able to look at this soon, but if what I described fixes it I can merge a PR right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants