main, steamcompmgr, shaders: Handle lack of LUTs + add debug for disabling color mgmt

This commit is contained in:
Joshua Ashton 2023-04-23 17:09:40 +01:00
parent 8608821414
commit 7ef68ce050
4 changed files with 16 additions and 4 deletions

View file

@ -296,6 +296,8 @@ extern enum g_panel_orientation g_drmModeOrientation;
extern std::atomic<uint64_t> 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 );

View file

@ -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) {

View file

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

View file

@ -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 )