Atlas - SDL_shaders_d3d12_xboxseries.cpp

Home / ext / SDL / src / render / direct3d12 Lines: 1 | Size: 4192 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2026 Sam Lantinga <[email protected]> 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#include "../../SDL_internal.h" 22 23#if defined(SDL_VIDEO_RENDER_D3D12) && defined(SDL_PLATFORM_XBOXSERIES) 24 25#include <SDL3/SDL_stdinc.h> 26 27#include "../../core/windows/SDL_windows.h" 28#include "../../video/directx/SDL_d3d12.h" 29 30#include "SDL_shaders_d3d12.h" 31 32 33// Shader blob headers are generated with a pre-build step using compile_shaders_xbox.bat 34 35#define g_main D3D12_PixelShader_Colors 36#include "D3D12_PixelShader_Colors_Series.h" 37#undef g_main 38 39#define g_main D3D12_PixelShader_Textures 40#include "D3D12_PixelShader_Textures_Series.h" 41#undef g_main 42 43#define g_main D3D12_PixelShader_Advanced 44#include "D3D12_PixelShader_Advanced_Series.h" 45#undef g_main 46 47 48#define g_mainColor D3D12_VertexShader_Colors 49#include "D3D12_VertexShader_Color_Series.h" 50#undef g_mainColor 51 52#define g_mainTexture D3D12_VertexShader_Textures 53#include "D3D12_VertexShader_Texture_Series.h" 54#undef g_mainTexture 55 56#define g_mainAdvanced D3D12_VertexShader_Advanced 57#include "D3D12_VertexShader_Advanced_Series.h" 58#undef g_mainAdvanced 59 60 61#define g_ColorRS D3D12_RootSig_Color 62#include "D3D12_RootSig_Color_Series.h" 63#undef g_ColorRS 64 65#define g_TextureRS D3D12_RootSig_Texture 66#include "D3D12_RootSig_Texture_Series.h" 67#undef g_TextureRS 68 69#define g_AdvancedRS D3D12_RootSig_Advanced 70#include "D3D12_RootSig_Advanced_Series.h" 71#undef g_AdvancedRS 72 73 74static struct 75{ 76 const void *ps_shader_data; 77 SIZE_T ps_shader_size; 78 const void *vs_shader_data; 79 SIZE_T vs_shader_size; 80 D3D12_RootSignature root_sig; 81} D3D12_shaders[NUM_SHADERS] = { 82 { D3D12_PixelShader_Colors, sizeof(D3D12_PixelShader_Colors), 83 D3D12_VertexShader_Colors, sizeof(D3D12_VertexShader_Colors), 84 ROOTSIG_COLOR }, 85 { D3D12_PixelShader_Textures, sizeof(D3D12_PixelShader_Textures), 86 D3D12_VertexShader_Textures, sizeof(D3D12_VertexShader_Textures), 87 ROOTSIG_TEXTURE }, 88 { D3D12_PixelShader_Advanced, sizeof(D3D12_PixelShader_Advanced), 89 D3D12_VertexShader_Advanced, sizeof(D3D12_VertexShader_Advanced), 90 ROOTSIG_ADVANCED }, 91}; 92 93static struct 94{ 95 const void *rs_shader_data; 96 SIZE_T rs_shader_size; 97} D3D12_rootsigs[NUM_ROOTSIGS] = { 98 { D3D12_RootSig_Color, sizeof(D3D12_RootSig_Color) }, 99 { D3D12_RootSig_Texture, sizeof(D3D12_RootSig_Texture) }, 100 { D3D12_RootSig_Advanced, sizeof(D3D12_RootSig_Advanced) }, 101}; 102 103extern "C" 104void D3D12_GetVertexShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) 105{ 106 outBytecode->pShaderBytecode = D3D12_shaders[shader].vs_shader_data; 107 outBytecode->BytecodeLength = D3D12_shaders[shader].vs_shader_size; 108} 109 110extern "C" 111void D3D12_GetPixelShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) 112{ 113 outBytecode->pShaderBytecode = D3D12_shaders[shader].ps_shader_data; 114 outBytecode->BytecodeLength = D3D12_shaders[shader].ps_shader_size; 115} 116 117extern "C" 118D3D12_RootSignature D3D12_GetRootSignatureType(D3D12_Shader shader) 119{ 120 return D3D12_shaders[shader].root_sig; 121} 122 123extern "C" 124void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *outBytecode) 125{ 126 outBytecode->pShaderBytecode = D3D12_rootsigs[rootSig].rs_shader_data; 127 outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; 128} 129 130#endif // SDL_VIDEO_RENDER_D3D12 && SDL_PLATFORM_XBOXSERIES 131 132
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.