summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-06-09 12:22:31 +0200
committerEmil Velikov <[email protected]>2016-06-21 11:52:36 +0100
commit76377387c2d44d0fbae21763386ac86ffb54c635 (patch)
treeca67cae3f13fb6bda5472566bce408bd0020a2fd
parent6775b169cdffecd373d57847e5d71db3fe39409a (diff)
st/mesa: flush bitmap cache before texture functions
As far as I can tell, a sequence of glBitmap followed by texture functions that refer to a texture bound as the framebuffer is well within what should be allowed. Found by inspection. Cc: 11.2 12.0 <[email protected]> Reviewed-by: Marek Olšák <[email protected]> (cherry picked from commit e7fff3cfe156e13198107e5e76a77fb79ed02173)
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c9
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index cfe9c4b2c07..cf1c351ae42 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -48,6 +48,7 @@
#include "state_tracker/st_debug.h"
#include "state_tracker/st_context.h"
+#include "state_tracker/st_cb_bitmap.h"
#include "state_tracker/st_cb_fbo.h"
#include "state_tracker/st_cb_flush.h"
#include "state_tracker/st_cb_texture.h"
@@ -1716,6 +1717,8 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
unsigned dstz = texImage->Face + texImage->TexObject->MinLayer;
unsigned dst_level = 0;
+ st_flush_bitmap_cache(st);
+
if (stObj->pt == stImage->pt)
dst_level = texImage->TexObject->MinLevel + texImage->Level;
@@ -2181,6 +2184,8 @@ st_GetTexSubImage(struct gl_context * ctx,
assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
+ st_flush_bitmap_cache(st);
+
if (!st->prefer_blit_based_texture_transfer &&
!_mesa_is_format_compressed(texImage->TexFormat)) {
/* Try to avoid the fallback if we're doing texture decompression here */
@@ -2644,6 +2649,8 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
unsigned bind;
GLint srcY0, srcY1;
+ st_flush_bitmap_cache(st);
+
assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
@@ -3166,6 +3173,8 @@ st_ClearTexSubImage(struct gl_context *ctx,
if (!pt)
return;
+ st_flush_bitmap_cache(st);
+
u_box_3d(xoffset, yoffset, zoffset + texImage->Face,
width, height, depth, &box);
if (texImage->TexObject->Immutable) {
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index a14bbfabaa3..adf02e71fd8 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -40,6 +40,7 @@
#include "st_context.h"
#include "st_texture.h"
#include "st_gen_mipmap.h"
+#include "st_cb_bitmap.h"
#include "st_cb_texture.h"
@@ -96,6 +97,8 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
if (lastLevel == 0)
return;
+ st_flush_bitmap_cache(st);
+
/* The texture isn't in a "complete" state yet so set the expected
* lastLevel here, since it won't get done in st_finalize_texture().
*/