mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
float clear values (num_bits=16)
This commit is contained in:
parent
bd9f82df94
commit
bac1488ff4
@ -771,7 +771,7 @@ endif()
|
||||
|
||||
create_target_directory_groups(shadps4)
|
||||
|
||||
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn)
|
||||
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half)
|
||||
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::SPIRV glslang::glslang SDL3::SDL3 pugixml::pugixml)
|
||||
|
||||
target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h")
|
||||
@ -794,9 +794,6 @@ if (APPLE)
|
||||
|
||||
# Replacement for std::chrono::time_zone
|
||||
target_link_libraries(shadps4 PRIVATE date::date-tz)
|
||||
|
||||
# Half float conversions for F16C patches
|
||||
target_link_libraries(shadps4 PRIVATE half)
|
||||
endif()
|
||||
|
||||
if (NOT ENABLE_QT_GUI)
|
||||
|
8
externals/CMakeLists.txt
vendored
8
externals/CMakeLists.txt
vendored
@ -141,11 +141,11 @@ if (WIN32)
|
||||
target_compile_options(sirit PUBLIC "-Wno-error=unused-command-line-argument")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# half
|
||||
add_library(half INTERFACE)
|
||||
target_include_directories(half INTERFACE half/include)
|
||||
# half
|
||||
add_library(half INTERFACE)
|
||||
target_include_directories(half INTERFACE half/include)
|
||||
|
||||
if (APPLE)
|
||||
# date
|
||||
if (NOT TARGET date::date-tz)
|
||||
option(BUILD_TZ_LIB "" ON)
|
||||
|
@ -5,10 +5,13 @@
|
||||
#include "video_core/amdgpu/pixel_format.h"
|
||||
#include "video_core/renderer_vulkan/liverpool_to_vk.h"
|
||||
|
||||
#include <half.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
namespace Vulkan::LiverpoolToVK {
|
||||
|
||||
using half_float::half;
|
||||
using half_float::half_cast;
|
||||
using DepthBuffer = Liverpool::DepthBuffer;
|
||||
|
||||
vk::StencilOp StencilOp(Liverpool::StencilFunc op) {
|
||||
@ -730,6 +733,10 @@ static constexpr float U8ToUnorm(u8 v) {
|
||||
return float(v * c);
|
||||
}
|
||||
|
||||
static float F16BitsToFloat(u16 v) {
|
||||
return half_cast<float>(*(reinterpret_cast<half*>(&v)));
|
||||
}
|
||||
|
||||
vk::ClearValue ColorBufferClearValue(const AmdGpu::Liverpool::ColorBuffer& color_buffer) {
|
||||
const auto comp_swap = color_buffer.info.comp_swap.Value();
|
||||
ASSERT_MSG(comp_swap == Liverpool::ColorBuffer::SwapMode::Standard ||
|
||||
@ -762,7 +769,25 @@ vk::ClearValue ColorBufferClearValue(const AmdGpu::Liverpool::ColorBuffer& color
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOG_ERROR(Render_Vulkan, "Missing clear color conversion for bits {}", num_bits);
|
||||
LOG_ERROR(Render_Vulkan, "Missing clear color conversion for uint and bits {}", num_bits);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AmdGpu::NumberFormat::Float: {
|
||||
switch (num_bits) {
|
||||
case 64: {
|
||||
color.float32 = std::array{
|
||||
F16BitsToFloat((comp_swap_alt ? c1 : c0) & 0xffff),
|
||||
F16BitsToFloat((c0 >> 16) & 0xffff),
|
||||
F16BitsToFloat((comp_swap_alt ? c0 : c1) & 0xffff),
|
||||
F16BitsToFloat((c1 >> 16) & 0xffff),
|
||||
};
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOG_ERROR(Render_Vulkan, "Missing clear color conversion for float and bits {}", num_bits);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user