diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index 53440b60af7..c4f34c6ea5f 100644
--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -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
diff --git a/src/gallium/auxiliary/util/u_driconf.c b/src/gallium/auxiliary/util/u_driconf.c
index 98c995d024f..7280cfb6e18 100644
--- a/src/gallium/auxiliary/util/u_driconf.c
+++ b/src/gallium/auxiliary/util/u_driconf.c
@@ -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);
}
diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h
index 263792a58b4..bef0a8d7cd1 100644
--- a/src/gallium/include/frontend/api.h
+++ b/src/gallium/include/frontend/api.h
@@ -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];
};
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 0a320073d7e..53b1e368fd1 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -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;
}
}
diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf
index 6801fbd197b..1f69544ca9d 100644
--- a/src/util/00-mesa-defaults.conf
+++ b/src/util/00-mesa-defaults.conf
@@ -352,6 +352,11 @@ TODO: document the other workarounds.
+
+
+
+
+
diff --git a/src/util/driconf.h b/src/util/driconf.h
index ea8976a224c..ef04aba598b 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -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
*/