Mesa (master): swrast: increase array size of TextureSample

Marek Olšák mareko at kemper.freedesktop.org
Tue May 28 11:05:41 UTC 2013


Module: Mesa
Branch: master
Commit: b4cb857dbfeb89d56ac0eb67ba1d7d5f65e336d4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4cb857dbfeb89d56ac0eb67ba1d7d5f65e336d4

Author: Marek Olšák <maraeo at gmail.com>
Date:   Mon May 13 16:24:57 2013 +0200

swrast: increase array size of TextureSample

to match the size of ctx->Texture.Unit, and it will also fix
piglit/max-samplers with the following commit.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/swrast/s_context.c |    6 +++---
 src/mesa/swrast/s_context.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 591fe57..70bbb83 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -459,7 +459,7 @@ _swrast_invalidate_state( struct gl_context *ctx, GLbitfield new_state )
       swrast->BlendFunc = _swrast_validate_blend_func;
 
    if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC)
-      for (i = 0 ; i < ctx->Const.FragmentProgram.MaxTextureImageUnits ; i++)
+      for (i = 0 ; i < ARRAY_SIZE(swrast->TextureSample); i++)
 	 swrast->TextureSample[i] = NULL;
 }
 
@@ -473,7 +473,7 @@ _swrast_update_texture_samplers(struct gl_context *ctx)
    if (!swrast)
       return; /* pipe hack */
 
-   for (u = 0; u < ctx->Const.FragmentProgram.MaxTextureImageUnits; u++) {
+   for (u = 0; u < ARRAY_SIZE(swrast->TextureSample); u++) {
       struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
       /* Note: If tObj is NULL, the sample function will be a simple
        * function that just returns opaque black (0,0,0,1).
@@ -766,7 +766,7 @@ _swrast_CreateContext( struct gl_context *ctx )
    swrast->Driver.SpanRenderStart = _swrast_span_render_start;
    swrast->Driver.SpanRenderFinish = _swrast_span_render_finish;
 
-   for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
+   for (i = 0; i < ARRAY_SIZE(swrast->TextureSample); i++)
       swrast->TextureSample[i] = NULL;
 
    /* SpanArrays is global and shared by all SWspan instances. However, when
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 3d3f636..9520185 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -313,7 +313,7 @@ typedef struct
    /** Internal hooks, kept up to date by the same mechanism as above.
     */
    blend_func BlendFunc;
-   texture_sample_func TextureSample[MAX_TEXTURE_IMAGE_UNITS];
+   texture_sample_func TextureSample[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
 
    /** Buffer for saving the sampled texture colors.
     * Needed for GL_ARB_texture_env_crossbar implementation.




More information about the mesa-commit mailing list