@@ -831,6 +831,26 @@ extern SDL_DECLSPEC SDL_GpuBackend SDLCALL SDL_GpuGetBackend(SDL_GpuDevice *devi
831
831
/**
832
832
* Creates a pipeline object to be used in a compute workflow.
833
833
*
834
+ * Shader resource bindings must be authored to follow a particular order.
835
+ * For SPIR-V shaders, use the following resource sets:
836
+ * 0: Read-only storage textures, followed by read-only storage buffers
837
+ * 1: Read-write storage textures, followed by read-write storage buffers
838
+ * 2: Uniform buffers
839
+ *
840
+ * For HLSL/DXBC/DXIL, use the following order:
841
+ * For t registers:
842
+ * Read-only storage textures, followed by read-only storage buffers
843
+ * For b registers:
844
+ * Uniform buffers
845
+ * For u registers:
846
+ * Read-write storage textures, followed by read-write storage buffers
847
+ *
848
+ * For MSL/metallib, use the following order:
849
+ * For [[buffer]]:
850
+ * Uniform buffers, followed by read-only storage buffers, followed by read-write storage buffers
851
+ * For [[texture]]:
852
+ * Read-only storage textures, followed by read-write storage textures
853
+ *
834
854
* \param device a GPU Context
835
855
* \param computePipelineCreateInfo a struct describing the state of the requested compute pipeline
836
856
* \returns a compute pipeline object on success, or NULL on failure
@@ -881,6 +901,34 @@ extern SDL_DECLSPEC SDL_GpuSampler *SDLCALL SDL_GpuCreateSampler(
881
901
/**
882
902
* Creates a shader to be used when creating a graphics pipeline.
883
903
*
904
+ * Shader resource bindings must be authored to follow a particular order.
905
+ * For SPIR-V shaders, use the following resource sets:
906
+ * For vertex shaders:
907
+ * 0: Sampled textures, followed by storage textures, followed by storage buffers
908
+ * 1: Uniform buffers
909
+ * For fragment shaders:
910
+ * 2: Sampled textures, followed by storage textures, followed by storage buffers
911
+ * 3: Uniform buffers
912
+ *
913
+ * For HLSL/DXBC/DXIL, use the following order:
914
+ * For t registers:
915
+ * Sampled textures, followed by storage textures, followed by storage buffers
916
+ * For s registers:
917
+ * Samplers with indices corresponding to the sampled textures
918
+ * For b registers:
919
+ * Uniform buffers
920
+ *
921
+ * For MSL/metallib, use the following order:
922
+ * For [[texture]]:
923
+ * Sampled textures, followed by storage textures
924
+ * For [[sampler]]:
925
+ * Samplers with indices corresponding to the sampled textures
926
+ * For [[buffer]]:
927
+ * Uniform buffers, followed by storage buffers.
928
+ * Vertex buffer 0 is bound at [[buffer(30)]], vertex buffer 1 at [[buffer(29)]], and so on.
929
+ * Rather than manually authoring vertex buffer indices, use the [[stage_in]] attribute
930
+ * which will automatically use the vertex input information from the SDL_GpuPipeline.
931
+ *
884
932
* \param device a GPU Context
885
933
* \param shaderCreateInfo a struct describing the state of the desired shader
886
934
* \returns a shader object on success, or NULL on failure
0 commit comments