core/d3d12: drop the [dithering] dim from the batch matrices
Commit 2 of the batch matrix variant-shrinking arc. Follow-on to3af8e02(DITHERING-via-cbuffer routing): the FS source is now invariant under the dithering bit, so the two slots at [..., dithering=0, ...] and [..., dithering=1, ...] in the batch PSO and batch FS blob matrices held identical ComPtr contents - a redundant dim that compiled the same DXBC twice and held the same PSO pointer twice. Cleaning up the dim removes 2x of wasted slots, 2x of useless precompile-worker iterations, and one parameter from the three hot-path helpers. Matrices (DimensionalArray template-param order is inner-to-outer in indexing space; the rightmost template arg is the outermost array index): m_batch_pipelines: <2, 2, 5, 9, 4, 2, 7> -> <2, 5, 9, 4, 2, 7> [filter][depth_test][render_mode][texture_mode][transparency_mode][dithering][interlacing] -> [filter][depth_test][render_mode][texture_mode][transparency_mode][interlacing] Same for m_batch_pipelines_fastpath. m_batch_fragment_shader_blobs: <2, 2, 9, 4, 7> -> <2, 9, 4, 7> [filter][render][texture][dither][interlace] -> [filter][render][texture][interlace] Same for m_batch_fragment_shader_blobs_fastpath. Slot-count delta: Batch FS blobs: 1008 -> 504 (-50%) Batch PSO grid: 10080 -> 5040 (-50%) Helper signatures and the parameter through-line: GetBatchFragmentShader: drops `bool dithering` GetBatchPipeline: drops `bool dithering` DrawBatchVertices: stops passing m_batch.dithering through to GetBatchPipeline. m_batch.dithering still lives - it owns the UBO push via m_batch_ubo_data.u_dithering in SetDrawMode (3af8e02) - it's just no longer a PSO key. Precompile loops (both the synchronous CompilePipelines path under shader_precompile_mode = Enabled and the background worker for shader_precompile_mode = Lazy) lose their inner `for (dithering)` loop. The progress counter is recomputed implicitly - each call site walks one fewer dim, so the cell count drops in lockstep with the matrix collapse. Pass-through to shadergen: GetBatchFragmentShader passes a literal `false` to tmp_shadergen.GenerateBatchFragmentShader's `dithering` parameter. The shadergen function still takes the parameter (the four backends share that signature and D3D11 / OpenGL / Vulkan still pass their own dithering values from their own matrix iterations), but as of3af8e02the parameter is a no-op - the FS source is identical regardless of what's passed. Picking `false` consistently keeps the disk shader cache hash stable across the matrix collapse: the cache key is the source string, the source string is invariant under the parameter, every cell hashes to the same key it would have hashed to at dithering=0 before the collapse. Any pre-existing on-disk cache from3af8e02(which produced identical DXBC for dithering=0 / dithering=1 anyway) remains valid; the dithering=1 entries become unreachable garbage that get evicted on the next cache GC pass but are otherwise harmless. D3D11 / OpenGL / Vulkan untouched. They still pass `dithering` to GenerateBatchFragmentShader and key their batch matrices on it. They produce identical DXBC for the two dithering values, so each is wasting matrix slots in the same way D3D12 was before this commit. Equivalent per-backend cleanup commits can follow: same shape, just different matrix template params and helper signatures. Visible behaviour: zero. Every (filter, depth_test, render_mode, texture_mode, transparency_mode, dithering=X, interlacing) call site that previously routed to slot [..., dithering=X, ...] now routes to the single [...] slot. The PSO at that slot was already bit-identical to the removed slot, the FS blob at that slot was already bit-identical to the removed slot, and the runtime PSO binding it produces is unchanged. m_batch.dithering still flips per-batch (PSX GP0(E1).dither_enable register write), SetDrawMode still pushes the new value into the batch UBO, the FS still reads it via u_dithering and branches at the ApplyDithering call sites - just no PSO swap is needed for the flip. Cost matrix delta (D3D12): Cold sync precompile (shader_precompile_mode = Enabled): 1008 FS compiles + 10080 PSO compiles -> 504 FS compiles + 5040 PSO compiles. ~50% faster. Background worker walk (shader_precompile_mode = Lazy): 10080 cells -> 5040 cells. ~50% faster to warm the matrix on second launch. Filter switch mid-session: 144 lazy FS compiles -> 56 lazy FS compiles for the new filter's sub-cube. (Filter is still a matrix dim and flipping it still trips lazy fault-ins for the new sub-cube; that's the next axis to route via cbuffer if we want filter changes to be free as well.) PSX GP0(E1).dither_enable mid-frame flip: ~4 byte UBO write (unchanged from3af8e02- that commit already eliminated the recompile path; this commit just removes the redundant matrix slots). Test: - Build: D3D12 backend compiles, links. - Boot any PSX title: matrix-resize is invisible to the user; the runtime fetches the same PSO content it would have fetched before, just from a smaller indexed slot. - Dither toggle mid-game: visual output unchanged. - Filter switch mid-game: same lazy-warmup behaviour as before for the new filter's sub-cube (the sub-cube is just half the size now). - Shader cache: existing on-disk cache continues to serve hits; new misses populate the smaller matrix. Follow-up arc (next commits): - Route INTERLACING through u_interlacing cbuffer slot (same shape as DITHERING - one #if in the FS body, no register-bit-mid-frame considerations). After that the [interlacing] dim is the next collapse candidate, taking the FS matrix to <2, 9, 4>:252 slots and the PSO matrix to <2, 5, 9, 4, 2>:2520 slots. - Route PGXP_DEPTH for the VS through cbuffer. - Decide on PGXP_DEPTH for the FS (requires always-emit SV_Depth). - Route UV_LIMITS (requires per-vertex buffer layout change). - Pre-bake the resulting reduced FS matrix.
This commit is contained in:
parent
3af8e0247a
commit
f7f9e5352b
2 changed files with 75 additions and 67 deletions
|
|
@ -892,17 +892,13 @@ bool GPU_HW_D3D12::CompilePipelines()
|
|||
if (!IsBatchShaderReachable(static_cast<BatchRenderMode>(render_mode), texture_mode, dual_source))
|
||||
continue;
|
||||
|
||||
for (uint8_t dithering = 0; dithering < 2; dithering++)
|
||||
for (uint8_t interlacing = 0; interlacing < 2; interlacing++)
|
||||
{
|
||||
for (uint8_t interlacing = 0; interlacing < 2; interlacing++)
|
||||
{
|
||||
ComPtr<ID3DBlob> blob = GetBatchFragmentShader(cur_filter, render_mode, texture_mode,
|
||||
static_cast<bool>(dithering),
|
||||
static_cast<bool>(interlacing));
|
||||
if (!blob)
|
||||
return false;
|
||||
progress.Increment();
|
||||
}
|
||||
ComPtr<ID3DBlob> blob = GetBatchFragmentShader(cur_filter, render_mode, texture_mode,
|
||||
static_cast<bool>(interlacing));
|
||||
if (!blob)
|
||||
return false;
|
||||
progress.Increment();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -918,17 +914,14 @@ bool GPU_HW_D3D12::CompilePipelines()
|
|||
if (!IsBatchShaderReachable(static_cast<BatchRenderMode>(render_mode), texture_mode, dual_source))
|
||||
continue;
|
||||
|
||||
for (uint8_t dithering = 0; dithering < 2; dithering++)
|
||||
for (uint8_t interlacing = 0; interlacing < 2; interlacing++)
|
||||
{
|
||||
for (uint8_t interlacing = 0; interlacing < 2; interlacing++)
|
||||
{
|
||||
ComPtr<ID3D12PipelineState> pso =
|
||||
GetBatchPipeline(cur_filter, depth_test, render_mode, texture_mode, transparency_mode,
|
||||
static_cast<bool>(dithering), static_cast<bool>(interlacing));
|
||||
if (!pso)
|
||||
return false;
|
||||
progress.Increment();
|
||||
}
|
||||
ComPtr<ID3D12PipelineState> pso =
|
||||
GetBatchPipeline(cur_filter, depth_test, render_mode, texture_mode, transparency_mode,
|
||||
static_cast<bool>(interlacing));
|
||||
if (!pso)
|
||||
return false;
|
||||
progress.Increment();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1063,12 +1056,12 @@ bool GPU_HW_D3D12::CompilePipelines()
|
|||
// Kick off the background batch / PSO fill so gameplay can start
|
||||
// immediately. The worker walks the full PSO matrix in
|
||||
// (depth_test, render_mode, transparency_mode, texture_mode,
|
||||
// dithering, interlacing) order, calling the same
|
||||
// GetBatchPipeline the draw path uses; the main thread can race
|
||||
// ahead and pre-fill any slot it actually needs at draw time, and
|
||||
// the worker's recheck-under-lock pattern just observes the
|
||||
// filled slot and moves on. DestroyPipelines signals
|
||||
// m_shader_compile_thread_quit and joins.
|
||||
// interlacing) order, calling the same GetBatchPipeline the draw
|
||||
// path uses; the main thread can race ahead and pre-fill any slot
|
||||
// it actually needs at draw time, and the worker's
|
||||
// recheck-under-lock pattern just observes the filled slot and
|
||||
// moves on. DestroyPipelines signals m_shader_compile_thread_quit
|
||||
// and joins.
|
||||
m_shader_compile_thread_quit.store(false, std::memory_order_relaxed);
|
||||
m_shader_compile_thread = std::thread(&GPU_HW_D3D12::ShaderCompileThreadEntryPoint, this);
|
||||
}
|
||||
|
|
@ -1101,7 +1094,7 @@ void GPU_HW_D3D12::ShaderCompileThreadEntryPoint()
|
|||
// there for why. The worker only walks the batch matrix.
|
||||
//
|
||||
// Walks the PSO matrix in (depth_test, render_mode,
|
||||
// transparency_mode, texture_mode, dithering, interlacing) order
|
||||
// transparency_mode, texture_mode, interlacing) order
|
||||
// - the same order CompilePipelines uses for the Enabled precompile
|
||||
// loop - and calls GetBatchPipeline on each cell. GetBatchPipeline
|
||||
// internally calls GetBatchFragmentShader for the bound shader, so
|
||||
|
|
@ -1138,16 +1131,13 @@ void GPU_HW_D3D12::ShaderCompileThreadEntryPoint()
|
|||
if (!IsBatchShaderReachable(static_cast<BatchRenderMode>(render_mode), texture_mode, dual_source))
|
||||
continue;
|
||||
|
||||
for (uint8_t dithering = 0; dithering < 2; dithering++)
|
||||
for (uint8_t interlacing = 0; interlacing < 2; interlacing++)
|
||||
{
|
||||
for (uint8_t interlacing = 0; interlacing < 2; interlacing++)
|
||||
{
|
||||
if (m_shader_compile_thread_quit.load(std::memory_order_relaxed))
|
||||
return;
|
||||
if (m_shader_compile_thread_quit.load(std::memory_order_relaxed))
|
||||
return;
|
||||
|
||||
GetBatchPipeline(cur_filter, depth_test, render_mode, texture_mode, transparency_mode,
|
||||
static_cast<bool>(dithering), static_cast<bool>(interlacing));
|
||||
}
|
||||
GetBatchPipeline(cur_filter, depth_test, render_mode, texture_mode, transparency_mode,
|
||||
static_cast<bool>(interlacing));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1155,7 +1145,7 @@ void GPU_HW_D3D12::ShaderCompileThreadEntryPoint()
|
|||
}
|
||||
}
|
||||
|
||||
GPU_HW_D3D12::ComPtr<ID3DBlob> GPU_HW_D3D12::GetBatchFragmentShader(GPUTextureFilter filter, uint8_t render_mode, uint8_t texture_mode, bool dithering,
|
||||
GPU_HW_D3D12::ComPtr<ID3DBlob> GPU_HW_D3D12::GetBatchFragmentShader(GPUTextureFilter filter, uint8_t render_mode, uint8_t texture_mode,
|
||||
bool interlacing)
|
||||
{
|
||||
// Reserved_*Direct16Bit shader-source dedup is applied at the
|
||||
|
|
@ -1175,7 +1165,7 @@ GPU_HW_D3D12::ComPtr<ID3DBlob> GPU_HW_D3D12::GetBatchFragmentShader(GPUTextureFi
|
|||
// a slot concurrently without serialising against each other or
|
||||
// each other's slow-path compiles.
|
||||
std::atomic<ID3DBlob*>& fast_slot =
|
||||
m_batch_fragment_shader_blobs_fastpath[filter_idx][render_mode][texture_mode][static_cast<uint8_t>(dithering)][static_cast<uint8_t>(interlacing)];
|
||||
m_batch_fragment_shader_blobs_fastpath[filter_idx][render_mode][texture_mode][static_cast<uint8_t>(interlacing)];
|
||||
ID3DBlob* existing = fast_slot.load(std::memory_order_acquire);
|
||||
if (existing)
|
||||
{
|
||||
|
|
@ -1205,14 +1195,19 @@ GPU_HW_D3D12::ComPtr<ID3DBlob> GPU_HW_D3D12::GetBatchFragmentShader(GPUTextureFi
|
|||
m_host_display->GetRenderAPI(), m_resolution_scale, m_multisamples, m_per_sample_shading, m_true_color,
|
||||
m_scaled_dithering, filter, m_using_uv_limits, m_pgxp_depth_buffer, m_disable_color_perspective,
|
||||
m_supports_dual_source_blend);
|
||||
// dithering passes false to GenerateBatchFragmentShader for source
|
||||
// stability across backends. The shadergen's `dithering` parameter
|
||||
// is a no-op as of 3af8e02 (the FS body now reads u_dithering from
|
||||
// the batch UBO); passing any value yields identical DXBC. Picking
|
||||
// false consistently keeps the disk shader cache hash stable.
|
||||
const std::string fs = tmp_shadergen.GenerateBatchFragmentShader(
|
||||
static_cast<BatchRenderMode>(render_mode), static_cast<GPUTextureMode>(lookup_mode), dithering, interlacing);
|
||||
static_cast<BatchRenderMode>(render_mode), static_cast<GPUTextureMode>(lookup_mode), false, interlacing);
|
||||
ComPtr<ID3DBlob> fresh_blob = m_shader_cache.GetPixelShader(fs);
|
||||
if (!fresh_blob)
|
||||
{
|
||||
Log_ErrorPrintf("Lazy batch fragment shader compile failed for (f=%u, rm=%u, tm=%u, d=%u, i=%u)",
|
||||
Log_ErrorPrintf("Lazy batch fragment shader compile failed for (f=%u, rm=%u, tm=%u, i=%u)",
|
||||
static_cast<uint8_t>(filter), render_mode, texture_mode,
|
||||
static_cast<uint8_t>(dithering), static_cast<uint8_t>(interlacing));
|
||||
static_cast<uint8_t>(interlacing));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
@ -1232,19 +1227,19 @@ GPU_HW_D3D12::ComPtr<ID3DBlob> GPU_HW_D3D12::GetBatchFragmentShader(GPUTextureFi
|
|||
}
|
||||
|
||||
ComPtr<ID3DBlob>& canonical_slot =
|
||||
m_batch_fragment_shader_blobs[filter_idx][render_mode][lookup_mode][static_cast<uint8_t>(dithering)][static_cast<uint8_t>(interlacing)];
|
||||
m_batch_fragment_shader_blobs[filter_idx][render_mode][lookup_mode][static_cast<uint8_t>(interlacing)];
|
||||
|
||||
if (!canonical_slot)
|
||||
{
|
||||
canonical_slot = fresh_blob;
|
||||
m_batch_fragment_shader_blobs_fastpath[filter_idx][render_mode][lookup_mode][static_cast<uint8_t>(dithering)][static_cast<uint8_t>(interlacing)]
|
||||
m_batch_fragment_shader_blobs_fastpath[filter_idx][render_mode][lookup_mode][static_cast<uint8_t>(interlacing)]
|
||||
.store(canonical_slot.Get(), std::memory_order_release);
|
||||
}
|
||||
|
||||
if (lookup_mode != texture_mode)
|
||||
{
|
||||
ComPtr<ID3DBlob>& dup_slot =
|
||||
m_batch_fragment_shader_blobs[filter_idx][render_mode][texture_mode][static_cast<uint8_t>(dithering)][static_cast<uint8_t>(interlacing)];
|
||||
m_batch_fragment_shader_blobs[filter_idx][render_mode][texture_mode][static_cast<uint8_t>(interlacing)];
|
||||
if (!dup_slot)
|
||||
dup_slot = canonical_slot;
|
||||
}
|
||||
|
|
@ -1256,7 +1251,7 @@ GPU_HW_D3D12::ComPtr<ID3DBlob> GPU_HW_D3D12::GetBatchFragmentShader(GPUTextureFi
|
|||
|
||||
GPU_HW_D3D12::ComPtr<ID3D12PipelineState> GPU_HW_D3D12::GetBatchPipeline(GPUTextureFilter filter, uint8_t depth_test, uint8_t render_mode,
|
||||
uint8_t texture_mode, uint8_t transparency_mode,
|
||||
bool dithering, bool interlacing)
|
||||
bool interlacing)
|
||||
{
|
||||
// Reserved_*Direct16Bit PSO dedup. Because the only texture_mode-
|
||||
// dependent input to the PSO is the bound fragment shader (which
|
||||
|
|
@ -1275,7 +1270,7 @@ GPU_HW_D3D12::ComPtr<ID3D12PipelineState> GPU_HW_D3D12::GetBatchPipeline(GPUText
|
|||
// an earlier main-thread fault-in). No mutex, no contention
|
||||
// against the worker.
|
||||
std::atomic<ID3D12PipelineState*>& fast_slot =
|
||||
m_batch_pipelines_fastpath[filter_idx][depth_test][render_mode][texture_mode][transparency_mode][static_cast<uint8_t>(dithering)]
|
||||
m_batch_pipelines_fastpath[filter_idx][depth_test][render_mode][texture_mode][transparency_mode]
|
||||
[static_cast<uint8_t>(interlacing)];
|
||||
ID3D12PipelineState* existing = fast_slot.load(std::memory_order_acquire);
|
||||
if (existing)
|
||||
|
|
@ -1295,7 +1290,7 @@ GPU_HW_D3D12::ComPtr<ID3D12PipelineState> GPU_HW_D3D12::GetBatchPipeline(GPUText
|
|||
// slot B. Two threads racing to compile the SAME slot is
|
||||
// wasteful but harmless - both produce equivalent PSOs and the
|
||||
// double-check below picks the winner.
|
||||
ComPtr<ID3DBlob> fs_blob = GetBatchFragmentShader(filter, render_mode, lookup_mode, dithering, interlacing);
|
||||
ComPtr<ID3DBlob> fs_blob = GetBatchFragmentShader(filter, render_mode, lookup_mode, interlacing);
|
||||
if (!fs_blob)
|
||||
return {};
|
||||
|
||||
|
|
@ -1356,9 +1351,9 @@ GPU_HW_D3D12::ComPtr<ID3D12PipelineState> GPU_HW_D3D12::GetBatchPipeline(GPUText
|
|||
ComPtr<ID3D12PipelineState> fresh_pso = gpbuilder.Create(g_d3d12_context->GetDevice(), m_shader_cache);
|
||||
if (!fresh_pso)
|
||||
{
|
||||
Log_ErrorPrintf("Lazy batch PSO compile failed for (f=%u, dt=%u, rm=%u, tm=%u, tr=%u, d=%u, i=%u)",
|
||||
Log_ErrorPrintf("Lazy batch PSO compile failed for (f=%u, dt=%u, rm=%u, tm=%u, tr=%u, i=%u)",
|
||||
static_cast<uint8_t>(filter), depth_test, render_mode, texture_mode, transparency_mode,
|
||||
static_cast<uint8_t>(dithering), static_cast<uint8_t>(interlacing));
|
||||
static_cast<uint8_t>(interlacing));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
@ -1379,18 +1374,18 @@ GPU_HW_D3D12::ComPtr<ID3D12PipelineState> GPU_HW_D3D12::GetBatchPipeline(GPUText
|
|||
}
|
||||
|
||||
ComPtr<ID3D12PipelineState>& canonical_slot =
|
||||
m_batch_pipelines[filter_idx][depth_test][render_mode][lookup_mode][transparency_mode][static_cast<uint8_t>(dithering)]
|
||||
m_batch_pipelines[filter_idx][depth_test][render_mode][lookup_mode][transparency_mode]
|
||||
[static_cast<uint8_t>(interlacing)];
|
||||
|
||||
if (!canonical_slot)
|
||||
{
|
||||
canonical_slot = fresh_pso;
|
||||
D3D12::SetObjectNameFormatted(canonical_slot.Get(), "Batch Pipeline f%u,%u,%u,%u,%u,%u,%u", filter_idx, depth_test, render_mode,
|
||||
lookup_mode, transparency_mode, static_cast<uint8_t>(dithering), static_cast<uint8_t>(interlacing));
|
||||
D3D12::SetObjectNameFormatted(canonical_slot.Get(), "Batch Pipeline f%u,%u,%u,%u,%u,%u", filter_idx, depth_test, render_mode,
|
||||
lookup_mode, transparency_mode, static_cast<uint8_t>(interlacing));
|
||||
|
||||
// Publish the canonical raw pointer for future fast-path
|
||||
// readers of the canonical slot.
|
||||
m_batch_pipelines_fastpath[filter_idx][depth_test][render_mode][lookup_mode][transparency_mode][static_cast<uint8_t>(dithering)]
|
||||
m_batch_pipelines_fastpath[filter_idx][depth_test][render_mode][lookup_mode][transparency_mode]
|
||||
[static_cast<uint8_t>(interlacing)]
|
||||
.store(canonical_slot.Get(), std::memory_order_release);
|
||||
}
|
||||
|
|
@ -1398,7 +1393,7 @@ GPU_HW_D3D12::ComPtr<ID3D12PipelineState> GPU_HW_D3D12::GetBatchPipeline(GPUText
|
|||
if (lookup_mode != texture_mode)
|
||||
{
|
||||
ComPtr<ID3D12PipelineState>& dup_slot =
|
||||
m_batch_pipelines[filter_idx][depth_test][render_mode][texture_mode][transparency_mode][static_cast<uint8_t>(dithering)]
|
||||
m_batch_pipelines[filter_idx][depth_test][render_mode][texture_mode][transparency_mode]
|
||||
[static_cast<uint8_t>(interlacing)];
|
||||
if (!dup_slot)
|
||||
dup_slot = canonical_slot;
|
||||
|
|
@ -2268,16 +2263,19 @@ void GPU_HW_D3D12::DrawBatchVertices(BatchRenderMode render_mode, uint32_t base_
|
|||
// The mutex serialises both the PSO matrix and the shader-cache
|
||||
// mutation; cost is ~20 ns uncontended per modern std::mutex impl.
|
||||
//
|
||||
// [filter][depth_test][render_mode][texture_mode][transparency_mode][dithering][interlacing]
|
||||
// [filter][depth_test][render_mode][texture_mode][transparency_mode][interlacing]
|
||||
// m_texture_filtering selects the active filter's sub-cube. Filter
|
||||
// is the outermost dim so a filter toggle in UpdateSettings can
|
||||
// skip DestroyPipelines - the other filters' sub-cubes remain
|
||||
// valid and reachable, switching back to a previously-visited
|
||||
// filter is an atomic load on an already-filled slot.
|
||||
// The dithering bit (m_batch.dithering) reaches the PSO through
|
||||
// u_dithering on the batch UBO; the [dithering] dim was dropped
|
||||
// in the matrix-collapse commit after the cbuffer routing landed.
|
||||
const uint8_t depth_test = static_cast<uint8_t>(m_batch.check_mask_before_draw || m_batch.use_depth_buffer);
|
||||
ComPtr<ID3D12PipelineState> pipeline =
|
||||
GetBatchPipeline(m_texture_filtering, depth_test, static_cast<uint8_t>(render_mode), static_cast<uint8_t>(m_batch.texture_mode),
|
||||
static_cast<uint8_t>(m_batch.transparency_mode), m_batch.dithering, m_batch.interlacing);
|
||||
static_cast<uint8_t>(m_batch.transparency_mode), m_batch.interlacing);
|
||||
|
||||
cmdlist->SetPipelineState(pipeline.Get());
|
||||
cmdlist->DrawInstanced(num_vertices, 1, base_vertex, 0);
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ private:
|
|||
//
|
||||
// GetBatchFragmentShader returns a non-null ComPtr to the
|
||||
// ID3DBlob holding the compiled HLSL bytecode for the requested
|
||||
// (filter, render_mode, texture_mode, dithering, interlacing)
|
||||
// (filter, render_mode, texture_mode, interlacing)
|
||||
// tuple, generating the shader source via a temporary shadergen
|
||||
// bound to that filter and feeding it through
|
||||
// m_shader_cache.GetPixelShader on a cache miss. The temporary
|
||||
|
|
@ -153,9 +153,9 @@ private:
|
|||
// Both helpers serialise their cache + array mutations through
|
||||
// m_batch_shader_mutex. The fast path is one uncontended lock
|
||||
// per DrawBatchVertices call.
|
||||
ComPtr<ID3DBlob> GetBatchFragmentShader(GPUTextureFilter filter, uint8_t render_mode, uint8_t texture_mode, bool dithering, bool interlacing);
|
||||
ComPtr<ID3DBlob> GetBatchFragmentShader(GPUTextureFilter filter, uint8_t render_mode, uint8_t texture_mode, bool interlacing);
|
||||
ComPtr<ID3D12PipelineState> GetBatchPipeline(GPUTextureFilter filter, uint8_t depth_test, uint8_t render_mode, uint8_t texture_mode, uint8_t transparency_mode,
|
||||
bool dithering, bool interlacing);
|
||||
bool interlacing);
|
||||
|
||||
// Lazy non-batch PSO compile path.
|
||||
//
|
||||
|
|
@ -195,7 +195,7 @@ private:
|
|||
|
||||
// Background-thread worker for 'Lazy' precompile mode: walks the
|
||||
// full PSO matrix in (depth_test, render_mode, transparency_mode,
|
||||
// texture_mode, dithering, interlacing) order and calls
|
||||
// texture_mode, interlacing) order and calls
|
||||
// GetBatchPipeline on each cell. As with D3D11, the main thread
|
||||
// can race ahead and fill any slot it needs at draw time; the
|
||||
// worker just observes the filled slot under the lock and moves
|
||||
|
|
@ -252,9 +252,16 @@ private:
|
|||
//
|
||||
// GPUTextureFilter::Count = 7 -> the outermost dim size.
|
||||
//
|
||||
// [filter][depth_test][render_mode][texture_mode][transparency_mode][dithering][interlacing]
|
||||
DimensionalArray<ComPtr<ID3D12PipelineState>, 2, 2, 5, 9, 4, 2, 7> m_batch_pipelines;
|
||||
DimensionalArray<std::atomic<ID3D12PipelineState*>, 2, 2, 5, 9, 4, 2, 7> m_batch_pipelines_fastpath{};
|
||||
// [filter][depth_test][render_mode][texture_mode][transparency_mode][interlacing]
|
||||
// The [dithering] dim was dropped at the matrix-collapse commit
|
||||
// following the DITHERING-via-cbuffer routing (3af8e02): the FS
|
||||
// source no longer depends on the dithering bit, so the two
|
||||
// dithering slots compiled to identical DXBC and the matrix only
|
||||
// held a redundant ComPtr in each pair. m_batch.dithering still
|
||||
// flips per-batch but it reaches the FS through u_dithering on the
|
||||
// batch UBO; the PSO lookup is dithering-agnostic.
|
||||
DimensionalArray<ComPtr<ID3D12PipelineState>, 2, 5, 9, 4, 2, 7> m_batch_pipelines;
|
||||
DimensionalArray<std::atomic<ID3D12PipelineState*>, 2, 5, 9, 4, 2, 7> m_batch_pipelines_fastpath{};
|
||||
|
||||
// m_batch_shader_mutex serialises the SLOW path of the lazy
|
||||
// helpers (cache mutation, ComPtr-array write, atomic-raw-pointer
|
||||
|
|
@ -280,16 +287,19 @@ private:
|
|||
// background compile they must outlive CompilePipelines so the
|
||||
// PSO-builder helper can fetch the bound bytecode when faulting
|
||||
// in a PSO. The fragment-shader matrix is keyed on
|
||||
// (render, texture, dithering, interlacing) only - the
|
||||
// depth/transparency dimensions of m_batch_pipelines don't enter
|
||||
// the fragment shader source.
|
||||
// (render, texture, interlacing) only - the depth/transparency
|
||||
// dimensions of m_batch_pipelines don't enter the fragment shader
|
||||
// source, and the dithering dim was collapsed at the same time as
|
||||
// the PSO matrix above (DITHERING is now a u_dithering cbuffer
|
||||
// runtime branch in the FS body; the source is invariant under
|
||||
// the dithering bit).
|
||||
//
|
||||
// Same fast/slow-path split as m_batch_pipelines above:
|
||||
// m_batch_fragment_shader_blobs owns the ComPtr; the parallel
|
||||
// _fastpath array is the lock-free view.
|
||||
DimensionalArray<ComPtr<ID3DBlob>, 2> m_batch_vertex_shader_blobs; // [textured]
|
||||
DimensionalArray<ComPtr<ID3DBlob>, 2, 2, 9, 4, 7> m_batch_fragment_shader_blobs; // [filter][render][texture][dither][interlace]
|
||||
DimensionalArray<std::atomic<ID3DBlob*>, 2, 2, 9, 4, 7> m_batch_fragment_shader_blobs_fastpath{};
|
||||
DimensionalArray<ComPtr<ID3DBlob>, 2, 9, 4, 7> m_batch_fragment_shader_blobs; // [filter][render][texture][interlace]
|
||||
DimensionalArray<std::atomic<ID3DBlob*>, 2, 9, 4, 7> m_batch_fragment_shader_blobs_fastpath{};
|
||||
|
||||
// [wrapped][interlaced]
|
||||
DimensionalArray<ComPtr<ID3D12PipelineState>, 2, 2> m_vram_fill_pipelines;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue