-
Notifications
You must be signed in to change notification settings - Fork 125
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
A single GPU_Flip() isn't updating the screen #245
Comments
I've noticed that if I do a certain amount of GPU_Flips in a row before my wait loop, it works. On my machine, it's about 20. Which makes it feel like some sort of race condition to me. |
I've refactored the code to be more like my game loops:
And it works fine. So maybe my understanding of how sdl-gpu works is off. |
I am not at a computer to test anything, but you could try GPU_FlushBlitBuffer() before the flip. SDL_gpu does hold on to data in order to render it all in one go and double-buffering could also be involved (so front and back buffers might appear out of sync if you aren't clearing and flipping them every frame). |
GPU_FlushBlitBuffer() didn't make a difference either. |
I'll confirm I can make a minimal repro in C. |
Can you share it with us? |
Here's a C repro: https://gitlab.com/macaroni.dev/sdl-gpu-hs/-/merge_requests/11/diffs |
I've been writing a little tool to visualize hitbox collisions. It's a function that takes two hitboxes, draws them + their collision manifold (if any), and then waits for Quit/Esc.
The code is basically
For some reason, the screen isn't being updated on that GPU_Flip() for me (it's just showing the pixels that were there if that makes sense - the way it behaves when you just spawn a window).
When I put GPU_Flip() in my wait loop and call it a bunch of times, everything does work. But I'm surprised a single one isn't working.
There is some indirection here: I am calling sdl-gpu from Haskell in its repl using my bindings. That said, I think I've done everything I need to for that to work (RTS is threaded, I'm using more than one native thread to back the green threads, the loop is running in a bound thread and not being shifted around OS thread in the b/g, etc). It is possible this is something on my end of the Haskell/C divide, but I figured I'd ask (and I'd like to fix it on my side anyways ofc).
The text was updated successfully, but these errors were encountered: