mesa: move _mesa_update_pixel out of _mesa_update_state
authorMarek Olšák <marek.olsak@amd.com>
Wed, 3 Feb 2021 17:56:52 +0000 (12:56 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 26 Feb 2021 23:38:02 +0000 (23:38 +0000)
This only has to be called in a few places and not in normal draw calls.

egl_image_target_texture doesn't call  _mesa_update_pixel because it only
assigns an EGL image to a texture object.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8850>

src/mesa/main/drawpix.c
src/mesa/main/readpix.c
src/mesa/main/state.c
src/mesa/main/teximage.c

index 60e1b87..a6c48f2 100644 (file)
@@ -32,6 +32,7 @@
 #include "framebuffer.h"
 #include "image.h"
 #include "pbo.h"
+#include "pixel.h"
 #include "state.h"
 #include "glformats.h"
 #include "fbobject.h"
@@ -72,6 +73,9 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
     */
    _mesa_set_vp_override(ctx, GL_TRUE);
 
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_pixel(ctx);
+
    if (ctx->NewState)
       _mesa_update_state(ctx);
 
@@ -241,6 +245,9 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
     */
    _mesa_set_vp_override(ctx, GL_TRUE);
 
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_pixel(ctx);
+
    if (ctx->NewState)
       _mesa_update_state(ctx);
 
@@ -327,6 +334,9 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
       return;    /* do nothing */
    }
 
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_pixel(ctx);
+
    if (ctx->NewState)
       _mesa_update_state(ctx);
 
index 1800450..6f4d499 100644 (file)
@@ -36,6 +36,7 @@
 #include "mtypes.h"
 #include "pack.h"
 #include "pbo.h"
+#include "pixel.h"
 #include "state.h"
 #include "glformats.h"
 #include "fbobject.h"
@@ -1048,6 +1049,9 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
       return;
    }
 
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_pixel(ctx);
+
    if (ctx->NewState)
       _mesa_update_state(ctx);
 
index 43466a2..8ddc102 100644 (file)
@@ -465,9 +465,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
       if (new_state & _NEW_LIGHT_CONSTANTS)
          _mesa_update_lighting(ctx);
 
-      if (new_state & _NEW_PIXEL)
-         _mesa_update_pixel( ctx );
-
       /* ctx->_NeedEyeCoords is determined here.
        *
        * If the truth value of this variable has changed, update for the
index f6eb1b3..8105c64 100644 (file)
@@ -42,6 +42,7 @@
 #include "macros.h"
 #include "mipmap.h"
 #include "multisample.h"
+#include "pixel.h"
 #include "pixelstore.h"
 #include "state.h"
 #include "texcompress.h"
@@ -3127,7 +3128,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
       }
 
       if (ctx->NewState & _NEW_PIXEL)
-         _mesa_update_state(ctx);
+         _mesa_update_pixel(ctx);
 
       _mesa_lock_texture(ctx, texObj);
       {
@@ -3423,9 +3424,6 @@ egl_image_target_texture(struct gl_context *ctx,
       return;
    }
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_state(ctx);
-
    _mesa_lock_texture(ctx, texObj);
 
    if (texObj->Immutable) {
@@ -3565,7 +3563,7 @@ texture_sub_image(struct gl_context *ctx, GLuint dims,
    FLUSH_VERTICES(ctx, 0, 0);
 
    if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_state(ctx);
+      _mesa_update_pixel(ctx);
 
    _mesa_lock_texture(ctx, texObj);
    {
@@ -4248,6 +4246,9 @@ copy_texture_sub_image_err(struct gl_context *ctx, GLuint dims,
                   _mesa_enum_to_string(target),
                   level, xoffset, yoffset, zoffset, x, y, width, height);
 
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_pixel(ctx);
+
    if (ctx->NewState & NEW_COPY_TEX_STATE)
       _mesa_update_state(ctx);
 
@@ -4271,6 +4272,9 @@ copy_texture_sub_image_no_error(struct gl_context *ctx, GLuint dims,
 {
    FLUSH_VERTICES(ctx, 0, 0);
 
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_pixel(ctx);
+
    if (ctx->NewState & NEW_COPY_TEX_STATE)
       _mesa_update_state(ctx);
 
@@ -4300,6 +4304,9 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texO
                   _mesa_enum_to_string(internalFormat),
                   x, y, width, height, border);
 
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_pixel(ctx);
+
    if (ctx->NewState & NEW_COPY_TEX_STATE)
       _mesa_update_state(ctx);