SDL: GPU: Note buffer alignment requirements

From 799093799abbbe6f02b99ba5982cfdb2b561ba3b Mon Sep 17 00:00:00 2001
From: cosmonaut <[EMAIL REDACTED]>
Date: Tue, 21 Jan 2025 15:07:34 -0800
Subject: [PATCH] GPU: Note buffer alignment requirements

---
 include/SDL3/SDL_gpu.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h
index 36b235b333db5..8e7dc69e49cd9 100644
--- a/include/SDL3/SDL_gpu.h
+++ b/include/SDL3/SDL_gpu.h
@@ -2494,6 +2494,9 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
  * Note that certain combinations of usage flags are invalid. For example, a
  * buffer cannot have both the VERTEX and INDEX flags.
  *
+ * If you use a STORAGE flag, the data in the buffer must respect std140 layout conventions.
+ * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
+ *
  * For better understanding of underlying concepts and memory management with
  * SDL GPU API, you may refer
  * [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/)
@@ -2796,6 +2799,9 @@ extern SDL_DECLSPEC SDL_GPUCommandBuffer *SDLCALL SDL_AcquireGPUCommandBuffer(
  *
  * Subsequent draw calls will use this uniform data.
  *
+ * The data being pushed must respect std140 layout conventions.
+ * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
+ *
  * \param command_buffer a command buffer.
  * \param slot_index the vertex uniform slot to push data to.
  * \param data client data to write.
@@ -2835,6 +2841,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData(
  * Pushes data to a uniform slot on the command buffer.
  *
  * Subsequent draw calls will use this uniform data.
+
+ * The data being pushed must respect std140 layout conventions.
+ * In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.
  *
  * \param command_buffer a command buffer.
  * \param slot_index the uniform slot to push data to.