Skip to content

Comments

Add cf_gpu_sync#478

Merged
RandyGaul merged 1 commit intoRandyGaul:masterfrom
waldnercharles:cute_graphics/add-cf-gpu-sync
Feb 23, 2026
Merged

Add cf_gpu_sync#478
RandyGaul merged 1 commit intoRandyGaul:masterfrom
waldnercharles:cute_graphics/add-cf-gpu-sync

Conversation

@waldnercharles
Copy link
Contributor

Needed this while timing compute shader dispatches. It's not perfect, but, was useful for some basic wall-clock timing.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8513a3b613

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +818 to +822
if (g_ctx.cmd) {
SDL_GPUFence *fence = SDL_SubmitGPUCommandBufferAndAcquireFence(g_ctx.cmd);
SDL_WaitForGPUFences(g_ctx.device, true, &fence, 1);
SDL_ReleaseGPUFence(g_ctx.device, fence);
g_ctx.cmd = SDL_AcquireGPUCommandBuffer(g_ctx.device);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wait for in-flight GPU work when no command buffer

On the SDL backend this sync path only blocks when g_ctx.cmd is non-null, but cf_sdlgpu_end_frame clears g_ctx.cmd after submitting the frame (src/cute_graphics_sdlgpu.cpp:884-885), so calling public cf_gpu_sync between frames becomes a no-op even though GPU work may still be running. That violates the documented "GPU/CPU serialization" behavior and can produce incorrect timing/synchronization results compared with the GLES path (glFinish).

Useful? React with 👍 / 👎.

@RandyGaul RandyGaul merged commit c4e5b9e into RandyGaul:master Feb 23, 2026
21 checks passed
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

Successfully merging this pull request may close these issues.

2 participants