| 1 | /* |
| 2 | Simple DirectMedia Layer |
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> |
| 4 | |
| 5 | This software is provided 'as-is', without any express or implied |
| 6 | warranty. In no event will the authors be held liable for any damages |
| 7 | arising from the use of this software. |
| 8 | |
| 9 | Permission is granted to anyone to use this software for any purpose, |
| 10 | including commercial applications, and to alter it and redistribute it |
| 11 | freely, subject to the following restrictions: |
| 12 | |
| 13 | 1. The origin of this software must not be misrepresented; you must not |
| 14 | claim that you wrote the original software. If you use this software |
| 15 | in a product, an acknowledgment in the product documentation would be |
| 16 | appreciated but is not required. |
| 17 | 2. Altered source versions must be plainly marked as such, and must not be |
| 18 | misrepresented as being the original software. |
| 19 | 3. This notice may not be removed or altered from any source distribution. |
| 20 | */ |
| 21 | |
| 22 | #ifndef SDL_shaders_gpu_h_ |
| 23 | #define SDL_shaders_gpu_h_ |
| 24 | |
| 25 | #include "SDL_internal.h" |
| 26 | |
| 27 | // SDL_GPU shader implementation |
| 28 | |
| 29 | typedef enum |
| 30 | { |
| 31 | VERT_SHADER_INVALID = -1, |
| 32 | VERT_SHADER_LINEPOINT, |
| 33 | VERT_SHADER_TRI_COLOR, |
| 34 | VERT_SHADER_TRI_TEXTURE, |
| 35 | |
| 36 | NUM_VERT_SHADERS, |
| 37 | } GPU_VertexShaderID; |
| 38 | |
| 39 | typedef enum |
| 40 | { |
| 41 | FRAG_SHADER_INVALID = -1, |
| 42 | FRAG_SHADER_COLOR, |
| 43 | FRAG_SHADER_TEXTURE_RGB, |
| 44 | FRAG_SHADER_TEXTURE_RGBA, |
| 45 | FRAG_SHADER_TEXTURE_RGB_PIXELART, |
| 46 | FRAG_SHADER_TEXTURE_RGBA_PIXELART, |
| 47 | FRAG_SHADER_TEXTURE_CUSTOM, |
| 48 | |
| 49 | NUM_FRAG_SHADERS, |
| 50 | } GPU_FragmentShaderID; |
| 51 | |
| 52 | struct GPU_Shaders |
| 53 | { |
| 54 | SDL_GPUShader *vert_shaders[NUM_VERT_SHADERS]; |
| 55 | SDL_GPUShader *frag_shaders[NUM_FRAG_SHADERS]; |
| 56 | }; |
| 57 | |
| 58 | typedef struct GPU_Shaders GPU_Shaders; |
| 59 | |
| 60 | void GPU_FillSupportedShaderFormats(SDL_PropertiesID props); |
| 61 | extern bool GPU_InitShaders(GPU_Shaders *shaders, SDL_GPUDevice *device); |
| 62 | extern void GPU_ReleaseShaders(GPU_Shaders *shaders, SDL_GPUDevice *device); |
| 63 | extern SDL_GPUShader *GPU_GetVertexShader(GPU_Shaders *shaders, GPU_VertexShaderID id); |
| 64 | extern SDL_GPUShader *GPU_GetFragmentShader(GPU_Shaders *shaders, GPU_FragmentShaderID id); |
| 65 | |
| 66 | #endif // SDL_shaders_gpu_h_ |
| 67 | |