Misc: clang-cl warning clean-up

This commit is contained in:
Stenzek 2023-09-03 14:30:26 +10:00
parent 7f446526d1
commit 80e3d29ab8
52 changed files with 470 additions and 394 deletions

View file

@ -1007,34 +1007,32 @@ Global
{32EEAF44-57F8-4C6C-A6F0-DE5667123DD5}.ReleaseLTCG-Clang|x86.Build.0 = ReleaseLTCG-Clang|Win32 {32EEAF44-57F8-4C6C-A6F0-DE5667123DD5}.ReleaseLTCG-Clang|x86.Build.0 = ReleaseLTCG-Clang|Win32
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug|ARM64.ActiveCfg = Debug|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug|ARM64.ActiveCfg = Debug|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug|ARM64.Build.0 = Debug|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug|ARM64.Build.0 = Debug|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug|x64.ActiveCfg = Debug|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug|x64.ActiveCfg = Debug|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug|x86.ActiveCfg = Debug|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug|x86.ActiveCfg = Debug|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug-Clang|ARM64.ActiveCfg = Debug-Clang|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug-Clang|ARM64.ActiveCfg = Debug-Clang|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug-Clang|x64.ActiveCfg = Debug-Clang|x64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug-Clang|x64.ActiveCfg = Debug-Clang|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug-Clang|x86.ActiveCfg = Debug-Clang|Win32 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Debug-Clang|x86.ActiveCfg = Debug-Clang|Win32
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast|ARM64.ActiveCfg = DebugFast|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast|ARM64.ActiveCfg = DebugFast|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast|ARM64.Build.0 = DebugFast|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast|ARM64.Build.0 = DebugFast|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast|x64.ActiveCfg = DebugFast|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast|x64.ActiveCfg = DebugFast|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast|x86.ActiveCfg = DebugFast|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast|x86.ActiveCfg = DebugFast|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|ARM64.ActiveCfg = DebugFast-Clang|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|ARM64.ActiveCfg = DebugFast-Clang|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|ARM64.Build.0 = DebugFast-Clang|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|ARM64.Build.0 = DebugFast-Clang|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|x64.ActiveCfg = DebugFast-Clang|x64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|x64.ActiveCfg = DebugFast-Clang|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|x64.Build.0 = DebugFast-Clang|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|x86.ActiveCfg = DebugFast-Clang|Win32 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|x86.ActiveCfg = DebugFast-Clang|Win32
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|x86.Build.0 = DebugFast-Clang|Win32 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.DebugFast-Clang|x86.Build.0 = DebugFast-Clang|Win32
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release|ARM64.ActiveCfg = Release|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release|ARM64.ActiveCfg = Release|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release|ARM64.Build.0 = Release|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release|ARM64.Build.0 = Release|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release|x64.ActiveCfg = Release|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release|x64.ActiveCfg = Release|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release|x86.ActiveCfg = Release|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release|x86.ActiveCfg = Release|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|ARM64.ActiveCfg = Release-Clang|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|ARM64.ActiveCfg = Release-Clang|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|ARM64.Build.0 = Release-Clang|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|ARM64.Build.0 = Release-Clang|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|x64.ActiveCfg = Release-Clang|x64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|x64.ActiveCfg = Release-Clang|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|x64.Build.0 = Release-Clang|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|x86.ActiveCfg = Release-Clang|Win32 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|x86.ActiveCfg = Release-Clang|Win32
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|x86.Build.0 = Release-Clang|Win32 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.Release-Clang|x86.Build.0 = Release-Clang|Win32
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG|ARM64.Build.0 = ReleaseLTCG|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG|ARM64.Build.0 = ReleaseLTCG|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG|x64.ActiveCfg = ReleaseLTCG|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG|x64.ActiveCfg = ReleaseLTCG|x64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG|x86.ActiveCfg = ReleaseLTCG|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG|x86.ActiveCfg = ReleaseLTCG|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG-Clang|ARM64.ActiveCfg = ReleaseLTCG-Clang|ARM64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG-Clang|ARM64.ActiveCfg = ReleaseLTCG-Clang|ARM64
{8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG-Clang|x64.ActiveCfg = ReleaseLTCG-Clang|x64 {8906836E-F06E-46E8-B11A-74E5E8C7B8FB}.ReleaseLTCG-Clang|x64.ActiveCfg = ReleaseLTCG-Clang|x64
@ -1053,7 +1051,6 @@ Global
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|ARM64.ActiveCfg = DebugFast-Clang|ARM64 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|ARM64.ActiveCfg = DebugFast-Clang|ARM64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|ARM64.Build.0 = DebugFast-Clang|ARM64 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|ARM64.Build.0 = DebugFast-Clang|ARM64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|x64.ActiveCfg = DebugFast-Clang|x64 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|x64.ActiveCfg = DebugFast-Clang|x64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|x64.Build.0 = DebugFast-Clang|x64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|x86.ActiveCfg = DebugFast-Clang|Win32 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|x86.ActiveCfg = DebugFast-Clang|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|x86.Build.0 = DebugFast-Clang|Win32 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast-Clang|x86.Build.0 = DebugFast-Clang|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release|ARM64.ActiveCfg = Release|ARM64 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release|ARM64.ActiveCfg = Release|ARM64
@ -1063,7 +1060,6 @@ Global
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|ARM64.ActiveCfg = Release-Clang|ARM64 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|ARM64.ActiveCfg = Release-Clang|ARM64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|ARM64.Build.0 = Release-Clang|ARM64 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|ARM64.Build.0 = Release-Clang|ARM64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|x64.ActiveCfg = Release-Clang|x64 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|x64.ActiveCfg = Release-Clang|x64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|x64.Build.0 = Release-Clang|x64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|x86.ActiveCfg = Release-Clang|Win32 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|x86.ActiveCfg = Release-Clang|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|x86.Build.0 = Release-Clang|Win32 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release-Clang|x86.Build.0 = Release-Clang|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64 {0A172B2E-DC67-49FC-A4C1-975F93C586C4}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64
@ -1133,7 +1129,6 @@ Global
{3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|ARM64.ActiveCfg = DebugFast-Clang|ARM64 {3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|ARM64.ActiveCfg = DebugFast-Clang|ARM64
{3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|ARM64.Build.0 = DebugFast-Clang|ARM64 {3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|ARM64.Build.0 = DebugFast-Clang|ARM64
{3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|x64.ActiveCfg = DebugFast-Clang|x64 {3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|x64.ActiveCfg = DebugFast-Clang|x64
{3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|x64.Build.0 = DebugFast-Clang|x64
{3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|x86.ActiveCfg = DebugFast-Clang|Win32 {3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|x86.ActiveCfg = DebugFast-Clang|Win32
{3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|x86.Build.0 = DebugFast-Clang|Win32 {3029310E-4211-4C87-801A-72E130A648EF}.DebugFast-Clang|x86.Build.0 = DebugFast-Clang|Win32
{3029310E-4211-4C87-801A-72E130A648EF}.Release|ARM64.ActiveCfg = Release|ARM64 {3029310E-4211-4C87-801A-72E130A648EF}.Release|ARM64.ActiveCfg = Release|ARM64
@ -1142,7 +1137,6 @@ Global
{3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|ARM64.ActiveCfg = Release-Clang|ARM64 {3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|ARM64.ActiveCfg = Release-Clang|ARM64
{3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|ARM64.Build.0 = Release-Clang|ARM64 {3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|ARM64.Build.0 = Release-Clang|ARM64
{3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|x64.ActiveCfg = Release-Clang|x64 {3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|x64.ActiveCfg = Release-Clang|x64
{3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|x64.Build.0 = Release-Clang|x64
{3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|x86.ActiveCfg = Release-Clang|Win32 {3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|x86.ActiveCfg = Release-Clang|Win32
{3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|x86.Build.0 = Release-Clang|Win32 {3029310E-4211-4C87-801A-72E130A648EF}.Release-Clang|x86.Build.0 = Release-Clang|Win32
{3029310E-4211-4C87-801A-72E130A648EF}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64 {3029310E-4211-4C87-801A-72E130A648EF}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64

View file

@ -188,7 +188,8 @@ static ALWAYS_INLINE void FormatLogMessageAndPrintW(const char* channelName, con
char* message_buf = buf; char* message_buf = buf;
int message_len; int message_len;
if ((message_len = FormatLogMessageForDisplay(message_buf, sizeof(buf), channelName, functionName, level, message, if ((message_len = FormatLogMessageForDisplay(message_buf, sizeof(buf), channelName, functionName, level, message,
timestamp, ansi_color_code, newline)) > (sizeof(buf) - 1)) timestamp, ansi_color_code, newline)) >
static_cast<int>(sizeof(buf) - 1))
{ {
message_buf = static_cast<char*>(std::malloc(message_len + 1)); message_buf = static_cast<char*>(std::malloc(message_len + 1));
message_len = FormatLogMessageForDisplay(message_buf, message_len + 1, channelName, functionName, level, message, message_len = FormatLogMessageForDisplay(message_buf, message_len + 1, channelName, functionName, level, message,
@ -201,8 +202,8 @@ static ALWAYS_INLINE void FormatLogMessageAndPrintW(const char* channelName, con
// anyway... // anyway...
wchar_t wbuf[512]; wchar_t wbuf[512];
wchar_t* wmessage_buf = wbuf; wchar_t* wmessage_buf = wbuf;
int wmessage_buflen = countof(wbuf) - 1; int wmessage_buflen = static_cast<int>(std::size(wbuf) - 1);
if (message_len >= countof(wbuf)) if (message_len >= static_cast<int>(std::size(wbuf)))
{ {
wmessage_buflen = message_len; wmessage_buflen = message_len;
wmessage_buf = static_cast<wchar_t*>(std::malloc((wmessage_buflen + 1) * sizeof(wchar_t))); wmessage_buf = static_cast<wchar_t*>(std::malloc((wmessage_buflen + 1) * sizeof(wchar_t)));

View file

@ -839,12 +839,12 @@ static const char* s_invert_settings[] = {TRANSLATE_NOOP("AnalogController", "No
static const SettingInfo s_settings[] = { static const SettingInfo s_settings[] = {
{SettingInfo::Type::Boolean, "ForceAnalogOnReset", TRANSLATE_NOOP("AnalogController", "Force Analog Mode on Reset"), {SettingInfo::Type::Boolean, "ForceAnalogOnReset", TRANSLATE_NOOP("AnalogController", "Force Analog Mode on Reset"),
TRANSLATE_NOOP("AnalogController", "Forces the controller to analog mode when the console is reset/powered on."), TRANSLATE_NOOP("AnalogController", "Forces the controller to analog mode when the console is reset/powered on."),
"true"}, "true", nullptr, nullptr, nullptr, nullptr, nullptr, 0.0f},
{SettingInfo::Type::Boolean, "AnalogDPadInDigitalMode", {SettingInfo::Type::Boolean, "AnalogDPadInDigitalMode",
TRANSLATE_NOOP("AnalogController", "Use Analog Sticks for D-Pad in Digital Mode"), TRANSLATE_NOOP("AnalogController", "Use Analog Sticks for D-Pad in Digital Mode"),
TRANSLATE_NOOP("AnalogController", TRANSLATE_NOOP("AnalogController",
"Allows you to use the analog sticks to control the d-pad in digital mode, as well as the buttons."), "Allows you to use the analog sticks to control the d-pad in digital mode, as well as the buttons."),
"true"}, "true", nullptr, nullptr, nullptr, nullptr, nullptr, 0.0f},
{SettingInfo::Type::Float, "AnalogDeadzone", TRANSLATE_NOOP("AnalogController", "Analog Deadzone"), {SettingInfo::Type::Float, "AnalogDeadzone", TRANSLATE_NOOP("AnalogController", "Analog Deadzone"),
TRANSLATE_NOOP("AnalogController", TRANSLATE_NOOP("AnalogController",
"Sets the analog stick deadzone, i.e. the fraction of the stick movement which will be ignored."), "Sets the analog stick deadzone, i.e. the fraction of the stick movement which will be ignored."),

View file

@ -2099,6 +2099,9 @@ void CDROM::ExecuteCommandSecondResponse(void*, TickCount ticks, TickCount ticks
case Command::Stop: case Command::Stop:
DoStatSecondResponse(); DoStatSecondResponse();
break; break;
default:
break;
} }
s_command_second_response = Command::None; s_command_second_response = Command::None;
@ -2731,7 +2734,6 @@ void CDROM::DoSectorRead()
} }
else else
{ {
const CDImage::Position pos(CDImage::Position::FromLBA(s_current_lba));
Log_DevPrintf("Sector %u [%s] has invalid subchannel Q", s_current_lba, Log_DevPrintf("Sector %u [%s] has invalid subchannel Q", s_current_lba,
LBAToMSFString(s_current_lba).GetCharArray()); LBAToMSFString(s_current_lba).GetCharArray());
} }

View file

@ -561,7 +561,8 @@ void LogCurrentState()
CodeBlockKey GetNextBlockKey() CodeBlockKey GetNextBlockKey()
{ {
CodeBlockKey key = {}; CodeBlockKey key;
key.bits = 0;
key.SetPC(g_state.pc); key.SetPC(g_state.pc);
key.user_mode = InUserMode(); key.user_mode = InUserMode();
return key; return key;

View file

@ -31,6 +31,10 @@ union CodeBlockKey
ALWAYS_INLINE u32 GetPCPhysicalAddress() const { return (aligned_pc << 2) & PHYSICAL_MEMORY_ADDRESS_MASK; } ALWAYS_INLINE u32 GetPCPhysicalAddress() const { return (aligned_pc << 2) & PHYSICAL_MEMORY_ADDRESS_MASK; }
ALWAYS_INLINE CodeBlockKey() = default;
ALWAYS_INLINE CodeBlockKey(const CodeBlockKey& rhs) : bits(rhs.bits) {}
ALWAYS_INLINE CodeBlockKey& operator=(const CodeBlockKey& rhs) ALWAYS_INLINE CodeBlockKey& operator=(const CodeBlockKey& rhs)
{ {
bits = rhs.bits; bits = rhs.bits;

View file

@ -1353,7 +1353,7 @@ restart_instruction:
WriteRegDelayed(inst.i.rt, sxvalue); WriteRegDelayed(inst.i.rt, sxvalue);
if constexpr (pgxp_mode >= PGXPMode::Memory) if constexpr (pgxp_mode >= PGXPMode::Memory)
PGXP::CPU_LHx(inst.bits, addr, sxvalue); PGXP::CPU_LH(inst.bits, addr, sxvalue);
} }
break; break;
@ -1406,7 +1406,7 @@ restart_instruction:
WriteRegDelayed(inst.i.rt, zxvalue); WriteRegDelayed(inst.i.rt, zxvalue);
if constexpr (pgxp_mode >= PGXPMode::Memory) if constexpr (pgxp_mode >= PGXPMode::Memory)
PGXP::CPU_LHx(inst.bits, addr, zxvalue); PGXP::CPU_LHU(inst.bits, addr, zxvalue);
} }
break; break;

View file

@ -1476,7 +1476,10 @@ bool CodeGenerator::Compile_Load(const CodeBlockInstruction& cbi)
ConvertValueSizeInPlace(&result, RegSize_32, (cbi.instruction.op == InstructionOp::lh)); ConvertValueSizeInPlace(&result, RegSize_32, (cbi.instruction.op == InstructionOp::lh));
if (g_settings.gpu_pgxp_enable) if (g_settings.gpu_pgxp_enable)
EmitFunctionCall(nullptr, PGXP::CPU_LHx, Value::FromConstantU32(cbi.instruction.bits), address, result); {
EmitFunctionCall(nullptr, (cbi.instruction.op == InstructionOp::lhu) ? &PGXP::CPU_LHU : PGXP::CPU_LH,
Value::FromConstantU32(cbi.instruction.bits), address, result);
}
if (address_spec) if (address_spec)
{ {

View file

@ -303,6 +303,8 @@ void CodeGenerator::EmitSignExtend(HostReg to_reg, RegSize to_size, HostReg from
case RegSize_8: case RegSize_8:
m_emit->movsx(GetHostReg16(to_reg), GetHostReg8(from_reg)); m_emit->movsx(GetHostReg16(to_reg), GetHostReg8(from_reg));
return; return;
default:
break;
} }
} }
break; break;
@ -317,14 +319,17 @@ void CodeGenerator::EmitSignExtend(HostReg to_reg, RegSize to_size, HostReg from
case RegSize_16: case RegSize_16:
m_emit->movsx(GetHostReg32(to_reg), GetHostReg16(from_reg)); m_emit->movsx(GetHostReg32(to_reg), GetHostReg16(from_reg));
return; return;
default:
break;
} }
} }
break; break;
default: default:
Panic("Unknown sign-extend combination");
break; break;
} }
Panic("Unknown sign-extend combination");
} }
void CodeGenerator::EmitZeroExtend(HostReg to_reg, RegSize to_size, HostReg from_reg, RegSize from_size) void CodeGenerator::EmitZeroExtend(HostReg to_reg, RegSize to_size, HostReg from_reg, RegSize from_size)
@ -338,6 +343,8 @@ void CodeGenerator::EmitZeroExtend(HostReg to_reg, RegSize to_size, HostReg from
case RegSize_8: case RegSize_8:
m_emit->movzx(GetHostReg16(to_reg), GetHostReg8(from_reg)); m_emit->movzx(GetHostReg16(to_reg), GetHostReg8(from_reg));
return; return;
default:
break;
} }
} }
break; break;
@ -352,9 +359,14 @@ void CodeGenerator::EmitZeroExtend(HostReg to_reg, RegSize to_size, HostReg from
case RegSize_16: case RegSize_16:
m_emit->movzx(GetHostReg32(to_reg), GetHostReg16(from_reg)); m_emit->movzx(GetHostReg32(to_reg), GetHostReg16(from_reg));
return; return;
default:
break;
} }
} }
break; break;
default:
break;
} }
Panic("Unknown sign-extend combination"); Panic("Unknown sign-extend combination");
@ -410,6 +422,10 @@ void CodeGenerator::EmitCopyValue(HostReg to_reg, const Value& value)
m_emit->mov(GetHostReg64(to_reg), GetHostReg64(value.host_reg)); m_emit->mov(GetHostReg64(to_reg), GetHostReg64(value.host_reg));
} }
break; break;
default:
UnreachableCode();
break;
} }
} }
@ -479,6 +495,10 @@ void CodeGenerator::EmitAdd(HostReg to_reg, HostReg from_reg, const Value& value
} }
} }
break; break;
default:
UnreachableCode();
break;
} }
} }
@ -548,6 +568,10 @@ void CodeGenerator::EmitSub(HostReg to_reg, HostReg from_reg, const Value& value
} }
} }
break; break;
default:
UnreachableCode();
break;
} }
} }
@ -605,6 +629,10 @@ void CodeGenerator::EmitCmp(HostReg to_reg, const Value& value)
} }
} }
break; break;
default:
UnreachableCode();
break;
} }
} }
@ -1838,6 +1866,10 @@ void CodeGenerator::EmitLoadGuestRAMFastmem(const Value& address, RegSize size,
} }
} }
break; break;
default:
UnreachableCode();
break;
} }
} }
else else
@ -1862,6 +1894,10 @@ void CodeGenerator::EmitLoadGuestRAMFastmem(const Value& address, RegSize size,
case RegSize_32: case RegSize_32:
m_emit->mov(GetHostReg32(result.host_reg), m_emit->dword[GetHostReg64(RARG1) + GetHostReg64(RARG2)]); m_emit->mov(GetHostReg32(result.host_reg), m_emit->dword[GetHostReg64(RARG1) + GetHostReg64(RARG2)]);
break; break;
default:
UnreachableCode();
break;
} }
} }
} }
@ -1936,6 +1972,10 @@ void CodeGenerator::EmitLoadGuestMemoryFastmem(const CodeBlockInstruction& cbi,
} }
} }
break; break;
default:
UnreachableCode();
break;
} }
} }
else else
@ -1963,6 +2003,10 @@ void CodeGenerator::EmitLoadGuestMemoryFastmem(const CodeBlockInstruction& cbi,
case RegSize_32: case RegSize_32:
m_emit->mov(GetHostReg32(result.host_reg), m_emit->dword[GetHostReg64(RARG1) + GetHostReg64(RARG2)]); m_emit->mov(GetHostReg32(result.host_reg), m_emit->dword[GetHostReg64(RARG1) + GetHostReg64(RARG2)]);
break; break;
default:
UnreachableCode();
break;
} }
} }
@ -2191,6 +2235,10 @@ void CodeGenerator::EmitStoreGuestMemoryFastmem(const CodeBlockInstruction& cbi,
} }
} }
break; break;
default:
UnreachableCode();
break;
} }
} }
else else
@ -2234,6 +2282,10 @@ void CodeGenerator::EmitStoreGuestMemoryFastmem(const CodeBlockInstruction& cbi,
m_emit->mov(m_emit->dword[GetHostReg64(RARG1) + GetHostReg64(RARG2)], GetHostReg32(value.host_reg)); m_emit->mov(m_emit->dword[GetHostReg64(RARG1) + GetHostReg64(RARG2)], GetHostReg32(value.host_reg));
} }
break; break;
default:
UnreachableCode();
break;
} }
} }

View file

@ -7,7 +7,9 @@
#include "system.h" #include "system.h"
#include "util/state_wrapper.h" #include "util/state_wrapper.h"
DigitalController::DigitalController(u32 index) : Controller(index) {} DigitalController::DigitalController(u32 index) : Controller(index)
{
}
DigitalController::~DigitalController() = default; DigitalController::~DigitalController() = default;
@ -164,7 +166,7 @@ static const Controller::ControllerBindingInfo s_binding_info[] = {
BUTTON("R1", TRANSLATE_NOOP("DigitalController", "R1"), DigitalController::Button::R1, GenericInputBinding::R1), BUTTON("R1", TRANSLATE_NOOP("DigitalController", "R1"), DigitalController::Button::R1, GenericInputBinding::R1),
BUTTON("L2", TRANSLATE_NOOP("DigitalController", "L2"), DigitalController::Button::L2, GenericInputBinding::L2), BUTTON("L2", TRANSLATE_NOOP("DigitalController", "L2"), DigitalController::Button::L2, GenericInputBinding::L2),
BUTTON("R2", TRANSLATE_NOOP("DigitalController", "R2"), DigitalController::Button::R2, GenericInputBinding::R2), BUTTON("R2", TRANSLATE_NOOP("DigitalController", "R2"), DigitalController::Button::R2, GenericInputBinding::R2),
// clang-format on // clang-format on
#undef BUTTON #undef BUTTON
}; };
@ -172,7 +174,8 @@ static const Controller::ControllerBindingInfo s_binding_info[] = {
static const SettingInfo s_settings[] = { static const SettingInfo s_settings[] = {
{SettingInfo::Type::Boolean, "ForcePopnControllerMode", {SettingInfo::Type::Boolean, "ForcePopnControllerMode",
TRANSLATE_NOOP("DigitalController", "Force Pop'n Controller Mode"), TRANSLATE_NOOP("DigitalController", "Force Pop'n Controller Mode"),
TRANSLATE_NOOP("DigitalController", "Forces the Digital Controller to act as a Pop'n Controller."), "false"}}; TRANSLATE_NOOP("DigitalController", "Forces the Digital Controller to act as a Pop'n Controller."), "false", nullptr,
nullptr, nullptr, nullptr, nullptr, 0.0f}};
const Controller::ControllerInfo DigitalController::INFO = {ControllerType::DigitalController, const Controller::ControllerInfo DigitalController::INFO = {ControllerType::DigitalController,
"DigitalController", "DigitalController",

View file

@ -38,7 +38,7 @@ enum class SyncMode : u32
}; };
static constexpr PhysicalMemoryAddress BASE_ADDRESS_MASK = UINT32_C(0x00FFFFFF); static constexpr PhysicalMemoryAddress BASE_ADDRESS_MASK = UINT32_C(0x00FFFFFF);
static constexpr PhysicalMemoryAddress ADDRESS_MASK = UINT32_C(0x001FFFFC); // static constexpr PhysicalMemoryAddress ADDRESS_MASK = UINT32_C(0x001FFFFC);
static u32 GetAddressMask(); static u32 GetAddressMask();
static void ClearState(); static void ClearState();

View file

@ -4330,6 +4330,9 @@ void FullscreenUI::DrawPostProcessingSettingsPage()
ImGui::PopFont(); ImGui::PopFont();
} }
break; break;
default:
break;
} }
} }
@ -4590,9 +4593,10 @@ void FullscreenUI::DrawAchievementsLoginWindow()
if (ImGui::BeginPopupModal("Achievements Login", &is_open, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize)) if (ImGui::BeginPopupModal("Achievements Login", &is_open, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize))
{ {
ImGui::TextWrapped(FSUI_CSTR("Please enter your user name and password for retroachievements.org.")); ImGui::TextWrapped("%s", FSUI_CSTR("Please enter your user name and password for retroachievements.org."));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextWrapped( ImGui::TextWrapped(
"%s",
FSUI_CSTR("Your password will not be saved in DuckStation, an access token will be generated and used instead.")); FSUI_CSTR("Your password will not be saved in DuckStation, an access token will be generated and used instead."));
ImGui::NewLine(); ImGui::NewLine();
@ -4600,11 +4604,11 @@ void FullscreenUI::DrawAchievementsLoginWindow()
static char username[256] = {}; static char username[256] = {};
static char password[256] = {}; static char password[256] = {};
ImGui::Text(FSUI_CSTR("User Name: ")); ImGui::TextUnformatted(FSUI_CSTR("User Name: "));
ImGui::SameLine(LayoutScale(200.0f)); ImGui::SameLine(LayoutScale(200.0f));
ImGui::InputText("##username", username, sizeof(username)); ImGui::InputText("##username", username, sizeof(username));
ImGui::Text(FSUI_CSTR("Password: ")); ImGui::TextUnformatted(FSUI_CSTR("Password: "));
ImGui::SameLine(LayoutScale(200.0f)); ImGui::SameLine(LayoutScale(200.0f));
ImGui::InputText("##password", password, sizeof(password), ImGuiInputTextFlags_Password); ImGui::InputText("##password", password, sizeof(password), ImGuiInputTextFlags_Password);
@ -5260,7 +5264,6 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
0.5f; 0.5f;
u32 grid_x = 0; u32 grid_x = 0;
u32 grid_y = 0;
ImGui::SetCursorPos(ImVec2(start_x, 0.0f)); ImGui::SetCursorPos(ImVec2(start_x, 0.0f));
for (u32 i = 0; i < s_save_state_selector_slots.size(); i++) for (u32 i = 0; i < s_save_state_selector_slots.size(); i++)
{ {
@ -5455,7 +5458,6 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
if (grid_x == grid_count_x) if (grid_x == grid_count_x)
{ {
grid_x = 0; grid_x = 0;
grid_y++;
ImGui::SetCursorPosX(start_x); ImGui::SetCursorPosX(start_x);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + item_spacing); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + item_spacing);
} }
@ -5996,7 +5998,6 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
SmallString draw_title; SmallString draw_title;
u32 grid_x = 0; u32 grid_x = 0;
u32 grid_y = 0;
ImGui::SetCursorPos(ImVec2(start_x, 0.0f)); ImGui::SetCursorPos(ImVec2(start_x, 0.0f));
for (const GameList::Entry* entry : s_game_list_sorted_entries) for (const GameList::Entry* entry : s_game_list_sorted_entries)
{ {
@ -6060,7 +6061,6 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
if (grid_x == grid_count_x) if (grid_x == grid_count_x)
{ {
grid_x = 0; grid_x = 0;
grid_y++;
ImGui::SetCursorPosX(start_x); ImGui::SetCursorPosX(start_x);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + item_spacing); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + item_spacing);
} }
@ -6452,18 +6452,19 @@ void FullscreenUI::DrawAboutWindow()
if (ImGui::BeginPopupModal(FSUI_CSTR("About DuckStation"), &s_about_window_open, if (ImGui::BeginPopupModal(FSUI_CSTR("About DuckStation"), &s_about_window_open,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize)) ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize))
{ {
ImGui::TextWrapped(FSUI_CSTR("DuckStation is a free and open-source simulator/emulator of the Sony PlayStation(TM) " ImGui::TextWrapped("%s",
FSUI_CSTR("DuckStation is a free and open-source simulator/emulator of the Sony PlayStation(TM) "
"console, focusing on playability, speed, and long-term maintainability.")); "console, focusing on playability, speed, and long-term maintainability."));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextWrapped( ImGui::TextWrapped(
FSUI_CSTR("Contributor List: https://github.com/stenzek/duckstation/blob/master/CONTRIBUTORS.md")); "%s", FSUI_CSTR("Contributor List: https://github.com/stenzek/duckstation/blob/master/CONTRIBUTORS.md"));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextWrapped( ImGui::TextWrapped(
FSUI_CSTR("Duck icon by icons8 (https://icons8.com/icon/74847/platforms.undefined.short-title)")); "%s", FSUI_CSTR("Duck icon by icons8 (https://icons8.com/icon/74847/platforms.undefined.short-title)"));
ImGui::NewLine(); ImGui::NewLine();
ImGui::TextWrapped( ImGui::TextWrapped(
FSUI_CSTR("\"PlayStation\" and \"PSX\" are registered trademarks of Sony Interactive Entertainment Europe " "%s", FSUI_CSTR("\"PlayStation\" and \"PSX\" are registered trademarks of Sony Interactive Entertainment Europe "
"Limited. This software is not affiliated in any way with Sony Interactive Entertainment.")); "Limited. This software is not affiliated in any way with Sony Interactive Entertainment."));
ImGui::NewLine(); ImGui::NewLine();

View file

@ -331,6 +331,15 @@ void GPU::UpdateDMARequest()
m_GPUSTAT.ready_to_send_vram = true; m_GPUSTAT.ready_to_send_vram = true;
m_GPUSTAT.ready_to_recieve_dma = m_fifo.IsEmpty(); m_GPUSTAT.ready_to_recieve_dma = m_fifo.IsEmpty();
break; break;
case BlitterState::DrawingPolyLine:
m_GPUSTAT.ready_to_send_vram = false;
m_GPUSTAT.ready_to_recieve_dma = (m_fifo.GetSize() < m_fifo_size);
break;
default:
UnreachableCode();
break;
} }
bool dma_request; bool dma_request;
@ -375,6 +384,14 @@ void GPU::UpdateGPUIdle()
case BlitterState::ReadingVRAM: case BlitterState::ReadingVRAM:
m_GPUSTAT.gpu_idle = false; m_GPUSTAT.gpu_idle = false;
break; break;
case BlitterState::DrawingPolyLine:
m_GPUSTAT.gpu_idle = false;
break;
default:
UnreachableCode();
break;
} }
} }
@ -1657,7 +1674,6 @@ bool GPU::RenderDisplay(GPUFramebuffer* target, const Common::Rectangle<s32>& dr
m_display_texture->MakeReadyForSampling(); m_display_texture->MakeReadyForSampling();
bool texture_filter_linear = false; bool texture_filter_linear = false;
bool bilinear_adjust = false;
struct Uniforms struct Uniforms
{ {
@ -1676,7 +1692,6 @@ bool GPU::RenderDisplay(GPUFramebuffer* target, const Common::Rectangle<s32>& dr
case DisplayScalingMode::BilinearSmooth: case DisplayScalingMode::BilinearSmooth:
texture_filter_linear = true; texture_filter_linear = true;
bilinear_adjust = true;
break; break;
case DisplayScalingMode::BilinearSharp: case DisplayScalingMode::BilinearSharp:

View file

@ -6,11 +6,7 @@
#include "util/gpu_device.h" #include "util/gpu_device.h"
#include "common/assert.h"
#include "common/log.h"
#include <algorithm> #include <algorithm>
Log_SetChannel(GPU_SW_Backend);
GPU_SW_Backend::GPU_SW_Backend() : GPUBackend() GPU_SW_Backend::GPU_SW_Backend() : GPUBackend()
{ {
@ -209,6 +205,9 @@ void ALWAYS_INLINE_RELEASE GPU_SW_Backend::ShadePixel(const GPUBackendDrawComman
color.bits = Truncate16((sum - carry) | (carry - (carry >> 5))); color.bits = Truncate16((sum - carry) | (carry - (carry >> 5)));
} }
break; break;
default:
break;
} }
// See above. // See above.

View file

@ -10,12 +10,14 @@
#include "util/state_wrapper.h" #include "util/state_wrapper.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/log.h"
#include "common/path.h" #include "common/path.h"
#include <array> #include <array>
#ifdef _DEBUG
#include "common/log.h"
Log_SetChannel(GunCon); Log_SetChannel(GunCon);
#endif
static constexpr std::array<u8, static_cast<size_t>(GunCon::Button::Count)> s_button_indices = {{13, 3, 14}}; static constexpr std::array<u8, static_cast<size_t>(GunCon::Button::Count)> s_button_indices = {{13, 3, 14}};
@ -230,7 +232,8 @@ static const Controller::ControllerBindingInfo s_binding_info[] = {
static const SettingInfo s_settings[] = { static const SettingInfo s_settings[] = {
{SettingInfo::Type::Path, "CrosshairImagePath", TRANSLATE_NOOP("GunCon", "Crosshair Image Path"), {SettingInfo::Type::Path, "CrosshairImagePath", TRANSLATE_NOOP("GunCon", "Crosshair Image Path"),
TRANSLATE_NOOP("GunCon", "Path to an image to use as a crosshair/cursor.")}, TRANSLATE_NOOP("GunCon", "Path to an image to use as a crosshair/cursor."), nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, 0.0f},
{SettingInfo::Type::Float, "CrosshairScale", TRANSLATE_NOOP("GunCon", "Crosshair Image Scale"), {SettingInfo::Type::Float, "CrosshairScale", TRANSLATE_NOOP("GunCon", "Crosshair Image Scale"),
TRANSLATE_NOOP("GunCon", "Scale of crosshair image on screen."), "1.0", "0.0001", "100.0", "0.10", "%.0f%%", nullptr, TRANSLATE_NOOP("GunCon", "Scale of crosshair image on screen."), "1.0", "0.0001", "100.0", "0.10", "%.0f%%", nullptr,
100.0f}, 100.0f},

View file

@ -1,30 +1,16 @@
/*************************************************************************** // SPDX-FileCopyrightText: 2016 iCatButler, 2019-2023 Connor McLaughlin <stenzek@gmail.com>
* Original copyright notice from PGXP code from Beetle PSX. * // SPDX-License-Identifier: GPL-2.0+
* Copyright (C) 2016 by iCatButler *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
#include "pgxp.h" #include "pgxp.h"
#include "bus.h" #include "bus.h"
#include "common/log.h"
#include "cpu_core.h" #include "cpu_core.h"
#include "settings.h" #include "settings.h"
#include "common/log.h"
#include <climits> #include <climits>
#include <cmath> #include <cmath>
Log_SetChannel(PGXP); Log_SetChannel(PGXP);
namespace PGXP { namespace PGXP {
@ -50,19 +36,19 @@ enum : u32
#define VALID_ALL (VALID_0 | VALID_1 | VALID_2 | VALID_3) #define VALID_ALL (VALID_0 | VALID_1 | VALID_2 | VALID_3)
#define INV_VALID_ALL (ALL ^ VALID_ALL) #define INV_VALID_ALL (ALL ^ VALID_ALL)
typedef struct PGXP_value_Tag struct PGXP_value
{ {
float x; float x;
float y; float y;
float z; float z;
union union
{ {
unsigned int flags; u32 flags;
unsigned char compFlags[4]; u8 compFlags[4];
unsigned short halfFlags[2]; u16 halfFlags[2];
}; };
unsigned int value; u32 value;
} PGXP_value; };
typedef union typedef union
{ {
@ -184,7 +170,7 @@ ALWAYS_INLINE_RELEASE void ValidateAndCopyMem(PGXP_value* dest, u32 addr, u32 va
*dest = PGXP_value_invalid; *dest = PGXP_value_invalid;
} }
ALWAYS_INLINE_RELEASE static void ValidateAndCopyMem16(PGXP_value* dest, u32 addr, u32 value, int sign) ALWAYS_INLINE_RELEASE static void ValidateAndCopyMem16(PGXP_value* dest, u32 addr, u32 value, bool sign)
{ {
u32 validMask = 0; u32 validMask = 0;
psx_value val, mask; psx_value val, mask;
@ -333,13 +319,13 @@ void Shutdown()
} }
// Instruction register decoding // Instruction register decoding
#define op(_instr) (_instr >> 26) // The op part of the instruction register #define op(_instr) (_instr >> 26) // The op part of the instruction register
#define func(_instr) ((_instr)&0x3F) // The funct part of the instruction register #define func(_instr) ((_instr)&0x3F) // The funct part of the instruction register
#define sa(_instr) ((_instr >> 6) & 0x1F) // The sa part of the instruction register #define sa(_instr) ((_instr >> 6) & 0x1F) // The sa part of the instruction register
#define rd(_instr) ((_instr >> 11) & 0x1F) // The rd part of the instruction register #define rd(_instr) ((_instr >> 11) & 0x1F) // The rd part of the instruction register
#define rt(_instr) ((_instr >> 16) & 0x1F) // The rt part of the instruction register #define rt(_instr) ((_instr >> 16) & 0x1F) // The rt part of the instruction register
#define rs(_instr) ((_instr >> 21) & 0x1F) // The rs part of the instruction register #define rs(_instr) ((_instr >> 21) & 0x1F) // The rs part of the instruction register
#define imm(_instr) (_instr & 0xFFFF) // The immediate part of the instruction register #define imm(_instr) (_instr & 0xFFFF) // The immediate part of the instruction register
#define cop2idx(_instr) (((_instr >> 11) & 0x1F) | ((_instr >> 17) & 0x20)) #define cop2idx(_instr) (((_instr >> 11) & 0x1F) | ((_instr >> 17) & 0x20))
#define SX0 (GTE_regs[12].x) #define SX0 (GTE_regs[12].x)
@ -548,13 +534,13 @@ bool GetPreciseVertex(u32 addr, u32 value, int x, int y, int xOffs, int yOffs, f
} }
// Instruction register decoding // Instruction register decoding
#define op(_instr) (_instr >> 26) // The op part of the instruction register #define op(_instr) (_instr >> 26) // The op part of the instruction register
#define func(_instr) ((_instr)&0x3F) // The funct part of the instruction register #define func(_instr) ((_instr)&0x3F) // The funct part of the instruction register
#define sa(_instr) ((_instr >> 6) & 0x1F) // The sa part of the instruction register #define sa(_instr) ((_instr >> 6) & 0x1F) // The sa part of the instruction register
#define rd(_instr) ((_instr >> 11) & 0x1F) // The rd part of the instruction register #define rd(_instr) ((_instr >> 11) & 0x1F) // The rd part of the instruction register
#define rt(_instr) ((_instr >> 16) & 0x1F) // The rt part of the instruction register #define rt(_instr) ((_instr >> 16) & 0x1F) // The rt part of the instruction register
#define rs(_instr) ((_instr >> 21) & 0x1F) // The rs part of the instruction register #define rs(_instr) ((_instr >> 21) & 0x1F) // The rs part of the instruction register
#define imm(_instr) (_instr & 0xFFFF) // The immediate part of the instruction register #define imm(_instr) (_instr & 0xFFFF) // The immediate part of the instruction register
#define imm_sext(_instr) \ #define imm_sext(_instr) \
static_cast<s32>(static_cast<s16>(_instr & 0xFFFF)) // The immediate part of the instruction register static_cast<s32>(static_cast<s16>(_instr & 0xFFFF)) // The immediate part of the instruction register
@ -569,10 +555,16 @@ void CPU_LBx(u32 instr, u32 addr, u32 rtVal)
CPU_reg[rt(instr)] = PGXP_value_invalid; CPU_reg[rt(instr)] = PGXP_value_invalid;
} }
void CPU_LHx(u32 instr, u32 addr, u32 rtVal) void CPU_LH(u32 instr, u32 addr, u32 rtVal)
{ {
// Rt = Mem[Rs + Im] (sign/zero extended) // Rt = Mem[Rs + Im] (sign extended)
ValidateAndCopyMem16(&CPU_reg[rt(instr)], addr, rtVal, 1); ValidateAndCopyMem16(&CPU_reg[rt(instr)], addr, rtVal, true);
}
void CPU_LHU(u32 instr, u32 addr, u32 rtVal)
{
// Rt = Mem[Rs + Im] (zero extended)
ValidateAndCopyMem16(&CPU_reg[rt(instr)], addr, rtVal, false);
} }
void CPU_SB(u32 instr, u32 addr, u32 rtVal) void CPU_SB(u32 instr, u32 addr, u32 rtVal)
@ -782,7 +774,15 @@ void CPU_ADD(u32 instr, u32 rsVal, u32 rtVal)
Validate(&CPU_reg[rs(instr)], rsVal); Validate(&CPU_reg[rs(instr)], rsVal);
Validate(&CPU_reg[rt(instr)], rtVal); Validate(&CPU_reg[rt(instr)], rtVal);
if (rtVal != 0) if (rtVal == 0)
{
ret = CPU_reg[rs(instr)];
}
else if (rsVal == 0)
{
ret = CPU_reg[rt(instr)];
}
else
{ {
// iCB: Only require one valid input // iCB: Only require one valid input
if (((CPU_reg[rt(instr)].flags & VALID_01) != VALID_01) != ((CPU_reg[rs(instr)].flags & VALID_01) != VALID_01)) if (((CPU_reg[rt(instr)].flags & VALID_01) != VALID_01) != ((CPU_reg[rs(instr)].flags & VALID_01) != VALID_01))
@ -809,10 +809,6 @@ void CPU_ADD(u32 instr, u32 rsVal, u32 rtVal)
ret.halfFlags[0] &= CPU_reg[rt(instr)].halfFlags[0]; ret.halfFlags[0] &= CPU_reg[rt(instr)].halfFlags[0];
} }
else
{
ret = CPU_reg[rs(instr)];
}
ret.value = rsVal + rtVal; ret.value = rsVal + rtVal;

View file

@ -1,22 +1,5 @@
/*************************************************************************** // SPDX-FileCopyrightText: 2016 iCatButler, 2019-2023 Connor McLaughlin <stenzek@gmail.com>
* Original copyright notice from PGXP code from Beetle PSX. * // SPDX-License-Identifier: GPL-2.0+
* Copyright (C) 2016 by iCatButler *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
#pragma once #pragma once
#include "types.h" #include "types.h"
@ -45,7 +28,8 @@ bool GetPreciseVertex(u32 addr, u32 value, int x, int y, int xOffs, int yOffs, f
// -- CPU functions // -- CPU functions
void CPU_LW(u32 instr, u32 addr, u32 rtVal); void CPU_LW(u32 instr, u32 addr, u32 rtVal);
void CPU_LHx(u32 instr, u32 addr, u32 rtVal); void CPU_LH(u32 instr, u32 addr, u32 rtVal);
void CPU_LHU(u32 instr, u32 addr, u32 rtVal);
void CPU_LBx(u32 instr, u32 addr, u32 rtVal); void CPU_LBx(u32 instr, u32 addr, u32 rtVal);
void CPU_SB(u32 instr, u32 addr, u32 rtVal); void CPU_SB(u32 instr, u32 addr, u32 rtVal);
void CPU_SH(u32 instr, u32 addr, u32 rtVal); void CPU_SH(u32 instr, u32 addr, u32 rtVal);

View file

@ -191,14 +191,15 @@ static const Controller::ControllerBindingInfo s_binding_info[] = {
// clang-format off // clang-format off
BUTTON("Left", TRANSLATE_NOOP("PlayStationMouse", "Left Button"), PlayStationMouse::Button::Left, GenericInputBinding::Cross), BUTTON("Left", TRANSLATE_NOOP("PlayStationMouse", "Left Button"), PlayStationMouse::Button::Left, GenericInputBinding::Cross),
BUTTON("Right", TRANSLATE_NOOP("PlayStationMouse", "Right Button"), PlayStationMouse::Button::Right, GenericInputBinding::Circle), BUTTON("Right", TRANSLATE_NOOP("PlayStationMouse", "Right Button"), PlayStationMouse::Button::Right, GenericInputBinding::Circle),
// clang-format on // clang-format on
#undef BUTTON #undef BUTTON
}; };
static const SettingInfo s_settings[] = { static const SettingInfo s_settings[] = {
{SettingInfo::Type::Boolean, "RelativeMouseMode", TRANSLATE_NOOP("PlayStationMouse", "Relative Mouse Mode"), {SettingInfo::Type::Boolean, "RelativeMouseMode", TRANSLATE_NOOP("PlayStationMouse", "Relative Mouse Mode"),
TRANSLATE_NOOP("PlayStationMouse", "Locks the mouse cursor to the window, use for FPS games."), "false"}, TRANSLATE_NOOP("PlayStationMouse", "Locks the mouse cursor to the window, use for FPS games."), "false", nullptr,
nullptr, nullptr, nullptr, nullptr, 0.0f},
}; };
const Controller::ControllerInfo PlayStationMouse::INFO = {ControllerType::PlayStationMouse, const Controller::ControllerInfo PlayStationMouse::INFO = {ControllerType::PlayStationMouse,

View file

@ -101,8 +101,6 @@ static std::string GetExecutableNameForImage(ISOReader& iso, bool strip_subdirec
static bool ReadExecutableFromImage(ISOReader& iso, std::string* out_executable_name, static bool ReadExecutableFromImage(ISOReader& iso, std::string* out_executable_name,
std::vector<u8>* out_executable_data); std::vector<u8>* out_executable_data);
static void StallCPU(TickCount ticks);
static bool LoadBIOS(const std::string& override_bios_path); static bool LoadBIOS(const std::string& override_bios_path);
static void InternalReset(); static void InternalReset();
static void ClearRunningGame(); static void ClearRunningGame();
@ -2927,10 +2925,6 @@ bool SetExpansionROM(const char* filename)
return true; return true;
} }
void System::StallCPU(TickCount ticks)
{
CPU::AddPendingTicks(ticks);
}
#endif #endif
Controller* System::GetController(u32 slot) Controller* System::GetController(u32 slot)
@ -3207,6 +3201,10 @@ void System::UpdateMultitaps()
Pad::GetMultitap(1)->SetEnable(true, 4); Pad::GetMultitap(1)->SetEnable(true, 4);
} }
break; break;
default:
UnreachableCode();
break;
} }
} }

View file

@ -27,8 +27,7 @@ struct ImageInfo;
struct Hash; struct Hash;
} // namespace BIOS } // namespace BIOS
namespace GameDatabase namespace GameDatabase {
{
struct Entry; struct Entry;
} }
@ -79,7 +78,10 @@ enum : u32
{ {
// 5 megabytes is sufficient for now, at the moment they're around 4.3MB, or 10.3MB with 8MB RAM enabled. // 5 megabytes is sufficient for now, at the moment they're around 4.3MB, or 10.3MB with 8MB RAM enabled.
MAX_SAVE_STATE_SIZE = 11 * 1024 * 1024, MAX_SAVE_STATE_SIZE = 11 * 1024 * 1024,
};
enum : s32
{
PER_GAME_SAVE_STATE_SLOTS = 10, PER_GAME_SAVE_STATE_SLOTS = 10,
GLOBAL_SAVE_STATE_SLOTS = 10 GLOBAL_SAVE_STATE_SLOTS = 10
}; };
@ -477,8 +479,7 @@ void UpdateMemorySaveStateSettings();
bool LoadRewindState(u32 skip_saves = 0, bool consume_state = true); bool LoadRewindState(u32 skip_saves = 0, bool consume_state = true);
void SetRunaheadReplayFlag(); void SetRunaheadReplayFlag();
namespace Internal namespace Internal {
{
/// Called on process startup. /// Called on process startup.
void ProcessStartup(); void ProcessStartup();
@ -487,7 +488,7 @@ void ProcessShutdown();
/// Polls input, updates subsystems which are present while paused/inactive. /// Polls input, updates subsystems which are present while paused/inactive.
void IdlePollUpdate(); void IdlePollUpdate();
} } // namespace Internal
} // namespace System } // namespace System

View file

@ -177,6 +177,9 @@ void Timers::SetGate(u32 timer, bool state)
case SyncMode::FreeRunOnGate: case SyncMode::FreeRunOnGate:
cs.mode.sync_enable = false; cs.mode.sync_enable = false;
break; break;
default:
break;
} }
} }

View file

@ -758,6 +758,7 @@ void Host::OnAchievementsRefreshed()
void Host::SetMouseMode(bool relative, bool hide_cursor) void Host::SetMouseMode(bool relative, bool hide_cursor)
{ {
#if 0
// TODO: Find a better home for this. // TODO: Find a better home for this.
if (InputManager::HasPointerAxisBinds()) if (InputManager::HasPointerAxisBinds())
{ {
@ -766,6 +767,7 @@ void Host::SetMouseMode(bool relative, bool hide_cursor)
} }
// emit g_emu_thread->mouseModeRequested(relative, hide_cursor); // emit g_emu_thread->mouseModeRequested(relative, hide_cursor);
#endif
} }
void Host::PumpMessagesOnCPUThread() void Host::PumpMessagesOnCPUThread()

View file

@ -2,19 +2,21 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "win32_nogui_platform.h" #include "win32_nogui_platform.h"
#include "common/log.h"
#include "common/scoped_guard.h"
#include "common/string_util.h"
#include "common/threading.h"
#include "core/host.h"
#include "util/imgui_manager.h"
#include "nogui_host.h" #include "nogui_host.h"
#include "resource.h" #include "resource.h"
#include "win32_key_names.h" #include "win32_key_names.h"
#include "core/host.h"
#include "util/imgui_manager.h"
#include "common/scoped_guard.h"
#include "common/string_util.h"
#include "common/threading.h"
#include <Dbt.h> #include <Dbt.h>
#include <shellapi.h> #include <shellapi.h>
#include <tchar.h> #include <tchar.h>
Log_SetChannel(Win32HostInterface);
static constexpr LPCWSTR WINDOW_CLASS_NAME = L"DuckStationNoGUI"; static constexpr LPCWSTR WINDOW_CLASS_NAME = L"DuckStationNoGUI";
static constexpr DWORD WINDOWED_STYLE = WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX; static constexpr DWORD WINDOWED_STYLE = WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX;
@ -126,7 +128,8 @@ bool Win32NoGUIPlatform::CreatePlatformWindow(std::string title)
SetFullscreen(true); SetFullscreen(true);
// We use these notifications to detect when a controller is connected or disconnected. // We use these notifications to detect when a controller is connected or disconnected.
DEV_BROADCAST_DEVICEINTERFACE_W filter = {sizeof(DEV_BROADCAST_DEVICEINTERFACE_W), DBT_DEVTYP_DEVICEINTERFACE}; DEV_BROADCAST_DEVICEINTERFACE_W filter = {
sizeof(DEV_BROADCAST_DEVICEINTERFACE_W), DBT_DEVTYP_DEVICEINTERFACE, 0, {}, {}};
m_dev_notify_handle = m_dev_notify_handle =
RegisterDeviceNotificationW(hwnd, &filter, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES); RegisterDeviceNotificationW(hwnd, &filter, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
@ -247,7 +250,7 @@ void Win32NoGUIPlatform::SetFullscreen(bool enabled)
if (!monitor) if (!monitor)
return; return;
MONITORINFO mi = {sizeof(MONITORINFO)}; MONITORINFO mi = {sizeof(MONITORINFO), {}, {}, 0u};
if (!GetMonitorInfo(monitor, &mi) || !GetWindowRect(m_hwnd, &m_windowed_rect)) if (!GetMonitorInfo(monitor, &mi) || !GetWindowRect(m_hwnd, &m_windowed_rect))
return; return;

View file

@ -174,7 +174,8 @@ void MainWindow::registerForDeviceNotifications()
{ {
#ifdef _WIN32 #ifdef _WIN32
// We use these notifications to detect when a controller is connected or disconnected. // We use these notifications to detect when a controller is connected or disconnected.
DEV_BROADCAST_DEVICEINTERFACE_W filter = {sizeof(DEV_BROADCAST_DEVICEINTERFACE_W), DBT_DEVTYP_DEVICEINTERFACE}; DEV_BROADCAST_DEVICEINTERFACE_W filter = {
sizeof(DEV_BROADCAST_DEVICEINTERFACE_W), DBT_DEVTYP_DEVICEINTERFACE, 0u, {}, {}};
m_device_notification_handle = RegisterDeviceNotificationW( m_device_notification_handle = RegisterDeviceNotificationW(
(HANDLE)winId(), &filter, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES); (HANDLE)winId(), &filter, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
#endif #endif

View file

@ -213,7 +213,7 @@ void SettingsDialog::setCategory(const char* category)
void SettingsDialog::onCategoryCurrentRowChanged(int row) void SettingsDialog::onCategoryCurrentRowChanged(int row)
{ {
DebugAssert(row < MAX_SETTINGS_WIDGETS); DebugAssert(row < static_cast<int>(MAX_SETTINGS_WIDGETS));
m_ui.settingsContainer->setCurrentIndex(row); m_ui.settingsContainer->setCurrentIndex(row);
m_ui.helpText->setText(m_category_help_text[row]); m_ui.helpText->setText(m_category_help_text[row]);
} }

View file

@ -34,7 +34,6 @@ static void PrintCommandLineHelp(const char* progname);
static bool InitializeConfig(); static bool InitializeConfig();
static void InitializeEarlyConsole(); static void InitializeEarlyConsole();
static void HookSignals(); static void HookSignals();
static void SetAppRoot();
static bool SetFolders(); static bool SetFolders();
static std::string GetFrameDumpFilename(u32 frame); static std::string GetFrameDumpFilename(u32 frame);
} // namespace RegTestHost } // namespace RegTestHost

View file

@ -144,6 +144,12 @@ public:
BitField<u8, bool, 6, 1> data; BitField<u8, bool, 6, 1> data;
BitField<u8, bool, 7, 1> four_channel_audio; BitField<u8, bool, 7, 1> four_channel_audio;
Control() = default;
Control(u8 bits_) : bits(bits_) {}
Control(const Control& rhs) : bits(rhs.bits) {}
Control& operator=(const Control& rhs) Control& operator=(const Control& rhs)
{ {
bits = rhs.bits; bits = rhs.bits;
@ -170,11 +176,15 @@ public:
static u16 ComputeCRC(const Data& data); static u16 ComputeCRC(const Data& data);
Control GetControl() const { return Control{control_bits}; } Control GetControl() const { return Control(control_bits); }
bool IsData() const { return GetControl().data; } bool IsData() const { return GetControl().data; }
bool IsCRCValid() const; bool IsCRCValid() const;
SubChannelQ() = default;
SubChannelQ(const SubChannelQ& q) : data(q.data) {}
SubChannelQ& operator=(const SubChannelQ& q) SubChannelQ& operator=(const SubChannelQ& q)
{ {
data = q.data; data = q.data;
@ -233,42 +243,15 @@ public:
ProgressCallback* progress = ProgressCallback::NullProgressCallback); ProgressCallback* progress = ProgressCallback::NullProgressCallback);
// Accessors. // Accessors.
const std::string& GetFileName() const const std::string& GetFileName() const { return m_filename; }
{ LBA GetPositionOnDisc() const { return m_position_on_disc; }
return m_filename; Position GetMSFPositionOnDisc() const { return Position::FromLBA(m_position_on_disc); }
} LBA GetPositionInTrack() const { return m_position_in_track; }
LBA GetPositionOnDisc() const Position GetMSFPositionInTrack() const { return Position::FromLBA(m_position_in_track); }
{ LBA GetLBACount() const { return m_lba_count; }
return m_position_on_disc; u32 GetIndexNumber() const { return m_current_index->index_number; }
} u32 GetTrackNumber() const { return m_current_index->track_number; }
Position GetMSFPositionOnDisc() const u32 GetTrackCount() const { return static_cast<u32>(m_tracks.size()); }
{
return Position::FromLBA(m_position_on_disc);
}
LBA GetPositionInTrack() const
{
return m_position_in_track;
}
Position GetMSFPositionInTrack() const
{
return Position::FromLBA(m_position_in_track);
}
LBA GetLBACount() const
{
return m_lba_count;
}
u32 GetIndexNumber() const
{
return m_current_index->index_number;
}
u32 GetTrackNumber() const
{
return m_current_index->track_number;
}
u32 GetTrackCount() const
{
return static_cast<u32>(m_tracks.size());
}
LBA GetTrackStartPosition(u8 track) const; LBA GetTrackStartPosition(u8 track) const;
Position GetTrackStartMSFPosition(u8 track) const; Position GetTrackStartMSFPosition(u8 track) const;
LBA GetTrackLength(u8 track) const; LBA GetTrackLength(u8 track) const;
@ -276,26 +259,11 @@ public:
TrackMode GetTrackMode(u8 track) const; TrackMode GetTrackMode(u8 track) const;
LBA GetTrackIndexPosition(u8 track, u8 index) const; LBA GetTrackIndexPosition(u8 track, u8 index) const;
LBA GetTrackIndexLength(u8 track, u8 index) const; LBA GetTrackIndexLength(u8 track, u8 index) const;
u32 GetFirstTrackNumber() const u32 GetFirstTrackNumber() const { return m_tracks.front().track_number; }
{ u32 GetLastTrackNumber() const { return m_tracks.back().track_number; }
return m_tracks.front().track_number; u32 GetIndexCount() const { return static_cast<u32>(m_indices.size()); }
} const std::vector<Track>& GetTracks() const { return m_tracks; }
u32 GetLastTrackNumber() const const std::vector<Index>& GetIndices() const { return m_indices; }
{
return m_tracks.back().track_number;
}
u32 GetIndexCount() const
{
return static_cast<u32>(m_indices.size());
}
const std::vector<Track>& GetTracks() const
{
return m_tracks;
}
const std::vector<Index>& GetIndices() const
{
return m_indices;
}
const Track& GetTrack(u32 track) const; const Track& GetTrack(u32 track) const;
const Index& GetIndex(u32 i) const; const Index& GetIndex(u32 i) const;

View file

@ -135,8 +135,8 @@ bool CDImageDeviceWin32::Open(const char* filename, Error* error)
} }
// Set it to 4x speed. A good balance between readahead and spinning up way too high. // Set it to 4x speed. A good balance between readahead and spinning up way too high.
static constexpr u32 READ_SPEED_MULTIPLIER = 4; static constexpr u32 READ_SPEED_MULTIPLIER = 8;
static constexpr u32 READ_SPEED_KBS = (DATA_SECTOR_SIZE * FRAMES_PER_SECOND * 8) / 1024; static constexpr u32 READ_SPEED_KBS = (DATA_SECTOR_SIZE * FRAMES_PER_SECOND * READ_SPEED_MULTIPLIER) / 1024;
CDROM_SET_SPEED set_speed = {CdromSetSpeed, READ_SPEED_KBS, 0, CdromDefaultRotation}; CDROM_SET_SPEED set_speed = {CdromSetSpeed, READ_SPEED_KBS, 0, CdromDefaultRotation};
if (!DeviceIoControl(m_hDevice, IOCTL_CDROM_SET_SPEED, &set_speed, sizeof(set_speed), nullptr, 0, nullptr, nullptr)) if (!DeviceIoControl(m_hDevice, IOCTL_CDROM_SET_SPEED, &set_speed, sizeof(set_speed), nullptr, 0, nullptr, nullptr))
Log_WarningPrintf("DeviceIoControl(IOCTL_CDROM_SET_SPEED) failed: %08X", GetLastError()); Log_WarningPrintf("DeviceIoControl(IOCTL_CDROM_SET_SPEED) failed: %08X", GetLastError());

View file

@ -33,7 +33,7 @@ void SetD3DDebugObjectName(ID3D11DeviceChild* obj, const std::string_view& name)
{ {
#ifdef _DEBUG #ifdef _DEBUG
// WKPDID_D3DDebugObjectName // WKPDID_D3DDebugObjectName
static constexpr GUID guid = {0x429b8c22, 0x9188, 0x4b0c, 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00}; static constexpr GUID guid = {0x429b8c22, 0x9188, 0x4b0c, {0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00}};
UINT existing_data_size; UINT existing_data_size;
HRESULT hr = obj->GetPrivateData(guid, &existing_data_size, nullptr); HRESULT hr = obj->GetPrivateData(guid, &existing_data_size, nullptr);

View file

@ -82,10 +82,11 @@ std::unique_ptr<GPUShader> D3D11Device::CreateShaderFromBinary(GPUShaderStage st
default: default:
UnreachableCode(); UnreachableCode();
hr = S_FALSE;
break; break;
} }
if (!shader) if (FAILED(hr) || !shader)
return {}; return {};
return std::unique_ptr<GPUShader>(new D3D11Shader(stage, std::move(shader), std::move(bytecode))); return std::unique_ptr<GPUShader>(new D3D11Shader(stage, std::move(shader), std::move(bytecode)));

View file

@ -16,7 +16,7 @@ bool D3D12DescriptorHeapManager::Create(ID3D12Device* device, D3D12_DESCRIPTOR_H
{ {
D3D12_DESCRIPTOR_HEAP_DESC desc = {type, static_cast<UINT>(num_descriptors), D3D12_DESCRIPTOR_HEAP_DESC desc = {type, static_cast<UINT>(num_descriptors),
shader_visible ? D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE : shader_visible ? D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE :
D3D12_DESCRIPTOR_HEAP_FLAG_NONE}; D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0u};
HRESULT hr = device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(m_descriptor_heap.ReleaseAndGetAddressOf())); HRESULT hr = device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(m_descriptor_heap.ReleaseAndGetAddressOf()));
if (FAILED(hr)) if (FAILED(hr))
@ -44,10 +44,12 @@ bool D3D12DescriptorHeapManager::Create(ID3D12Device* device, D3D12_DESCRIPTOR_H
void D3D12DescriptorHeapManager::Destroy() void D3D12DescriptorHeapManager::Destroy()
{ {
#ifdef _DEBUG
for (BitSetType& bs : m_free_slots) for (BitSetType& bs : m_free_slots)
{ {
DebugAssert(bs.all()); DebugAssert(bs.all());
} }
#endif
m_shader_visible = false; m_shader_visible = false;
m_num_descriptors = 0; m_num_descriptors = 0;
@ -111,7 +113,7 @@ D3D12DescriptorAllocator::~D3D12DescriptorAllocator() = default;
bool D3D12DescriptorAllocator::Create(ID3D12Device* device, D3D12_DESCRIPTOR_HEAP_TYPE type, u32 num_descriptors) bool D3D12DescriptorAllocator::Create(ID3D12Device* device, D3D12_DESCRIPTOR_HEAP_TYPE type, u32 num_descriptors)
{ {
const D3D12_DESCRIPTOR_HEAP_DESC desc = {type, static_cast<UINT>(num_descriptors), const D3D12_DESCRIPTOR_HEAP_DESC desc = {type, static_cast<UINT>(num_descriptors),
D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE}; D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, 0u};
const HRESULT hr = device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(m_descriptor_heap.ReleaseAndGetAddressOf())); const HRESULT hr = device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(m_descriptor_heap.ReleaseAndGetAddressOf()));
if (FAILED(hr)) if (FAILED(hr))
{ {

View file

@ -58,7 +58,7 @@ enum : u32
// We need to synchronize instance creation because of adapter enumeration from the UI thread. // We need to synchronize instance creation because of adapter enumeration from the UI thread.
static std::mutex s_instance_mutex; static std::mutex s_instance_mutex;
static constexpr D3D12_CLEAR_VALUE s_present_clear_color = {DXGI_FORMAT_R8G8B8A8_UNORM, {0.0f, 0.0f, 0.0f, 1.0f}}; static constexpr D3D12_CLEAR_VALUE s_present_clear_color = {DXGI_FORMAT_R8G8B8A8_UNORM, {{0.0f, 0.0f, 0.0f, 1.0f}}};
static constexpr GPUTexture::Format s_swap_chain_format = GPUTexture::Format::RGBA8; static constexpr GPUTexture::Format s_swap_chain_format = GPUTexture::Format::RGBA8;
// We just need to keep this alive, never reference it. // We just need to keep this alive, never reference it.
@ -82,19 +82,6 @@ D3D12Device::~D3D12Device()
Assert(s_pipeline_cache_data.empty()); Assert(s_pipeline_cache_data.empty());
} }
static constexpr u32 GetActiveTexturesForLayout(GPUPipeline::Layout layout)
{
constexpr std::array<u8, static_cast<u8>(GPUPipeline::Layout::MaxCount)> counts = {
1, // SingleTextureAndUBO
1, // SingleTextureAndPushConstants
0, // SingleTextureBufferAndPushConstants
GPUDevice::MAX_TEXTURE_SAMPLERS, // MultiTextureAndUBO
GPUDevice::MAX_TEXTURE_SAMPLERS, // MultiTextureAndPushConstants
};
return counts[static_cast<u8>(layout)];
}
D3D12Device::ComPtr<ID3DBlob> D3D12Device::SerializeRootSignature(const D3D12_ROOT_SIGNATURE_DESC* desc) D3D12Device::ComPtr<ID3DBlob> D3D12Device::SerializeRootSignature(const D3D12_ROOT_SIGNATURE_DESC* desc)
{ {
ComPtr<ID3DBlob> blob; ComPtr<ID3DBlob> blob;
@ -202,7 +189,7 @@ bool D3D12Device::CreateDevice(const std::string_view& adapter, bool threaded_pr
} }
const D3D12_COMMAND_QUEUE_DESC queue_desc = {D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL, const D3D12_COMMAND_QUEUE_DESC queue_desc = {D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL,
D3D12_COMMAND_QUEUE_FLAG_NONE}; D3D12_COMMAND_QUEUE_FLAG_NONE, 0u};
hr = m_device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&m_command_queue)); hr = m_device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&m_command_queue));
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -468,8 +455,8 @@ bool D3D12Device::CreateDescriptorHeaps()
} }
// Allocate null SRV descriptor for unbound textures. // Allocate null SRV descriptor for unbound textures.
constexpr D3D12_SHADER_RESOURCE_VIEW_DESC null_srv_desc = {DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_SRV_DIMENSION_TEXTURE2D, static constexpr D3D12_SHADER_RESOURCE_VIEW_DESC null_srv_desc = {
D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING}; DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_SRV_DIMENSION_TEXTURE2D, D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING, {}};
if (!m_descriptor_heap_manager.Allocate(&m_null_srv_descriptor)) if (!m_descriptor_heap_manager.Allocate(&m_null_srv_descriptor))
{ {
@ -629,7 +616,7 @@ bool D3D12Device::CreateTimestampQuery()
constexpr u32 QUERY_COUNT = NUM_TIMESTAMP_QUERIES_PER_CMDLIST * NUM_COMMAND_LISTS; constexpr u32 QUERY_COUNT = NUM_TIMESTAMP_QUERIES_PER_CMDLIST * NUM_COMMAND_LISTS;
constexpr u32 BUFFER_SIZE = sizeof(u64) * QUERY_COUNT; constexpr u32 BUFFER_SIZE = sizeof(u64) * QUERY_COUNT;
const D3D12_QUERY_HEAP_DESC desc = {D3D12_QUERY_HEAP_TYPE_TIMESTAMP, QUERY_COUNT}; const D3D12_QUERY_HEAP_DESC desc = {D3D12_QUERY_HEAP_TYPE_TIMESTAMP, QUERY_COUNT, 0u};
HRESULT hr = m_device->CreateQueryHeap(&desc, IID_PPV_ARGS(m_timestamp_query_heap.GetAddressOf())); HRESULT hr = m_device->CreateQueryHeap(&desc, IID_PPV_ARGS(m_timestamp_query_heap.GetAddressOf()));
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -638,7 +625,8 @@ bool D3D12Device::CreateTimestampQuery()
return false; return false;
} }
const D3D12MA::ALLOCATION_DESC allocation_desc = {D3D12MA::ALLOCATION_FLAG_NONE, D3D12_HEAP_TYPE_READBACK}; const D3D12MA::ALLOCATION_DESC allocation_desc = {D3D12MA::ALLOCATION_FLAG_NONE, D3D12_HEAP_TYPE_READBACK,
D3D12_HEAP_FLAG_NONE, nullptr, nullptr};
const D3D12_RESOURCE_DESC resource_desc = {D3D12_RESOURCE_DIMENSION_BUFFER, const D3D12_RESOURCE_DESC resource_desc = {D3D12_RESOURCE_DIMENSION_BUFFER,
0, 0,
BUFFER_SIZE, BUFFER_SIZE,
@ -878,7 +866,7 @@ bool D3D12Device::CreateSwapChainRTV()
if (FAILED(hr)) if (FAILED(hr))
return false; return false;
const D3D12_RENDER_TARGET_VIEW_DESC rtv_desc = {swap_chain_desc.BufferDesc.Format, D3D12_RTV_DIMENSION_TEXTURE2D}; const D3D12_RENDER_TARGET_VIEW_DESC rtv_desc = {swap_chain_desc.BufferDesc.Format, D3D12_RTV_DIMENSION_TEXTURE2D, {}};
for (u32 i = 0; i < swap_chain_desc.BufferCount; i++) for (u32 i = 0; i < swap_chain_desc.BufferCount; i++)
{ {
@ -1038,7 +1026,7 @@ bool D3D12Device::SupportsTextureFormat(GPUTexture::Format format) const
if (dfmt == DXGI_FORMAT_UNKNOWN) if (dfmt == DXGI_FORMAT_UNKNOWN)
return false; return false;
D3D12_FEATURE_DATA_FORMAT_SUPPORT support = {dfmt}; D3D12_FEATURE_DATA_FORMAT_SUPPORT support = {dfmt, {}, {}};
return SUCCEEDED(m_device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &support, sizeof(support))) && return SUCCEEDED(m_device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &support, sizeof(support))) &&
(support.Support1 & required) == required; (support.Support1 & required) == required;
} }
@ -1189,7 +1177,8 @@ void D3D12Device::SetFeatures()
m_max_multisamples = 1; m_max_multisamples = 1;
for (u32 multisamples = 2; multisamples < D3D12_MAX_MULTISAMPLE_SAMPLE_COUNT; multisamples++) for (u32 multisamples = 2; multisamples < D3D12_MAX_MULTISAMPLE_SAMPLE_COUNT; multisamples++)
{ {
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS fd = {DXGI_FORMAT_R8G8B8A8_UNORM, static_cast<UINT>(multisamples)}; D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS fd = {DXGI_FORMAT_R8G8B8A8_UNORM, static_cast<UINT>(multisamples),
D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE, 0u};
if (SUCCEEDED(m_device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &fd, sizeof(fd))) && if (SUCCEEDED(m_device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &fd, sizeof(fd))) &&
fd.NumQualityLevels > 0) fd.NumQualityLevels > 0)
@ -1660,8 +1649,8 @@ void D3D12Device::BeginRenderPass()
// Re-rendering to swap chain. // Re-rendering to swap chain.
const auto& swap_chain_buf = m_swap_chain_buffers[m_current_swap_chain_buffer]; const auto& swap_chain_buf = m_swap_chain_buffers[m_current_swap_chain_buffer];
rt_desc = {swap_chain_buf.second, rt_desc = {swap_chain_buf.second,
{D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE}, {D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE, {}},
{D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE}}; {D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE, {}}};
rt_desc_p = &rt_desc; rt_desc_p = &rt_desc;
} }
@ -1705,7 +1694,7 @@ void D3D12Device::BeginSwapChainRenderPass()
const D3D12_RENDER_PASS_RENDER_TARGET_DESC rt_desc = { const D3D12_RENDER_PASS_RENDER_TARGET_DESC rt_desc = {
swap_chain_buf.second, swap_chain_buf.second,
{D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR, {s_present_clear_color}}, {D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR, {s_present_clear_color}},
{D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE}}; {D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE, {}}};
cmdlist->BeginRenderPass(1, &rt_desc, nullptr, D3D12_RENDER_PASS_FLAG_NONE); cmdlist->BeginRenderPass(1, &rt_desc, nullptr, D3D12_RENDER_PASS_FLAG_NONE);
m_current_framebuffer = nullptr; m_current_framebuffer = nullptr;
@ -1875,8 +1864,6 @@ void D3D12Device::SetScissor(ID3D12GraphicsCommandList4* cmdlist)
void D3D12Device::SetTextureSampler(u32 slot, GPUTexture* texture, GPUSampler* sampler) void D3D12Device::SetTextureSampler(u32 slot, GPUTexture* texture, GPUSampler* sampler)
{ {
D3D12DescriptorHandle null_handle;
D3D12Texture* T = static_cast<D3D12Texture*>(texture); D3D12Texture* T = static_cast<D3D12Texture*>(texture);
if (m_current_textures[slot] != T) if (m_current_textures[slot] != T)
{ {
@ -1984,7 +1971,7 @@ void D3D12Device::PreDrawCheck()
return; return;
} }
} }
else if (dirty & DIRTY_FLAG_CONSTANT_BUFFER | DIRTY_FLAG_TEXTURES | DIRTY_FLAG_SAMPLERS) else if (dirty & (DIRTY_FLAG_CONSTANT_BUFFER | DIRTY_FLAG_TEXTURES | DIRTY_FLAG_SAMPLERS))
{ {
if (!UpdateRootParameters(dirty)) if (!UpdateRootParameters(dirty))
{ {

View file

@ -15,8 +15,6 @@
Log_SetChannel(D3D12Device); Log_SetChannel(D3D12Device);
static u32 s_next_bad_shader_id = 1;
D3D12Shader::D3D12Shader(GPUShaderStage stage, Bytecode bytecode) : GPUShader(stage), m_bytecode(std::move(bytecode)) D3D12Shader::D3D12Shader(GPUShaderStage stage, Bytecode bytecode) : GPUShader(stage), m_bytecode(std::move(bytecode))
{ {
} }

View file

@ -160,16 +160,17 @@ std::unique_ptr<GPUTexture> D3D12Device::CreateTexture(u32 width, u32 height, u3
break; break;
} }
if (uav_format != DXGI_FORMAT_UNKNOWN && !CreateUAVDescriptor(resource.Get(), samples, fm.dsv_format, &uav_descriptor)) if (uav_format != DXGI_FORMAT_UNKNOWN &&
!CreateUAVDescriptor(resource.Get(), samples, fm.dsv_format, &uav_descriptor))
{ {
m_descriptor_heap_manager.Free(&write_descriptor); m_descriptor_heap_manager.Free(&write_descriptor);
m_descriptor_heap_manager.Free(&srv_descriptor); m_descriptor_heap_manager.Free(&srv_descriptor);
return {}; return {};
} }
std::unique_ptr<D3D12Texture> tex(new D3D12Texture(width, height, layers, levels, samples, type, format, fm.resource_format, std::unique_ptr<D3D12Texture> tex(new D3D12Texture(
std::move(resource), std::move(allocation), srv_descriptor, width, height, layers, levels, samples, type, format, fm.resource_format, std::move(resource),
write_descriptor, uav_descriptor, write_descriptor_type, state)); std::move(allocation), srv_descriptor, write_descriptor, uav_descriptor, write_descriptor_type, state));
if (data) if (data)
{ {
@ -203,7 +204,7 @@ bool D3D12Device::CreateSRVDescriptor(ID3D12Resource* resource, u32 layers, u32
else else
{ {
desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY; desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY;
desc.Texture2DArray = {0u, levels, 0u, layers}; desc.Texture2DArray = {0u, levels, 0u, layers, 0u, 0.0f};
} }
} }
else else
@ -215,7 +216,7 @@ bool D3D12Device::CreateSRVDescriptor(ID3D12Resource* resource, u32 layers, u32
else else
{ {
desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
desc.Texture2D = {0u, levels}; desc.Texture2D = {0u, levels, 0u, 0.0f};
} }
} }
@ -233,7 +234,7 @@ bool D3D12Device::CreateRTVDescriptor(ID3D12Resource* resource, u32 samples, DXG
} }
const D3D12_RENDER_TARGET_VIEW_DESC desc = {format, (samples > 1) ? D3D12_RTV_DIMENSION_TEXTURE2DMS : const D3D12_RENDER_TARGET_VIEW_DESC desc = {format, (samples > 1) ? D3D12_RTV_DIMENSION_TEXTURE2DMS :
D3D12_RTV_DIMENSION_TEXTURE2D}; D3D12_RTV_DIMENSION_TEXTURE2D, {} };
m_device->CreateRenderTargetView(resource, &desc, dh->cpu_handle); m_device->CreateRenderTargetView(resource, &desc, dh->cpu_handle);
return true; return true;
} }
@ -248,7 +249,7 @@ bool D3D12Device::CreateDSVDescriptor(ID3D12Resource* resource, u32 samples, DXG
} }
const D3D12_DEPTH_STENCIL_VIEW_DESC desc = { const D3D12_DEPTH_STENCIL_VIEW_DESC desc = {
format, (samples > 1) ? D3D12_DSV_DIMENSION_TEXTURE2DMS : D3D12_DSV_DIMENSION_TEXTURE2D, D3D12_DSV_FLAG_NONE}; format, (samples > 1) ? D3D12_DSV_DIMENSION_TEXTURE2DMS : D3D12_DSV_DIMENSION_TEXTURE2D, D3D12_DSV_FLAG_NONE, {} };
m_device->CreateDepthStencilView(resource, &desc, dh->cpu_handle); m_device->CreateDepthStencilView(resource, &desc, dh->cpu_handle);
return true; return true;
} }
@ -263,7 +264,7 @@ bool D3D12Device::CreateUAVDescriptor(ID3D12Resource* resource, u32 samples, DXG
} }
DebugAssert(samples == 1); DebugAssert(samples == 1);
const D3D12_UNORDERED_ACCESS_VIEW_DESC desc = {format, D3D12_UAV_DIMENSION_TEXTURE2D}; const D3D12_UNORDERED_ACCESS_VIEW_DESC desc = { format, D3D12_UAV_DIMENSION_TEXTURE2D, {} };
m_device->CreateUnorderedAccessView(resource, nullptr, &desc, dh->cpu_handle); m_device->CreateUnorderedAccessView(resource, nullptr, &desc, dh->cpu_handle);
return true; return true;
} }
@ -348,7 +349,8 @@ ID3D12Resource* D3D12Texture::AllocateUploadStagingBuffer(const void* data, u32
ComPtr<ID3D12Resource> resource; ComPtr<ID3D12Resource> resource;
ComPtr<D3D12MA::Allocation> allocation; ComPtr<D3D12MA::Allocation> allocation;
const D3D12MA::ALLOCATION_DESC allocation_desc = {D3D12MA::ALLOCATION_FLAG_NONE, D3D12_HEAP_TYPE_UPLOAD}; const D3D12MA::ALLOCATION_DESC allocation_desc = {D3D12MA::ALLOCATION_FLAG_NONE, D3D12_HEAP_TYPE_UPLOAD,
D3D12_HEAP_FLAG_NONE, nullptr, nullptr};
const D3D12_RESOURCE_DESC resource_desc = { const D3D12_RESOURCE_DESC resource_desc = {
D3D12_RESOURCE_DIMENSION_BUFFER, 0, size, 1, 1, 1, DXGI_FORMAT_UNKNOWN, {1, 0}, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, D3D12_RESOURCE_DIMENSION_BUFFER, 0, size, 1, 1, 1, DXGI_FORMAT_UNKNOWN, {1, 0}, D3D12_TEXTURE_LAYOUT_ROW_MAJOR,
D3D12_RESOURCE_FLAG_NONE}; D3D12_RESOURCE_FLAG_NONE};
@ -901,8 +903,10 @@ bool D3D12TextureBuffer::Create(D3D12Device& dev)
if (!dev.GetDescriptorHeapManager().Allocate(&m_descriptor)) if (!dev.GetDescriptorHeapManager().Allocate(&m_descriptor))
return {}; return {};
D3D12_SHADER_RESOURCE_VIEW_DESC desc = {format_mapping[static_cast<u8>(m_format)], D3D12_SRV_DIMENSION_BUFFER, D3D12_SHADER_RESOURCE_VIEW_DESC desc = {format_mapping[static_cast<u8>(m_format)],
D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING}; D3D12_SRV_DIMENSION_BUFFER,
D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING,
{}};
desc.Buffer.NumElements = m_size_in_elements; desc.Buffer.NumElements = m_size_in_elements;
dev.GetDevice()->CreateShaderResourceView(m_buffer.GetBuffer(), &desc, m_descriptor); dev.GetDevice()->CreateShaderResourceView(m_buffer.GetBuffer(), &desc, m_descriptor);
return true; return true;

View file

@ -415,7 +415,7 @@ std::optional<DynamicHeapArray<u8>> D3DCommon::CompileShader(D3D_FEATURE_LEVEL f
if (fp) if (fp)
{ {
std::fwrite(source.data(), source.size(), 1, fp.get()); std::fwrite(source.data(), source.size(), 1, fp.get());
std::fprintf(fp.get(), "\n\nCompile as %s failed: %08X\n", target, hr); std::fprintf(fp.get(), "\n\nCompile as %s failed: %08X\n", target, static_cast<unsigned>(hr));
std::fwrite(error_string.c_str(), error_string.size(), 1, fp.get()); std::fwrite(error_string.c_str(), error_string.size(), 1, fp.get());
} }

View file

@ -287,7 +287,8 @@ std::vector<std::pair<std::string, std::string>> DInputSource::EnumerateDevices(
std::vector<std::pair<std::string, std::string>> ret; std::vector<std::pair<std::string, std::string>> ret;
for (size_t i = 0; i < m_controllers.size(); i++) for (size_t i = 0; i < m_controllers.size(); i++)
{ {
DIDEVICEINSTANCEW dii = {sizeof(DIDEVICEINSTANCEW)}; DIDEVICEINSTANCEW dii;
dii.dwSize = sizeof(DIDEVICEINSTANCEW);
std::string name; std::string name;
if (SUCCEEDED(m_controllers[i].device->GetDeviceInfo(&dii))) if (SUCCEEDED(m_controllers[i].device->GetDeviceInfo(&dii)))
name = StringUtil::WideStringToUTF8String(dii.tszProductName); name = StringUtil::WideStringToUTF8String(dii.tszProductName);

View file

@ -10,6 +10,10 @@
Log_SetChannel(GL::ContextWGL); Log_SetChannel(GL::ContextWGL);
#ifdef __clang__
#pragma clang diagnostic ignored "-Wmicrosoft-cast"
#endif
static void* GetProcAddressCallback(const char* name) static void* GetProcAddressCallback(const char* name)
{ {
void* addr = wglGetProcAddress(name); void* addr = wglGetProcAddress(name);

View file

@ -109,7 +109,7 @@ bool GPUPipeline::InputLayout::operator==(const InputLayout& rhs) const
bool GPUPipeline::InputLayout::operator!=(const InputLayout& rhs) const bool GPUPipeline::InputLayout::operator!=(const InputLayout& rhs) const
{ {
return (vertex_stride != rhs.vertex_stride || return (vertex_stride != rhs.vertex_stride ||
vertex_attributes.size() != rhs.vertex_attributes.size() && vertex_attributes.size() != rhs.vertex_attributes.size() ||
std::memcmp(vertex_attributes.data(), rhs.vertex_attributes.data(), std::memcmp(vertex_attributes.data(), rhs.vertex_attributes.data(),
sizeof(VertexAttribute) * rhs.vertex_attributes.size()) != 0); sizeof(VertexAttribute) * rhs.vertex_attributes.size()) != 0);
} }

View file

@ -207,6 +207,8 @@ public:
u32 key; u32 key;
// clang-format off // clang-format off
ALWAYS_INLINE VertexAttribute() = default;
ALWAYS_INLINE constexpr VertexAttribute(const VertexAttribute& rhs) : key(rhs.key) {}
ALWAYS_INLINE VertexAttribute& operator=(const VertexAttribute& rhs) { key = rhs.key; return *this; } ALWAYS_INLINE VertexAttribute& operator=(const VertexAttribute& rhs) { key = rhs.key; return *this; }
ALWAYS_INLINE bool operator==(const VertexAttribute& rhs) const { return key == rhs.key; } ALWAYS_INLINE bool operator==(const VertexAttribute& rhs) const { return key == rhs.key; }
ALWAYS_INLINE bool operator!=(const VertexAttribute& rhs) const { return key != rhs.key; } ALWAYS_INLINE bool operator!=(const VertexAttribute& rhs) const { return key != rhs.key; }
@ -217,11 +219,14 @@ public:
u16 offset) u16 offset)
{ {
// Nasty :/ can't access an inactive element of a union here.. // Nasty :/ can't access an inactive element of a union here..
return VertexAttribute{{(static_cast<u32>(index) & 0xf) | ((static_cast<u32>(semantic) & 0x3) << 4) | return VertexAttribute((static_cast<u32>(index) & 0xf) | ((static_cast<u32>(semantic) & 0x3) << 4) |
((static_cast<u32>(semantic_index) & 0x3) << 6) | ((static_cast<u32>(type) & 0xf) << 8) | ((static_cast<u32>(semantic_index) & 0x3) << 6) | ((static_cast<u32>(type) & 0xf) << 8) |
((static_cast<u32>(components) & 0x7) << 12) | ((static_cast<u32>(components) & 0x7) << 12) |
((static_cast<u32>(offset) & 0xffff) << 16)}}; ((static_cast<u32>(offset) & 0xffff) << 16));
} }
private:
ALWAYS_INLINE constexpr VertexAttribute(u32 key_) : key(key_) {}
}; };
struct InputLayout struct InputLayout
@ -298,6 +303,8 @@ public:
u8 key; u8 key;
// clang-format off // clang-format off
ALWAYS_INLINE RasterizationState() = default;
ALWAYS_INLINE RasterizationState(const RasterizationState& rhs) : key(rhs.key) {}
ALWAYS_INLINE RasterizationState& operator=(const RasterizationState& rhs) { key = rhs.key; return *this; } ALWAYS_INLINE RasterizationState& operator=(const RasterizationState& rhs) { key = rhs.key; return *this; }
ALWAYS_INLINE bool operator==(const RasterizationState& rhs) const { return key == rhs.key; } ALWAYS_INLINE bool operator==(const RasterizationState& rhs) const { return key == rhs.key; }
ALWAYS_INLINE bool operator!=(const RasterizationState& rhs) const { return key != rhs.key; } ALWAYS_INLINE bool operator!=(const RasterizationState& rhs) const { return key != rhs.key; }
@ -314,6 +321,8 @@ public:
u8 key; u8 key;
// clang-format off // clang-format off
ALWAYS_INLINE DepthState() = default;
ALWAYS_INLINE DepthState(const DepthState& rhs) : key(rhs.key) {}
ALWAYS_INLINE DepthState& operator=(const DepthState& rhs) { key = rhs.key; return *this; } ALWAYS_INLINE DepthState& operator=(const DepthState& rhs) { key = rhs.key; return *this; }
ALWAYS_INLINE bool operator==(const DepthState& rhs) const { return key == rhs.key; } ALWAYS_INLINE bool operator==(const DepthState& rhs) const { return key == rhs.key; }
ALWAYS_INLINE bool operator!=(const DepthState& rhs) const { return key != rhs.key; } ALWAYS_INLINE bool operator!=(const DepthState& rhs) const { return key != rhs.key; }
@ -342,6 +351,8 @@ public:
u64 key; u64 key;
// clang-format off // clang-format off
ALWAYS_INLINE BlendState() = default;
ALWAYS_INLINE BlendState(const BlendState& rhs) : key(rhs.key) {}
ALWAYS_INLINE BlendState& operator=(const BlendState& rhs) { key = rhs.key; return *this; } ALWAYS_INLINE BlendState& operator=(const BlendState& rhs) { key = rhs.key; return *this; }
ALWAYS_INLINE bool operator==(const BlendState& rhs) const { return key == rhs.key; } ALWAYS_INLINE bool operator==(const BlendState& rhs) const { return key == rhs.key; }
ALWAYS_INLINE bool operator!=(const BlendState& rhs) const { return key != rhs.key; } ALWAYS_INLINE bool operator!=(const BlendState& rhs) const { return key != rhs.key; }

View file

@ -315,110 +315,110 @@ void ImGuiManager::SetKeyMap()
const char* alt_name; const char* alt_name;
}; };
static constexpr KeyMapping mapping[] = {{ImGuiKey_LeftArrow, "Left"}, static constexpr KeyMapping mapping[] = {{ImGuiKey_LeftArrow, "Left", nullptr},
{ImGuiKey_RightArrow, "Right"}, {ImGuiKey_RightArrow, "Right", nullptr},
{ImGuiKey_UpArrow, "Up"}, {ImGuiKey_UpArrow, "Up", nullptr},
{ImGuiKey_DownArrow, "Down"}, {ImGuiKey_DownArrow, "Down", nullptr},
{ImGuiKey_PageUp, "PageUp"}, {ImGuiKey_PageUp, "PageUp", nullptr},
{ImGuiKey_PageDown, "PageDown"}, {ImGuiKey_PageDown, "PageDown", nullptr},
{ImGuiKey_Home, "Home"}, {ImGuiKey_Home, "Home", nullptr},
{ImGuiKey_End, "End"}, {ImGuiKey_End, "End", nullptr},
{ImGuiKey_Insert, "Insert"}, {ImGuiKey_Insert, "Insert", nullptr},
{ImGuiKey_Delete, "Delete"}, {ImGuiKey_Delete, "Delete", nullptr},
{ImGuiKey_Backspace, "Backspace"}, {ImGuiKey_Backspace, "Backspace", nullptr},
{ImGuiKey_Space, "Space"}, {ImGuiKey_Space, "Space", nullptr},
{ImGuiKey_Enter, "Return"}, {ImGuiKey_Enter, "Return", nullptr},
{ImGuiKey_Escape, "Escape"}, {ImGuiKey_Escape, "Escape", nullptr},
{ImGuiKey_LeftCtrl, "LeftCtrl", "Ctrl"}, {ImGuiKey_LeftCtrl, "LeftCtrl", "Ctrl"},
{ImGuiKey_LeftShift, "LeftShift", "Shift"}, {ImGuiKey_LeftShift, "LeftShift", "Shift"},
{ImGuiKey_LeftAlt, "LeftAlt", "Alt"}, {ImGuiKey_LeftAlt, "LeftAlt", "Alt"},
{ImGuiKey_LeftSuper, "LeftSuper", "Super"}, {ImGuiKey_LeftSuper, "LeftSuper", "Super"},
{ImGuiKey_RightCtrl, "RightCtrl"}, {ImGuiKey_RightCtrl, "RightCtrl", nullptr},
{ImGuiKey_RightShift, "RightShift"}, {ImGuiKey_RightShift, "RightShift", nullptr},
{ImGuiKey_RightAlt, "RightAlt"}, {ImGuiKey_RightAlt, "RightAlt", nullptr},
{ImGuiKey_RightSuper, "RightSuper"}, {ImGuiKey_RightSuper, "RightSuper", nullptr},
{ImGuiKey_Menu, "Menu"}, {ImGuiKey_Menu, "Menu", nullptr},
{ImGuiKey_0, "0"}, {ImGuiKey_0, "0", nullptr},
{ImGuiKey_1, "1"}, {ImGuiKey_1, "1", nullptr},
{ImGuiKey_2, "2"}, {ImGuiKey_2, "2", nullptr},
{ImGuiKey_3, "3"}, {ImGuiKey_3, "3", nullptr},
{ImGuiKey_4, "4"}, {ImGuiKey_4, "4", nullptr},
{ImGuiKey_5, "5"}, {ImGuiKey_5, "5", nullptr},
{ImGuiKey_6, "6"}, {ImGuiKey_6, "6", nullptr},
{ImGuiKey_7, "7"}, {ImGuiKey_7, "7", nullptr},
{ImGuiKey_8, "8"}, {ImGuiKey_8, "8", nullptr},
{ImGuiKey_9, "9"}, {ImGuiKey_9, "9", nullptr},
{ImGuiKey_A, "A"}, {ImGuiKey_A, "A", nullptr},
{ImGuiKey_B, "B"}, {ImGuiKey_B, "B", nullptr},
{ImGuiKey_C, "C"}, {ImGuiKey_C, "C", nullptr},
{ImGuiKey_D, "D"}, {ImGuiKey_D, "D", nullptr},
{ImGuiKey_E, "E"}, {ImGuiKey_E, "E", nullptr},
{ImGuiKey_F, "F"}, {ImGuiKey_F, "F", nullptr},
{ImGuiKey_G, "G"}, {ImGuiKey_G, "G", nullptr},
{ImGuiKey_H, "H"}, {ImGuiKey_H, "H", nullptr},
{ImGuiKey_I, "I"}, {ImGuiKey_I, "I", nullptr},
{ImGuiKey_J, "J"}, {ImGuiKey_J, "J", nullptr},
{ImGuiKey_K, "K"}, {ImGuiKey_K, "K", nullptr},
{ImGuiKey_L, "L"}, {ImGuiKey_L, "L", nullptr},
{ImGuiKey_M, "M"}, {ImGuiKey_M, "M", nullptr},
{ImGuiKey_N, "N"}, {ImGuiKey_N, "N", nullptr},
{ImGuiKey_O, "O"}, {ImGuiKey_O, "O", nullptr},
{ImGuiKey_P, "P"}, {ImGuiKey_P, "P", nullptr},
{ImGuiKey_Q, "Q"}, {ImGuiKey_Q, "Q", nullptr},
{ImGuiKey_R, "R"}, {ImGuiKey_R, "R", nullptr},
{ImGuiKey_S, "S"}, {ImGuiKey_S, "S", nullptr},
{ImGuiKey_T, "T"}, {ImGuiKey_T, "T", nullptr},
{ImGuiKey_U, "U"}, {ImGuiKey_U, "U", nullptr},
{ImGuiKey_V, "V"}, {ImGuiKey_V, "V", nullptr},
{ImGuiKey_W, "W"}, {ImGuiKey_W, "W", nullptr},
{ImGuiKey_X, "X"}, {ImGuiKey_X, "X", nullptr},
{ImGuiKey_Y, "Y"}, {ImGuiKey_Y, "Y", nullptr},
{ImGuiKey_Z, "Z"}, {ImGuiKey_Z, "Z", nullptr},
{ImGuiKey_F1, "F1"}, {ImGuiKey_F1, "F1", nullptr},
{ImGuiKey_F2, "F2"}, {ImGuiKey_F2, "F2", nullptr},
{ImGuiKey_F3, "F3"}, {ImGuiKey_F3, "F3", nullptr},
{ImGuiKey_F4, "F4"}, {ImGuiKey_F4, "F4", nullptr},
{ImGuiKey_F5, "F5"}, {ImGuiKey_F5, "F5", nullptr},
{ImGuiKey_F6, "F6"}, {ImGuiKey_F6, "F6", nullptr},
{ImGuiKey_F7, "F7"}, {ImGuiKey_F7, "F7", nullptr},
{ImGuiKey_F8, "F8"}, {ImGuiKey_F8, "F8", nullptr},
{ImGuiKey_F9, "F9"}, {ImGuiKey_F9, "F9", nullptr},
{ImGuiKey_F10, "F10"}, {ImGuiKey_F10, "F10", nullptr},
{ImGuiKey_F11, "F11"}, {ImGuiKey_F11, "F11", nullptr},
{ImGuiKey_F12, "F12"}, {ImGuiKey_F12, "F12", nullptr},
{ImGuiKey_Apostrophe, "Apostrophe"}, {ImGuiKey_Apostrophe, "Apostrophe", nullptr},
{ImGuiKey_Comma, "Comma"}, {ImGuiKey_Comma, "Comma", nullptr},
{ImGuiKey_Minus, "Minus"}, {ImGuiKey_Minus, "Minus", nullptr},
{ImGuiKey_Period, "Period"}, {ImGuiKey_Period, "Period", nullptr},
{ImGuiKey_Slash, "Slash"}, {ImGuiKey_Slash, "Slash", nullptr},
{ImGuiKey_Semicolon, "Semicolon"}, {ImGuiKey_Semicolon, "Semicolon", nullptr},
{ImGuiKey_Equal, "Equal"}, {ImGuiKey_Equal, "Equal", nullptr},
{ImGuiKey_LeftBracket, "BracketLeft"}, {ImGuiKey_LeftBracket, "BracketLeft", nullptr},
{ImGuiKey_Backslash, "Backslash"}, {ImGuiKey_Backslash, "Backslash", nullptr},
{ImGuiKey_RightBracket, "BracketRight"}, {ImGuiKey_RightBracket, "BracketRight", nullptr},
{ImGuiKey_GraveAccent, "QuoteLeft"}, {ImGuiKey_GraveAccent, "QuoteLeft", nullptr},
{ImGuiKey_CapsLock, "CapsLock"}, {ImGuiKey_CapsLock, "CapsLock", nullptr},
{ImGuiKey_ScrollLock, "ScrollLock"}, {ImGuiKey_ScrollLock, "ScrollLock", nullptr},
{ImGuiKey_NumLock, "NumLock"}, {ImGuiKey_NumLock, "NumLock", nullptr},
{ImGuiKey_PrintScreen, "PrintScreen"}, {ImGuiKey_PrintScreen, "PrintScreen", nullptr},
{ImGuiKey_Pause, "Pause"}, {ImGuiKey_Pause, "Pause", nullptr},
{ImGuiKey_Keypad0, "Keypad0"}, {ImGuiKey_Keypad0, "Keypad0", nullptr},
{ImGuiKey_Keypad1, "Keypad1"}, {ImGuiKey_Keypad1, "Keypad1", nullptr},
{ImGuiKey_Keypad2, "Keypad2"}, {ImGuiKey_Keypad2, "Keypad2", nullptr},
{ImGuiKey_Keypad3, "Keypad3"}, {ImGuiKey_Keypad3, "Keypad3", nullptr},
{ImGuiKey_Keypad4, "Keypad4"}, {ImGuiKey_Keypad4, "Keypad4", nullptr},
{ImGuiKey_Keypad5, "Keypad5"}, {ImGuiKey_Keypad5, "Keypad5", nullptr},
{ImGuiKey_Keypad6, "Keypad6"}, {ImGuiKey_Keypad6, "Keypad6", nullptr},
{ImGuiKey_Keypad7, "Keypad7"}, {ImGuiKey_Keypad7, "Keypad7", nullptr},
{ImGuiKey_Keypad8, "Keypad8"}, {ImGuiKey_Keypad8, "Keypad8", nullptr},
{ImGuiKey_Keypad9, "Keypad9"}, {ImGuiKey_Keypad9, "Keypad9", nullptr},
{ImGuiKey_KeypadDecimal, "KeypadPeriod"}, {ImGuiKey_KeypadDecimal, "KeypadPeriod", nullptr},
{ImGuiKey_KeypadDivide, "KeypadDivide"}, {ImGuiKey_KeypadDivide, "KeypadDivide", nullptr},
{ImGuiKey_KeypadMultiply, "KeypadMultiply"}, {ImGuiKey_KeypadMultiply, "KeypadMultiply", nullptr},
{ImGuiKey_KeypadSubtract, "KeypadMinus"}, {ImGuiKey_KeypadSubtract, "KeypadMinus", nullptr},
{ImGuiKey_KeypadAdd, "KeypadPlus"}, {ImGuiKey_KeypadAdd, "KeypadPlus", nullptr },
{ImGuiKey_KeypadEnter, "KeypadReturn"}, {ImGuiKey_KeypadEnter, "KeypadReturn", nullptr },
{ImGuiKey_KeypadEqual, "KeypadEqual"}}; {ImGuiKey_KeypadEqual, "KeypadEqual", nullptr}};
s_imgui_key_map.clear(); s_imgui_key_map.clear();
for (const KeyMapping& km : mapping) for (const KeyMapping& km : mapping)

View file

@ -729,8 +729,11 @@ bool OpenGLDevice::ReadPipelineCache(const std::string& filename)
// Read footer. // Read footer.
const s64 size = FileSystem::FSize64(m_pipeline_disk_cache_file); const s64 size = FileSystem::FSize64(m_pipeline_disk_cache_file);
if (size < sizeof(PipelineDiskCacheFooter) || size >= static_cast<s64>(std::numeric_limits<u32>::max())) if (size < static_cast<s64>(sizeof(PipelineDiskCacheFooter)) ||
size >= static_cast<s64>(std::numeric_limits<u32>::max()))
{
return DiscardPipelineCache(); return DiscardPipelineCache();
}
PipelineDiskCacheFooter file_footer; PipelineDiskCacheFooter file_footer;
if (FileSystem::FSeek64(m_pipeline_disk_cache_file, size - sizeof(PipelineDiskCacheFooter), SEEK_SET) != 0 || if (FileSystem::FSeek64(m_pipeline_disk_cache_file, size - sizeof(PipelineDiskCacheFooter), SEEK_SET) != 0 ||

View file

@ -805,8 +805,6 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
m_textures.push_back(std::move(tex)); m_textures.push_back(std::move(tex));
} }
TextureID last_output = INPUT_COLOR_TEXTURE;
for (reshadefx::technique_info& tech : mod.techniques) for (reshadefx::technique_info& tech : mod.techniques)
{ {
for (reshadefx::pass_info& pi : tech.passes) for (reshadefx::pass_info& pi : tech.passes)
@ -915,7 +913,6 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
#ifdef _DEBUG #ifdef _DEBUG
pass.name = std::move(pi.name); pass.name = std::move(pi.name);
#endif #endif
last_output = pass.render_target;
m_passes.push_back(std::move(pass)); m_passes.push_back(std::move(pass));
} }
} }
@ -1019,8 +1016,8 @@ bool PostProcessing::ReShadeFXShader::CompilePipeline(GPUTexture::Format format,
const std::string_view code(mod.code.data(), mod.code.size()); const std::string_view code(mod.code.data(), mod.code.size());
auto get_shader = [this, needs_main_defn, &code](const std::string& name, const std::vector<Sampler>& samplers, auto get_shader = [needs_main_defn, &code](const std::string& name, const std::vector<Sampler>& samplers,
GPUShaderStage stage) { GPUShaderStage stage) {
std::string real_code; std::string real_code;
if (needs_main_defn) if (needs_main_defn)
{ {

View file

@ -485,20 +485,15 @@ bool VulkanDevice::CreateDevice(VkSurfaceKHR surface, bool enable_validation_lay
} }
VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT rasterization_order_access_feature = { VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT rasterization_order_access_feature = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT}; VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT, nullptr, VK_TRUE, VK_FALSE,
VK_FALSE};
VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT attachment_feedback_loop_feature = { VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT attachment_feedback_loop_feature = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT}; VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT, nullptr, VK_TRUE};
if (m_optional_extensions.vk_ext_rasterization_order_attachment_access) if (m_optional_extensions.vk_ext_rasterization_order_attachment_access)
{
rasterization_order_access_feature.rasterizationOrderColorAttachmentAccess = VK_TRUE;
Vulkan::AddPointerToChain(&device_info, &rasterization_order_access_feature); Vulkan::AddPointerToChain(&device_info, &rasterization_order_access_feature);
}
if (m_optional_extensions.vk_ext_attachment_feedback_loop_layout) if (m_optional_extensions.vk_ext_attachment_feedback_loop_layout)
{
attachment_feedback_loop_feature.attachmentFeedbackLoopLayout = VK_TRUE;
Vulkan::AddPointerToChain(&device_info, &attachment_feedback_loop_feature); Vulkan::AddPointerToChain(&device_info, &attachment_feedback_loop_feature);
}
VkResult res = vkCreateDevice(m_physical_device, &device_info, nullptr, &m_device); VkResult res = vkCreateDevice(m_physical_device, &device_info, nullptr, &m_device);
if (res != VK_SUCCESS) if (res != VK_SUCCESS)
@ -532,11 +527,12 @@ bool VulkanDevice::CreateDevice(VkSurfaceKHR surface, bool enable_validation_lay
void VulkanDevice::ProcessDeviceExtensions() void VulkanDevice::ProcessDeviceExtensions()
{ {
// advanced feature checks // advanced feature checks
VkPhysicalDeviceFeatures2 features2 = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; VkPhysicalDeviceFeatures2 features2 = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, nullptr, {}};
VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT rasterization_order_access_feature = { VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT rasterization_order_access_feature = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT}; VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT, nullptr, VK_FALSE, VK_FALSE,
VK_FALSE};
VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT attachment_feedback_loop_feature = { VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT attachment_feedback_loop_feature = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT}; VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT, nullptr, VK_FALSE};
// add in optional feature structs // add in optional feature structs
if (m_optional_extensions.vk_ext_rasterization_order_attachment_access) if (m_optional_extensions.vk_ext_rasterization_order_attachment_access)
@ -553,9 +549,9 @@ void VulkanDevice::ProcessDeviceExtensions()
m_optional_extensions.vk_ext_attachment_feedback_loop_layout &= m_optional_extensions.vk_ext_attachment_feedback_loop_layout &=
(attachment_feedback_loop_feature.attachmentFeedbackLoopLayout == VK_TRUE); (attachment_feedback_loop_feature.attachmentFeedbackLoopLayout == VK_TRUE);
VkPhysicalDeviceProperties2 properties2 = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2}; VkPhysicalDeviceProperties2 properties2 = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, nullptr, {}};
VkPhysicalDevicePushDescriptorPropertiesKHR push_descriptor_properties = { VkPhysicalDevicePushDescriptorPropertiesKHR push_descriptor_properties = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR}; VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR, nullptr, 0u};
if (m_optional_extensions.vk_khr_driver_properties) if (m_optional_extensions.vk_khr_driver_properties)
{ {
@ -1046,10 +1042,16 @@ void VulkanDevice::DoSubmitCommandBuffer(u32 index, VulkanSwapChain* present_swa
CommandBuffer& resources = m_frame_resources[index]; CommandBuffer& resources = m_frame_resources[index];
uint32_t wait_bits = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; uint32_t wait_bits = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
VkSubmitInfo submit_info = {VK_STRUCTURE_TYPE_SUBMIT_INFO}; VkSubmitInfo submit_info = {VK_STRUCTURE_TYPE_SUBMIT_INFO,
submit_info.commandBufferCount = resources.init_buffer_used ? 2u : 1u; nullptr,
submit_info.pCommandBuffers = 0u,
resources.init_buffer_used ? resources.command_buffers.data() : &resources.command_buffers[1]; nullptr,
nullptr,
resources.init_buffer_used ? 2u : 1u,
resources.init_buffer_used ? resources.command_buffers.data() :
&resources.command_buffers[1],
0u,
nullptr};
if (present_swap_chain) if (present_swap_chain)
{ {
@ -2679,7 +2681,8 @@ void VulkanDevice::BeginRenderPass()
{ {
DebugAssert(!InRenderPass()); DebugAssert(!InRenderPass());
VkRenderPassBeginInfo bi = {VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, nullptr}; VkRenderPassBeginInfo bi = {
VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, nullptr, VK_NULL_HANDLE, VK_NULL_HANDLE, {}, 0u, nullptr};
std::array<VkClearValue, 2> clear_values; std::array<VkClearValue, 2> clear_values;
if (LIKELY(m_current_framebuffer)) if (LIKELY(m_current_framebuffer))
@ -2746,7 +2749,7 @@ void VulkanDevice::BeginRenderPass()
case GPUTexture::State::Cleared: case GPUTexture::State::Cleared:
{ {
const u32 idx = rt ? 1 : 0; const u32 idx = rt ? 1 : 0;
clear_values[idx].depthStencil = {ds->GetClearDepth()}; clear_values[idx].depthStencil = {ds->GetClearDepth(), 0u};
ds_load_op = VK_ATTACHMENT_LOAD_OP_CLEAR; ds_load_op = VK_ATTACHMENT_LOAD_OP_CLEAR;
ds->SetState(GPUTexture::State::Dirty); ds->SetState(GPUTexture::State::Dirty);
bi.pClearValues = clear_values.data(); bi.pClearValues = clear_values.data();

View file

@ -75,6 +75,7 @@
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-completeness" #pragma clang diagnostic ignored "-Wnullability-completeness"
#pragma clang diagnostic ignored "-Wunused-variable" #pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#pragma warning(push, 0) #pragma warning(push, 0)
#endif #endif

View file

@ -11,8 +11,6 @@
Log_SetChannel(VulkanDevice); Log_SetChannel(VulkanDevice);
static u32 s_next_bad_shader_id = 1;
VulkanShader::VulkanShader(GPUShaderStage stage, VkShaderModule mod) : GPUShader(stage), m_module(mod) VulkanShader::VulkanShader(GPUShaderStage stage, VkShaderModule mod) : GPUShader(stage), m_module(mod)
{ {
} }

View file

@ -413,9 +413,10 @@ bool VulkanSwapChain::CreateSwapChain()
} }
#ifdef _WIN32 #ifdef _WIN32
VkSurfaceFullScreenExclusiveInfoEXT exclusive_info = {VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT}; VkSurfaceFullScreenExclusiveInfoEXT exclusive_info = {VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT,
nullptr, VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT};
VkSurfaceFullScreenExclusiveWin32InfoEXT exclusive_win32_info = { VkSurfaceFullScreenExclusiveWin32InfoEXT exclusive_win32_info = {
VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT}; VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT, nullptr, NULL};
if (m_exclusive_fullscreen_control.has_value()) if (m_exclusive_fullscreen_control.has_value())
{ {
if (dev.GetOptionalExtensions().vk_ext_full_screen_exclusive) if (dev.GetOptionalExtensions().vk_ext_full_screen_exclusive)

View file

@ -75,7 +75,12 @@ std::unique_ptr<VulkanTexture> VulkanTexture::Create(u32 width, u32 height, u32
levels, levels,
layers, layers,
static_cast<VkSampleCountFlagBits>(samples), static_cast<VkSampleCountFlagBits>(samples),
VK_IMAGE_TILING_OPTIMAL}; VK_IMAGE_TILING_OPTIMAL,
0u,
VK_SHARING_MODE_EXCLUSIVE,
0,
nullptr,
VK_IMAGE_LAYOUT_UNDEFINED};
VmaAllocationCreateInfo aci = {}; VmaAllocationCreateInfo aci = {};
aci.usage = VMA_MEMORY_USAGE_GPU_ONLY; aci.usage = VMA_MEMORY_USAGE_GPU_ONLY;
@ -433,7 +438,7 @@ void VulkanTexture::CommitClear(VkCommandBuffer cmdbuf)
if (IsDepthStencil()) if (IsDepthStencil())
{ {
const VkClearDepthStencilValue cv = {m_clear_value.depth}; const VkClearDepthStencilValue cv = {m_clear_value.depth, 0u};
const VkImageSubresourceRange srr = {VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 1u, 0u, 1u}; const VkImageSubresourceRange srr = {VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 1u, 0u, 1u};
vkCmdClearDepthStencilImage(cmdbuf, m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &cv, 1, &srr); vkCmdClearDepthStencilImage(cmdbuf, m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &cv, 1, &srr);
} }

View file

@ -49,7 +49,9 @@ bool Win32RawInputSource::Initialize(SettingsInterface& si, std::unique_lock<std
return true; return true;
} }
void Win32RawInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) {} void Win32RawInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
{
}
bool Win32RawInputSource::ReloadDevices() bool Win32RawInputSource::ReloadDevices()
{ {
@ -72,7 +74,9 @@ std::vector<std::pair<std::string, std::string>> Win32RawInputSource::EnumerateD
return {}; return {};
} }
void Win32RawInputSource::UpdateMotorState(InputBindingKey key, float intensity) {} void Win32RawInputSource::UpdateMotorState(InputBindingKey key, float intensity)
{
}
void Win32RawInputSource::UpdateMotorState(InputBindingKey large_key, InputBindingKey small_key, float large_intensity, void Win32RawInputSource::UpdateMotorState(InputBindingKey large_key, InputBindingKey small_key, float large_intensity,
float small_intensity) float small_intensity)
@ -171,7 +175,7 @@ bool Win32RawInputSource::OpenDevices()
m_num_keyboards++; m_num_keyboards++;
#endif #endif
if (rid.dwType == RIM_TYPEMOUSE) if (rid.dwType == RIM_TYPEMOUSE)
m_mice.push_back({rid.hDevice}); m_mice.push_back({rid.hDevice, 0u, 0, 0});
} }
Log_DevPrintf("(Win32RawInputSource) Found %u keyboards and %zu mice", m_num_keyboards, m_mice.size()); Log_DevPrintf("(Win32RawInputSource) Found %u keyboards and %zu mice", m_num_keyboards, m_mice.size());

View file

@ -55,7 +55,6 @@ private:
HWND m_dummy_window = {}; HWND m_dummy_window = {};
u32 m_num_keyboards = 0; u32 m_num_keyboards = 0;
u32 m_num_mice = 0;
std::vector<MouseState> m_mice; std::vector<MouseState> m_mice;
}; };

View file

@ -4,9 +4,6 @@
#include "window_info.h" #include "window_info.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/log.h"
Log_SetChannel(WindowInfo);
void WindowInfo::SetSurfaceless() void WindowInfo::SetSurfaceless()
{ {
@ -88,11 +85,14 @@ bool WindowInfo::QueryRefreshRateForWindow(const WindowInfo& wi, float* refresh_
#ifdef USE_X11 #ifdef USE_X11
#include "common/scoped_guard.h" #include "common/scoped_guard.h"
#include "common/log.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/extensions/Xrandr.h> #include <X11/extensions/Xrandr.h>
Log_SetChannel(WindowInfo);
// Helper class for managing X errors // Helper class for managing X errors
namespace { namespace {
class X11InhibitErrors; class X11InhibitErrors;

View file

@ -167,7 +167,13 @@ void XAudio2AudioStream::EnqueueBuffer()
const XAUDIO2_BUFFER buf = { const XAUDIO2_BUFFER buf = {
static_cast<UINT32>(0), // flags static_cast<UINT32>(0), // flags
static_cast<UINT32>(sizeof(s16) * m_channels * m_enqueue_buffer_size), // bytes static_cast<UINT32>(sizeof(s16) * m_channels * m_enqueue_buffer_size), // bytes
reinterpret_cast<const BYTE*>(samples) // data reinterpret_cast<const BYTE*>(samples), // data
0u,
0u,
0u,
0u,
0u,
nullptr,
}; };
HRESULT hr = m_source_voice->SubmitSourceBuffer(&buf, nullptr); HRESULT hr = m_source_voice->SubmitSourceBuffer(&buf, nullptr);
@ -189,19 +195,31 @@ void XAudio2AudioStream::SetOutputVolume(u32 volume)
m_volume = volume; m_volume = volume;
} }
void __stdcall XAudio2AudioStream::OnVoiceProcessingPassStart(UINT32 BytesRequired) {} void __stdcall XAudio2AudioStream::OnVoiceProcessingPassStart(UINT32 BytesRequired)
{
}
void __stdcall XAudio2AudioStream::OnVoiceProcessingPassEnd(void) {} void __stdcall XAudio2AudioStream::OnVoiceProcessingPassEnd(void)
{
}
void __stdcall XAudio2AudioStream::OnStreamEnd(void) {} void __stdcall XAudio2AudioStream::OnStreamEnd(void)
{
}
void __stdcall XAudio2AudioStream::OnBufferStart(void* pBufferContext) {} void __stdcall XAudio2AudioStream::OnBufferStart(void* pBufferContext)
{
}
void __stdcall XAudio2AudioStream::OnBufferEnd(void* pBufferContext) void __stdcall XAudio2AudioStream::OnBufferEnd(void* pBufferContext)
{ {
EnqueueBuffer(); EnqueueBuffer();
} }
void __stdcall XAudio2AudioStream::OnLoopEnd(void* pBufferContext) {} void __stdcall XAudio2AudioStream::OnLoopEnd(void* pBufferContext)
{
}
void __stdcall XAudio2AudioStream::OnVoiceError(void* pBufferContext, HRESULT Error) {} void __stdcall XAudio2AudioStream::OnVoiceError(void* pBufferContext, HRESULT Error)
{
}

View file

@ -106,7 +106,10 @@ bool XInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex
m_xinput_get_state = m_xinput_get_state =
reinterpret_cast<decltype(m_xinput_get_state)>(GetProcAddress(m_xinput_module, reinterpret_cast<LPCSTR>(100))); reinterpret_cast<decltype(m_xinput_get_state)>(GetProcAddress(m_xinput_module, reinterpret_cast<LPCSTR>(100)));
if (!m_xinput_get_state) if (!m_xinput_get_state)
reinterpret_cast<decltype(m_xinput_get_state)>(GetProcAddress(m_xinput_module, "XInputGetState")); {
m_xinput_get_state =
reinterpret_cast<decltype(m_xinput_get_state)>(GetProcAddress(m_xinput_module, "XInputGetState"));
}
m_xinput_set_state = m_xinput_set_state =
reinterpret_cast<decltype(m_xinput_set_state)>(GetProcAddress(m_xinput_module, "XInputSetState")); reinterpret_cast<decltype(m_xinput_set_state)>(GetProcAddress(m_xinput_module, "XInputSetState"));
m_xinput_get_capabilities = m_xinput_get_capabilities =
@ -122,7 +125,9 @@ bool XInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex
return true; return true;
} }
void XInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) {} void XInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
{
}
bool XInputSource::ReloadDevices() bool XInputSource::ReloadDevices()
{ {