driconf: Add ignore_discard_framebuffer option

Some apps use glDiscardFramebuffer()/glInvalidateFramebuffer() when they
only kidding.  Add a knob to disable that.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Mike Blumenkrantz <michael.blumenkrantz@gmail.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21916>
This commit is contained in:
Rob Clark
2023-03-14 16:07:43 -07:00
committed by Marge Bot
parent 976d964a35
commit a66c62420e
5 changed files with 10 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_FORCE_DIRECT_GLX_CONTEXT(false)
DRI_CONF_ALLOW_INVALID_GLX_DESTROY_WINDOW(false)
DRI_CONF_KEEP_NATIVE_WINDOW_GLX_DRAWABLE(false)
DRI_CONF_IGNORE_DISCARD_FRAMEBUFFER(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_MISCELLANEOUS

View File

@@ -64,6 +64,7 @@ u_driconf_fill_st_options(struct st_config_options *options,
query_bool_option(allow_draw_out_of_order);
query_bool_option(glthread_nop_check_framebuffer_status);
query_bool_option(ignore_map_unsynchronized);
query_bool_option(ignore_discard_framebuffer);
query_bool_option(force_gl_names_reuse);
query_bool_option(force_gl_map_buffer_synchronized);
query_bool_option(transcode_etc);

View File

@@ -192,6 +192,7 @@ struct st_config_options
bool allow_draw_out_of_order;
bool glthread_nop_check_framebuffer_status;
bool ignore_map_unsynchronized;
bool ignore_discard_framebuffer;
bool force_integer_tex_nearest;
bool force_gl_names_reuse;
bool force_gl_map_buffer_synchronized;

View File

@@ -5386,6 +5386,9 @@ discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
{
uint32_t mask = 0;
if (unlikely(ctx->st_opts->ignore_discard_framebuffer))
return;
for (int i = 0; i < numAttachments; i++) {
GLenum att = attachments[i];

View File

@@ -306,6 +306,10 @@
DRI_CONF_OPT_B(no_16bit, def, \
"Disable 16-bit instructions")
#define DRI_CONF_IGNORE_DISCARD_FRAMEBUFFER(def) \
DRI_CONF_OPT_B(ignore_discard_framebuffer, def, \
"Ignore glDiscardFramebuffer/glInvalidateFramebuffer, workaround for games that use it incorrectly")
/**
* \brief Image quality-related options
*/