drirc: add allow_sampled_tex_copy option

From OpenGL spec 8.6
"An INVALID_OPERATION error is generated if the object bound to
READ_FRAMEBUFFER_BINDING is framebuffer complete and its effective
value of SAMPLE_BUFFERS (see section 9.2.3.1) is one"

But some games might do this

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8425
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22147>
This commit is contained in:
Illia Polishchuk 2023-03-27 20:11:15 +03:00 committed by Marge Bot
parent 9e764eb8f8
commit f698d47571
6 changed files with 22 additions and 4 deletions

View file

@ -55,6 +55,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_ALLOW_INVALID_GLX_DESTROY_WINDOW(false)
DRI_CONF_KEEP_NATIVE_WINDOW_GLX_DRAWABLE(false)
DRI_CONF_IGNORE_DISCARD_FRAMEBUFFER(false)
DRI_CONF_ALLOW_MULTISAMPLED_COPYTEXIMAGE(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_MISCELLANEOUS

View file

@ -72,6 +72,7 @@ u_driconf_fill_st_options(struct st_config_options *options,
query_string_option(force_gl_vendor);
query_string_option(force_gl_renderer);
query_string_option(mesa_extension_override);
query_bool_option(allow_multisampled_copyteximage);
driComputeOptionsSha1(optionCache, options->config_options_sha1);
}

View file

@ -201,6 +201,8 @@ struct st_config_options
char *force_gl_vendor;
char *force_gl_renderer;
char *mesa_extension_override;
bool allow_multisampled_copyteximage;
unsigned char config_options_sha1[20];
};

View file

@ -2424,7 +2424,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
if (ctx->ReadBuffer->Visual.samples > 0) {
if (!ctx->st_opts->allow_multisampled_copyteximage &&
ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyTexImage%dD(multisample FBO)", dimensions);
return GL_TRUE;
@ -2691,9 +2692,10 @@ copytexsubimage_error_check(struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
if (ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(multisample FBO)", caller);
if (!ctx->st_opts->allow_multisampled_copyteximage &&
ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(multisample FBO)",
caller);
return GL_TRUE;
}
}

View file

@ -352,6 +352,11 @@ TODO: document the other workarounds.
<option name="lower_depth_range_rate" value="0.8" />
</application>
<application name="Penumbra: Overture" executable="Penumbra.exe">
<!-- https://gitlab.freedesktop.org/mesa/mesa/-/issues/8425 -->
<option name="allow_multisampled_copyteximage" value="true" />
</application>
<!-- Workarounds for SPECviewperf relying on invalid / non-conformant
OpenGL behavior. Older SPECviewperf versions might also need this.
-->

View file

@ -442,6 +442,13 @@
DRI_CONF_OPT_B(force_integer_tex_nearest, def, \
"Force integer textures to use nearest filtering")
/* The GL spec does not allow this but wine has translation bug:
https://bugs.winehq.org/show_bug.cgi?id=54787
*/
#define DRI_CONF_ALLOW_MULTISAMPLED_COPYTEXIMAGE(def) \
DRI_CONF_OPT_B(allow_multisampled_copyteximage, def, \
"Allow CopyTexSubImage and other to copy sampled framebuffer")
/**
* \brief Initialization configuration options
*/