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