Skip to content

SDL3GPU Seg Fault in DrawGPUIndexedPrimitives #13128

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

Open
WolfEYc opened this issue May 27, 2025 · 1 comment
Open

SDL3GPU Seg Fault in DrawGPUIndexedPrimitives #13128

WolfEYc opened this issue May 27, 2025 · 1 comment
Assignees
Milestone

Comments

@WolfEYc
Copy link

WolfEYc commented May 27, 2025

I am currently getting a seg fault in the above function. My code previously did not have this issue and I'm logging everything in my code to try to figure out why, everything seems present, and not null, array sizes are correct. etc.

SDL does not give me any info as to why I got a seg fault, is there a way to get more info? Any recommendations to debug this?
https://github.com/WolfEYc/revahcard/tree/lighting
this is the current branch that has the issue, (main branch is just fine)

Ok i did fix it, it was because I was binding a Frag storage buffer to with first_slot=2

layout(set=2, binding=0) uniform sampler2D base_sampler;
layout(set=2, binding=1) uniform sampler2D emissive_sampler;

struct Light {
    vec3 pos;
    float range;
    vec3 color;
    float intensity;
};

layout(set=2, binding=2) readonly buffer Lights {
    Light lights[64];
};

turns out i should just bind it to slot 0 and sdl does some magic because it knows that its not a sampler i guess.
better docs on this + getting an error msg instead of a segfault would be nice.

Not exactly sure if im using a dev/debug build of sdl3 in order to get these errors though, i have vulkan validation layers, and sdl set to verbose logging for all priorities.

@thatcosmonaut
Copy link
Collaborator

Binding a slot that is not declared by the shader object is an out of bounds error right now. We could probably sanity check that in SDL_gpu.c instead of segfaulting.

@thatcosmonaut thatcosmonaut self-assigned this May 27, 2025
@thatcosmonaut thatcosmonaut added this to the 3.2.16 milestone May 27, 2025
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

2 participants