[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::gpu;
constexpr std::string kRecentlyPlayedTitlesFilename = "recent.toml";
constexpr std::string_view kRecentlyPlayedTitlesFilename = "recent.toml";
constexpr std::string kBaseTitle = "Xenia-canary";
EmulatorWindow::EmulatorWindow(Emulator* emulator,

View File

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

View File

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

View File

@ -813,12 +813,12 @@ template <unsigned Size>
static void smallset_const(void* destination, unsigned char fill_value) {
#if XE_ARCH_AMD64 == 1 && XE_COMPILER_MSVC == 1
if constexpr ((Size & 7) == 0) {
unsigned long long fill =
static unsigned long long fill =
static_cast<unsigned long long>(fill_value) * 0x0101010101010101ULL;
__stosq((unsigned long long*)destination, fill, Size / 8);
} else if constexpr ((Size & 3) == 0) {
static constexpr unsigned long fill =
static unsigned long fill =
static_cast<unsigned long>(fill_value) * 0x01010101U;
__stosd((unsigned long*)destination, fill, Size / 4);
// 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.
struct tcp_keepalive alive;
alive.onoff = TRUE;
alive.onoff = true;
alive.keepalivetime = 7200000;
alive.keepaliveinterval = 6000;
DWORD bytes_returned;
@ -209,7 +209,7 @@ class Win32SocketServer : public SocketServer {
SOCKET socket = socket_;
socket_ = INVALID_SOCKET;
linger so_linger;
so_linger.l_onoff = TRUE;
so_linger.l_onoff = true;
so_linger.l_linger = 30;
setsockopt(socket, SOL_SOCKET, SO_LINGER,
reinterpret_cast<const char*>(&so_linger), sizeof(so_linger));
@ -231,7 +231,7 @@ class Win32SocketServer : public SocketServer {
return false;
}
struct tcp_keepalive alive;
alive.onoff = TRUE;
alive.onoff = true;
alive.keepalivetime = 7200000;
alive.keepaliveinterval = 6000;
DWORD bytes_returned;

View File

@ -170,7 +170,7 @@ void Sleep(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) {
return SleepResult::kAlerted;
}
@ -211,7 +211,7 @@ WaitResult Wait(WaitHandle* wait_handle, bool is_alertable,
HANDLE handle = wait_handle->native_handle();
DWORD result;
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
// alertable, just need to study whether
// 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();
DWORD result =
SignalObjectAndWait(handle_to_signal, handle_to_wait_on,
DWORD(timeout.count()), is_alertable ? TRUE : FALSE);
DWORD(timeout.count()), is_alertable ? true : false);
switch (result) {
case WAIT_OBJECT_0:
return WaitResult::kSuccess;
@ -278,8 +278,8 @@ std::pair<WaitResult, size_t> WaitMultiple(WaitHandle* wait_handles[],
handles[i] = wait_handles[i]->native_handle();
}
DWORD result = WaitForMultipleObjectsEx(
static_cast<DWORD>(wait_handle_count), handles, wait_all ? TRUE : FALSE,
DWORD(timeout.count()), is_alertable ? TRUE : FALSE);
static_cast<DWORD>(wait_handle_count), handles, wait_all ? true : false,
DWORD(timeout.count()), is_alertable ? true : false);
if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + wait_handle_count) {
return std::pair<WaitResult, size_t>(WaitResult::kSuccess,
result - WAIT_OBJECT_0);
@ -339,7 +339,7 @@ class Win32Event : public Win32Handle<Event> {
std::unique_ptr<Event> Event::CreateManualResetEvent(bool initial_state) {
HANDLE handle =
CreateEvent(nullptr, TRUE, initial_state ? TRUE : FALSE, nullptr);
CreateEvent(nullptr, true, initial_state ? true : false, nullptr);
if (handle) {
return std::make_unique<Win32Event>(handle);
} else {
@ -351,7 +351,7 @@ std::unique_ptr<Event> Event::CreateManualResetEvent(bool initial_state) {
std::unique_ptr<Event> Event::CreateAutoResetEvent(bool initial_state) {
HANDLE handle =
CreateEvent(nullptr, FALSE, initial_state ? TRUE : FALSE, nullptr);
CreateEvent(nullptr, false, initial_state ? true : false, nullptr);
if (handle) {
return std::make_unique<Win32Event>(handle);
} else {
@ -397,7 +397,7 @@ class Win32Mutant : public Win32Handle<Mutant> {
};
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) {
return std::make_unique<Win32Mutant>(handle);
} else {
@ -433,7 +433,7 @@ class Win32Timer : public Win32Handle<Timer> {
callback_ ? reinterpret_cast<PTIMERAPCROUTINE>(CompletionRoutine)
: NULL;
return SetWaitableTimer(handle_, &due_time_li, 0, completion_routine, this,
FALSE)
false)
? true
: false;
}
@ -461,7 +461,7 @@ class Win32Timer : public Win32Handle<Timer> {
callback_ ? reinterpret_cast<PTIMERAPCROUTINE>(CompletionRoutine)
: NULL;
return SetWaitableTimer(handle_, &due_time_li, int32_t(period.count()),
completion_routine, this, FALSE)
completion_routine, this, false)
? true
: false;
}
@ -490,7 +490,7 @@ class Win32Timer : public Win32Handle<Timer> {
};
std::unique_ptr<Timer> Timer::CreateManualResetTimer() {
HANDLE handle = CreateWaitableTimer(NULL, TRUE, NULL);
HANDLE handle = CreateWaitableTimer(NULL, true, NULL);
if (handle) {
return std::make_unique<Win32Timer>(handle);
} else {
@ -500,7 +500,7 @@ std::unique_ptr<Timer> Timer::CreateManualResetTimer() {
}
std::unique_ptr<Timer> Timer::CreateSynchronizationTimer() {
HANDLE handle = CreateWaitableTimer(NULL, FALSE, NULL);
HANDLE handle = CreateWaitableTimer(NULL, false, NULL);
if (handle) {
return std::make_unique<Win32Timer>(handle);
} else {

View File

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

View File

@ -1243,7 +1243,7 @@ void* X64Emitter::FindQwordConstantOffset(uint64_t qwordvalue) {
}
// First location to try and place constants.
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.
static constexpr uintptr_t kConstDataIncrement = 0x00001000;

View File

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

View File

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

View File

@ -48,7 +48,7 @@ bool ControlFlowSimplificationPass::Run(HIRBuilder* builder) {
block = builder->last_block();
while (block) {
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 &&
(block->incoming_edge_head->flags & expected) == expected) {
// Dominated by the incoming block.

View File

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

View File

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

View File

@ -104,7 +104,7 @@ bool InitializeStackWalker() {
options |= SYMOPT_LOAD_LINES;
options |= SYMOPT_FAIL_CRITICAL_ERRORS;
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?");
return false;
}
@ -192,7 +192,7 @@ class Win32StackWalker : public StackWalker {
}
// Setup the frame for walking.
STACKFRAME64 stack_frame = {0};
STACKFRAME64 stack_frame = {};
stack_frame.AddrPC.Mode = AddrModeFlat;
stack_frame.AddrPC.Offset = thread_context.Rip;
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(
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
// to 8 byte alignment
// if we see this prior to our address, we can assume we are a function
// 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]);

View File

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

View File

@ -810,7 +810,7 @@ bool D3D12CommandProcessor::SetupContext() {
ID3D12Device* device = provider.GetDevice();
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) {
XELOGE("Failed to create the fence completion event");
return false;

View File

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

View File

@ -394,7 +394,7 @@ bool D3D12SharedMemory::AllocateSparseHostGpuMemoryRange(
region_start_coordinates.Subresource = 0;
D3D12_TILE_REGION_SIZE region_size;
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;
UINT heap_range_start_offset = 0;
direct_queue->UpdateTileMappings(

View File

@ -968,7 +968,7 @@ bool D3D12TextureCache::EnsureScaledResolveMemoryCommitted(
D3D12_TILE_REGION_SIZE region_size;
region_size.NumTiles =
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;
UINT heap_range_start_offset = 0;
UINT range_tile_count =

View File

@ -144,7 +144,7 @@ void DeferredCommandList::Execute(ID3D12GraphicsCommandList* command_list,
*reinterpret_cast<const D3DOMSetRenderTargetsArguments*>(stream);
command_list->OMSetRenderTargets(
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);
} break;
case Command::kD3DOMSetStencilRef: {

View File

@ -3029,7 +3029,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
break;
}
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.DepthBiasClamp = 0.0f;
// 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(),
render_target_cache_.draw_resolution_scale_y()));
state_desc.RasterizerState.DepthClipEnable =
description.depth_clip ? TRUE : FALSE;
description.depth_clip ? true : false;
uint32_t msaa_sample_count = uint32_t(1)
<< uint32_t(description.host_msaa_samples);
if (edram_rov_used) {
@ -3082,7 +3082,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
// Depth/stencil.
if (description.depth_func != xenos::CompareFunction::kAlways ||
description.depth_write) {
state_desc.DepthStencilState.DepthEnable = TRUE;
state_desc.DepthStencilState.DepthEnable = true;
state_desc.DepthStencilState.DepthWriteMask =
description.depth_write ? D3D12_DEPTH_WRITE_MASK_ALL
: D3D12_DEPTH_WRITE_MASK_ZERO;
@ -3093,7 +3093,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
uint32_t(description.depth_func));
}
if (description.stencil_enable) {
state_desc.DepthStencilState.StencilEnable = TRUE;
state_desc.DepthStencilState.StencilEnable = true;
state_desc.DepthStencilState.StencilReadMask =
description.stencil_read_mask;
state_desc.DepthStencilState.StencilWriteMask =
@ -3131,7 +3131,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
}
// Render targets and blending.
state_desc.BlendState.IndependentBlendEnable = TRUE;
state_desc.BlendState.IndependentBlendEnable = true;
static constexpr D3D12_BLEND kBlendFactorMap[] = {
D3D12_BLEND_ZERO, D3D12_BLEND_ONE,
D3D12_BLEND_SRC_COLOR, D3D12_BLEND_INV_SRC_COLOR,
@ -3169,7 +3169,7 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
rt.src_blend_alpha != PipelineBlendFactor::kOne ||
rt.dest_blend_alpha != PipelineBlendFactor::kZero ||
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.DestBlend = kBlendFactorMap[uint32_t(rt.dest_blend)];
blend_desc.BlendOp = kBlendOpMap[uint32_t(rt.blend_op)];
@ -3196,8 +3196,8 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
if (description.cull_mode == PipelineCullMode::kDisableRasterization) {
state_desc.PS.pShaderBytecode = nullptr;
state_desc.PS.BytecodeLength = 0;
state_desc.DepthStencilState.DepthEnable = FALSE;
state_desc.DepthStencilState.StencilEnable = FALSE;
state_desc.DepthStencilState.DepthEnable = false;
state_desc.DepthStencilState.StencilEnable = false;
}
// Create the D3D12 pipeline state object.

View File

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

View File

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

View File

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

View File

@ -134,7 +134,7 @@ bool D3D12ImmediateDrawer::Initialize() {
pipeline_desc.PS.BytecodeLength = sizeof(shaders::immediate_ps);
D3D12_RENDER_TARGET_BLEND_DESC& pipeline_blend_desc =
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.DestBlend = D3D12_BLEND_INV_SRC_ALPHA;
pipeline_blend_desc.BlendOp = D3D12_BLEND_OP_ADD;
@ -145,8 +145,8 @@ bool D3D12ImmediateDrawer::Initialize() {
pipeline_desc.SampleMask = UINT_MAX;
pipeline_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
pipeline_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
pipeline_desc.RasterizerState.FrontCounterClockwise = FALSE;
pipeline_desc.RasterizerState.DepthClipEnable = TRUE;
pipeline_desc.RasterizerState.FrontCounterClockwise = false;
pipeline_desc.RasterizerState.DepthClipEnable = true;
D3D12_INPUT_ELEMENT_DESC pipeline_input_elements[3] = {};
pipeline_input_elements[0].SemanticName = "POSITION";
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.Height = UINT(new_swap_chain_height);
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.Quality = 0;
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
@ -770,7 +770,7 @@ Presenter::PaintResult D3D12Presenter::PaintAndPresentImpl(
if (is_final_effect) {
if (!back_buffer_bound) {
command_list->OMSetRenderTargets(1, &back_buffer_rtv, TRUE,
command_list->OMSetRenderTargets(1, &back_buffer_rtv, true,
nullptr);
back_buffer_bound = true;
}
@ -780,7 +780,7 @@ Presenter::PaintResult D3D12Presenter::PaintAndPresentImpl(
rtv_heap_start,
uint32_t(PaintContext::kRTVIndexGuestOutputIntermediate0 +
i));
command_list->OMSetRenderTargets(1, &intermediate_rtv, TRUE, nullptr);
command_list->OMSetRenderTargets(1, &intermediate_rtv, true, nullptr);
back_buffer_bound = false;
}
if (is_final_effect) {
@ -1028,7 +1028,7 @@ Presenter::PaintResult D3D12Presenter::PaintAndPresentImpl(
if (execute_ui_drawers) {
// Draw the UI.
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;
}
D3D12UIDrawContext ui_draw_context(
@ -1285,7 +1285,7 @@ bool D3D12Presenter::InitializeSurfaceIndependent() {
D3D12_FILL_MODE_SOLID;
guest_output_paint_pipeline_desc.RasterizerState.CullMode =
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 =
D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
guest_output_paint_pipeline_desc.NumRenderTargets = 1;

View File

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

View File

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

View File

@ -21,7 +21,7 @@ namespace ui {
class ImGuiDialog {
public:
~ImGuiDialog();
virtual ~ImGuiDialog();
// Shows a simple message box containing a text message.
// 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());
GtkWidget* main_menu_widget = main_menu ? main_menu->handle() : nullptr;
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
// client area of the window occupying all the window space not taken by the
// main menu.
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
// 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
@ -186,7 +186,7 @@ void GTKWindow::ApplyNewFullscreen() {
return;
}
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.IsWindowDestroyed()) {
EndBatchedSizeUpdate(destruction_receiver);
@ -249,7 +249,7 @@ void GTKWindow::ApplyNewMainMenu(MenuItem* old_main_menu) {
return;
}
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.IsWindowDestroyed()) {
EndBatchedSizeUpdate(destruction_receiver);
@ -711,14 +711,14 @@ gboolean GTKWindow::DrawHandler(GtkWidget* widget, cairo_t* cr,
gpointer user_data) {
auto* window = static_cast<GTKWindow*>(user_data);
if (!window || widget != window->drawing_area_) {
return FALSE;
return false;
}
if (window->batched_size_update_depth_) {
window->batched_size_update_contained_draw_ = true;
} else {
window->OnPaint();
}
return TRUE;
return true;
}
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.
} else {
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);
if (!new_icon) {
return;
@ -547,7 +547,7 @@ std::unique_ptr<Surface> Win32Window::CreateSurfaceImpl(
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,
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 {
if (!hwnd_) {
return FALSE;
return false;
}
return AdjustWindowRectangle(rect, GetWindowLong(hwnd_, GWL_STYLE),
BOOL(GetMainMenu() != nullptr),
@ -1156,12 +1156,12 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
}
if (cursor_currently_auto_hidden_) {
SetCursor(nullptr);
return TRUE;
return true;
}
} break;
case CursorVisibility::kHidden:
SetCursor(nullptr);
return TRUE;
return true;
default:
break;
}

View File

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