diff --git a/src/drm.hpp b/src/drm.hpp index 4a23650..d3f6234 100644 --- a/src/drm.hpp +++ b/src/drm.hpp @@ -296,6 +296,8 @@ extern enum g_panel_orientation g_drmModeOrientation; extern std::atomic g_drmEffectiveOrientation; // DRM_MODE_ROTATE_* +extern bool g_bForceDisableColorMgmt; + bool init_drm(struct drm_t *drm, int width, int height, int refresh, bool wants_adaptive_sync); void finish_drm(struct drm_t *drm); int drm_commit(struct drm_t *drm, const struct FrameInfo_t *frameInfo ); diff --git a/src/main.cpp b/src/main.cpp index def9393..44ef792 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -112,6 +112,7 @@ const struct option *gamescope_options = (struct option[]){ { "force-orientation", required_argument, nullptr, 0 }, { "force-windows-fullscreen", no_argument, nullptr, 0 }, + { "disable-color-management", no_argument, nullptr, 0 }, { "hdr-enabled", no_argument, nullptr, 0 }, { "hdr-sdr-content-nits", required_argument, nullptr, 0 }, { "hdr-wide-gammut-for-sdr", no_argument, nullptr, 0 }, @@ -203,6 +204,7 @@ const char usage[] = " --debug-events debug X11 events\n" " --force-composition disable direct scan-out\n" " --composite-debug draw frame markers on alternating corners of the screen when compositing\n" + " --disable-color-management disable color management\n" " --disable-xres disable XRes for PID lookup\n" " --hdr-debug-force-support forces support for HDR, etc even if the display doesn't support it. HDR clients will be outputted as SDR still in that case.\n" " --hdr-debug-force-output forces support and output to HDR10 PQ even if the output does not support it (will look very wrong if it doesn't)\n" @@ -482,6 +484,8 @@ int main(int argc, char **argv) g_bUseLayers = false; } else if (strcmp(opt_name, "debug-layers") == 0) { g_bDebugLayers = true; + } else if (strcmp(opt_name, "disable-color-management") == 0) { + g_bForceDisableColorMgmt = true; } else if (strcmp(opt_name, "xwayland-count") == 0) { g_nXWaylandCount = atoi( optarg ); } else if (strcmp(opt_name, "composite-debug") == 0) { diff --git a/src/shaders/composite.h b/src/shaders/composite.h index f573e4b..575c7d3 100644 --- a/src/shaders/composite.h +++ b/src/shaders/composite.h @@ -56,8 +56,12 @@ vec3 apply_layer_color_mgmt(vec3 color, uint colorspace) { // // We also need to do degamma here for non-linear views to blend in linear space. // ie. PQ -> PQ would need us to manually do bilinear here. - color = perform_1dlut(color, s_shaperLut[plane_eotf]); - color = perform_3dlut(color, s_lut3D[plane_eotf]); + bool lut3d_enabled = textureQueryLevels(s_shaperLut[plane_eotf]) != 0; + if (lut3d_enabled) + { + color = perform_1dlut(color, s_shaperLut[plane_eotf]); + color = perform_3dlut(color, s_lut3D[plane_eotf]); + } color = colorspace_blend_tf(color, c_output_eotf); } diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 35ab094..080ae05 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -2280,8 +2280,10 @@ paint_all(bool async) for (uint32_t i = 0; i < EOTF_Count; i++) { - frameInfo.shaperLut[i] = g_ColorMgmtLuts[i].vk_lut1d; - frameInfo.lut3D[i] = g_ColorMgmtLuts[i].vk_lut3d; + if (!g_ColorMgmtLuts[i].lut1d.empty()) + frameInfo.shaperLut[i] = g_ColorMgmtLuts[i].vk_lut1d; + if (!g_ColorMgmtLuts[i].lut3d.empty()) + frameInfo.lut3D[i] = g_ColorMgmtLuts[i].vk_lut3d; } if ( !BIsNested() && g_bOutputHDREnabled )