Compare commits

...

3 Commits

Author SHA1 Message Date
lightningterror
f6e0d1d368 common-linux: Fix -Wformat warnings. 2025-04-30 22:43:23 +02:00
lightningterror
5bb18bee17 GS/GL: Guard/track PopDebugGroup calls.
Fixes GL_STACK_UNDERFLOW and GL_INVALID_VALUE issues which spammed the log.
2025-04-30 22:43:23 +02:00
lightningterror
d0fb219939 Misc: Fix compiler warnings. 2025-04-30 22:43:23 +02:00
5 changed files with 23 additions and 12 deletions

View File

@@ -54,18 +54,18 @@ u64 GetAvailablePhysicalMemory()
while (fgets(line, sizeof(line), file))
{
// Modern kernels provide MemAvailable directly - preferred and most accurate.
if (sscanf(line, "MemAvailable: %llu kB", &mem_available) == 1)
if (sscanf(line, "MemAvailable: %lu kB", &mem_available) == 1)
{
fclose(file);
return mem_available * _1kb;
}
// Fallback values for manual approximation.
sscanf(line, "MemFree: %llu kB", &mem_free);
sscanf(line, "Buffers: %llu kB", &buffers);
sscanf(line, "Cached: %llu kB", &cached);
sscanf(line, "SReclaimable: %llu kB", &sreclaimable);
sscanf(line, "Shmem: %llu kB", &shmem);
sscanf(line, "MemFree: %lu kB", &mem_free);
sscanf(line, "Buffers: %lu kB", &buffers);
sscanf(line, "Cached: %lu kB", &cached);
sscanf(line, "SReclaimable: %lu kB", &sreclaimable);
sscanf(line, "Shmem: %lu kB", &shmem);
}
fclose(file);

View File

@@ -3270,7 +3270,7 @@ void GSRendererHW::Draw()
src->m_texture = rt->m_texture;
// If we've moved it and the source is expecting to be inside this target, we need to update the region to point to it.
u32 max_region_y = src->m_region.GetMaxY() + new_offset;
int max_region_y = src->m_region.GetMaxY() + new_offset;
if (max_region_y == new_offset)
max_region_y = new_size.y;

View File

@@ -1658,8 +1658,8 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const bool is_color, const
// PSM equality needed because CreateSource does not handle PSM conversion.
// Only inclusive hit to limit false hits.
GSVector4i rect = block_boundary_rect;
int src_bw = bw;
int src_psm = psm;
u32 src_bw = bw;
u32 src_psm = psm;
// If the input is C16 and it's actually a shuffle of 32bits we need to correct the size.
if ((tex_color_psm & 0xF) <= PSMCT24 && (psm & 0x7) == PSMCT16 && possible_shuffle)

View File

@@ -2830,6 +2830,9 @@ void GSDeviceOGL::DebugMessageCallback(GLenum gl_source, GLenum gl_type, GLuint
}
}
#ifdef ENABLE_OGL_DEBUG
static int s_debugGroupDepth = 0;
#endif
void GSDeviceOGL::PushDebugGroup(const char* fmt, ...)
{
#ifdef ENABLE_OGL_DEBUG
@@ -2840,18 +2843,26 @@ void GSDeviceOGL::PushDebugGroup(const char* fmt, ...)
va_start(ap, fmt);
const std::string buf(StringUtil::StdStringFromFormatV(fmt, ap));
va_end(ap);
if (!buf.empty())
{
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, buf.c_str());
// Make sure the calls succeed first.
if (glGetError() == GL_NO_ERROR)
s_debugGroupDepth++;
}
#endif
}
void GSDeviceOGL::PopDebugGroup()
{
#ifdef ENABLE_OGL_DEBUG
if (!glPopDebugGroup || !GSConfig.UseDebugDevice)
if (!glPopDebugGroup || !GSConfig.UseDebugDevice || (s_debugGroupDepth <= 0))
return;
glPopDebugGroup();
s_debugGroupDepth--;
#endif
}

View File

@@ -991,7 +991,7 @@ TinyString SDLInputSource::ConvertKeyToString(InputBindingKey key, bool display,
if (it != m_controllers.end())
is_sixaxis = IsControllerSixaxis(*it);
const int joy_axis_Index = key.data - std::size(s_sdl_axis_setting_names);
const size_t joy_axis_Index = key.data - std::size(s_sdl_axis_setting_names);
if (is_sixaxis && key.modifier == InputModifier::FullAxis && key.invert == false &&
joy_axis_Index < std::size(s_sdl_ps3_sxs_pressure_names) && s_sdl_ps3_sxs_pressure_names[joy_axis_Index] != nullptr)
@@ -1112,7 +1112,7 @@ TinyString SDLInputSource::ConvertKeyToIcon(InputBindingKey key)
}
else if (it != m_controllers.end() && IsControllerSixaxis(*it) && key.invert == false)
{
const int joy_axis_Index = key.data - std::size(s_sdl_axis_setting_names);
const size_t joy_axis_Index = key.data - std::size(s_sdl_axis_setting_names);
if (joy_axis_Index < std::size(s_sdl_ps3_pressure_icons) && s_sdl_ps3_pressure_icons[joy_axis_Index] != nullptr)
ret.format("SDL-{} {}", static_cast<u32>(key.source_index), s_sdl_ps3_pressure_icons[joy_axis_Index]);