From 4f794b1c37f63c1c564b9519754f859f124b563b Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 20 Feb 2020 23:21:54 +0900 Subject: [PATCH] Add precompiled versions of D3D11 display shaders --- src/frontend-common/display_ps.hlsl | 8 + src/frontend-common/display_ps.hlsl.h | 131 ++++++++++++ src/frontend-common/display_vs.hlsl | 13 ++ src/frontend-common/display_vs.hlsl.h | 197 ++++++++++++++++++ .../make_d3d_display_shader_bytecode.bat | 2 + 5 files changed, 351 insertions(+) create mode 100644 src/frontend-common/display_ps.hlsl create mode 100644 src/frontend-common/display_ps.hlsl.h create mode 100644 src/frontend-common/display_vs.hlsl create mode 100644 src/frontend-common/display_vs.hlsl.h create mode 100644 src/frontend-common/make_d3d_display_shader_bytecode.bat diff --git a/src/frontend-common/display_ps.hlsl b/src/frontend-common/display_ps.hlsl new file mode 100644 index 000000000..d20f60ed2 --- /dev/null +++ b/src/frontend-common/display_ps.hlsl @@ -0,0 +1,8 @@ +Texture2D samp0 : register(t0); +SamplerState samp0_ss : register(s0); + +void main(in float2 v_tex0 : TEXCOORD0, + out float4 o_col0 : SV_Target) +{ + o_col0 = samp0.Sample(samp0_ss, v_tex0); +} \ No newline at end of file diff --git a/src/frontend-common/display_ps.hlsl.h b/src/frontend-common/display_ps.hlsl.h new file mode 100644 index 000000000..688c4570f --- /dev/null +++ b/src/frontend-common/display_ps.hlsl.h @@ -0,0 +1,131 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 10.1 +// +// +// Resource Bindings: +// +// Name Type Format Dim HLSL Bind Count +// ------------------------------ ---------- ------- ----------- -------------- ------ +// samp0_ss sampler NA NA s0 1 +// samp0 texture float4 2d t0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v0.xy +dcl_output o0.xyzw +sample o0.xyzw, v0.xyxx, t0.xyzw, s0 +ret +// Approximately 2 instruction slots used +#endif + +const BYTE static s_display_ps_bytecode[] = +{ + 68, 88, 66, 67, 140, 134, + 46, 29, 68, 36, 193, 23, + 94, 171, 102, 123, 183, 66, + 19, 177, 1, 0, 0, 0, + 32, 2, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 208, 0, 0, 0, 4, 1, + 0, 0, 56, 1, 0, 0, + 164, 1, 0, 0, 82, 68, + 69, 70, 148, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 129, 0, 0, + 107, 0, 0, 0, 92, 0, + 0, 0, 3, 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, + 101, 0, 0, 0, 2, 0, + 0, 0, 5, 0, 0, 0, + 4, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 1, 0, 0, 0, 13, 0, + 0, 0, 115, 97, 109, 112, + 48, 95, 115, 115, 0, 115, + 97, 109, 112, 48, 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, 171, 73, 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, 3, 3, + 0, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 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, 68, 82, 100, 0, + 0, 0, 64, 0, 0, 0, + 25, 0, 0, 0, 90, 0, + 0, 3, 0, 96, 16, 0, + 0, 0, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 0, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 0, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 69, 0, 0, 9, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 0, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 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, 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 +}; diff --git a/src/frontend-common/display_vs.hlsl b/src/frontend-common/display_vs.hlsl new file mode 100644 index 000000000..5b071d4f1 --- /dev/null +++ b/src/frontend-common/display_vs.hlsl @@ -0,0 +1,13 @@ +cbuffer UBOBlock : register(b0) +{ + float4 u_src_rect; +}; + +void main(in uint vertex_id : SV_VertexID, + out float2 v_tex0 : TEXCOORD0, + out float4 o_pos : SV_Position) +{ + float2 pos = float2(float((vertex_id << 1) & 2u), float(vertex_id & 2u)); + v_tex0 = u_src_rect.xy + pos * u_src_rect.zw; + o_pos = float4(pos * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f); +} diff --git a/src/frontend-common/display_vs.hlsl.h b/src/frontend-common/display_vs.hlsl.h new file mode 100644 index 000000000..3bac3ea39 --- /dev/null +++ b/src/frontend-common/display_vs.hlsl.h @@ -0,0 +1,197 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 10.1 +// +// +// Buffer Definitions: +// +// cbuffer UBOBlock +// { +// +// float4 u_src_rect; // Offset: 0 Size: 16 +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim HLSL Bind Count +// ------------------------------ ---------- ------- ----------- -------------- ------ +// UBOBlock cbuffer NA NA cb0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_VertexID 0 x 0 VERTID uint x +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// SV_Position 0 xyzw 1 POS float xyzw +// +vs_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_input_sgv v0.x, vertex_id +dcl_output o0.xy +dcl_output_siv o1.xyzw, position +dcl_temps 1 +ishl r0.x, v0.x, l(1) +and r0.x, r0.x, l(2) +and r0.z, v0.x, l(2) +utof r0.xy, r0.xzxx +mad o0.xy, r0.xyxx, cb0[0].zwzz, cb0[0].xyxx +mad o1.xy, r0.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000) +mov o1.zw, l(0,0,0,1.000000) +ret +// Approximately 8 instruction slots used +#endif + +const BYTE static s_display_vs_bytecode[] = +{ + 68, 88, 66, 67, 37, 97, + 157, 234, 112, 10, 38, 98, + 114, 228, 143, 118, 71, 158, + 122, 195, 1, 0, 0, 0, + 72, 3, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 248, 0, 0, 0, 44, 1, + 0, 0, 132, 1, 0, 0, + 204, 2, 0, 0, 82, 68, + 69, 70, 188, 0, 0, 0, + 1, 0, 0, 0, 72, 0, + 0, 0, 1, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 254, 255, 0, 129, 0, 0, + 148, 0, 0, 0, 60, 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, 66, 108, 111, + 99, 107, 0, 171, 171, 171, + 60, 0, 0, 0, 1, 0, + 0, 0, 96, 0, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 120, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 2, 0, 0, 0, 132, 0, + 0, 0, 0, 0, 0, 0, + 117, 95, 115, 114, 99, 95, + 114, 101, 99, 116, 0, 171, + 1, 0, 3, 0, 1, 0, + 4, 0, 0, 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, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 0, 0, + 83, 86, 95, 86, 101, 114, + 116, 101, 120, 73, 68, 0, + 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, + 3, 12, 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, + 68, 82, 64, 1, 0, 0, + 64, 0, 1, 0, 80, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 96, 0, 0, 4, 18, 16, + 16, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 101, 0, + 0, 3, 50, 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, 41, 0, + 0, 7, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 16, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 2, 0, 0, 0, + 1, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 10, 16, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 2, 0, 0, 0, 86, 0, + 0, 5, 50, 0, 16, 0, + 0, 0, 0, 0, 134, 0, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 11, 50, 32, + 16, 0, 0, 0, 0, 0, + 70, 0, 16, 0, 0, 0, + 0, 0, 230, 138, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 15, + 50, 32, 16, 0, 1, 0, + 0, 0, 70, 0, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 64, + 0, 0, 0, 192, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 191, 0, 0, 128, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 194, 32, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 128, 63, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 8, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 2, 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, 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 +}; diff --git a/src/frontend-common/make_d3d_display_shader_bytecode.bat b/src/frontend-common/make_d3d_display_shader_bytecode.bat new file mode 100644 index 000000000..6bf21cc38 --- /dev/null +++ b/src/frontend-common/make_d3d_display_shader_bytecode.bat @@ -0,0 +1,2 @@ +fxc /T vs_4_0 /E main /O3 /Fh display_vs.hlsl.h /Vn "static s_display_vs_bytecode" display_vs.hlsl +fxc /T ps_4_0 /E main /O3 /Fh display_ps.hlsl.h /Vn "static s_display_ps_bytecode" display_ps.hlsl \ No newline at end of file