Skip to content

Commit

Permalink
Merge pull request #20018 from oltolm/warnings
Browse files Browse the repository at this point in the history
fix compiler warnings
  • Loading branch information
hrydgard authored Feb 22, 2025
2 parents 16d866a + 02e7678 commit 2a372ca
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 33 deletions.
38 changes: 29 additions & 9 deletions Common/GPU/D3D11/thin3d_d3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,17 @@ class D3D11DrawContext : public DrawContext {
case InfoField::DRIVER: return "-";
case InfoField::SHADELANGVERSION:
switch (featureLevel_) {
case D3D_FEATURE_LEVEL_9_1: return "Feature Level 9.1"; break;
case D3D_FEATURE_LEVEL_9_2: return "Feature Level 9.2"; break;
case D3D_FEATURE_LEVEL_9_3: return "Feature Level 9.3"; break;
case D3D_FEATURE_LEVEL_10_0: return "Feature Level 10.0"; break;
case D3D_FEATURE_LEVEL_10_1: return "Feature Level 10.1"; break;
case D3D_FEATURE_LEVEL_11_0: return "Feature Level 11.0"; break;
case D3D_FEATURE_LEVEL_11_1: return "Feature Level 11.1"; break;
case D3D_FEATURE_LEVEL_12_0: return "Feature Level 12.0"; break;
case D3D_FEATURE_LEVEL_12_1: return "Feature Level 12.1"; break;
case D3D_FEATURE_LEVEL_1_0_CORE: return "Feature Level 1.0 Core";
case D3D_FEATURE_LEVEL_9_1: return "Feature Level 9.1";
case D3D_FEATURE_LEVEL_9_2: return "Feature Level 9.2";
case D3D_FEATURE_LEVEL_9_3: return "Feature Level 9.3";
case D3D_FEATURE_LEVEL_10_0: return "Feature Level 10.0";
case D3D_FEATURE_LEVEL_10_1: return "Feature Level 10.1";
case D3D_FEATURE_LEVEL_11_0: return "Feature Level 11.0";
case D3D_FEATURE_LEVEL_11_1: return "Feature Level 11.1";
case D3D_FEATURE_LEVEL_12_0: return "Feature Level 12.0";
case D3D_FEATURE_LEVEL_12_1: return "Feature Level 12.1";
case D3D_FEATURE_LEVEL_12_2: return "Feature Level 12.2";
}
return "Unknown feature level";
case InfoField::APINAME: return "Direct3D 11";
Expand Down Expand Up @@ -464,6 +466,11 @@ void D3D11DrawContext::HandleEvent(Event ev, int width, int height, void *param1
curRTHeight_ = height;
break;
}
case Event::LOST_DEVICE:
case Event::GOT_DEVICE:
case Event::RESIZED:
case Event::PRESENTED:
break;
}
}

Expand Down Expand Up @@ -1168,6 +1175,8 @@ Pipeline *D3D11DrawContext::CreateGraphicsPipeline(const PipelineDesc &desc, con
case ShaderStage::Geometry:
dPipeline->gs = module->gs;
break;
case ShaderStage::Compute:
break;
}
}
dPipeline->shaderModules = shaders;
Expand Down Expand Up @@ -1636,6 +1645,12 @@ void D3D11DrawContext::CopyFramebufferImage(Framebuffer *srcfb, int level, int x
srcTex = src->depthStencilTex;
dstTex = dst->depthStencilTex;
break;
case Aspect::NO_BIT:
case Aspect::STENCIL_BIT:
case Aspect::SURFACE_BIT:
case Aspect::VIEW_BIT:
case Aspect::FORMAT_BIT:
break;
}
_assert_(srcTex && dstTex);

Expand Down Expand Up @@ -1814,6 +1829,11 @@ bool D3D11DrawContext::CopyFramebufferToMemory(Framebuffer *src, Aspect channelB
_assert_(false);
}
break;
case Aspect::NO_BIT:
case Aspect::SURFACE_BIT:
case Aspect::VIEW_BIT:
case Aspect::FORMAT_BIT:
break;
}

context_->Unmap(packTex.Get(), 0);
Expand Down
36 changes: 34 additions & 2 deletions Common/GPU/D3D9/thin3d_d3d9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ bool D3D9Texture::Create(const TextureDesc &desc) {
case TextureType::CUBE:
hr = device_->CreateCubeTexture(desc.width, desc.mipLevels, usage, d3dfmt_, pool, &cubeTex_, NULL);
break;
case TextureType::ARRAY1D:
case TextureType::ARRAY2D:
case TextureType::UNKNOWN:
break;
}
if (FAILED(hr)) {
ERROR_LOG(Log::G3D, "D3D9 Texture creation failed");
Expand Down Expand Up @@ -482,6 +486,10 @@ void D3D9Texture::SetToSampler(LPDIRECT3DDEVICE9 device, int sampler) {
case TextureType::CUBE:
device->SetTexture(sampler, cubeTex_.Get());
break;
case TextureType::ARRAY1D:
case TextureType::ARRAY2D:
case TextureType::UNKNOWN:
break;
}
}

Expand Down Expand Up @@ -739,7 +747,7 @@ D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, ID
}

if (SUCCEEDED(result)) {
snprintf(shadeLangVersion_, sizeof(shadeLangVersion_), "PS: %04x VS: %04x", d3dCaps_.PixelShaderVersion & 0xFFFF, d3dCaps_.VertexShaderVersion & 0xFFFF);
snprintf(shadeLangVersion_, sizeof(shadeLangVersion_), "PS: %04lx VS: %04lx", d3dCaps_.PixelShaderVersion & 0xFFFF, d3dCaps_.VertexShaderVersion & 0xFFFF);
} else {
WARN_LOG(Log::G3D, "Direct3D9: Failed to get the device caps!");
truncate_cpy(shadeLangVersion_, "N/A");
Expand Down Expand Up @@ -796,6 +804,16 @@ D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, ID
bugs_.Infest(Bugs::BROKEN_NAN_IN_CONDITIONAL);
}
break;
case Draw::GPUVendor::VENDOR_AMD:
case Draw::GPUVendor::VENDOR_APPLE:
case Draw::GPUVendor::VENDOR_ARM:
case Draw::GPUVendor::VENDOR_BROADCOM:
case Draw::GPUVendor::VENDOR_IMGTEC:
case Draw::GPUVendor::VENDOR_MESA:
case Draw::GPUVendor::VENDOR_QUALCOMM:
case Draw::GPUVendor::VENDOR_UNKNOWN:
case Draw::GPUVendor::VENDOR_VIVANTE:
break;
}

if (d3d) {
Expand Down Expand Up @@ -913,11 +931,17 @@ RasterState *D3D9Context::CreateRasterState(const RasterStateDesc &desc) {
switch (desc.cull) {
case CullMode::FRONT: rs->cullMode = D3DCULL_CCW; break;
case CullMode::BACK: rs->cullMode = D3DCULL_CW; break;
case CullMode::FRONT_AND_BACK:
case CullMode::NONE:
break;
}
case Facing::CCW:
switch (desc.cull) {
case CullMode::FRONT: rs->cullMode = D3DCULL_CW; break;
case CullMode::BACK: rs->cullMode = D3DCULL_CCW; break;
case CullMode::FRONT_AND_BACK:
case CullMode::NONE:
break;
}
}
return rs;
Expand Down Expand Up @@ -1565,7 +1589,12 @@ bool D3D9Context::CopyFramebufferToMemory(Framebuffer *src, Aspect aspects, int
_assert_(false);
}
break;
}
case Aspect::NO_BIT:
case Aspect::SURFACE_BIT:
case Aspect::VIEW_BIT:
case Aspect::FORMAT_BIT:
break;
}
}

if (aspects != Aspect::COLOR_BIT) {
Expand All @@ -1589,6 +1618,9 @@ void D3D9Context::HandleEvent(Event ev, int width, int height, void *param1, voi
device_->GetDepthStencilSurface(&deviceDSsurf);
break;
case Event::PRESENTED:
case Event::GOT_DEVICE:
case Event::LOST_DEVICE:
case Event::RESIZED:
break;
}
}
Expand Down
6 changes: 4 additions & 2 deletions Common/GPU/Vulkan/thin3d_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,13 +802,15 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanBarrierBatch *postBarriers, Vu
usageBits |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
}

VkComponentMapping r8AsAlpha[4] = { VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_R };
VkComponentMapping r8AsColor[4] = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_ONE };
VkComponentMapping r8AsAlpha[4] = { {VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_R} };
VkComponentMapping r8AsColor[4] = { {VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_ONE} };

VkComponentMapping *swizzle = nullptr;
switch (desc.swizzle) {
case TextureSwizzle::R8_AS_ALPHA: swizzle = r8AsAlpha; break;
case TextureSwizzle::R8_AS_GRAYSCALE: swizzle = r8AsColor; break;
case TextureSwizzle::DEFAULT:
break;
}
VulkanBarrierBatch barrier;
if (!vkTex_->CreateDirect(width_, height_, 1, mipLevels_, vulkanFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, usageBits, &barrier, swizzle)) {
Expand Down
4 changes: 2 additions & 2 deletions Common/Log/ConsoleListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,14 @@ void ConsoleListener::WriteToConsole(LogLevel Level, const char *Text, size_t Le
if (Len > 10) {
// First 10 chars white
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
int wlen = MultiByteToWideChar(CP_UTF8, 0, Text, (int)Len, NULL, NULL);
int wlen = MultiByteToWideChar(CP_UTF8, 0, Text, (int)Len, NULL, 0);
MultiByteToWideChar(CP_UTF8, 0, Text, (int)Len, tempBuf, wlen);
WriteConsole(hConsole, tempBuf, 10, &cCharsWritten, NULL);
Text += 10;
Len -= 10;
}
SetConsoleTextAttribute(hConsole, Color);
int wlen = MultiByteToWideChar(CP_UTF8, 0, Text, (int)Len, NULL, NULL);
int wlen = MultiByteToWideChar(CP_UTF8, 0, Text, (int)Len, NULL, 0);
MultiByteToWideChar(CP_UTF8, 0, Text, (int)Len, tempBuf, wlen);
WriteConsole(hConsole, tempBuf, (DWORD)wlen, &cCharsWritten, NULL);
}
Expand Down
2 changes: 1 addition & 1 deletion Common/TimeUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void sleep_precise(double seconds) {
LARGE_INTEGER due;
due.QuadPart = -(sleepTicks > maxTicks ? maxTicks : sleepTicks);
// Note: SetWaitableTimerEx is not available on Vista.
SetWaitableTimer(Timer, &due, 0, NULL, NULL, NULL);
SetWaitableTimer(Timer, &due, 0, NULL, NULL, FALSE);
WaitForSingleObject(Timer, INFINITE);
QueryPerformanceCounter(&qpc);
}
Expand Down
3 changes: 3 additions & 0 deletions Core/Debugger/SymbolMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,9 @@ void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symType) {
}
}
break;
case ST_NONE:
case ST_ALL:
break;
}

SendMessage(listbox, WM_SETREDRAW, TRUE, 0);
Expand Down
2 changes: 1 addition & 1 deletion Core/MIPS/IR/IRFrontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void IRFrontend::DoJit(u32 em_address, std::vector<IRInst> &instructions, u32 &m
instructions.reserve(block_instructions.capacity());
// The first instruction is "Downcount"
instructions.push_back(block_instructions.front());
instructions.push_back({ IROp::LogIRBlock, 0, 0, 0, 0 });
instructions.push_back({ IROp::LogIRBlock, {0}, 0, 0, 0 });
std::copy(block_instructions.begin() + 1, block_instructions.end(), std::back_inserter(instructions));
}

Expand Down
16 changes: 8 additions & 8 deletions Core/MIPS/MIPSVFPUUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,25 +964,25 @@ uint32_t vrnd_generate(uint32_t *rcx) {

// Lookup tables.
// Note: these are never unloaded, and stay till program termination.
static uint32_t (*vfpu_sin_lut8192)=nullptr;
static uint32_t *vfpu_sin_lut8192=nullptr;
static int8_t (*vfpu_sin_lut_delta)[2]=nullptr;
static int16_t (*vfpu_sin_lut_interval_delta)=nullptr;
static uint8_t (*vfpu_sin_lut_exceptions)=nullptr;
static int16_t *vfpu_sin_lut_interval_delta=nullptr;
static uint8_t *vfpu_sin_lut_exceptions=nullptr;

static int8_t (*vfpu_sqrt_lut)[2]=nullptr;

static int8_t (*vfpu_rsqrt_lut)[2]=nullptr;

static uint32_t (*vfpu_exp2_lut65536)=nullptr;
static uint32_t *vfpu_exp2_lut65536=nullptr;
static uint8_t (*vfpu_exp2_lut)[2]=nullptr;

static uint32_t (*vfpu_log2_lut65536)=nullptr;
static uint32_t (*vfpu_log2_lut65536_quadratic)=nullptr;
static uint32_t *vfpu_log2_lut65536=nullptr;
static uint32_t *vfpu_log2_lut65536_quadratic=nullptr;
static uint8_t (*vfpu_log2_lut)[131072][2]=nullptr;

static int32_t (*vfpu_asin_lut65536)[3]=nullptr;
static uint64_t (*vfpu_asin_lut_deltas)=nullptr;
static uint16_t (*vfpu_asin_lut_indices)=nullptr;
static uint64_t *vfpu_asin_lut_deltas=nullptr;
static uint16_t *vfpu_asin_lut_indices=nullptr;

static int8_t (*vfpu_rcp_lut)[2]=nullptr;

Expand Down
6 changes: 6 additions & 0 deletions GPU/Directx9/ShaderManagerDX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ std::vector<std::string> ShaderManagerDX9::DebugGetShaderIDs(DebugShaderType typ
ids.push_back(id);
}
break;
case SHADER_TYPE_GEOMETRY:
case SHADER_TYPE_PIPELINE:
case SHADER_TYPE_SAMPLER:
case SHADER_TYPE_TEXTURE:
case SHADER_TYPE_VERTEXLOADER:
break;
}
return ids;
}
Expand Down
2 changes: 1 addition & 1 deletion UI/BackgroundAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ class SampleLoadTask : public Task {
TaskPriority Priority() const override {
return TaskPriority::NORMAL;
}
virtual void Run() override {
void Run() override {
mixer_->LoadSamplesOnThread();
}
private:
Expand Down
2 changes: 2 additions & 0 deletions UI/ImDebugger/ImDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,8 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
break;
case ImCmd::NONE:
break;
case ImCmd::SHOW_IN_PIXEL_VIEWER:
break;
}
}

Expand Down
2 changes: 2 additions & 0 deletions Windows/CaptureDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,8 @@ void WindowsCaptureDevice::messageHandler() {
case CAPTUREDEVIDE_COMMAND::UPDATE_STATE:
updateState((*(CAPTUREDEVIDE_STATE *)message.opacity));
break;
case CAPTUREDEVIDE_COMMAND::SHUTDOWN:
break;
}
}

Expand Down
2 changes: 2 additions & 0 deletions Windows/Debugger/DumpMemoryWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ void DumpMemoryWindow::changeMode(HWND hwnd, Mode newMode)
size = PSP_GetScratchpadMemoryEnd()-start;
defaultFileName = "Scratchpad.dump";
break;
case MODE_CUSTOM:
break;
}

snprintf(buffer, sizeof(buffer), "0x%08X", start);
Expand Down
4 changes: 2 additions & 2 deletions Windows/GEDebugger/TabDisplayLists.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ void TabDisplayLists::UpdateSize(WORD width, WORD height)
}
}

void TabDisplayLists::Update(bool reload)
void TabDisplayLists::Update()
{
if (reload && gpuDebug != NULL)
if (gpuDebug != NULL)
{
lists = gpuDebug->ActiveDisplayLists();
}
Expand Down
2 changes: 1 addition & 1 deletion Windows/GEDebugger/TabDisplayLists.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TabDisplayLists : public Dialog
public:
TabDisplayLists(HINSTANCE _hInstance, HWND _hParent);
~TabDisplayLists();
void Update(bool reload = true);
void Update() override;
protected:
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
private:
Expand Down
2 changes: 1 addition & 1 deletion Windows/GEDebugger/TabState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ bool CtrlStateValues::OnRowPrePaint(int row, LPNMLVCUSTOMDRAW msg) {
}

void CtrlStateValues::SetCmdValue(u32 op) {
SendMessage(GetParent(GetParent(GetHandle())), WM_GEDBG_SETCMDWPARAM, op, NULL);
SendMessage(GetParent(GetParent(GetHandle())), WM_GEDBG_SETCMDWPARAM, op, 0);
Update();
}

Expand Down
2 changes: 1 addition & 1 deletion Windows/GEDebugger/TabVertices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void CtrlMatrixList::OnDoubleClick(int row, int column) {
if (sscanf(strvalue.c_str(), "%f", &val) == 1) {
auto prevState = gpuDebug->GetGState();
auto setCmdValue = [&](u32 op) {
SendMessage(GetParent(GetParent(GetHandle())), WM_GEDBG_SETCMDWPARAM, op, NULL);
SendMessage(GetParent(GetParent(GetHandle())), WM_GEDBG_SETCMDWPARAM, op, 0);
};

union {
Expand Down
6 changes: 4 additions & 2 deletions Windows/WASAPIStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,14 @@ bool WASAPIAudioThread::DetectFormat() {
} else {
wchar_t guid[256]{};
StringFromGUID2(closest->SubFormat, guid, 256);
ERROR_LOG_REPORT_ONCE(badfallbackclosest, Log::sceAudio, "WASAPI fallback and closest unsupported (fmt=%04x/%s)", closest->Format.wFormatTag, guid);
ERROR_LOG_REPORT_ONCE(badfallbackclosest, Log::sceAudio, "WASAPI fallback and closest unsupported (fmt=%04x/%s)", closest->Format.wFormatTag, ConvertWStringToUTF8(guid).c_str());
CoTaskMemFree(closest);
return false;
}
} else {
CoTaskMemFree(closest);
if (hr != AUDCLNT_E_DEVICE_INVALIDATED && hr != AUDCLNT_E_SERVICE_NOT_RUNNING)
ERROR_LOG_REPORT_ONCE(badfallback, Log::sceAudio, "WASAPI fallback format was unsupported (%08x)", hr);
ERROR_LOG_REPORT_ONCE(badfallback, Log::sceAudio, "WASAPI fallback format was unsupported (%08lx)", hr);
return false;
}
}
Expand Down Expand Up @@ -514,6 +514,8 @@ void WASAPIAudioThread::Run() {
case Format::PCM16:
callback_((short *)pData, pNumAvFrames, sampleRate_);
break;
case Format::UNKNOWN:
break;
}
}

Expand Down
11 changes: 11 additions & 0 deletions Windows/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,17 @@ void System_Notify(SystemNotification notification) {
}
break;
}
case SystemNotification::AUDIO_RESET_DEVICE:
case SystemNotification::FORCE_RECREATE_ACTIVITY:
case SystemNotification::IMMERSIVE_MODE_CHANGE:
case SystemNotification::SUSTAINED_PERF_CHANGE:
case SystemNotification::ROTATE_UPDATED:
case SystemNotification::TEST_JAVA_EXCEPTION:
break;
case SystemNotification::UI_STATE_CHANGED:
case SystemNotification::AUDIO_MODE_CHANGED:
case SystemNotification::APP_SWITCH_MODE_CHANGED:
break;
}
}

Expand Down

0 comments on commit 2a372ca

Please sign in to comment.