st/mesa: flush bitmap cache before texture functions
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 9 Jun 2016 10:22:31 +0000 (12:22 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 21 Jun 2016 08:54:08 +0000 (10:54 +0200)
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 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_gen_mipmap.c

index 3e504965fc05b01efb214ae060db5d80b87a53e4..3b870d77e17f0f19446565db5613920222ae457d 100644 (file)
@@ -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"
@@ -1323,6 +1324,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;
 
@@ -1791,6 +1794,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 */
@@ -2254,6 +2259,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);
 
@@ -2776,6 +2783,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) {
index a14bbfabaa31b474e15771787ebe994af345b6d1..adf02e71fd8599d044c0c4a7ebbb0e5a1a874279 100644 (file)
@@ -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().
     */