From 10c75ae41c4e914a0160f9d93bbe1e65b5e14517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 3 Feb 2021 12:56:52 -0500 Subject: [PATCH] mesa: move _mesa_update_pixel out of _mesa_update_state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- src/mesa/main/drawpix.c | 10 ++++++++++ src/mesa/main/readpix.c | 4 ++++ src/mesa/main/state.c | 3 --- src/mesa/main/teximage.c | 17 ++++++++++++----- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 60e1b87cabf..a6c48f2d2e4 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -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); diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index 1800450015a..6f4d49905a1 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -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); diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 43466a236de..8ddc10200ba 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -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 diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index f6eb1b37631..8105c647db0 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -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);