mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-31 23:19:44 +08:00
fix(agc): merge Prospero attrib-table formats onto IR vertex inputs (#556)
IR-discovered BufferLoadFormat often keeps a stale float sharp format; patch DataFormat/offset from the AGC attrib table (semantic index), allow offen fetches, and map quirks 113/121 through NarrowVk for host vertex input. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6488,6 +6488,32 @@ public static partial class AgcExports
|
||||
TraceAstroTitlePixelGlobalProbe(pixelEvaluation);
|
||||
}
|
||||
|
||||
// Patch BufferFormat from the attrib table onto the V# before host
|
||||
// vertex input. IR discovery often keeps a stale float format from the
|
||||
// unpatched sharp — that turns UI glyphs into gradient triangles.
|
||||
// Match by stride+offset (not bare base address) so interleaved streams
|
||||
// keep loading-video bindings intact.
|
||||
if (exportEvaluation.VertexInputs is { Count: > 0 } discoveredInputs &&
|
||||
AgcVertexMetadata.TryGetVertexTableRegisters(
|
||||
ctx,
|
||||
exportShaderAddress,
|
||||
exportShaderHeader,
|
||||
out var vertexTables))
|
||||
{
|
||||
var merged = AgcVertexMetadata.MergeVertexInputsFromMetadata(
|
||||
ctx,
|
||||
exportEvaluation.ScalarRegisters,
|
||||
vertexTables,
|
||||
discoveredInputs);
|
||||
if (!ReferenceEquals(merged, discoveredInputs))
|
||||
{
|
||||
TraceAgcShader(
|
||||
$"agc.vertex_metadata_format es=0x{exportShaderAddress:X16} " +
|
||||
$"count={merged.Count}");
|
||||
exportEvaluation = exportEvaluation with { VertexInputs = merged };
|
||||
}
|
||||
}
|
||||
|
||||
// Every bound color target the shader exports to. Deferred renderers
|
||||
// draw a multi-render-target G-buffer (up to eight slots) in one pass.
|
||||
// Fall back to slot 0 if we cannot match any export to a bound target.
|
||||
@@ -7269,6 +7295,7 @@ public static partial class AgcExports
|
||||
Mix(input.NumberFormat);
|
||||
Mix(input.Stride);
|
||||
Mix(input.OffsetBytes);
|
||||
Mix(input.PerInstance ? 1u : 0u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8277,7 +8304,8 @@ public static partial class AgcExports
|
||||
binding.OffsetBytes,
|
||||
binding.Data,
|
||||
binding.DataLength,
|
||||
binding.DataPooled);
|
||||
binding.DataPooled,
|
||||
binding.PerInstance);
|
||||
}
|
||||
|
||||
return buffers;
|
||||
|
||||
Reference in New Issue
Block a user