From a85f0b49f4a9fa610e5c2a6e14577da9231c8f89 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 12 Nov 2024 17:32:25 -0800 Subject: [PATCH] GPU: Remove D3D11 shaders from testgpu_spinning_cube --- test/testgpu/build-shaders.sh | 13 +- test/testgpu/cube.hlsl | 6 +- test/testgpu/testgpu_dxbc.h | 333 ---------------------------------- test/testgpu_spinning_cube.c | 8 +- 4 files changed, 4 insertions(+), 356 deletions(-) delete mode 100644 test/testgpu/testgpu_dxbc.h diff --git a/test/testgpu/build-shaders.sh b/test/testgpu/build-shaders.sh index ac62d2729..d76f9d645 100755 --- a/test/testgpu/build-shaders.sh +++ b/test/testgpu/build-shaders.sh @@ -82,18 +82,9 @@ if [[ "$OSTYPE" == "darwin"* ]]; then elif [[ "$OSTYPE" == "cygwin"* ]] || [[ "$OSTYPE" == "msys"* ]]; then - # FXC - fxc cube.hlsl /E VSMain /T vs_5_0 /Fh cube.vert.h - fxc cube.hlsl /E PSMain /T ps_5_0 /Fh cube.frag.h - - cat cube.vert.h | perl -w -p -e 's/BYTE/unsigned char/;s/g_VSMain/D3D11_CubeVert/;' > cube.vert.temp.h - cat cube.frag.h | perl -w -p -e 's/BYTE/unsigned char/;s/g_PSMain/D3D11_CubeFrag/;' > cube.frag.temp.h - cat cube.vert.temp.h cube.frag.temp.h > testgpu_dxbc.h - rm -f cube.vert.h cube.frag.h cube.vert.temp.h cube.frag.temp.h - # DXC - dxc cube.hlsl /E VSMain /T vs_6_0 /Fh cube.vert.h /D D3D12=1 - dxc cube.hlsl /E PSMain /T ps_6_0 /Fh cube.frag.h /D D3D12=1 + dxc cube.hlsl /E VSMain /T vs_6_0 /Fh cube.vert.h + dxc cube.hlsl /E PSMain /T ps_6_0 /Fh cube.frag.h cat cube.vert.h | perl -w -p -e 's/BYTE/unsigned char/;s/g_VSMain/D3D12_CubeVert/;' > cube.vert.temp.h cat cube.frag.h | perl -w -p -e 's/BYTE/unsigned char/;s/g_PSMain/D3D12_CubeFrag/;' > cube.frag.temp.h diff --git a/test/testgpu/cube.hlsl b/test/testgpu/cube.hlsl index 219065b18..6d214dcb2 100644 --- a/test/testgpu/cube.hlsl +++ b/test/testgpu/cube.hlsl @@ -1,8 +1,4 @@ -#if D3D12 #define REG(reg, space) register(reg, space) -#else -#define REG(reg, space) register(reg) -#endif cbuffer UBO : REG(b0, space1) { @@ -32,4 +28,4 @@ VSOutput VSMain(VSInput input) float4 PSMain(VSOutput input) : SV_Target0 { return input.Color; -} \ No newline at end of file +} diff --git a/test/testgpu/testgpu_dxbc.h b/test/testgpu/testgpu_dxbc.h deleted file mode 100644 index ab9657876..000000000 --- a/test/testgpu/testgpu_dxbc.h +++ /dev/null @@ -1,333 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 10.1 -// -// -// Buffer Definitions: -// -// cbuffer UBO -// { -// -// float4x4 ModelViewProj; // Offset: 0 Size: 64 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim HLSL Bind Count -// ------------------------------ ---------- ------- ----------- -------------- ------ -// UBO cbuffer NA NA cb0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// TEXCOORD 0 xyz 0 NONE float xyz -// TEXCOORD 1 xyz 1 NONE float xyz -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// TEXCOORD 0 xyzw 0 NONE float xyzw -// SV_Position 0 xyzw 1 POS float xyzw -// -vs_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer CB0[4], immediateIndexed -dcl_input v0.xyz -dcl_input v1.xyz -dcl_output o0.xyzw -dcl_output_siv o1.xyzw, position -dcl_temps 1 -mov o0.xyz, v1.xyzx -mov o0.w, l(1.000000) -mul r0.xyzw, v0.yyyy, cb0[1].xyzw -mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw -mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw -add o1.xyzw, r0.xyzw, cb0[3].xyzw -ret -// Approximately 7 instruction slots used -#endif - -const unsigned char D3D11_CubeVert[] = -{ - 68, 88, 66, 67, 114, 13, - 37, 16, 19, 3, 132, 73, - 243, 18, 23, 177, 140, 169, - 19, 240, 1, 0, 0, 0, - 156, 3, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 64, 1, 0, 0, 140, 1, - 0, 0, 228, 1, 0, 0, - 0, 3, 0, 0, 82, 68, - 69, 70, 4, 1, 0, 0, - 1, 0, 0, 0, 96, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 254, 255, 0, 1, 0, 0, - 220, 0, 0, 0, 82, 68, - 49, 49, 60, 0, 0, 0, - 24, 0, 0, 0, 32, 0, - 0, 0, 40, 0, 0, 0, - 36, 0, 0, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 92, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 0, - 0, 0, 85, 66, 79, 0, - 92, 0, 0, 0, 1, 0, - 0, 0, 120, 0, 0, 0, - 64, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 160, 0, 0, 0, 0, 0, - 0, 0, 64, 0, 0, 0, - 2, 0, 0, 0, 184, 0, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 77, 111, - 100, 101, 108, 86, 105, 101, - 119, 80, 114, 111, 106, 0, - 102, 108, 111, 97, 116, 52, - 120, 52, 0, 171, 3, 0, - 3, 0, 4, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 174, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 49, 48, 46, - 49, 0, 73, 83, 71, 78, - 68, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 7, 7, 0, 0, - 56, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 7, 7, 0, 0, - 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, - 79, 83, 71, 78, 80, 0, - 0, 0, 2, 0, 0, 0, - 8, 0, 0, 0, 56, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 65, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 0, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, - 0, 83, 86, 95, 80, 111, - 115, 105, 116, 105, 111, 110, - 0, 171, 171, 171, 83, 72, - 69, 88, 20, 1, 0, 0, - 80, 0, 1, 0, 69, 0, - 0, 0, 106, 8, 0, 1, - 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 95, 0, - 0, 3, 114, 16, 16, 0, - 0, 0, 0, 0, 95, 0, - 0, 3, 114, 16, 16, 0, - 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 103, 0, - 0, 4, 242, 32, 16, 0, - 1, 0, 0, 0, 1, 0, - 0, 0, 104, 0, 0, 2, - 1, 0, 0, 0, 54, 0, - 0, 5, 114, 32, 16, 0, - 0, 0, 0, 0, 70, 18, - 16, 0, 1, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 242, 0, 16, 0, 0, 0, - 0, 0, 86, 21, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 16, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 166, 26, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 242, 32, - 16, 0, 1, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 148, 0, - 0, 0, 7, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 10.1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// TEXCOORD 0 xyzw 0 NONE float xyzw -// SV_Position 0 xyzw 1 POS float -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_Target 0 xyzw 0 TARGET float xyzw -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_input_ps linear v0.xyzw -dcl_output o0.xyzw -mov o0.xyzw, v0.xyzw -ret -// Approximately 2 instruction slots used -#endif - -const unsigned char D3D11_CubeFrag[] = -{ - 68, 88, 66, 67, 100, 36, - 97, 53, 102, 218, 120, 105, - 57, 43, 222, 229, 58, 45, - 195, 237, 1, 0, 0, 0, - 12, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 160, 0, 0, 0, 248, 0, - 0, 0, 44, 1, 0, 0, - 112, 1, 0, 0, 82, 68, - 69, 70, 100, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 60, 0, 0, 0, 82, 68, - 49, 49, 60, 0, 0, 0, - 24, 0, 0, 0, 32, 0, - 0, 0, 40, 0, 0, 0, - 36, 0, 0, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 77, 105, 99, 114, 111, 115, - 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, - 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 49, - 48, 46, 49, 0, 73, 83, - 71, 78, 80, 0, 0, 0, - 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 15, - 0, 0, 65, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, - 0, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 83, - 86, 95, 80, 111, 115, 105, - 116, 105, 111, 110, 0, 171, - 171, 171, 79, 83, 71, 78, - 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 97, 114, - 103, 101, 116, 0, 171, 171, - 83, 72, 69, 88, 60, 0, - 0, 0, 80, 0, 0, 0, - 15, 0, 0, 0, 106, 8, - 0, 1, 98, 16, 0, 3, - 242, 16, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 0, 0, - 0, 0, 70, 30, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; diff --git a/test/testgpu_spinning_cube.c b/test/testgpu_spinning_cube.c index 9fe01a1a8..df07e5c5f 100644 --- a/test/testgpu_spinning_cube.c +++ b/test/testgpu_spinning_cube.c @@ -22,7 +22,6 @@ /* Regenerate the shaders with testgpu/build-shaders.sh */ #include "testgpu/testgpu_spirv.h" -#include "testgpu/testgpu_dxbc.h" #include "testgpu/testgpu_dxil.h" #include "testgpu/testgpu_metallib.h" @@ -471,12 +470,7 @@ load_shader(bool is_vertex) createinfo.props = 0; SDL_GPUShaderFormat format = SDL_GetGPUShaderFormats(gpu_device); - if (format & SDL_GPU_SHADERFORMAT_DXBC) { - createinfo.format = SDL_GPU_SHADERFORMAT_DXBC; - createinfo.code = is_vertex ? D3D11_CubeVert : D3D11_CubeFrag; - createinfo.code_size = is_vertex ? SDL_arraysize(D3D11_CubeVert) : SDL_arraysize(D3D11_CubeFrag); - createinfo.entrypoint = is_vertex ? "VSMain" : "PSMain"; - } else if (format & SDL_GPU_SHADERFORMAT_DXIL) { + if (format & SDL_GPU_SHADERFORMAT_DXIL) { createinfo.format = SDL_GPU_SHADERFORMAT_DXIL; createinfo.code = is_vertex ? D3D12_CubeVert : D3D12_CubeFrag; createinfo.code_size = is_vertex ? SDL_arraysize(D3D12_CubeVert) : SDL_arraysize(D3D12_CubeFrag);