[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

@@ -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;
}