Browse Source

[vk] Toggle for LDR degradation with sRGB

pull/3062/head
CamilleLaVey 1 month ago
parent
commit
d53225835a
  1. 6
      src/android/app/src/main/res/values/strings.xml
  2. 4
      src/common/settings.h
  3. 7
      src/qt_common/config/shared_translation.cpp
  4. 12
      src/video_core/renderer_vulkan/maxwell_to_vk.cpp

6
src/android/app/src/main/res/values/strings.xml

@ -954,7 +954,11 @@
<!-- Force Identity Swizzle -->
<string name="force_identity_swizzle">Force Identity Swizzle</string>
<string name="force_identity_swizzle_description">Forces identity component swizzle for storage and input attachment images. Required by Vulkan spec. Disable only for debugging driver issues.</string>
<string name="force_identity_swizzle_description">Forces identity component swizzle for storage and input attachment images. Required by Vulkan spec. Disable if graphical issues.</string>
<!-- Force LDR to sRGB -->
<string name="force_ldr_to_srgb">Force LDR to sRGB</string>
<string name="force_ldr_to_srgb_description">Converts LDR texture formats to sRGB for proper gamma correction. Fixes washed out colors on Adreno GPUs. Enable if textures look too bright or desaturated.</string>
<!-- VRAM Usage Mode -->
<string name="vram_usage_mode">VRAM Usage Mode</string>

4
src/common/settings.h

@ -461,6 +461,10 @@ struct Values {
false,
"force_identity_swizzle",
Category::RendererAdvanced};
SwitchableSetting<bool> force_ldr_to_srgb{linkage,
false,
"force_ldr_to_srgb",
Category::RendererAdvanced};
SwitchableSetting<VramUsageMode, true> vram_usage_mode{linkage,
VramUsageMode::Conservative,
"vram_usage_mode",

7
src/qt_common/config/shared_translation.cpp

@ -204,8 +204,13 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent)
INSERT(Settings,
force_identity_swizzle,
tr("Force Identity Swizzle"),
tr("Forces identity component swizzle for storage and input attachment images.\n"
tr("Forces identity component swizzle for storage and input attachment images. "
"Required by Vulkan spec. Disable only for debugging driver issues."));
INSERT(Settings,
force_ldr_to_srgb,
tr("Force LDR Formats to sRGB"),
tr("Converts LDR texture formats (RGBA8_UNORM, A2B10G10R10_UNORM) to sRGB variants. "
"Fixes gamma correction issues on some games. Enable for correct colors on Adreno GPUs."));
INSERT(Settings,
use_disk_shader_cache,
tr("Use persistent pipeline cache"),

12
src/video_core/renderer_vulkan/maxwell_to_vk.cpp

@ -241,6 +241,18 @@ FormatInfo SurfaceFormat(const Device& device, FormatType format_type, bool with
PixelFormat pixel_format) {
ASSERT(static_cast<size_t>(pixel_format) < std::size(tex_format_tuples));
FormatTuple tuple = tex_format_tuples[static_cast<size_t>(pixel_format)];
// Force LDR formats to sRGB when toggle is enabled (fixes gamma on Adreno GPUs)
if (Settings::values.force_ldr_to_srgb.GetValue() && !with_srgb) {
if (pixel_format == PixelFormat::A8B8G8R8_UNORM) {
tuple.format = VK_FORMAT_A8B8G8R8_SRGB_PACK32;
with_srgb = true; // Ensure we use sRGB variant
} else if (pixel_format == PixelFormat::A2B10G10R10_UNORM) {
// A2B10G10R10 doesn't have sRGB variant in Vulkan, keep as UNORM
// The gamma correction will be handled by shaders if needed
}
}
// Transcode on hardware that doesn't support ASTC natively
if (!device.IsOptimalAstcSupported() && VideoCore::Surface::IsPixelFormatASTC(pixel_format)) {
const bool is_srgb = with_srgb && VideoCore::Surface::IsPixelFormatSRGB(pixel_format);

Loading…
Cancel
Save