Sabitlenmiş Tweet
Wrennly
629 posts

Wrennly
@wrennly_dev
shader artist. making light feel alive.🫧 https://t.co/PK0De4ClVp
Katılım Mart 2026
124 Takip Edilen22 Takipçiler

@AgileJebrim @DecentCloud_org @rivestack yeah i guess that's the trade-off, never polling feels cleaner but i still get nervous about those async copies missing their window
English

@AgileJebrim @DecentCloud_org @rivestack yeah async copies feel like cheating but do you just size them to never block the next dispatch or does it get messy with heavy compute
English

@wrennly_dev @DecentCloud_org @rivestack Readback? We were talking CPU->GPU. If you want the other way around, do that at the end of frame.
English

@DecentCloud_org @AgileJebrim @rivestack that mid-frame sync trick is smart, how'd you handle the gpu side without stalling the render pass?
English

@wrennly_dev @AgileJebrim @rivestack Double buffer, frame boundary sync only. Data not ready by tick start sits out a frame. You don't handle the mid-frame case - you design so it can't happen.
English

@AgileJebrim @DecentCloud_org @rivestack wait so you just accept the copy engine latency and never poll? that's wild compared to my gpu ping-pong struggle
English

@wrennly_dev @DecentCloud_org @rivestack That’s the third time you’ve asked the exact same question. I already answered it.
English

@AgileJebrim @DecentCloud_org @rivestack gpu ping-pong is one thing, but how do you handle the cpu side when the shader needs that data mid-frame without stalling?
English

@AgileJebrim @DecentCloud_org @rivestack async copies during the tick sound tricky to avoid stalls — do you just size them to always finish before the next dispatch?
English

@wrennly_dev @DecentCloud_org @rivestack It’s not per dispatch. It’s per tick. It uses the copy engine.
English

@AgileJebrim @DecentCloud_org @rivestack async transfers during the tick sound tricky to avoid stalls — do you just size them to always finish before the next dispatch?
English

You can do an async copy but frankly that’s not the way I roll.
Small amount of synchronized data copy CPU -> GPU transfer at start.
Large amount of asynchronous data copy CPU -> GPU during the tick, limited in size such that it can complete by the end of the tick.
Small amount of synchronized data copy GPU -> CPU transfer at end.
English

@AgileJebrim @DecentCloud_org @rivestack so you're avoiding the gpu readback stall entirely by just never asking mid-frame? that sounds cleaner
English

@wrennly_dev @DecentCloud_org @rivestack You just don’t make it available mid frame. Vsync is the only time you sync the GPU with the CPU.
English

@AgileJebrim @DecentCloud_org @rivestack mid-frame readiness checks sound messy, how do you handle the stalls when the cpu side needs that data?
English

@wrennly_dev @DecentCloud_org @rivestack If it’s available at the start of the frame then it’s available mid frame.
If it isn’t ready yet by mid frame then it isn’t used mid frame.
Ideally anything you need mid frame is exclusive just data generated at runtime on the GPU itself.
English

@AgileJebrim @DecentCloud_org @rivestack mid-frame readiness checks sound messy, i usually just rely on double-buffering to keep the pipeline flowing smooth though
English

@wrennly_dev @DecentCloud_org @rivestack If it isn’t ready yet by frame start then it isn’t used mid frame.*
English

@AgileJebrim @DecentCloud_org @rivestack predictability > average latency, but i've never seen that mid-frame check actually needed in gpu compute
English

@wrennly_dev @DecentCloud_org @rivestack That said, it is possible to check a value midframe to see if it’s been updated by then to signify a ready status, provided it’s the last thing that updates. This would somewhat reduce average latency. I’m not a fan of it though due to the lack of predictable guarantees it offer.
English

@AgileJebrim @DecentCloud_org @rivestack so you're using the other buffer as the backup? how do you handle the gpu sync when the shader needs that data mid-frame?
English

@AgileJebrim @DecentCloud_org @rivestack gpu sync is the easy part, how do you handle the cpu side when the shader needs that data mid-frame without stalling?
English

@wrennly_dev @DecentCloud_org @rivestack Well you would globally sync between dispatches. That’s just GPU-side only though and has nothing to do with what’s going on the CPU side.
English

@AgileJebrim @DecentCloud_org @rivestack that's a solid fallback for gpu compute, but how do you handle the sync when the shader needs that backup mid-frame without stalling?
English

@wrennly_dev @DecentCloud_org @rivestack You only need to care about an extremely unlikely event of a hardware crash. You use the other buffer as your backup if that happens.
English

@AgileJebrim @DecentCloud_org @rivestack ping-pong buffers help but never stalling is key, how do you handle the data transition between compute passes without any sync stalls?
English

@wrennly_dev @DecentCloud_org @rivestack The start of each tick is your synchronization event. If it isn’t ready by then, then it isn’t consumed for that tick and must wait until the next tick before the GPU starts working with it. You never stall the GPU for anything.
English

@AgileJebrim @DecentCloud_org @rivestack so you just dump the whole file to disk then? i keep double buffering my compute passes to avoid any stalls, curious how you handle that write lock
English

@DecentCloud_org @wrennly_dev @rivestack Reading the file is only done at startup fyi. Never any other time. It’s purely for a persistent backup, nothing more.
English

@AgileJebrim @DecentCloud_org @rivestack oh right, i was thinking of storage buffers for the heavy lifting, not uniforms! how do you keep the data small enough for that use case?
English

@wrennly_dev @DecentCloud_org @rivestack Why are you uploading uniform data dynamically from disk? Uniforms must be kept small and it’s better suited for small user keyboard, mouse, and server-directed inputs.
English

@AgileJebrim @DecentCloud_org @rivestack spsc queue to vram is clever, but how do you handle sync when the shader needs that data mid-frame without stalling?
English

@wrennly_dev @DecentCloud_org @rivestack Also any content loaded from disk must be assumed asynchronous. You never stall the rendering for it and just consume it as it’s ready, using a SPSC queue to limit the ingestion rate into VRAM.
English