diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index 1e9f90a96cb..1eb9c886479 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -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 diff --git a/src/gallium/auxiliary/util/u_driconf.c b/src/gallium/auxiliary/util/u_driconf.c index 64692bf2459..98c995d024f 100644 --- a/src/gallium/auxiliary/util/u_driconf.c +++ b/src/gallium/auxiliary/util/u_driconf.c @@ -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); diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index 2ae5d0bc01b..263792a58b4 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -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; diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 4b6fc23438a..e011453a21d 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -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]; diff --git a/src/util/driconf.h b/src/util/driconf.h index eb5393fe753..c5de0c1ad58 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -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 */