mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 00:53:02 -05:00
The geometry path's merged ES/GS programs (VGT_SHADER_STAGES_EN.GS_EN) were compiled as mesh-stage programs whose input metadata was never filled in, so every such draw failed with "mesh shader translation configuration is not supported". Recompiler: - BuildShaderStageInputInfo takes the draw's MeshConfiguration; the mesh input helpers (primitive size, step and counts) are implemented. - The prologue emulates one NGG subgroup per workgroup: s2 GS_TG_INFO, s3 the merged wave info per wave, the GS vertex offsets (ES thread index times VGT_ESGS_RING_ITEMSIZE, odd strip triangles swapped), the primitive id, and the ES vertex and instance ids. An indexed draw's vertex id is read from the index buffer through a raw V# the driver puts in hidden user words 4..7. - s_sendmsg GS_ALLOC_REQ becomes MeshAllocate. The epilogue zeroes the allocation first, clamps it to the output limits, culls primitives no thread exported and decodes the 9-bit vertex indices. - The draw parameters live in the last six push dwords. A BDA fault in a mesh program no longer stops the invocation (as for other programs with barriers, the fault is recorded and the read returns zero), so every invocation reaches the subgroup barriers and the epilogue. - The cache keys cover the mesh configuration; requests serialize its new esgsItemSize field (version 4). Driver: - DecodeShaderStages reads VGT_ESGS_RING_ITEMSIZE (now in the draw key) and sizes the subgroup for its ES vertices, GS primitives and outputs. - Stages compile below the mesh draw parameters, which every mesh draw pushes; the mesh stage always takes part in the push range. - The index-buffer V# is set per draw (per record on the CPU-resolved indirect path); the index-buffer alias check spares read-only elements. - The workgroup and LocalSize checks count two guest lanes per invocation on 32-wide subgroups; mesh draws may carry a first vertex or instance. agc_driver_mesh_tests (EXCLUDE_FROM_ALL, needs VK_EXT_mesh_shader) recompiles a hand-assembled merged ES/GS program in the PS5 compiler's layout and draws indexed and non-indexed triangle lists in one- and two-wave subgroups and a triangle strip across odd-starting subgroups, reading the pixels back. agc_shader_replay prints a request's draw and mesh configuration.
41 lines
2.2 KiB
CMake
41 lines
2.2 KiB
CMake
set(agcColorTransferSource ${CMAKE_CURRENT_SOURCE_DIR}/Graphics/shaders/ColorTransfer.comp)
|
|
set(agcColorTransferSpv ${agcTextureDetileGeneratedDir}/ColorTransfer.spv)
|
|
set(agcColorTransferHeader ${agcTextureDetileGeneratedDir}/ColorTransfer_spv.h)
|
|
add_custom_command(
|
|
OUTPUT "${agcColorTransferHeader}"
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${agcTextureDetileGeneratedDir}"
|
|
COMMAND "$<TARGET_FILE:glslang-standalone>" -V --target-env vulkan1.1 -o "${agcColorTransferSpv}" "${agcColorTransferSource}"
|
|
COMMAND ${CMAKE_COMMAND} -DINPUT=${agcColorTransferSpv} -DOUTPUT=${agcColorTransferHeader} -DSYMBOL=COLOR_TRANSFER_SPV -P "${CMAKE_CURRENT_SOURCE_DIR}/embed_spirv.cmake"
|
|
DEPENDS "${agcColorTransferSource}" glslang-standalone
|
|
VERBATIM
|
|
)
|
|
|
|
foreach(agcTarget IN ITEMS libSceAgcDriver agc_driver_visual_test agc_driver_graphics_tests agc_driver_bda_device_tests agc_driver_mesh_tests)
|
|
if(TARGET ${agcTarget})
|
|
target_sources(${agcTarget} PRIVATE Graphics/src/BufferPool.cpp)
|
|
endif()
|
|
endforeach()
|
|
|
|
foreach(agcTarget IN ITEMS libSceAgcDriver agc_driver_visual_test agc_driver_graphics_tests agc_driver_mesh_tests)
|
|
if(TARGET ${agcTarget})
|
|
target_sources(${agcTarget} PRIVATE Graphics/src/TextureDetilerDescriptors.cpp Graphics/src/TextureCache.cpp)
|
|
endif()
|
|
endforeach()
|
|
|
|
foreach(agcTarget IN ITEMS libSceAgcDriver agc_driver_visual_test agc_driver_graphics_tests agc_driver_bda_device_tests agc_driver_mesh_tests)
|
|
if(TARGET ${agcTarget})
|
|
target_sources(${agcTarget} PRIVATE Graphics/src/GpuColorTransfer.cpp ${agcColorTransferHeader})
|
|
endif()
|
|
endforeach()
|
|
|
|
target_sources(agc_driver_bda_device_tests PRIVATE tests/ColorTransferTests.cpp Graphics/src/ColorTargetLayout.cpp Execution/src/GuestMemory.cpp)
|
|
target_include_directories(agc_driver_bda_device_tests PRIVATE ${agcTextureDetileGeneratedRoot})
|
|
|
|
if(TARGET agc_driver_visual_test)
|
|
target_sources(agc_driver_visual_test PRIVATE Execution/src/DisplayBuffer.cpp)
|
|
endif()
|
|
|
|
# Upstream's GPU-resident draw path (RenderCache, DrawQueue, RenderTexture, PresentationImage,
|
|
# GraphicsPipelineCache) targets the single-target Pipeline/GpuColorTransfer API; the multi-target
|
|
# draw path in Draw.cpp does not use it yet, so those sources stay out of the build.
|