SDL: GPU: Remove D3D11 backend and allow D3D12 to ingest DXBC (#11456)

From 119b4fa5f5938f5ee752442d2f2894d8468b24df Mon Sep 17 00:00:00 2001
From: Evan Hemsley <[EMAIL REDACTED]>
Date: Tue, 12 Nov 2024 10:55:21 -0800
Subject: [PATCH] GPU: Remove D3D11 backend and allow D3D12 to ingest DXBC
 (#11456)

---
 VisualC-GDK/SDL/SDL.vcxproj         |    1 -
 VisualC-GDK/SDL/SDL.vcxproj.filters |    1 -
 VisualC/SDL/SDL.vcxproj             |    1 -
 VisualC/SDL/SDL.vcxproj.filters     |    3 -
 include/SDL3/SDL_gpu.h              |   23 +-
 src/SDL_internal.h                  |    1 -
 src/gpu/SDL_gpu.c                   |    3 -
 src/gpu/SDL_sysgpu.h                |    1 -
 src/gpu/d3d11/D3D11_Blit.h          | 1707 -------
 src/gpu/d3d11/SDL_gpu_d3d11.c       | 6534 ---------------------------
 src/gpu/d3d11/compile_shaders.bat   |    8 -
 src/gpu/d3d12/SDL_gpu_d3d12.c       |    4 +-
 src/render/gpu/SDL_shaders_gpu.c    |   24 -
 13 files changed, 6 insertions(+), 8305 deletions(-)
 delete mode 100644 src/gpu/d3d11/D3D11_Blit.h
 delete mode 100644 src/gpu/d3d11/SDL_gpu_d3d11.c
 delete mode 100644 src/gpu/d3d11/compile_shaders.bat

diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj
index c779b40ccea90..7d41bbc5e76b4 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj
+++ b/VisualC-GDK/SDL/SDL.vcxproj
@@ -884,7 +884,6 @@
     <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.c" />
     <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_std.c" />
     <ClCompile Include="..\..\src\gpu\SDL_gpu.c" />
-    <ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c" />
     <ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c">
       <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
       <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters
index 46d3b47750832..866d073e0f899 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj.filters
+++ b/VisualC-GDK/SDL/SDL.vcxproj.filters
@@ -58,7 +58,6 @@
     <ClCompile Include="..\..\src\file\SDL_iostream.c" />
     <ClCompile Include="..\..\src\filesystem\gdk\SDL_sysfilesystem.cpp" />
     <ClCompile Include="..\..\src\gpu\SDL_gpu.c" />
-    <ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c" />
     <ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c" />
     <ClCompile Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan.c" />
     <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj
index a6371238f965c..91fde679c2706 100644
--- a/VisualC/SDL/SDL.vcxproj
+++ b/VisualC/SDL/SDL.vcxproj
@@ -413,7 +413,6 @@
     <ClCompile Include="..\..\src\filesystem\SDL_filesystem.c" />
     <ClCompile Include="..\..\src\filesystem\windows\SDL_sysfsops.c" />
     <ClCompile Include="..\..\src\gpu\SDL_gpu.c" />
-    <ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c" />
     <ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c" />
     <ClCompile Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan.c" />
     <ClCompile Include="..\..\src\main\generic\SDL_sysmain_callbacks.c" />
diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters
index ada794006fb9c..8cd2691322fad 100644
--- a/VisualC/SDL/SDL.vcxproj.filters
+++ b/VisualC/SDL/SDL.vcxproj.filters
@@ -1601,9 +1601,6 @@
     <ClCompile Include="..\..\src\gpu\SDL_gpu.c">
       <Filter>gpu</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c">
-      <Filter>gpu</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c">
       <Filter>gpu</Filter>
     </ClCompile>
diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h
index e5568261ac6b9..b9acd8f40dd03 100644
--- a/include/SDL3/SDL_gpu.h
+++ b/include/SDL3/SDL_gpu.h
@@ -782,8 +782,8 @@ typedef Uint32 SDL_GPUShaderFormat;
 #define SDL_GPU_SHADERFORMAT_INVALID  0
 #define SDL_GPU_SHADERFORMAT_PRIVATE  (1u << 0) /**< Shaders for NDA'd platforms. */
 #define SDL_GPU_SHADERFORMAT_SPIRV    (1u << 1) /**< SPIR-V shaders for Vulkan. */
-#define SDL_GPU_SHADERFORMAT_DXBC     (1u << 2) /**< DXBC SM5_0 shaders for D3D11. */
-#define SDL_GPU_SHADERFORMAT_DXIL     (1u << 3) /**< DXIL shaders for D3D12. */
+#define SDL_GPU_SHADERFORMAT_DXBC     (1u << 2) /**< DXBC SM5_1 shaders for D3D12. */
+#define SDL_GPU_SHADERFORMAT_DXIL     (1u << 3) /**< DXIL SM6_0 shaders for D3D12. */
 #define SDL_GPU_SHADERFORMAT_MSL      (1u << 4) /**< MSL shaders for Metal. */
 #define SDL_GPU_SHADERFORMAT_METALLIB (1u << 5) /**< Precompiled metallib shaders for Metal. */
 
@@ -2076,15 +2076,7 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD
  * - 1: Write-only storage textures, followed by write-only storage buffers
  * - 2: Uniform buffers
  *
- * For DXBC Shader Model 5_0 shaders, use the following register order:
- *
- * - t registers: Sampled textures, followed by read-only storage textures,
- *   followed by read-only storage buffers
- * - u registers: Write-only storage textures, followed by write-only storage
- *   buffers
- * - b registers: Uniform buffers
- *
- * For DXIL shaders, use the following register order:
+ * For DXBC and DXIL shaders, use the following register order:
  *
  * - (t[n], space0): Sampled textures, followed by read-only storage textures,
  *   followed by read-only storage buffers
@@ -2172,14 +2164,7 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler(
  *   buffers
  * - 3: Uniform buffers
  *
- * For DXBC Shader Model 5_0 shaders, use the following register order:
- *
- * - t registers: Sampled textures, followed by storage textures, followed by
- *   storage buffers
- * - s registers: Samplers with indices corresponding to the sampled textures
- * - b registers: Uniform buffers
- *
- * For DXIL shaders, use the following register order:
+ * For DXBC and DXIL shaders, use the following register order:
  *
  * For vertex shaders:
  *
diff --git a/src/SDL_internal.h b/src/SDL_internal.h
index 75fa957a5f138..e0d7ace11827d 100644
--- a/src/SDL_internal.h
+++ b/src/SDL_internal.h
@@ -207,7 +207,6 @@
 #endif // SDL_RENDER_DISABLED
 
 #ifdef SDL_GPU_DISABLED
-#undef SDL_GPU_D3D11
 #undef SDL_GPU_D3D12
 #undef SDL_GPU_METAL
 #undef SDL_GPU_VULKAN
diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c
index 6f1e8975ddfd0..fe60bf5ae7cce 100644
--- a/src/gpu/SDL_gpu.c
+++ b/src/gpu/SDL_gpu.c
@@ -166,9 +166,6 @@ static const SDL_GPUBootstrap *backends[] = {
 #endif
 #ifdef SDL_GPU_D3D12
     &D3D12Driver,
-#endif
-#ifdef SDL_GPU_D3D11
-    &D3D11Driver,
 #endif
     NULL
 };
diff --git a/src/gpu/SDL_sysgpu.h b/src/gpu/SDL_sysgpu.h
index c20531f99b9bf..bd2a2f42bc7f2 100644
--- a/src/gpu/SDL_sysgpu.h
+++ b/src/gpu/SDL_sysgpu.h
@@ -953,7 +953,6 @@ extern "C" {
 #endif
 
 extern SDL_GPUBootstrap VulkanDriver;
-extern SDL_GPUBootstrap D3D11Driver;
 extern SDL_GPUBootstrap D3D12Driver;
 extern SDL_GPUBootstrap MetalDriver;
 extern SDL_GPUBootstrap PS5Driver;
diff --git a/src/gpu/d3d11/D3D11_Blit.h b/src/gpu/d3d11/D3D11_Blit.h
deleted file mode 100644
index 58800af6da3fa..0000000000000
--- a/src/gpu/d3d11/D3D11_Blit.h
+++ /dev/null
@@ -1,1707 +0,0 @@
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 10.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_5_0
-dcl_globalFlags refactoringAllowed
-dcl_input_sgv v0.x, vertex_id
-dcl_output o0.xy
-dcl_output_siv o1.xyzw, position
-dcl_temps 1
-bfi r0.x, l(1), l(1), v0.x, l(0)
-and r0.z, v0.x, l(2)
-utof r0.xy, r0.xzxx
-mov o0.xy, r0.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 7 instruction slots used
-#endif
-
-const BYTE g_FullscreenVert[] =
-{
-     68,  88,  66,  67,  35, 105, 
-    237, 237, 146, 210, 147,  25, 
-    112,  64, 239,   9, 223, 111, 
-    229, 225,   1,   0,   0,   0, 
-    224,   2,   0,   0,   5,   0, 
-      0,   0,  52,   0,   0,   0, 
-    160,   0,   0,   0, 212,   0, 
-      0,   0,  44,   1,   0,   0, 
-     68,   2,   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, 
-    254, 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,  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, 
-     69,  82,  84,  69,  88,  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,  79,  83,  73,  84,  73, 
-     79,  78,   0, 171, 171, 171, 
-     83,  72,  69,  88,  16,   1, 
-      0,   0,  80,   0,   1,   0, 
-     68,   0,   0,   0, 106,   8, 
-      0,   1,  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, 
-    140,   0,   0,  11,  18,   0, 
-     16,   0,   0,   0,   0,   0, 
-      1,  64,   0,   0,   1,   0, 
-      0,   0,   1,  64,   0,   0, 
-      1,   0,   0,   0,  10,  16, 
-     16,   0,   0,   0,   0,   0, 
-      1,  64,   0,   0,   0,   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,  54,   0,   0,   5, 
-     50,  32,  16,   0,   0,   0, 
-      0,   0,  70,   0,  16,   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, 148,   0,   0,   0, 
-      7,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   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, 
-      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
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 10.1
-//
-//
-// Buffer Definitions: 
-//
-// cbuffer SourceRegionBuffer
-// {
-//
-//   float2 UVLeftTop;                  // Offset:    0 Size:     8
-//   float2 UVDimensions;               // Offset:    8 Size:     8
-//   uint MipLevel;                     // Offset:   16 Size:     4
-//   float LayerOrDepth;                // Offset:   20 Size:     4 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim      HLSL Bind  Count
-// ------------------------------ ---------- ------- ----------- -------------- ------
-// SourceSampler                     sampler      NA          NA             s0      1 
-// SourceTexture2D                   texture  float4          2d             t0      1 
-// SourceRegionBuffer                cbuffer      NA          NA            cb0      1 
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// TEXCOORD                 0   xy          0     NONE   float   xy  
-// 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_constantbuffer CB0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_input_ps linear v0.xy
-dcl_output o0.xyzw
-dcl_temps 1
-mad r0.xy, cb0[0].zwzz, v0.xyxx, cb0[0].xyxx
-utof r0.z, cb0[1].x
-sample_l_indexable(texture2d)(float,float,float,float) o0.xyzw, r0.xyxx, t0.xyzw, s0, r0.z
-ret 
-// Approximately 4 instruction slots used
-#endif
-
-const BYTE g_BlitFrom2D[] =
-{
-     68,  88,  66,  67, 202, 121, 
-     86, 209, 195,  28,  22, 216, 
-     35, 118,  37,  69, 114, 188, 
-    248, 164,   1,   0,   0,   0, 
-    160,   4,   0,   0,   5,   0, 
-      0,   0,  52,   0,   0,   0, 
-    156,   2,   0,   0, 244,   2, 
-      0,   0,  40,   3,   0,   0, 
-      4,   4,   0,   0,  82,  68, 
-     69,  70,  96,   2,   0,   0, 
-      1,   0,   0,   0, 208,   0, 
-      0,   0,   3,   0,   0,   0, 
-     60,   0,   0,   0,   0,   5, 
-    255, 255,   0,   1,   0,   0, 
-     56,   2,   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, 
-    156,   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, 170,   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, 186,   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, 
-     83, 111, 117, 114,  99, 101, 
-     83,  97, 109, 112, 108, 101, 
-    114,   0,  83, 111, 117, 114, 
-     99, 101,  84, 101, 120, 116, 
-    117, 114, 101,  50,  68,   0, 
-     83, 111, 117, 114,  99, 101, 
-     82, 101, 103, 105, 111, 110, 
-     66, 117, 102, 102, 101, 114, 
-      0, 171, 171, 171, 186,   0, 
-      0,   0,   4,   0,   0,   0, 
-    232,   0,   0,   0,  32,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 136,   1, 
-      0,   0,   0,   0,   0,   0, 
-      8,   0,   0,   0,   2,   0, 
-      0,   0, 156,   1,   0,   0, 
-      0,   0,   0,   0, 255, 255, 
-    255, 255,   0,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0, 192,   1,   0,   0, 
-      8,   0,   0,   0,   8,   0, 
-      0,   0,   2,   0,   0,   0, 
-    156,   1,   0,   0,   0,   0, 
-      0,   0, 255, 255, 255, 255, 
-      0,   0,   0,   0, 255, 255, 
-    255, 255,   0,   0,   0,   0, 
-    205,   1,   0,   0,  16,   0, 
-      0,   0,   4,   0,   0,   0, 
-      2,   0,   0,   0, 220,   1, 
-      0,   0,   0,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0, 255, 255, 255, 255, 
-      0,   0,   0,   0,   0,   2, 
-      0,   0,  20,   0,   0,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,  20,   2,   0,   0, 
-      0,   0,   0,   0, 255, 255, 
-    255, 255,   0,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0,  85,  86,  76, 101, 
-    102, 116,  84, 111, 112,   0, 
-    102, 108, 111,  97, 116,  50, 
-      0, 171, 171, 171,   1,   0, 
-      3,   0,   1,   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, 
-    146,   1,   0,   0,  85,  86, 
-     68, 105, 109, 101, 110, 115, 
-    105, 111, 110, 115,   0,  77, 
-    105, 112,  76, 101, 118, 101, 
-    108,   0, 100, 119, 111, 114, 
-    100,   0,   0,   0,  19,   0, 
-      1,   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, 214,   1, 
-      0,   0,  76,  97, 121, 101, 
-    114,  79, 114,  68, 101, 112, 
-    116, 104,   0, 102, 108, 111, 
-     97, 116,   0, 171,   0,   0, 
-      3,   0,   1,   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, 
-     13,   2,   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,   3,   3,   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,  79,  83,  73,  84,  73, 
-     79,  78,   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, 212,   0,   0,   0, 
-     80,   0,   0,   0,  53,   0, 
-      0,   0, 106,   8,   0,   1, 
-     89,   0,   0,   4,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-      2,   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, 104,   0,   0,   2, 
-      1,   0,   0,   0,  50,   0, 
-      0,  11,  50,   0,  16,   0, 
-      0,   0,   0,   0, 230, 138, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  70,  16, 
-     16,   0,   0,   0,   0,   0, 
-     70, 128,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     86,   0,   0,   6,  66,   0, 
-     16,   0,   0,   0,   0,   0, 
-     10, 128,  32,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     72,   0,   0, 141, 194,   0, 
-      0, 128,  67,  85,  21,   0, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,  70,   0,  16,   0, 
-      0,   0,   0,   0,  70, 126, 
-     16,   0,   0,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  42,   0,  16,   0, 
-      0,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    148,   0,   0,   0,   4,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,   1,   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,   1,   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
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 10.1
-//
-//
-// Buffer Definitions: 
-//
-// cbuffer SourceRegionBuffer
-// {
-//
-//   float2 UVLeftTop;                  // Offset:    0 Size:     8
-//   float2 UVDimensions;               // Offset:    8 Size:     8
-//   uint MipLevel;                     // Offset:   16 Size:     4
-//   float LayerOrDepth;                // Offset:   20 Size:     4
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim      HLSL Bind  Count
-// ------------------------------ ---------- ------- ----------- -------------- ------
-// SourceSampler                     sampler      NA          NA             s0      1 
-// SourceTexture2DArray              texture  float4     2darray             t0      1 
-// SourceRegionBuffer                cbuffer      NA          NA            cb0      1 
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// TEXCOORD                 0   xy          0     NONE   float   xy  
-// 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_constantbuffer CB0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2darray (float,float,float,float) t0
-dcl_input_ps linear v0.xy
-dcl_output o0.xyzw
-dcl_temps 1
-ftou r0.x, cb0[1].y
-utof r0.z, r0.x
-mad r0.xy, cb0[0].zwzz, v0.xyxx, cb0[0].xyxx
-utof r0.w, cb0[1].x
-sample_l_indexable(texture2darray)(float,float,float,float) o0.xyzw, r0.xyzx, t0.xyzw, s0, r0.w
-ret 
-// Approximately 6 instruction slots used
-#endif
-
-const BYTE g_BlitFrom2DArray[] =
-{
-     68,  88,  66,  67, 228, 235, 
-     27, 223, 254, 144, 184,  34, 
-     12, 203, 116, 115,  17, 233, 
-    159, 157,   1,   0,   0,   0, 
-    208,   4,   0,   0,   5,   0, 
-      0,   0,  52,   0,   0,   0, 
-    160,   2,   0,   0, 248,   2, 
-      0,   0,  44,   3,   0,   0, 
-     52,   4,   0,   0,  82,  68, 
-     69,  70, 100,   2,   0,   0, 
-      1,   0,   0,   0, 212,   0, 
-      0,   0,   3,   0,   0,   0, 
-     60,   0,   0,   0,   0,   5, 
-    255, 255,   0,   1,   0,   0, 
-     60,   2,   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, 
-    156,   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, 170,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   5,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     13,   0,   0,   0, 191,   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, 
-     83, 111, 117, 114,  99, 101, 
-     83,  97, 109, 112, 108, 101, 
-    114,   0,  83, 111, 117, 114, 
-     99, 101,  84, 101, 120, 116, 
-    117, 114, 101,  50,  68,  65, 
-    114, 114,  97, 121,   0,  83, 
-    111, 117, 114,  99, 101,  82, 
-    101, 103, 105, 111, 110,  66, 
-    117, 102, 102, 101, 114,   0, 
-    171, 171, 191,   0,   0,   0, 
-      4,   0,   0,   0, 236,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 140,   1,   0,   0, 
-      0,   0,   0,   0,   8,   0, 
-      0,   0,   2,   0,   0,   0, 
-    160,   1,   0,   0,   0,   0, 
-      0,   0, 255, 255, 255, 255, 
-      0,   0,   0,   0, 255, 255, 
-    255, 255,   0,   0,   0,   0, 
-    196,   1,   0,   0,   8,   0, 
-      0,   0,   8,   0,   0,   0, 
-      2,   0,   0,   0, 160,   1, 
-      0,   0,   0,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0, 255, 255, 255, 255, 
-      0,   0,   0,   0, 209,   1, 
-      0,   0,  16,   0,   0,   0, 
-      4,   0,   0,   0,   2,   0, 
-      0,   0, 224,   1,   0,   0, 
-      0,   0,   0,   0, 255, 255, 
-    255, 255,   0,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0,   4,   2,   0,   0, 
-     20,   0,   0,   0,   4,   0, 
-      0,   0,   2,   0,   0,   0, 
-     24,   2,   0,   0,   0,   0, 
-      0,   0, 255, 255, 255, 255, 
-      0,   0,   0,   0, 255, 255, 
-    255, 255,   0,   0,   0,   0, 
-     85,  86,  76, 101, 102, 116, 
-     84, 111, 112,   0, 102, 108, 
-    111,  97, 116,  50,   0, 171, 
-    171, 171,   1,   0,   3,   0, 
-      1,   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, 150,   1, 
-      0,   0,  85,  86,  68, 105, 
-    109, 101, 110, 115, 105, 111, 
-    110, 115,   0,  77, 105, 112, 
-     76, 101, 118, 101, 108,   0, 
-    100, 119, 111, 114, 100,   0, 
-      0,   0,  19,   0,   1,   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, 218,   1,   0,   0, 
-     76,  97, 121, 101, 114,  79, 
-    114,  68, 101, 112, 116, 104, 
-      0, 102, 108, 111,  97, 116, 
-      0, 171,   0,   0,   3,   0, 
-      1,   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,  17,   2, 
-      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, 
-      3,   3,   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,  79, 
-     83,  73,  84,  73,  79,  78, 
-      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, 
-      0,   1,   0,   0,  80,   0, 
-      0,   0,  64,   0,   0,   0, 
-    106,   8,   0,   1,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,  90,   0,   0,   3, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  88,  64,   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, 
-    104,   0,   0,   2,   1,   0, 
-      0,   0,  28,   0,   0,   6, 
-     18,   0,  16,   0,   0,   0, 
-      0,   0,  26, 128,  32,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  86,   0,   0,   5, 
-     66,   0,  16,   0,   0,   0, 
-      0,   0,  10,   0,  16,   0, 
-      0,   0,   0,   0,  50,   0, 
-      0,  11,  50,   0,  16,   0, 
-      0,   0,   0,   0, 230, 138, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  70,  16, 
-     16,   0,   0,   0,   0,   0, 
-     70, 128,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     86,   0,   0,   6, 130,   0, 
-     16,   0,   0,   0,   0,   0, 
-     10, 128,  32,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     72,   0,   0, 141,   2,   2, 
-      0, 128,  67,  85,  21,   0, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,  70,   2,  16,   0, 
-      0,   0,   0,   0,  70, 126, 
-     16,   0,   0,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  58,   0,  16,   0, 
-      0,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    148,   0,   0,   0,   6,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,   1,   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,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   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
-//
-//
-// Buffer Definitions: 
-//
-// cbuffer SourceRegionBuffer
-// {
-//
-//   float2 UVLeftTop;                  // Offset:    0 Size:     8
-//   float2 UVDimensions;               // Offset:    8 Size:     8
-//   uint MipLevel;                     // Offset:   16 Size:     4
-//   float LayerOrDepth;                // Offset:   20 Size:     4
-//
-// }
-//
-//
-// Resour

(Patch may be truncated, please check the link at the top of this post.)