From 1c71428f828284b9e87c461b1a698ff0ef73acef Mon Sep 17 00:00:00 2001 From: don Date: Fri, 9 Oct 2026 14:12:24 +0200 Subject: [PATCH] fix(agc): restore the standalone visual demo --- core/libs/prx/libSceAgcDriver/CMakeLists.txt | 38 +++---------------- .../libs/prx/libSceAgcDriver/tests/Visual.cpp | 8 +++- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/CMakeLists.txt b/core/libs/prx/libSceAgcDriver/CMakeLists.txt index 1d8e5eacf..5990533f9 100644 --- a/core/libs/prx/libSceAgcDriver/CMakeLists.txt +++ b/core/libs/prx/libSceAgcDriver/CMakeLists.txt @@ -737,37 +737,7 @@ if(AGC_BUILD_VISUAL_TEST) add_test_executable(agc_driver_visual_test EXCLUDE_FROM_ALL tests/Visual.cpp - Execution/src/VulkanDevice.cpp - Execution/src/DisplayFormat.cpp - Execution/src/AspectFit.cpp - Execution/src/PresentationScaler.cpp - Execution/src/GuestMemory.cpp - Execution/src/BdaFeatures.cpp - Execution/src/SubgroupClock.cpp - Execution/src/ShaderDeviceProfile.cpp - Graphics/src/Draw.cpp - Graphics/src/DepthSurface.cpp - Graphics/src/ColorTargetLayout.cpp - Graphics/src/ColorTargetTransfer.cpp - Graphics/src/Pipeline.cpp - Graphics/src/PipelineCache.cpp - Graphics/src/Resources.cpp - Graphics/src/ShaderResources.cpp - Graphics/src/ShaderAddressResources.cpp - Graphics/src/GuestBufferMemory.cpp - Graphics/src/BdaResources.cpp - Graphics/src/BufferAddress.cpp - Graphics/src/ShaderValidation.cpp - Graphics/src/GuestTextureResource.cpp - Graphics/src/GuestSamplerResource.cpp - Graphics/src/TextureFormat.cpp - Graphics/src/DccMetadata.cpp - Graphics/src/TextureTiling.cpp - Graphics/src/TextureDetiler.cpp - Graphics/src/Texture.cpp - Graphics/src/UnitShadow.cpp - Graphics/src/Sampler.cpp - ${agcTextureDetileShaderHeader} + ${agcDriverSources} ${visualShaders} ) @@ -783,15 +753,17 @@ if(AGC_BUILD_VISUAL_TEST) ) target_link_libraries(agc_driver_visual_test PRIVATE + shader_recompiler_agc_driver SDL2-static libc + libkernel ) set_target_properties(agc_driver_visual_test PROPERTIES CXX_EXTENSIONS OFF) configure_windows_unwind(agc_driver_visual_test) if(WIN32) - set(visualRuntimeFiles "$") + set(visualRuntimeFiles "$" "$") if(MINGW) get_filename_component(visualCompilerDirectory "${CMAKE_CXX_COMPILER}" DIRECTORY) @@ -815,7 +787,7 @@ if(AGC_BUILD_VISUAL_TEST) COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${visualRuntimeFiles} "$" - DEPENDS libc + DEPENDS libc libkernel COMMAND_EXPAND_LISTS VERBATIM ) diff --git a/core/libs/prx/libSceAgcDriver/tests/Visual.cpp b/core/libs/prx/libSceAgcDriver/tests/Visual.cpp index 8e9d5d0ca..4e94aa248 100644 --- a/core/libs/prx/libSceAgcDriver/tests/Visual.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/Visual.cpp @@ -61,7 +61,8 @@ void Run(SDL_Window* window, const std::filesystem::path& directory, bool verify } AgcDriver::Graphics::State state{}; state.stages.path = AgcDriver::Graphics::ShaderPath::Vertex; - state.color = {reinterpret_cast(Pixels.data()), {Width, Height}, VK_FORMAT_R8G8B8A8_UNORM, Pixels.size()}; + state.color = {reinterpret_cast(Pixels.data()), {Width, Height}, VK_FORMAT_R8G8B8A8_UNORM, Pixels.size(), 0xe4u}; + state.colors = {state.color}; state.hasColorTarget = true; state.renderExtent = {Width, Height}; state.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; @@ -69,9 +70,11 @@ void Run(SDL_Window* window, const std::filesystem::path& directory, bool verify state.scissor = {{0, 0}, {Width, Height}}; state.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; state.blend.colorWriteMask = 15; - const std::array indices{0, 1, 2}; + state.blends = {state.blend}; + static constexpr std::array indices{0, 1, 2}; const AgcDriver::Pm4::DrawParameters draw{reinterpret_cast(indices.data()), 3, 2, 1, 0}; device.Draw(state, draw, shaders); + device.WaitIdle(); const std::vector indexedPixels(Pixels.begin(), Pixels.end()); for (std::size_t i = 0; i < Pixels.size(); i += 4) { Pixels[i] = std::byte{16}; @@ -81,6 +84,7 @@ void Run(SDL_Window* window, const std::filesystem::path& directory, bool verify } const AgcDriver::Pm4::DrawParameters autoDraw{0, 3, 0, 1, 0, false}; device.Draw(state, autoDraw, shaders); + device.WaitIdle(); Require(std::equal(Pixels.begin(), Pixels.end(), indexedPixels.begin()), "GPU readback: auto draw differs from indexed triangle"); const auto center = (Height / 2 * Width + Width / 2) * 4; Require(std::to_integer(Pixels[center]) > 30 && std::to_integer(Pixels[center + 1]) > 30 && std::to_integer(Pixels[center + 2]) > 30, "GPU readback: triangle center was not rendered");