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

Optional debug validation in SDL_gpu.c #65

Open
18 of 70 tasks
flibitijibibo opened this issue Jun 29, 2024 · 3 comments
Open
18 of 70 tasks

Optional debug validation in SDL_gpu.c #65

flibitijibibo opened this issue Jun 29, 2024 · 3 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Comments

@flibitijibibo
Copy link
Collaborator

flibitijibibo commented Jun 29, 2024

The non-optional ones are just stuff like obvious null checks, the optional ones are for debug devices only which will do validation which should not be necessary for release mode.

Resource Creation:

  • SDL_GpuCreateComputePipeline;
  • SDL_GpuCreateGraphicsPipeline;
  • SDL_GpuCreateSampler;
  • SDL_GpuCreateShader;
  • SDL_GpuCreateTexture;
  • SDL_GpuCreateBuffer;
  • SDL_GpuCreateTransferBuffer;

Debug:

  • SDL_GpuSetBufferName;
  • SDL_GpuSetTextureName;
  • SDL_GpuInsertDebugLabel;
  • SDL_GpuPushDebugGroup;
  • SDL_GpuPopDebugGroup;

Render Passes:

  • SDL_GpuBeginRenderPass;
    • Validate that a single mip+layer subresource is not bound more than once
  • SDL_GpuBindGraphicsPipeline;
  • SDL_GpuSetViewport;
  • SDL_GpuSetScissor;
  • SDL_GpuBindVertexBuffers;
  • SDL_GpuBindIndexBuffer;
  • SDL_GpuBindVertexSamplers;
  • SDL_GpuBindVertexStorageTextures;
  • SDL_GpuBindVertexStorageBuffers;
  • SDL_GpuBindFragmentSamplers;
  • SDL_GpuBindFragmentStorageTextures;
  • SDL_GpuBindFragmentStorageBuffers;
  • SDL_GpuPushVertexUniformData;
  • SDL_GpuPushFragmentUniformData;
  • SDL_GpuDrawIndexedPrimitives;
  • SDL_GpuDrawPrimitives;
  • SDL_GpuDrawPrimitivesIndirect;
  • SDL_GpuDrawIndexedPrimitivesIndirect;
  • SDL_GpuEndRenderPass;

Compute Passes:

  • SDL_GpuBeginComputePass;
  • SDL_GpuBindComputePipeline;
  • SDL_GpuBindComputeStorageTextures;
  • SDL_GpuBindComputeStorageBuffers;
  • SDL_GpuPushComputeUniformData;
  • SDL_GpuDispatchCompute;
  • SDL_GpuEndComputePass;

Copy Passes:

  • SDL_GpuMapTransferBuffer;
  • SDL_GpuUnmapTransferBuffer;
  • SDL_GpuSetTransferData;
  • SDL_GpuGetTransferData;
  • SDL_GpuBeginCopyPass;
  • SDL_GpuUploadToTexture;
  • SDL_GpuUploadToBuffer;
  • SDL_GpuCopyTextureToTexture;
  • SDL_GpuCopyBufferToBuffer;
  • SDL_GpuGenerateMipmaps;
  • SDL_GpuDownloadFromTexture;
  • SDL_GpuDownloadFromBuffer;
  • SDL_GpuEndCopyPass;

Miscellaneous:

  • SDL_GpuBlit;

Swapchains:

  • SDL_GpuSupportsSwapchainComposition;
  • SDL_GpuSupportsPresentMode;
  • SDL_GpuClaimWindow;
  • SDL_GpuUnclaimWindow;
  • SDL_GpuSetSwapchainParameters;
  • SDL_GpuGetSwapchainTextureFormat;
  • SDL_GpuAcquireCommandBuffer;
  • SDL_GpuAcquireSwapchainTexture;

Submission:

  • SDL_GpuSubmit;
  • SDL_GpuSubmitAndAcquireFence;
  • SDL_GpuWait;
  • SDL_GpuWaitForFences;
  • SDL_GpuQueryFence;
  • SDL_GpuReleaseFence;

Queries:

  • SDL_GpuTextureFormatTexelBlockSize;
  • SDL_GpuIsTextureFormatSupported;
  • SDL_GpuGetBestSampleCount;
@flibitijibibo
Copy link
Collaborator Author

Null checks are in the latest revision! As it turns out we actually have a good chunk of validation in the system already, so we really just need to set up the debug-only validation system and then it should be easy enough to trickle in validation as we finish this thing up.

@flibitijibibo flibitijibibo removed their assignment Jul 5, 2024
@flibitijibibo flibitijibibo changed the title Parameter checks, optional validation Optional debug validation Jul 5, 2024
@flibitijibibo flibitijibibo changed the title Optional debug validation Optional debug validation in SDL_gpu.c Jul 5, 2024
@flibitijibibo
Copy link
Collaborator Author

flibitijibibo commented Jul 6, 2024

Looking over some of the debugging systems I've had over the years for low-level graphics/audio, and one thing that we should probably do is migrate from SDL_LogError to SDL_assert_release(!#msg); errors this critical will likely only be useful in the moment and not after a crash, and logs are usually only helpful for public builds.

Since the idea is that this won't ever pop up in shipping builds, let's design this to be as useful for builds running in a debugger as possible, and giving debug builds a chance to breakpoint on serious errors with proper messages will definitely make fixing app issues MUCH easier than having to rewind after an error printf shows up like you would for a typical crash log.

@flibitijibibo
Copy link
Collaborator Author

Merged in the framework that lets us do debug validation, we just have to fill in the functions whenever we have time to do so.

@flibitijibibo flibitijibibo added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant