The batch vertex shader was the last shadergen + D3DCompile call on
the D3D12 backend - the batch fragment shaders (e07ce04 .. f2620c1
arc) and the non-batch VRAM-ops / display shaders were already
pre-baked. Pre-baking it as DXBC and consuming the blobs on both
backends removes that last call, so the D3D12 backend issues ZERO
D3DCompile calls at runtime and no longer instantiates
GPU_HW_ShaderGen at all. The D3D11 backend drops one of its ten
shadergen calls (the screen/uv quad VS and the copy/display/vram_*
shaders still go through shadergen there - separate follow-ups).
Why only 2 blobs, not the FS-style 12. The runtime shadergen calls
DeclareVertexEntryPoint with msaa / per_sample / disable_color_
perspective, which add centroid / sample / noperspective qualifiers
to the v_col0 / v_tex0 OUTPUTS. In Direct3D the interpolation mode is
fixed by the PIXEL shader INPUT signature, not the vertex shader
output signature, so fxc emits byte-identical VS DXBC regardless of
those qualifiers - verified by hashing all 6 interp x persp
permutations per TEXTURED value (identical). So the only real axis is
the vertex-format split (TEXTURED), giving 2 blobs. This matches the
[textured] 2-slot batch VS array both backends already kept.
RESOLUTION_SCALE / PGXP_DEPTH / UV_LIMITS are cbuffer-routed
(7b575a3 et al), so they don't multiply the matrix either.
Foundation:
- data/shaders/d3d_common/batch_vertex.vs.hlsl - mirror of
GPU_HW_ShaderGen::GenerateBatchVertexShader. Shared 64-byte
BatchUBOData cbuffer (VS reads u_resolution_scale + u_pgxp_depth);
the pos transform + textured tex/texpage/uv_limits passthrough.
The GL/Vulkan-only API_* blocks (POS_EPSILON, depth-range remap,
Y-flip) are omitted - this is the D3D path.
- tools/regen_d3d_common_dxbc.py - TEMPLATE_VARIANTS entry: 1 axis
(TEXTURED) = 2 variants (untextured / textured).
- src/common/d3d_common/embedded_dxbc/batch_vertex_vs_{untextured,
textured}.inc - fxc vs_5_0 /O3 output (1908 / 2556 bytes).
Activation:
- embedded_shaders.{h,cpp} - externs for the 2 blobs + the includes
+ Bytecode PickBatchVertexShader(bool textured) returning the
matching DXBC. The header documents why there is no interp/persp
axis.
- D3D12 (gpu_hw_d3d12.{cpp,h}): GetBatchPipeline wraps
PickBatchVertexShader(textured) into a D3D12_SHADER_BYTECODE
inline (same shape as GetFullscreenQuadVertexShader). Removed: the
synchronous batch VS compile loop in CompilePipelines, the
m_batch_vertex_shader_blobs member + its DestroyPipelines reset,
the m_shadergen member + its setup + its DestroyPipelines reset,
the now-unused shader_cache local alias, and the 2-unit VS
allotment in the progress total. Dropped the
#include "gpu_hw_shadergen.h" from both files - D3D12 no longer
references GPU_HW_ShaderGen (except one doc cross-reference
comment). m_shader_cache stays: it still backs the PSO pipeline-
library cache. Refreshed stale comments (ClearDisplayPipelines
display-regen text, the copy-PSO d3d12/embedded_dxbc path, the
GetBatchPipeline VS-source line).
- D3D11 (gpu_hw_d3d11.cpp): CreateInputLayout consumes
PickBatchVertexShader(true).data/size directly (the input layout
only needs the bytecode's input signature); the
m_batch_vertex_shaders[textured] objects are built via
D3D11::ShaderCompiler::CreateVertexShader from the picked DXBC.
shadergen + m_shader_cache stay alive on D3D11 for the
not-yet-pre-baked screen/uv quad VS and non-batch shaders.
Both backends consume the same .inc blobs - DXBC at vs_5_0 is
honoured identically by D3D11 CreateVertexShader and D3D12 PSO
creation, the same arrangement the batch FS and VRAM-ops shaders
already use.
Test:
- Regenerated the 2 blobs with the regen tool's own compile_one /
emit_inc (fxc via the Microsoft d3dcompiler_47.dll under wine);
confirmed Microsoft-creator DXBC, magic 0x43425844. Verified the
6 interp x persp permutations hash identically per TEXTURED value
(the basis for collapsing to 2 blobs).
- x86_64-w64-mingw32-g++ -fsyntax-only -std=c++17 on
gpu_hw_d3d11.cpp, gpu_hw_d3d12.cpp: exit 0, zero diagnostics.
- embedded_shaders.cpp standalone g++ -c: exit 0 (embed.o 14 MiB).
- regen tool parses (ast); brace balance + symbol/extern names
cross-checked; no stray .dxbc.tmp.
Next (D3DCompile-removal arc):
- D3D11 non-batch wiring: consume the already-pre-baked copy /
display / vram_* blobs (the pickers exist) in place of the
shader_cache.GetPixelShader compiles.
- D3D11 quad VS pre-bake: screen_quad_vs, uv_quad_vs.
- Remove shadergen + ShaderCompiler::CompileShader + the D3DCompile
linkage once D3D11 no longer compiles anything.
- Then: GL MD5 -> xxh3 hash swap (per the audit).