[Misc] Fix Some Warnings on Clang Build with Windows + Adding constexpr

This commit is contained in:
Xphalnos 2025-03-26 17:48:49 +01:00 committed by Radosław Gliński
parent 5f918ef28d
commit 7479ccc292
34 changed files with 93 additions and 92 deletions

View file

@ -167,7 +167,7 @@ using xe::ui::UIEvent;
using namespace xe::hid; using namespace xe::hid;
using namespace xe::gpu; using namespace xe::gpu;
constexpr std::string kRecentlyPlayedTitlesFilename = "recent.toml"; constexpr std::string_view kRecentlyPlayedTitlesFilename = "recent.toml";
constexpr std::string kBaseTitle = "Xenia-canary"; constexpr std::string kBaseTitle = "Xenia-canary";
EmulatorWindow::EmulatorWindow(Emulator* emulator, EmulatorWindow::EmulatorWindow(Emulator* emulator,

View file

@ -137,10 +137,10 @@ bool XAudio2AudioDriver::InitializeObjects(Objects& objects) {
api::XAUDIO2_DEBUG_CONFIGURATION config; api::XAUDIO2_DEBUG_CONFIGURATION config;
config.TraceMask = api::XE_XAUDIO2_LOG_ERRORS | api::XE_XAUDIO2_LOG_WARNINGS; config.TraceMask = api::XE_XAUDIO2_LOG_ERRORS | api::XE_XAUDIO2_LOG_WARNINGS;
config.BreakMask = 0; config.BreakMask = 0;
config.LogThreadID = FALSE; config.LogThreadID = false;
config.LogTiming = TRUE; config.LogTiming = true;
config.LogFunctionName = TRUE; config.LogFunctionName = true;
config.LogFileline = TRUE; config.LogFileline = true;
objects.audio->SetDebugConfiguration(&config); objects.audio->SetDebugConfiguration(&config);
hr = objects.audio->CreateMasteringVoice(&objects.mastering_voice); hr = objects.audio->CreateMasteringVoice(&objects.mastering_voice);

View file

@ -60,7 +60,7 @@ static void RequestWin32HighResolutionTimer() {
ULONG minimum_resolution, maximum_resolution, current_resolution; ULONG minimum_resolution, maximum_resolution, current_resolution;
nt_query_timer_resolution(&minimum_resolution, &maximum_resolution, nt_query_timer_resolution(&minimum_resolution, &maximum_resolution,
&current_resolution); &current_resolution);
nt_set_timer_resolution(maximum_resolution, TRUE, &current_resolution); nt_set_timer_resolution(maximum_resolution, true, &current_resolution);
} }
static void RequestWin32MMCSS() { static void RequestWin32MMCSS() {
@ -74,7 +74,7 @@ static void RequestWin32MMCSS() {
dwm_enable_mmcss = reinterpret_cast<decltype(dwm_enable_mmcss)>( dwm_enable_mmcss = reinterpret_cast<decltype(dwm_enable_mmcss)>(
GetProcAddress(dwmapi_module, "DwmEnableMMCSS")); GetProcAddress(dwmapi_module, "DwmEnableMMCSS"));
if (dwm_enable_mmcss) { if (dwm_enable_mmcss) {
dwm_enable_mmcss(TRUE); dwm_enable_mmcss(true);
} }
FreeLibrary(dwmapi_module); FreeLibrary(dwmapi_module);
} }

View file

@ -813,12 +813,12 @@ template <unsigned Size>
static void smallset_const(void* destination, unsigned char fill_value) { static void smallset_const(void* destination, unsigned char fill_value) {
#if XE_ARCH_AMD64 == 1 && XE_COMPILER_MSVC == 1 #if XE_ARCH_AMD64 == 1 && XE_COMPILER_MSVC == 1
if constexpr ((Size & 7) == 0) { if constexpr ((Size & 7) == 0) {
unsigned long long fill = static unsigned long long fill =
static_cast<unsigned long long>(fill_value) * 0x0101010101010101ULL; static_cast<unsigned long long>(fill_value) * 0x0101010101010101ULL;
__stosq((unsigned long long*)destination, fill, Size / 8); __stosq((unsigned long long*)destination, fill, Size / 8);
} else if constexpr ((Size & 3) == 0) { } else if constexpr ((Size & 3) == 0) {
static constexpr unsigned long fill = static unsigned long fill =
static_cast<unsigned long>(fill_value) * 0x01010101U; static_cast<unsigned long>(fill_value) * 0x01010101U;
__stosd((unsigned long*)destination, fill, Size / 4); __stosd((unsigned long*)destination, fill, Size / 4);
// dont even bother with movsw, i think the operand size override prefix // dont even bother with movsw, i think the operand size override prefix

View file

@ -96,7 +96,7 @@ class Win32Socket : public Socket {
// Keepalive for a looong time, as we may be paused by the debugger/etc. // Keepalive for a looong time, as we may be paused by the debugger/etc.
struct tcp_keepalive alive; struct tcp_keepalive alive;
alive.onoff = TRUE; alive.onoff = true;
alive.keepalivetime = 7200000; alive.keepalivetime = 7200000;
alive.keepaliveinterval = 6000; alive.keepaliveinterval = 6000;
DWORD bytes_returned; DWORD bytes_returned;
@ -209,7 +209,7 @@ class Win32SocketServer : public SocketServer {
SOCKET socket = socket_; SOCKET socket = socket_;
socket_ = INVALID_SOCKET; socket_ = INVALID_SOCKET;
linger so_linger; linger so_linger;
so_linger.l_onoff = TRUE; so_linger.l_onoff = true;
so_linger.l_linger = 30; so_linger.l_linger = 30;
setsockopt(socket, SOL_SOCKET, SO_LINGER, setsockopt(socket, SOL_SOCKET, SO_LINGER,
reinterpret_cast<const char*>(&so_linger), sizeof(so_linger)); reinterpret_cast<const char*>(&so_linger), sizeof(so_linger));
@ -231,7 +231,7 @@ class Win32SocketServer : public SocketServer {
return false; return false;
} }
struct tcp_keepalive alive; struct tcp_keepalive alive;
alive.onoff = TRUE; alive.onoff = true;
alive.keepalivetime = 7200000; alive.keepalivetime = 7200000;
alive.keepaliveinterval = 6000; alive.keepaliveinterval = 6000;
DWORD bytes_returned; DWORD bytes_returned;

View file

@ -170,7 +170,7 @@ void Sleep(std::chrono::microseconds duration) {
} }
SleepResult AlertableSleep(std::chrono::microseconds duration) { SleepResult AlertableSleep(std::chrono::microseconds duration) {
if (SleepEx(static_cast<DWORD>(duration.count() / 1000), TRUE) == if (SleepEx(static_cast<DWORD>(duration.count() / 1000), true) ==
WAIT_IO_COMPLETION) { WAIT_IO_COMPLETION) {
return SleepResult::kAlerted; return SleepResult::kAlerted;
} }
@ -211,7 +211,7 @@ WaitResult Wait(WaitHandle* wait_handle, bool is_alertable,
HANDLE handle = wait_handle->native_handle(); HANDLE handle = wait_handle->native_handle();
DWORD result; DWORD result;
DWORD timeout_dw = DWORD(timeout.count()); DWORD timeout_dw = DWORD(timeout.count());
BOOL bAlertable = is_alertable ? TRUE : FALSE; BOOL bAlertable = is_alertable ? true : false;
// todo: we might actually be able to use NtWaitForSingleObject even if its // todo: we might actually be able to use NtWaitForSingleObject even if its
// alertable, just need to study whether // alertable, just need to study whether
// RtlDeactivateActivationContextUnsafeFast/RtlActivateActivationContext are // RtlDeactivateActivationContextUnsafeFast/RtlActivateActivationContext are
@ -251,7 +251,7 @@ WaitResult SignalAndWait(WaitHandle* wait_handle_to_signal,
HANDLE handle_to_wait_on = wait_handle_to_wait_on->native_handle(); HANDLE handle_to_wait_on = wait_handle_to_wait_on->native_handle();
DWORD result = DWORD result =
SignalObjectAndWait(handle_to_signal, handle_to_wait_on, SignalObjectAndWait(handle_to_signal, handle_to_wait_on,
DWORD(timeout.count()), is_alertable ? TRUE : FALSE); DWORD(timeout.count()), is_alertable ? true : false);
switch (result) { switch (result) {
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
return WaitResult::kSuccess; return WaitResult::kSuccess;
@ -278,8 +278,8 @@ std::pair<WaitResult, size_t> WaitMultiple(WaitHandle* wait_handles[],
handles[i] = wait_handles[i]->native_handle(); handles[i] = wait_handles[i]->native_handle();
} }
DWORD result = WaitForMultipleObjectsEx( DWORD result = WaitForMultipleObjectsEx(
static_cast<DWORD>(wait_handle_count), handles, wait_all ? TRUE : FALSE, static_cast<DWORD>(wait_handle_count), handles, wait_all ? true : false,
DWORD(timeout.count()), is_alertable ? TRUE : FALSE); DWORD(timeout.count()), is_alertable ? true : false);
if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + wait_handle_count) { if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + wait_handle_count) {
return std::pair<WaitResult, size_t>(WaitResult::kSuccess, return std::pair<WaitResult, size_t>(WaitResult::kSuccess,
result - WAIT_OBJECT_0); result - WAIT_OBJECT_0);
@ -339,7 +339,7 @@ class Win32Event : public Win32Handle<Event> {
std::unique_ptr<Event> Event::CreateManualResetEvent(bool initial_state) { std::unique_ptr<Event> Event::CreateManualResetEvent(bool initial_state) {
HANDLE handle = HANDLE handle =
CreateEvent(nullptr, TRUE, initial_state ? TRUE : FALSE, nullptr); CreateEvent(nullptr, true, initial_state ? true : false, nullptr);
if (handle) { if (handle) {
return std::make_unique<Win32Event>(handle); return std::make_unique<Win32Event>(handle);
} else { } else {
@ -351,7 +351,7 @@ std::unique_ptr<Event> Event::CreateManualResetEvent(bool initial_state) {
std::unique_ptr<Event> Event::CreateAutoResetEvent(bool initial_state) { std::unique_ptr<Event> Event::CreateAutoResetEvent(bool initial_state) {
HANDLE handle = HANDLE handle =
CreateEvent(nullptr, FALSE, initial_state ? TRUE : FALSE, nullptr); CreateEvent(nullptr, false, initial_state ? true : false, nullptr);
if (handle) { if (handle) {
return std::make_unique<Win32Event>(handle); return std::make_unique<Win32Event>(handle);
} else { } else {
@ -397,7 +397,7 @@ class Win32Mutant : public Win32Handle<Mutant> {
}; };
std::unique_ptr<Mutant> Mutant::Create(bool initial_owner) { std::unique_ptr<Mutant> Mutant::Create(bool initial_owner) {
HANDLE handle = CreateMutex(nullptr, initial_owner ? TRUE : FALSE, nullptr); HANDLE handle = CreateMutex(nullptr, initial_owner ? true : false, nullptr);
if (handle) { if (handle) {
return std::make_unique<Win32Mutant>(handle); return std::make_unique<Win32Mutant>(handle);
} else { } else {
@ -433,7 +433,7 @@ class Win32Timer : public Win32Handle<Timer> {
callback_ ? reinterpret_cast<PTIMERAPCROUTINE>(CompletionRoutine) callback_ ? reinterpret_cast<PTIMERAPCROUTINE>(CompletionRoutine)
: NULL; : NULL;
return SetWaitableTimer(handle_, &due_time_li, 0, completion_routine, this, return SetWaitableTimer(handle_, &due_time_li, 0, completion_routine, this,
FALSE) false)
? true ? true
: false; : false;
} }
@ -461,7 +461,7 @@ class Win32Timer : public Win32Handle<Timer> {
callback_ ? reinterpret_cast<PTIMERAPCROUTINE>(CompletionRoutine) callback_ ? reinterpret_cast<PTIMERAPCROUTINE>(CompletionRoutine)
: NULL; : NULL;
return SetWaitableTimer(handle_, &due_time_li, int32_t(period.count()), return SetWaitableTimer(handle_, &due_time_li, int32_t(period.count()),
completion_routine, this, FALSE) completion_routine, this, false)
? true ? true
: false; : false;
} }
@ -490,7 +490,7 @@ class Win32Timer : public Win32Handle<Timer> {
}; };
std::unique_ptr<Timer> Timer::CreateManualResetTimer() { std::unique_ptr<Timer> Timer::CreateManualResetTimer() {
HANDLE handle = CreateWaitableTimer(NULL, TRUE, NULL); HANDLE handle = CreateWaitableTimer(NULL, true, NULL);
if (handle) { if (handle) {
return std::make_unique<Win32Timer>(handle); return std::make_unique<Win32Timer>(handle);
} else { } else {
@ -500,7 +500,7 @@ std::unique_ptr<Timer> Timer::CreateManualResetTimer() {
} }
std::unique_ptr<Timer> Timer::CreateSynchronizationTimer() { std::unique_ptr<Timer> Timer::CreateSynchronizationTimer() {
HANDLE handle = CreateWaitableTimer(NULL, FALSE, NULL); HANDLE handle = CreateWaitableTimer(NULL, false, NULL);
if (handle) { if (handle) {
return std::make_unique<Win32Timer>(handle); return std::make_unique<Win32Timer>(handle);
} else { } else {

View file

@ -92,7 +92,7 @@ typedef struct _UNWIND_INFO {
// Size of unwind info per function. // Size of unwind info per function.
// TODO(benvanik): move this to emitter. // TODO(benvanik): move this to emitter.
static const uint32_t kUnwindInfoSize = static constexpr uint32_t kUnwindInfoSize =
sizeof(UNWIND_INFO) + (sizeof(UNWIND_CODE) * (6 - 1)); sizeof(UNWIND_INFO) + (sizeof(UNWIND_CODE) * (6 - 1));
class Win32X64CodeCache : public X64CodeCache { class Win32X64CodeCache : public X64CodeCache {

View file

@ -1243,7 +1243,7 @@ void* X64Emitter::FindQwordConstantOffset(uint64_t qwordvalue) {
} }
// First location to try and place constants. // First location to try and place constants.
static constexpr uintptr_t kConstDataLocation = 0x20000000; static constexpr uintptr_t kConstDataLocation = 0x20000000;
static const uintptr_t kConstDataSize = sizeof(xmm_consts); static constexpr uintptr_t kConstDataSize = sizeof(xmm_consts);
// Increment the location by this amount for every allocation failure. // Increment the location by this amount for every allocation failure.
static constexpr uintptr_t kConstDataIncrement = 0x00001000; static constexpr uintptr_t kConstDataIncrement = 0x00001000;

View file

@ -227,8 +227,8 @@ class X64Emitter : public Xbyak::CodeGenerator {
// xmm0-2 // xmm0-2
// Available: rbx, r10-r15 // Available: rbx, r10-r15
// xmm4-xmm15 (save to get xmm3) // xmm4-xmm15 (save to get xmm3)
static const int GPR_COUNT = 7; static constexpr int GPR_COUNT = 7;
static const int XMM_COUNT = 12; static constexpr int XMM_COUNT = 12;
static constexpr size_t kStashOffset = 32; static constexpr size_t kStashOffset = 32;
static void SetupReg(const hir::Value* v, Xbyak::Reg8& r) { static void SetupReg(const hir::Value* v, Xbyak::Reg8& r) {
auto idx = gpr_reg_map_[v->reg.index]; auto idx = gpr_reg_map_[v->reg.index];

View file

@ -123,7 +123,7 @@ struct OpBase {};
template <typename T, KeyType KEY_TYPE> template <typename T, KeyType KEY_TYPE>
struct Op : OpBase { struct Op : OpBase {
static const KeyType key_type = KEY_TYPE; static constexpr KeyType key_type = KEY_TYPE;
}; };
struct VoidOp : Op<VoidOp, KEY_TYPE_X> { struct VoidOp : Op<VoidOp, KEY_TYPE_X> {

View file

@ -48,7 +48,7 @@ bool ControlFlowSimplificationPass::Run(HIRBuilder* builder) {
block = builder->last_block(); block = builder->last_block();
while (block) { while (block) {
auto prev_block = block->prev; auto prev_block = block->prev;
const uint32_t expected = Edge::DOMINATES | Edge::UNCONDITIONAL; constexpr uint32_t expected = Edge::DOMINATES | Edge::UNCONDITIONAL;
if (block->incoming_edge_head && if (block->incoming_edge_head &&
(block->incoming_edge_head->flags & expected) == expected) { (block->incoming_edge_head->flags & expected) == expected) {
// Dominated by the incoming block. // Dominated by the incoming block.

View file

@ -14,7 +14,7 @@ namespace cpu {
namespace hir { namespace hir {
#define DEFINE_OPCODE(num, name, sig, flags) \ #define DEFINE_OPCODE(num, name, sig, flags) \
const OpcodeInfo num##_info = { \ constexpr OpcodeInfo num##_info = { \
num, \ num, \
flags, \ flags, \
sig, \ sig, \

View file

@ -44,7 +44,7 @@ using namespace xe::literals;
typedef std::vector<std::pair<std::string, std::string>> AnnotationList; typedef std::vector<std::pair<std::string, std::string>> AnnotationList;
const uint32_t START_ADDRESS = 0x80000000; constexpr uint32_t START_ADDRESS = 0x80000000;
struct TestCase { struct TestCase {
TestCase(uint32_t address, std::string& name) TestCase(uint32_t address, std::string& name)

View file

@ -43,7 +43,7 @@ struct Context {
typedef std::vector<std::pair<std::string, std::string>> AnnotationList; typedef std::vector<std::pair<std::string, std::string>> AnnotationList;
const uint32_t START_ADDRESS = 0x00000000; constexpr uint32_t START_ADDRESS = 0x00000000;
struct TestCase { struct TestCase {
TestCase(uint32_t address, std::string& name) TestCase(uint32_t address, std::string& name)

View file

@ -104,7 +104,7 @@ bool InitializeStackWalker() {
options |= SYMOPT_LOAD_LINES; options |= SYMOPT_LOAD_LINES;
options |= SYMOPT_FAIL_CRITICAL_ERRORS; options |= SYMOPT_FAIL_CRITICAL_ERRORS;
sym_set_options_(options); sym_set_options_(options);
if (!sym_initialize_(GetCurrentProcess(), nullptr, TRUE)) { if (!sym_initialize_(GetCurrentProcess(), nullptr, true)) {
XELOGE("Unable to initialize symbol services - already in use?"); XELOGE("Unable to initialize symbol services - already in use?");
return false; return false;
} }
@ -192,7 +192,7 @@ class Win32StackWalker : public StackWalker {
} }
// Setup the frame for walking. // Setup the frame for walking.
STACKFRAME64 stack_frame = {0}; STACKFRAME64 stack_frame = {};
stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrPC.Mode = AddrModeFlat;
stack_frame.AddrPC.Offset = thread_context.Rip; stack_frame.AddrPC.Offset = thread_context.Rip;
stack_frame.AddrFrame.Mode = AddrModeFlat; stack_frame.AddrFrame.Mode = AddrModeFlat;

View file

@ -1505,13 +1505,13 @@ std::vector<uint32_t> XexModule::PreanalyzeCode() {
uint32_t* range_end = (uint32_t*)memory()->TranslateVirtual( uint32_t* range_end = (uint32_t*)memory()->TranslateVirtual(
high_8_aligned); // align down to multiple of 8 high_8_aligned); // align down to multiple of 8
const uint8_t mfspr_r12_lr[4] = {0x7D, 0x88, 0x02, 0xA6}; constexpr uint8_t mfspr_r12_lr[4] = {0x7D, 0x88, 0x02, 0xA6};
// a blr instruction, with 4 zero bytes afterwards to pad the next address // a blr instruction, with 4 zero bytes afterwards to pad the next address
// to 8 byte alignment // to 8 byte alignment
// if we see this prior to our address, we can assume we are a function // if we see this prior to our address, we can assume we are a function
// start // start
const uint8_t blr[4] = {0x4E, 0x80, 0x0, 0x20}; constexpr uint8_t blr[4] = {0x4E, 0x80, 0x0, 0x20};
uint32_t blr32 = *reinterpret_cast<const uint32_t*>(&blr[0]); uint32_t blr32 = *reinterpret_cast<const uint32_t*>(&blr[0]);

View file

@ -55,8 +55,8 @@ class Window;
namespace xe { namespace xe {
constexpr fourcc_t kEmulatorSaveSignature = make_fourcc("XSAV"); constexpr fourcc_t kEmulatorSaveSignature = make_fourcc("XSAV");
static const std::string kDefaultGameSymbolicLink = "GAME:"; static constexpr std::string_view kDefaultGameSymbolicLink = "GAME:";
static const std::string kDefaultPartitionSymbolicLink = "D:"; static constexpr std::string_view kDefaultPartitionSymbolicLink = "D:";
// The main type that runs the whole emulator. // The main type that runs the whole emulator.
// This is responsible for initializing and managing all the various subsystems. // This is responsible for initializing and managing all the various subsystems.

View file

@ -810,7 +810,7 @@ bool D3D12CommandProcessor::SetupContext() {
ID3D12Device* device = provider.GetDevice(); ID3D12Device* device = provider.GetDevice();
ID3D12CommandQueue* direct_queue = provider.GetDirectQueue(); ID3D12CommandQueue* direct_queue = provider.GetDirectQueue();
fence_completion_event_ = CreateEvent(nullptr, FALSE, FALSE, nullptr); fence_completion_event_ = CreateEvent(nullptr, false, false, nullptr);
if (fence_completion_event_ == nullptr) { if (fence_completion_event_ == nullptr) {
XELOGE("Failed to create the fence completion event"); XELOGE("Failed to create the fence completion event");
return false; return false;

View file

@ -969,7 +969,7 @@ bool D3D12RenderTargetCache::Initialize() {
D3D12_FILL_MODE_SOLID; D3D12_FILL_MODE_SOLID;
uint32_rtv_clear_pipeline_desc.RasterizerState.CullMode = uint32_rtv_clear_pipeline_desc.RasterizerState.CullMode =
D3D12_CULL_MODE_NONE; D3D12_CULL_MODE_NONE;
uint32_rtv_clear_pipeline_desc.RasterizerState.DepthClipEnable = TRUE; uint32_rtv_clear_pipeline_desc.RasterizerState.DepthClipEnable = true;
uint32_rtv_clear_pipeline_desc.PrimitiveTopologyType = uint32_rtv_clear_pipeline_desc.PrimitiveTopologyType =
D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
uint32_rtv_clear_pipeline_desc.NumRenderTargets = 1; uint32_rtv_clear_pipeline_desc.NumRenderTargets = 1;
@ -4327,12 +4327,12 @@ D3D12RenderTargetCache::GetOrCreateTransferPipelines(TransferShaderKey key) {
} }
pipeline_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID; pipeline_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
pipeline_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE; pipeline_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
pipeline_desc.RasterizerState.DepthClipEnable = TRUE; pipeline_desc.RasterizerState.DepthClipEnable = true;
pipeline_desc.InputLayout.pInputElementDescs = &pipeline_input_element_desc; pipeline_desc.InputLayout.pInputElementDescs = &pipeline_input_element_desc;
pipeline_desc.InputLayout.NumElements = 1; pipeline_desc.InputLayout.NumElements = 1;
pipeline_desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; pipeline_desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
if (dest_is_stencil_bit) { if (dest_is_stencil_bit) {
pipeline_desc.DepthStencilState.StencilEnable = TRUE; pipeline_desc.DepthStencilState.StencilEnable = true;
pipeline_desc.DepthStencilState.FrontFace.StencilFailOp = pipeline_desc.DepthStencilState.FrontFace.StencilFailOp =
D3D12_STENCIL_OP_KEEP; D3D12_STENCIL_OP_KEEP;
pipeline_desc.DepthStencilState.FrontFace.StencilDepthFailOp = pipeline_desc.DepthStencilState.FrontFace.StencilDepthFailOp =
@ -4375,14 +4375,14 @@ D3D12RenderTargetCache::GetOrCreateTransferPipelines(TransferShaderKey key) {
pipeline_desc.RTVFormats[0] = pipeline_desc.RTVFormats[0] =
GetColorOwnershipTransferDXGIFormat(dest_color_format); GetColorOwnershipTransferDXGIFormat(dest_color_format);
} else { } else {
pipeline_desc.DepthStencilState.DepthEnable = TRUE; pipeline_desc.DepthStencilState.DepthEnable = true;
pipeline_desc.DepthStencilState.DepthWriteMask = pipeline_desc.DepthStencilState.DepthWriteMask =
D3D12_DEPTH_WRITE_MASK_ALL; D3D12_DEPTH_WRITE_MASK_ALL;
pipeline_desc.DepthStencilState.DepthFunc = pipeline_desc.DepthStencilState.DepthFunc =
cvars::depth_transfer_not_equal_test ? D3D12_COMPARISON_FUNC_NOT_EQUAL cvars::depth_transfer_not_equal_test ? D3D12_COMPARISON_FUNC_NOT_EQUAL
: D3D12_COMPARISON_FUNC_ALWAYS; : D3D12_COMPARISON_FUNC_ALWAYS;
if (use_stencil_reference_output_) { if (use_stencil_reference_output_) {
pipeline_desc.DepthStencilState.StencilEnable = TRUE; pipeline_desc.DepthStencilState.StencilEnable = true;
pipeline_desc.DepthStencilState.StencilWriteMask = UINT8_MAX; pipeline_desc.DepthStencilState.StencilWriteMask = UINT8_MAX;
pipeline_desc.DepthStencilState.FrontFace.StencilFailOp = pipeline_desc.DepthStencilState.FrontFace.StencilFailOp =
D3D12_STENCIL_OP_KEEP; D3D12_STENCIL_OP_KEEP;
@ -4804,7 +4804,7 @@ void D3D12RenderTargetCache::PerformTransfersAndResolveClears(
are_current_command_list_render_targets_valid_ = false; are_current_command_list_render_targets_valid_ = false;
if (dest_rt_key.is_depth) { if (dest_rt_key.is_depth) {
auto handle = dest_d3d12_rt.descriptor_draw().GetHandle(); auto handle = dest_d3d12_rt.descriptor_draw().GetHandle();
command_list.D3DOMSetRenderTargets(0, nullptr, FALSE, &handle); command_list.D3DOMSetRenderTargets(0, nullptr, false, &handle);
if (!use_stencil_reference_output_) { if (!use_stencil_reference_output_) {
command_processor_.SetStencilReference(UINT8_MAX); command_processor_.SetStencilReference(UINT8_MAX);
} }
@ -4812,7 +4812,7 @@ void D3D12RenderTargetCache::PerformTransfersAndResolveClears(
auto handle = dest_d3d12_rt.descriptor_load_separate().IsValid() auto handle = dest_d3d12_rt.descriptor_load_separate().IsValid()
? dest_d3d12_rt.descriptor_load_separate().GetHandle() ? dest_d3d12_rt.descriptor_load_separate().GetHandle()
: dest_d3d12_rt.descriptor_draw().GetHandle(); : dest_d3d12_rt.descriptor_draw().GetHandle();
command_list.D3DOMSetRenderTargets(1, &handle, FALSE, nullptr); command_list.D3DOMSetRenderTargets(1, &handle, false, nullptr);
} }
uint32_t dest_pitch_tiles = dest_rt_key.GetPitchTiles(); uint32_t dest_pitch_tiles = dest_rt_key.GetPitchTiles();
@ -5432,7 +5432,7 @@ void D3D12RenderTargetCache::PerformTransfersAndResolveClears(
? dest_d3d12_rt.descriptor_load_separate().GetHandle() ? dest_d3d12_rt.descriptor_load_separate().GetHandle()
: dest_d3d12_rt.descriptor_draw().GetHandle()); : dest_d3d12_rt.descriptor_draw().GetHandle());
command_list.D3DOMSetRenderTargets(1, &handle, FALSE, nullptr); command_list.D3DOMSetRenderTargets(1, &handle, false, nullptr);
are_current_command_list_render_targets_valid_ = true; are_current_command_list_render_targets_valid_ = true;
D3D12_VIEWPORT clear_viewport; D3D12_VIEWPORT clear_viewport;
clear_viewport.TopLeftX = float(clear_rect.left); clear_viewport.TopLeftX = float(clear_rect.left);
@ -5553,7 +5553,7 @@ void D3D12RenderTargetCache::SetCommandListRenderTargets(
: d3d12_rt.descriptor_draw().GetHandle(); : d3d12_rt.descriptor_draw().GetHandle();
} }
command_processor_.GetDeferredCommandList().D3DOMSetRenderTargets( command_processor_.GetDeferredCommandList().D3DOMSetRenderTargets(
rtv_count, rtv_handles, FALSE, rtv_count, rtv_handles, false,
depth_and_color_render_targets[0] ? &dsv_handle : nullptr); depth_and_color_render_targets[0] ? &dsv_handle : nullptr);
are_current_command_list_render_targets_valid_ = true; are_current_command_list_render_targets_valid_ = true;
} }

View file

@ -394,7 +394,7 @@ bool D3D12SharedMemory::AllocateSparseHostGpuMemoryRange(
region_start_coordinates.Subresource = 0; region_start_coordinates.Subresource = 0;
D3D12_TILE_REGION_SIZE region_size; D3D12_TILE_REGION_SIZE region_size;
region_size.NumTiles = length_bytes / D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES; region_size.NumTiles = length_bytes / D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES;
region_size.UseBox = FALSE; region_size.UseBox = false;
D3D12_TILE_RANGE_FLAGS range_flags = D3D12_TILE_RANGE_FLAG_NONE; D3D12_TILE_RANGE_FLAGS range_flags = D3D12_TILE_RANGE_FLAG_NONE;
UINT heap_range_start_offset = 0; UINT heap_range_start_offset = 0;
direct_queue->UpdateTileMappings( direct_queue->UpdateTileMappings(

View file

@ -968,7 +968,7 @@ bool D3D12TextureCache::EnsureScaledResolveMemoryCommitted(
D3D12_TILE_REGION_SIZE region_size; D3D12_TILE_REGION_SIZE region_size;
region_size.NumTiles = region_size.NumTiles =
kScaledResolveHeapSize / D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES; kScaledResolveHeapSize / D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES;
region_size.UseBox = FALSE; region_size.UseBox = false;
D3D12_TILE_RANGE_FLAGS range_flags = D3D12_TILE_RANGE_FLAG_NONE; D3D12_TILE_RANGE_FLAGS range_flags = D3D12_TILE_RANGE_FLAG_NONE;
UINT heap_range_start_offset = 0; UINT heap_range_start_offset = 0;
UINT range_tile_count = UINT range_tile_count =

View file

@ -144,7 +144,7 @@ void DeferredCommandList::Execute(ID3D12GraphicsCommandList* command_list,
*reinterpret_cast<const D3DOMSetRenderTargetsArguments*>(stream); *reinterpret_cast<const D3DOMSetRenderTargetsArguments*>(stream);
command_list->OMSetRenderTargets( command_list->OMSetRenderTargets(
args.num_render_target_descriptors, args.render_target_descriptors, args.num_render_target_descriptors, args.render_target_descriptors,
args.rts_single_handle_to_descriptor_range ? TRUE : FALSE, args.rts_single_handle_to_descriptor_range ? true : false,
args.depth_stencil ? &args.depth_stencil_descriptor : nullptr); args.depth_stencil ? &args.depth_stencil_descriptor : nullptr);
} break; } break;
case Command::kD3DOMSetStencilRef: { case Command::kD3DOMSetStencilRef: {

View file

@ -3029,7 +3029,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
break; break;
} }
state_desc.RasterizerState.FrontCounterClockwise = state_desc.RasterizerState.FrontCounterClockwise =
description.front_counter_clockwise ? TRUE : FALSE; description.front_counter_clockwise ? true : false;
state_desc.RasterizerState.DepthBias = description.depth_bias; state_desc.RasterizerState.DepthBias = description.depth_bias;
state_desc.RasterizerState.DepthBiasClamp = 0.0f; state_desc.RasterizerState.DepthBiasClamp = 0.0f;
// With non-square resolution scaling, make sure the worst-case impact is // With non-square resolution scaling, make sure the worst-case impact is
@ -3041,7 +3041,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
float(std::max(render_target_cache_.draw_resolution_scale_x(), float(std::max(render_target_cache_.draw_resolution_scale_x(),
render_target_cache_.draw_resolution_scale_y())); render_target_cache_.draw_resolution_scale_y()));
state_desc.RasterizerState.DepthClipEnable = state_desc.RasterizerState.DepthClipEnable =
description.depth_clip ? TRUE : FALSE; description.depth_clip ? true : false;
uint32_t msaa_sample_count = uint32_t(1) uint32_t msaa_sample_count = uint32_t(1)
<< uint32_t(description.host_msaa_samples); << uint32_t(description.host_msaa_samples);
if (edram_rov_used) { if (edram_rov_used) {
@ -3082,7 +3082,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
// Depth/stencil. // Depth/stencil.
if (description.depth_func != xenos::CompareFunction::kAlways || if (description.depth_func != xenos::CompareFunction::kAlways ||
description.depth_write) { description.depth_write) {
state_desc.DepthStencilState.DepthEnable = TRUE; state_desc.DepthStencilState.DepthEnable = true;
state_desc.DepthStencilState.DepthWriteMask = state_desc.DepthStencilState.DepthWriteMask =
description.depth_write ? D3D12_DEPTH_WRITE_MASK_ALL description.depth_write ? D3D12_DEPTH_WRITE_MASK_ALL
: D3D12_DEPTH_WRITE_MASK_ZERO; : D3D12_DEPTH_WRITE_MASK_ZERO;
@ -3093,7 +3093,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
uint32_t(description.depth_func)); uint32_t(description.depth_func));
} }
if (description.stencil_enable) { if (description.stencil_enable) {
state_desc.DepthStencilState.StencilEnable = TRUE; state_desc.DepthStencilState.StencilEnable = true;
state_desc.DepthStencilState.StencilReadMask = state_desc.DepthStencilState.StencilReadMask =
description.stencil_read_mask; description.stencil_read_mask;
state_desc.DepthStencilState.StencilWriteMask = state_desc.DepthStencilState.StencilWriteMask =
@ -3131,7 +3131,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
} }
// Render targets and blending. // Render targets and blending.
state_desc.BlendState.IndependentBlendEnable = TRUE; state_desc.BlendState.IndependentBlendEnable = true;
static constexpr D3D12_BLEND kBlendFactorMap[] = { static constexpr D3D12_BLEND kBlendFactorMap[] = {
D3D12_BLEND_ZERO, D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_ONE,
D3D12_BLEND_SRC_COLOR, D3D12_BLEND_INV_SRC_COLOR, D3D12_BLEND_SRC_COLOR, D3D12_BLEND_INV_SRC_COLOR,
@ -3169,7 +3169,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
rt.src_blend_alpha != PipelineBlendFactor::kOne || rt.src_blend_alpha != PipelineBlendFactor::kOne ||
rt.dest_blend_alpha != PipelineBlendFactor::kZero || rt.dest_blend_alpha != PipelineBlendFactor::kZero ||
rt.blend_op_alpha != xenos::BlendOp::kAdd) { rt.blend_op_alpha != xenos::BlendOp::kAdd) {
blend_desc.BlendEnable = TRUE; blend_desc.BlendEnable = true;
blend_desc.SrcBlend = kBlendFactorMap[uint32_t(rt.src_blend)]; blend_desc.SrcBlend = kBlendFactorMap[uint32_t(rt.src_blend)];
blend_desc.DestBlend = kBlendFactorMap[uint32_t(rt.dest_blend)]; blend_desc.DestBlend = kBlendFactorMap[uint32_t(rt.dest_blend)];
blend_desc.BlendOp = kBlendOpMap[uint32_t(rt.blend_op)]; blend_desc.BlendOp = kBlendOpMap[uint32_t(rt.blend_op)];
@ -3196,8 +3196,8 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
if (description.cull_mode == PipelineCullMode::kDisableRasterization) { if (description.cull_mode == PipelineCullMode::kDisableRasterization) {
state_desc.PS.pShaderBytecode = nullptr; state_desc.PS.pShaderBytecode = nullptr;
state_desc.PS.BytecodeLength = 0; state_desc.PS.BytecodeLength = 0;
state_desc.DepthStencilState.DepthEnable = FALSE; state_desc.DepthStencilState.DepthEnable = false;
state_desc.DepthStencilState.StencilEnable = FALSE; state_desc.DepthStencilState.StencilEnable = false;
} }
// Create the D3D12 pipeline state object. // Create the D3D12 pipeline state object.

View file

@ -566,7 +566,7 @@ void SpirvShaderTranslator::CompleteFragmentShaderInMain() {
spv::Id alpha_test_result_non_not_equal; spv::Id alpha_test_result_non_not_equal;
{ {
// Function other than "not equal". // Function other than "not equal".
static const spv::Op kAlphaTestOps[] = { static constexpr spv::Op kAlphaTestOps[] = {
spv::OpFOrdLessThan, spv::OpFOrdEqual, spv::OpFOrdGreaterThan}; spv::OpFOrdLessThan, spv::OpFOrdEqual, spv::OpFOrdGreaterThan};
for (uint32_t i = 0; i < 3; ++i) { for (uint32_t i = 0; i < 3; ++i) {
spv::Id alpha_test_comparison_result = builder_->createBinOp( spv::Id alpha_test_comparison_result = builder_->createBinOp(

View file

@ -42,7 +42,7 @@ constexpr uint32_t kDashboardID = 0xFFFE07D1;
const static std::string kDashboardStringID = const static std::string kDashboardStringID =
fmt::format("{:08X}", kDashboardID); fmt::format("{:08X}", kDashboardID);
constexpr std::string kDefaultMountFormat = "User_{:016X}"; constexpr std::string_view kDefaultMountFormat = "User_{:016X}";
class ProfileManager { class ProfileManager {
public: public:

View file

@ -23,7 +23,8 @@ namespace xam {
bool xeXamIsUIActive(); bool xeXamIsUIActive();
static constexpr std::string kXamModuleLoaderDataFileName = "launch_data.bin"; static constexpr std::string_view kXamModuleLoaderDataFileName =
"launch_data.bin";
class XamModule : public KernelModule { class XamModule : public KernelModule {
public: public:

View file

@ -134,7 +134,7 @@ bool D3D12ImmediateDrawer::Initialize() {
pipeline_desc.PS.BytecodeLength = sizeof(shaders::immediate_ps); pipeline_desc.PS.BytecodeLength = sizeof(shaders::immediate_ps);
D3D12_RENDER_TARGET_BLEND_DESC& pipeline_blend_desc = D3D12_RENDER_TARGET_BLEND_DESC& pipeline_blend_desc =
pipeline_desc.BlendState.RenderTarget[0]; pipeline_desc.BlendState.RenderTarget[0];
pipeline_blend_desc.BlendEnable = TRUE; pipeline_blend_desc.BlendEnable = true;
pipeline_blend_desc.SrcBlend = D3D12_BLEND_SRC_ALPHA; pipeline_blend_desc.SrcBlend = D3D12_BLEND_SRC_ALPHA;
pipeline_blend_desc.DestBlend = D3D12_BLEND_INV_SRC_ALPHA; pipeline_blend_desc.DestBlend = D3D12_BLEND_INV_SRC_ALPHA;
pipeline_blend_desc.BlendOp = D3D12_BLEND_OP_ADD; pipeline_blend_desc.BlendOp = D3D12_BLEND_OP_ADD;
@ -145,8 +145,8 @@ bool D3D12ImmediateDrawer::Initialize() {
pipeline_desc.SampleMask = UINT_MAX; pipeline_desc.SampleMask = UINT_MAX;
pipeline_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID; pipeline_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
pipeline_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE; pipeline_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
pipeline_desc.RasterizerState.FrontCounterClockwise = FALSE; pipeline_desc.RasterizerState.FrontCounterClockwise = false;
pipeline_desc.RasterizerState.DepthClipEnable = TRUE; pipeline_desc.RasterizerState.DepthClipEnable = true;
D3D12_INPUT_ELEMENT_DESC pipeline_input_elements[3] = {}; D3D12_INPUT_ELEMENT_DESC pipeline_input_elements[3] = {};
pipeline_input_elements[0].SemanticName = "POSITION"; pipeline_input_elements[0].SemanticName = "POSITION";
pipeline_input_elements[0].Format = DXGI_FORMAT_R32G32_FLOAT; pipeline_input_elements[0].Format = DXGI_FORMAT_R32G32_FLOAT;

View file

@ -268,7 +268,7 @@ D3D12Presenter::ConnectOrReconnectPaintingToSurfaceFromUIThread(
swap_chain_desc.Width = UINT(new_swap_chain_width); swap_chain_desc.Width = UINT(new_swap_chain_width);
swap_chain_desc.Height = UINT(new_swap_chain_height); swap_chain_desc.Height = UINT(new_swap_chain_height);
swap_chain_desc.Format = kSwapChainFormat; swap_chain_desc.Format = kSwapChainFormat;
swap_chain_desc.Stereo = FALSE; swap_chain_desc.Stereo = false;
swap_chain_desc.SampleDesc.Count = 1; swap_chain_desc.SampleDesc.Count = 1;
swap_chain_desc.SampleDesc.Quality = 0; swap_chain_desc.SampleDesc.Quality = 0;
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
@ -770,7 +770,7 @@ Presenter::PaintResult D3D12Presenter::PaintAndPresentImpl(
if (is_final_effect) { if (is_final_effect) {
if (!back_buffer_bound) { if (!back_buffer_bound) {
command_list->OMSetRenderTargets(1, &back_buffer_rtv, TRUE, command_list->OMSetRenderTargets(1, &back_buffer_rtv, true,
nullptr); nullptr);
back_buffer_bound = true; back_buffer_bound = true;
} }
@ -780,7 +780,7 @@ Presenter::PaintResult D3D12Presenter::PaintAndPresentImpl(
rtv_heap_start, rtv_heap_start,
uint32_t(PaintContext::kRTVIndexGuestOutputIntermediate0 + uint32_t(PaintContext::kRTVIndexGuestOutputIntermediate0 +
i)); i));
command_list->OMSetRenderTargets(1, &intermediate_rtv, TRUE, nullptr); command_list->OMSetRenderTargets(1, &intermediate_rtv, true, nullptr);
back_buffer_bound = false; back_buffer_bound = false;
} }
if (is_final_effect) { if (is_final_effect) {
@ -1028,7 +1028,7 @@ Presenter::PaintResult D3D12Presenter::PaintAndPresentImpl(
if (execute_ui_drawers) { if (execute_ui_drawers) {
// Draw the UI. // Draw the UI.
if (!back_buffer_bound) { if (!back_buffer_bound) {
command_list->OMSetRenderTargets(1, &back_buffer_rtv, TRUE, nullptr); command_list->OMSetRenderTargets(1, &back_buffer_rtv, true, nullptr);
back_buffer_bound = true; back_buffer_bound = true;
} }
D3D12UIDrawContext ui_draw_context( D3D12UIDrawContext ui_draw_context(
@ -1285,7 +1285,7 @@ bool D3D12Presenter::InitializeSurfaceIndependent() {
D3D12_FILL_MODE_SOLID; D3D12_FILL_MODE_SOLID;
guest_output_paint_pipeline_desc.RasterizerState.CullMode = guest_output_paint_pipeline_desc.RasterizerState.CullMode =
D3D12_CULL_MODE_NONE; D3D12_CULL_MODE_NONE;
guest_output_paint_pipeline_desc.RasterizerState.DepthClipEnable = TRUE; guest_output_paint_pipeline_desc.RasterizerState.DepthClipEnable = true;
guest_output_paint_pipeline_desc.PrimitiveTopologyType = guest_output_paint_pipeline_desc.PrimitiveTopologyType =
D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
guest_output_paint_pipeline_desc.NumRenderTargets = 1; guest_output_paint_pipeline_desc.NumRenderTargets = 1;

View file

@ -118,7 +118,7 @@ bool D3D12Provider::EnableIncreaseBasePriorityPrivilege() {
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token)) { if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token)) {
return false; return false;
} }
bool enabled = AdjustTokenPrivileges(token, FALSE, &privileges, bool enabled = AdjustTokenPrivileges(token, false, &privileges,
sizeof(privileges), nullptr, nullptr) && sizeof(privileges), nullptr, nullptr) &&
GetLastError() != ERROR_NOT_ALL_ASSIGNED; GetLastError() != ERROR_NOT_ALL_ASSIGNED;
CloseHandle(token); CloseHandle(token);
@ -217,13 +217,13 @@ bool D3D12Provider::Initialize() {
0, IID_PPV_ARGS(&dxgi_info_queue)))) { 0, IID_PPV_ARGS(&dxgi_info_queue)))) {
if (cvars::d3d12_break_on_error) { if (cvars::d3d12_break_on_error) {
dxgi_info_queue->SetBreakOnSeverity( dxgi_info_queue->SetBreakOnSeverity(
DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, TRUE); DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, true);
dxgi_info_queue->SetBreakOnSeverity( dxgi_info_queue->SetBreakOnSeverity(
DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, TRUE); DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, true);
} }
if (cvars::d3d12_break_on_warning) { if (cvars::d3d12_break_on_warning) {
dxgi_info_queue->SetBreakOnSeverity( dxgi_info_queue->SetBreakOnSeverity(
DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_WARNING, TRUE); DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_WARNING, true);
} }
dxgi_info_queue->Release(); dxgi_info_queue->Release();
} }
@ -352,12 +352,12 @@ bool D3D12Provider::Initialize() {
d3d12_info_queue->PushStorageFilter(&d3d12_info_queue_filter); d3d12_info_queue->PushStorageFilter(&d3d12_info_queue_filter);
if (cvars::d3d12_break_on_error) { if (cvars::d3d12_break_on_error) {
d3d12_info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION, d3d12_info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_CORRUPTION,
TRUE); true);
d3d12_info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, TRUE); d3d12_info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, true);
} }
if (cvars::d3d12_break_on_warning) { if (cvars::d3d12_break_on_warning) {
d3d12_info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING, d3d12_info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING,
TRUE); true);
} }
d3d12_info_queue->Release(); d3d12_info_queue->Release();
} }

View file

@ -19,7 +19,7 @@ namespace d3d12 {
bool D3D12SubmissionTracker::Initialize(ID3D12Device* device, bool D3D12SubmissionTracker::Initialize(ID3D12Device* device,
ID3D12CommandQueue* queue) { ID3D12CommandQueue* queue) {
Shutdown(); Shutdown();
fence_completion_event_ = CreateEvent(nullptr, FALSE, FALSE, nullptr); fence_completion_event_ = CreateEvent(nullptr, false, false, nullptr);
if (!fence_completion_event_) { if (!fence_completion_event_) {
XELOGE( XELOGE(
"D3D12SubmissionTracker: Failed to create the fence completion event"); "D3D12SubmissionTracker: Failed to create the fence completion event");

View file

@ -21,7 +21,7 @@ namespace ui {
class ImGuiDialog { class ImGuiDialog {
public: public:
~ImGuiDialog(); virtual ~ImGuiDialog();
// Shows a simple message box containing a text message. // Shows a simple message box containing a text message.
// Callers can want for the dialog to close with Wait(). // Callers can want for the dialog to close with Wait().

View file

@ -67,14 +67,14 @@ bool GTKWindow::OpenImpl() {
const auto* main_menu = dynamic_cast<const GTKMenuItem*>(GetMainMenu()); const auto* main_menu = dynamic_cast<const GTKMenuItem*>(GetMainMenu());
GtkWidget* main_menu_widget = main_menu ? main_menu->handle() : nullptr; GtkWidget* main_menu_widget = main_menu ? main_menu->handle() : nullptr;
if (main_menu_widget) { if (main_menu_widget) {
gtk_box_pack_start(GTK_BOX(box_), main_menu_widget, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box_), main_menu_widget, false, false, 0);
} }
// Create the drawing area for creating the surface for, which will be the // Create the drawing area for creating the surface for, which will be the
// client area of the window occupying all the window space not taken by the // client area of the window occupying all the window space not taken by the
// main menu. // main menu.
drawing_area_ = gtk_drawing_area_new(); drawing_area_ = gtk_drawing_area_new();
gtk_box_pack_end(GTK_BOX(box_), drawing_area_, TRUE, TRUE, 0); gtk_box_pack_end(GTK_BOX(box_), drawing_area_, true, true, 0);
// The desired size is the client (drawing) area size. Let GTK auto-size the // The desired size is the client (drawing) area size. Let GTK auto-size the
// entire window around it (as well as the width of the menu actually if it // entire window around it (as well as the width of the menu actually if it
// happens to be bigger - the desired size in the Window will be updated later // happens to be bigger - the desired size in the Window will be updated later
@ -186,7 +186,7 @@ void GTKWindow::ApplyNewFullscreen() {
return; return;
} }
if (main_menu_widget) { if (main_menu_widget) {
gtk_box_pack_start(GTK_BOX(box_), main_menu_widget, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box_), main_menu_widget, false, false, 0);
if (destruction_receiver.IsWindowDestroyedOrClosed()) { if (destruction_receiver.IsWindowDestroyedOrClosed()) {
if (!destruction_receiver.IsWindowDestroyed()) { if (!destruction_receiver.IsWindowDestroyed()) {
EndBatchedSizeUpdate(destruction_receiver); EndBatchedSizeUpdate(destruction_receiver);
@ -249,7 +249,7 @@ void GTKWindow::ApplyNewMainMenu(MenuItem* old_main_menu) {
return; return;
} }
GtkWidget* new_main_menu_widget = new_main_menu->handle(); GtkWidget* new_main_menu_widget = new_main_menu->handle();
gtk_box_pack_start(GTK_BOX(box_), new_main_menu_widget, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box_), new_main_menu_widget, false, false, 0);
if (destruction_receiver.IsWindowDestroyedOrClosed() || IsFullscreen()) { if (destruction_receiver.IsWindowDestroyedOrClosed() || IsFullscreen()) {
if (!destruction_receiver.IsWindowDestroyed()) { if (!destruction_receiver.IsWindowDestroyed()) {
EndBatchedSizeUpdate(destruction_receiver); EndBatchedSizeUpdate(destruction_receiver);
@ -711,14 +711,14 @@ gboolean GTKWindow::DrawHandler(GtkWidget* widget, cairo_t* cr,
gpointer user_data) { gpointer user_data) {
auto* window = static_cast<GTKWindow*>(user_data); auto* window = static_cast<GTKWindow*>(user_data);
if (!window || widget != window->drawing_area_) { if (!window || widget != window->drawing_area_) {
return FALSE; return false;
} }
if (window->batched_size_update_depth_) { if (window->batched_size_update_depth_) {
window->batched_size_update_contained_draw_ = true; window->batched_size_update_contained_draw_ = true;
} else { } else {
window->OnPaint(); window->OnPaint();
} }
return TRUE; return true;
} }
std::unique_ptr<ui::MenuItem> MenuItem::Create(Type type, std::unique_ptr<ui::MenuItem> MenuItem::Create(Type type,

View file

@ -447,7 +447,7 @@ void Win32Window::LoadAndApplyIcon(const void* buffer, size_t size,
// specifies. // specifies.
} else { } else {
new_icon = CreateIconFromResourceEx( new_icon = CreateIconFromResourceEx(
static_cast<PBYTE>(const_cast<void*>(buffer)), DWORD(size), TRUE, static_cast<PBYTE>(const_cast<void*>(buffer)), DWORD(size), true,
0x00030000, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE); 0x00030000, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
if (!new_icon) { if (!new_icon) {
return; return;
@ -547,7 +547,7 @@ std::unique_ptr<Surface> Win32Window::CreateSurfaceImpl(
return nullptr; return nullptr;
} }
void Win32Window::RequestPaintImpl() { InvalidateRect(hwnd_, nullptr, FALSE); } void Win32Window::RequestPaintImpl() { InvalidateRect(hwnd_, nullptr, false); }
BOOL Win32Window::AdjustWindowRectangle(RECT& rect, DWORD style, BOOL menu, BOOL Win32Window::AdjustWindowRectangle(RECT& rect, DWORD style, BOOL menu,
DWORD ex_style, UINT dpi) const { DWORD ex_style, UINT dpi) const {
@ -567,7 +567,7 @@ BOOL Win32Window::AdjustWindowRectangle(RECT& rect, DWORD style, BOOL menu,
BOOL Win32Window::AdjustWindowRectangle(RECT& rect) const { BOOL Win32Window::AdjustWindowRectangle(RECT& rect) const {
if (!hwnd_) { if (!hwnd_) {
return FALSE; return false;
} }
return AdjustWindowRectangle(rect, GetWindowLong(hwnd_, GWL_STYLE), return AdjustWindowRectangle(rect, GetWindowLong(hwnd_, GWL_STYLE),
BOOL(GetMainMenu() != nullptr), BOOL(GetMainMenu() != nullptr),
@ -1156,12 +1156,12 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
} }
if (cursor_currently_auto_hidden_) { if (cursor_currently_auto_hidden_) {
SetCursor(nullptr); SetCursor(nullptr);
return TRUE; return true;
} }
} break; } break;
case CursorVisibility::kHidden: case CursorVisibility::kHidden:
SetCursor(nullptr); SetCursor(nullptr);
return TRUE; return true;
default: default:
break; break;
} }

View file

@ -34,7 +34,7 @@ bool DiscZarchiveDevice::Initialize() {
return false; return false;
} }
const std::string root_path = std::string("/"); constexpr std::string_view root_path = "/";
const ZArchiveNodeHandle handle = reader_->LookUp(root_path); const ZArchiveNodeHandle handle = reader_->LookUp(root_path);
auto root_entry = new DiscZarchiveEntry(this, nullptr, root_path); auto root_entry = new DiscZarchiveEntry(this, nullptr, root_path);
root_entry->attributes_ = kFileAttributeDirectory; root_entry->attributes_ = kFileAttributeDirectory;