Repository navigation
A mesh shader gets the vertex outputs its pixel shader reads and its SPH does not enable (Ocarina of Time's foliage mesh pipelines failed to link) - #1628
Conversation
…SPH does not enable, as (0, 0, 0, 1), like a vertex shader's vs_pad: Ocarina of Time's two Foliage.Product mesh pipelines failed to link on locn5 and their draws were skipped in Hyrule Field dmsh_build.py pairs each mesh shader with the pixel shader of its BNSH variation from shader_map.tsv's source column (mesh_pairs, the pair tables hold vertex / pixel pairs only) and ms_pad takes the locations the pixel MSL reads that the SPH does not enable; dmsh_meshstage.to_stage declares and writes them. The two pairs rebuilt link as Metal mesh pipelines where the app's libraries fail. test_dmsh_meshstage checks the pad; reference entry, game note, symptom index.
|
Thanks. We carry the same padding on our downstream stack: all 23 triples Metal refused in Ocarina of Time link on the device with it. One case you may meet: one mesh shader was over Metal's 32 KB mesh limit with the padding, so there the pixel shader's missing inputs become constants instead. |
|
Thanks, this is the right fix. The same change landed on main in 5e344a8 (chain 5616dbb62ec3, from #1590) in nearly the same form: The one left, 626fbf48 + c5eb985e at 35,840 bytes, is the 32 KB case @lunks describes; I'm working on it next. |
What
Two of Ocarina of Time's
Foliage.Producttask / mesh pipelines never build:The mesh shaders' SPH enables the position alone, so
dmsh_meshstage.to_stagedeclareddm_vertex_twith the position only; their pixel shaders readlocn5(x, y and z). On the hardware an attribute the mesh shader never wrote reads a default; Metal refuses to link the pipeline, the host reports it once and skips every draw of the pair: foliage missing from Hyrule Field.This is the mesh-shader form of pixel shader inputs the vertex shader does not write:
vs_padgives a vertex shader the outputs its pixel shaders read as (0, 0, 0, 1), but the pair tables hold vertex / pixel pairs only, so a mesh shader was never padded.Fix (chain
b488b8d163b2, on main 581f9c1)dmsh_build.py:mesh_pairspairs each mesh shader with the pixel shader of its BNSH variation fromshader_map.tsv's source column (the same#varNthe split pairs a vertex shader by), and adds the pairs toPAIRS, so a mesh shader is built after its pixel shader and keyed with it.ms_padtakes the locations the pixel MSL reads and the SPH does not enable.dmsh_meshstage.py:to_stagewrites those locations (i['pad']) asfloat4(0, 0, 0, 1)vertex outputs; the reflection'svs_padnames them.dm/gfx/nvn/dmsh_chain.hregenerated; reference entry, game note and symptom index.Verified
The four shaders rebuilt with the change into a scratch cache (
dmsh_build.py <pkg> <out> <4 keys>); the mesh sources now declarefloat4 a5 [[user(locn5)]]and set it inmain0andmain0_z. A Metal mesh pipeline built from each pair's metallibs (newRenderPipelineStateWithMeshDescriptor, RGBA8 target, Depth32Float):Fragment input(s) user(locn5) … not written by mesh shaderThe game's full rebuild with the new chain and an eye check in Hyrule Field are pending (about 75 minutes of shaders and archive on this Mac).
Tests
test_dmsh_meshstage.py(28, with the newtest_padded_outputs),test_nsp_chain.py(17),test_docs.py: pass.test_dmsh_pairs.py: 2 errors, the same onmainsince 9c2fb0c (vs_padnow callsoutput, which the test'sbuilder()does not exec); not touched here.regress.py check --gamescannot run on this Mac (one local game).