mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-16 23:17:29 +00:00
rsx: Fix printing of expected values
This commit is contained in:
parent
c7fed20f3c
commit
439bdde849
@ -237,6 +237,29 @@ struct fmt_class_string<wchar_t*, void> : fmt_class_string<const wchar_t*>
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace fmt
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
concept StringConvertible = requires (T & t)
|
||||||
|
{
|
||||||
|
{ t.to_string() } -> std::convertible_to<std::string>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <fmt::StringConvertible T>
|
||||||
|
struct fmt_class_string<T, void>
|
||||||
|
{
|
||||||
|
static FORCE_INLINE SAFE_BUFFERS(const T&) get_object(u64 arg)
|
||||||
|
{
|
||||||
|
return *reinterpret_cast<const T*>(static_cast<uptr>(arg));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void format(std::string& out, u64 arg)
|
||||||
|
{
|
||||||
|
out += get_object(arg).to_string();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
namespace fmt
|
namespace fmt
|
||||||
{
|
{
|
||||||
// Both uchar and std::byte are allowed
|
// Both uchar and std::byte are allowed
|
||||||
|
@ -3,6 +3,12 @@
|
|||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
namespace fmt
|
||||||
|
{
|
||||||
|
template <typename CharT, usz N, typename... Args>
|
||||||
|
static std::string format(const CharT(&)[N], const Args&...);
|
||||||
|
}
|
||||||
|
|
||||||
namespace rsx
|
namespace rsx
|
||||||
{
|
{
|
||||||
namespace exception_utils
|
namespace exception_utils
|
||||||
@ -26,6 +32,21 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
return error == soft_exception_error_code::none;
|
return error == soft_exception_error_code::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string to_string() const
|
||||||
|
{
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case soft_exception_error_code::none:
|
||||||
|
return "No error";
|
||||||
|
case soft_exception_error_code::range_exception:
|
||||||
|
return "Bad Range";
|
||||||
|
case soft_exception_error_code::invalid_enum:
|
||||||
|
return "Invalid enum";
|
||||||
|
default:
|
||||||
|
return "Unknown Error";
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,5 +100,20 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
return error.empty() && value == other;
|
return error.empty() && value == other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string to_string() const
|
||||||
|
{
|
||||||
|
if (error.empty())
|
||||||
|
{
|
||||||
|
return fmt::format("%s", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (std::is_same_v<E, exception_utils::soft_exception_t>)
|
||||||
|
{
|
||||||
|
return error.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt::format("%s", error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2820,7 +2820,7 @@ struct registers_decoder<NV3089_SET_COLOR_FORMAT>
|
|||||||
|
|
||||||
static std::string dump(const decoded_type& decoded)
|
static std::string dump(const decoded_type& decoded)
|
||||||
{
|
{
|
||||||
return fmt::format("NV3089: source fmt: %s", *decoded.transfer_source_fmt());
|
return fmt::format("NV3089: source fmt: %s", decoded.transfer_source_fmt());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2866,7 +2866,7 @@ struct registers_decoder<NV3062_SET_COLOR_FORMAT>
|
|||||||
|
|
||||||
static std::string dump(const decoded_type& decoded)
|
static std::string dump(const decoded_type& decoded)
|
||||||
{
|
{
|
||||||
return fmt::format("NV3062: output fmt: %s", *decoded.transfer_dest_fmt());
|
return fmt::format("NV3062: output fmt: %s", decoded.transfer_dest_fmt());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3759,7 +3759,7 @@ struct registers_decoder<NV309E_SET_FORMAT>
|
|||||||
|
|
||||||
static std::string dump(const decoded_type& decoded)
|
static std::string dump(const decoded_type& decoded)
|
||||||
{
|
{
|
||||||
return fmt::format("NV309E: output fmt: %s log2-width: %u log2-height: %u", *decoded.format(),
|
return fmt::format("NV309E: output fmt: %s log2-width: %u log2-height: %u", decoded.format(),
|
||||||
decoded.sw_width_log2(), decoded.sw_height_log2());
|
decoded.sw_width_log2(), decoded.sw_height_log2());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -520,6 +520,7 @@
|
|||||||
<ClInclude Include="Emu\perf_monitor.hpp" />
|
<ClInclude Include="Emu\perf_monitor.hpp" />
|
||||||
<ClInclude Include="Emu\RSX\Common\bitfield.hpp" />
|
<ClInclude Include="Emu\RSX\Common\bitfield.hpp" />
|
||||||
<ClInclude Include="Emu\RSX\Common\buffer_stream.hpp" />
|
<ClInclude Include="Emu\RSX\Common\buffer_stream.hpp" />
|
||||||
|
<ClInclude Include="Emu\RSX\Common\expected.hpp" />
|
||||||
<ClInclude Include="Emu\RSX\Common\profiling_timer.hpp" />
|
<ClInclude Include="Emu\RSX\Common\profiling_timer.hpp" />
|
||||||
<ClInclude Include="Emu\RSX\Common\ranged_map.hpp" />
|
<ClInclude Include="Emu\RSX\Common\ranged_map.hpp" />
|
||||||
<ClInclude Include="Emu\RSX\Common\simple_array.hpp" />
|
<ClInclude Include="Emu\RSX\Common\simple_array.hpp" />
|
||||||
|
@ -2227,6 +2227,9 @@
|
|||||||
<ClInclude Include="Emu\RSX\Core\RSXEngLock.hpp">
|
<ClInclude Include="Emu\RSX\Core\RSXEngLock.hpp">
|
||||||
<Filter>Emu\GPU\RSX\Core</Filter>
|
<Filter>Emu\GPU\RSX\Core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Emu\RSX\Common\expected.hpp">
|
||||||
|
<Filter>Emu\GPU\RSX\Common</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Emu\RSX\Program\GLSLSnippets\GPUDeswizzle.glsl">
|
<None Include="Emu\RSX\Program\GLSLSnippets\GPUDeswizzle.glsl">
|
||||||
|
Loading…
Reference in New Issue
Block a user