mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
fix(agc): restore the standalone visual demo
This commit is contained in:
@@ -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 "$<TARGET_FILE:libc>")
|
||||
set(visualRuntimeFiles "$<TARGET_FILE:libc>" "$<TARGET_FILE:libkernel>")
|
||||
|
||||
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}
|
||||
"$<TARGET_FILE_DIR:agc_driver_visual_test>"
|
||||
DEPENDS libc
|
||||
DEPENDS libc libkernel
|
||||
COMMAND_EXPAND_LISTS
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
@@ -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<std::uintptr_t>(Pixels.data()), {Width, Height}, VK_FORMAT_R8G8B8A8_UNORM, Pixels.size()};
|
||||
state.color = {reinterpret_cast<std::uintptr_t>(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<std::uint16_t, 3> indices{0, 1, 2};
|
||||
state.blends = {state.blend};
|
||||
static constexpr std::array<std::uint16_t, 3> indices{0, 1, 2};
|
||||
const AgcDriver::Pm4::DrawParameters draw{reinterpret_cast<std::uintptr_t>(indices.data()), 3, 2, 1, 0};
|
||||
device.Draw(state, draw, shaders);
|
||||
device.WaitIdle();
|
||||
const std::vector<std::byte> 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<unsigned>(Pixels[center]) > 30 && std::to_integer<unsigned>(Pixels[center + 1]) > 30 && std::to_integer<unsigned>(Pixels[center + 2]) > 30, "GPU readback: triangle center was not rendered");
|
||||
|
||||
Reference in New Issue
Block a user