Atlas - SDL_shaders_d3d12_xboxone.cpp

Home / ext / SDL / src / render / direct3d12 Lines: 1 | Size: 4159 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_XBOXONE) 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// Shader blob headers are generated with a pre-build step using compile_shaders_xbox.bat 33 34#define g_main D3D12_PixelShader_Colors 35#include "D3D12_PixelShader_Colors_One.h" 36#undef g_main 37 38#define g_main D3D12_PixelShader_Textures 39#include "D3D12_PixelShader_Textures_One.h" 40#undef g_main 41 42#define g_main D3D12_PixelShader_Advanced 43#include "D3D12_PixelShader_Advanced_One.h" 44#undef g_main 45 46 47#define g_mainColor D3D12_VertexShader_Colors 48#include "D3D12_VertexShader_Color_One.h" 49#undef g_mainColor 50 51#define g_mainTexture D3D12_VertexShader_Textures 52#include "D3D12_VertexShader_Texture_One.h" 53#undef g_mainTexture 54 55#define g_mainAdvanced D3D12_VertexShader_Advanced 56#include "D3D12_VertexShader_Advanced_One.h" 57#undef g_mainAdvanced 58 59 60#define g_ColorRS D3D12_RootSig_Color 61#include "D3D12_RootSig_Color_One.h" 62#undef g_ColorRS 63 64#define g_TextureRS D3D12_RootSig_Texture 65#include "D3D12_RootSig_Texture_One.h" 66#undef g_TextureRS 67 68#define g_AdvancedRS D3D12_RootSig_Advanced 69#include "D3D12_RootSig_Advanced_One.h" 70#undef g_AdvancedRS 71 72 73static struct 74{ 75 const void *ps_shader_data; 76 SIZE_T ps_shader_size; 77 const void *vs_shader_data; 78 SIZE_T vs_shader_size; 79 D3D12_RootSignature root_sig; 80} D3D12_shaders[NUM_SHADERS] = { 81 { D3D12_PixelShader_Colors, sizeof(D3D12_PixelShader_Colors), 82 D3D12_VertexShader_Colors, sizeof(D3D12_VertexShader_Colors), 83 ROOTSIG_COLOR }, 84 { D3D12_PixelShader_Textures, sizeof(D3D12_PixelShader_Textures), 85 D3D12_VertexShader_Textures, sizeof(D3D12_VertexShader_Textures), 86 ROOTSIG_TEXTURE }, 87 { D3D12_PixelShader_Advanced, sizeof(D3D12_PixelShader_Advanced), 88 D3D12_VertexShader_Advanced, sizeof(D3D12_VertexShader_Advanced), 89 ROOTSIG_ADVANCED }, 90}; 91 92static struct 93{ 94 const void *rs_shader_data; 95 SIZE_T rs_shader_size; 96} D3D12_rootsigs[NUM_ROOTSIGS] = { 97 { D3D12_RootSig_Color, sizeof(D3D12_RootSig_Color) }, 98 { D3D12_RootSig_Texture, sizeof(D3D12_RootSig_Texture) }, 99 { D3D12_RootSig_Advanced, sizeof(D3D12_RootSig_Advanced) }, 100}; 101 102extern "C" 103void D3D12_GetVertexShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) 104{ 105 outBytecode->pShaderBytecode = D3D12_shaders[shader].vs_shader_data; 106 outBytecode->BytecodeLength = D3D12_shaders[shader].vs_shader_size; 107} 108 109extern "C" 110void D3D12_GetPixelShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) 111{ 112 outBytecode->pShaderBytecode = D3D12_shaders[shader].ps_shader_data; 113 outBytecode->BytecodeLength = D3D12_shaders[shader].ps_shader_size; 114} 115 116extern "C" 117D3D12_RootSignature D3D12_GetRootSignatureType(D3D12_Shader shader) 118{ 119 return D3D12_shaders[shader].root_sig; 120} 121 122extern "C" 123void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *outBytecode) 124{ 125 outBytecode->pShaderBytecode = D3D12_rootsigs[rootSig].rs_shader_data; 126 outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; 127} 128 129#endif // SDL_VIDEO_RENDER_D3D12 && SDL_PLATFORM_XBOXONE 130 131
[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.