mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-14 15:49:12 +00:00
Devtools improvements I (#1392)
* devtools: fix showing entire depth instead of bits * devtools: show button for stage instead of menu bar - fix batch view dockspace not rendering when window collapsed * devtools: removed useless "Batch" collapse & don't collapse last batch * devtools: refactor DrawRow to templating * devtools: reg popup size adjusted to the content * devtools: better window names * devtools: regview layout compacted * devtools: option to show collapsed frame dump keep most popups open when selection changes best popup windows positioning * devtools: show compute shader regs * devtools: tips popup
This commit is contained in:
@@ -4,15 +4,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
#include "common/bit_field.h"
|
||||
#include "common/types.h"
|
||||
#include "video_core/amdgpu/pm4_opcodes.h"
|
||||
|
||||
namespace Core::Devtools::Widget {
|
||||
|
||||
/*
|
||||
* Generic PM4 header
|
||||
*/
|
||||
@@ -57,16 +58,24 @@ void DrawRow(const char* text, const char* fmt, Args... args) {
|
||||
ImGui::TextUnformatted(buf);
|
||||
}
|
||||
|
||||
template <typename T, typename V = u32>
|
||||
void DrawEnumRow(const char* text, T value) {
|
||||
DrawRow(text, "%X (%s)", V(value), magic_enum::enum_name(value).data());
|
||||
template <typename T>
|
||||
void DrawValueRow(const char* text, T value) {
|
||||
if constexpr (std::is_enum_v<T>) {
|
||||
return DrawRow(text, "%X (%s)", value, magic_enum::enum_name(value).data());
|
||||
} else if constexpr (std::is_integral_v<T>) {
|
||||
return DrawRow(text, "%X", value);
|
||||
} else if constexpr (std::is_base_of_v<BitField<T::position, T::bits, typename T::Type>, T>) {
|
||||
return DrawValueRow(text, value.Value());
|
||||
} else {
|
||||
static_assert(false, "Unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename V, typename... Extra>
|
||||
void DrawMultipleRow(const char* text, const char* fmt, V arg, Extra&&... extra_args) {
|
||||
DrawRow(text, fmt, arg);
|
||||
void DrawValueRowList(const char* text, V arg, Extra&&... extra_args) {
|
||||
DrawValueRow(text, arg);
|
||||
if constexpr (sizeof...(extra_args) > 0) {
|
||||
DrawMultipleRow(std::forward<Extra>(extra_args)...);
|
||||
DrawValueRowList(std::forward<Extra>(extra_args)...);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user