Mesa (gallium-sampler-view): r300g: fix up after merge

Keith Whitwell keithw at kemper.freedesktop.org
Mon Mar 15 10:27:43 UTC 2010


Module: Mesa
Branch: gallium-sampler-view
Commit: 506130fff5685742d280bde8800be036c8e8ebfa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=506130fff5685742d280bde8800be036c8e8ebfa

Author: Keith Whitwell <keithw at vmware.com>
Date:   Mon Mar 15 10:24:55 2010 +0000

r300g: fix up after merge

---

 src/gallium/drivers/r300/r300_blit.c          |    4 ++--
 src/gallium/drivers/r300/r300_context.h       |    7 +++----
 src/gallium/drivers/r300/r300_emit.c          |   13 +++++++------
 src/gallium/drivers/r300/r300_state.c         |   21 +++++++++++----------
 src/gallium/drivers/r300/r300_state_derived.c |    4 ++--
 5 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index a60b128..f99f9df 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -114,8 +114,8 @@ static void r300_hw_copy(struct pipe_context* pipe,
         r300->blitter, state->sampler_count, (void**)state->sampler_states);
 
     util_blitter_save_fragment_sampler_views(
-        r300->blitter, r300->fragment_sampler_view_count,
-        r300->fragment_sampler_views);
+        r300->blitter, state->texture_count,
+        state->fragment_sampler_views);
 
     /* Do a copy */
     util_blitter_copy(r300->blitter,
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 2763103..0c8fb68 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -139,7 +139,7 @@ struct r300_texture_fb_state {
 
 struct r300_textures_state {
     /* Textures. */
-    struct r300_texture *textures[8];
+    struct pipe_sampler_view *fragment_sampler_views[8];
     int texture_count;
     /* Sampler states. */
     struct r300_sampler_state *sampler_states[8];
@@ -343,9 +343,8 @@ struct r300_context {
     struct r300_atom rs_block_state;
     /* Scissor state. */
     struct r300_atom scissor_state;
-    /* Sampler view states. */
-    struct pipe_sampler_view* fragment_sampler_views[8];
-    int fragment_sampler_view_count;
+    /* Textures state. */
+    struct r300_atom textures_state;
     /* Vertex stream formatting state. */
     struct r300_atom vertex_stream_state;
     /* VAP (vertex shader) output mapping state. */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 0a3f0f4..3ad0e56 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -165,7 +165,7 @@ static const float * get_shader_constant(
                 /* Factor for converting rectangle coords to
                  * normalized coords. Should only show up on non-r500. */
                 case RC_STATE_R300_TEXRECT_FACTOR:
-                    tex = r300->fragment_sampler_views[constant->u.State[1]]->texture;
+                    tex = texstate->fragment_sampler_views[constant->u.State[1]]->texture;
                     vec[0] = 1.0 / tex->width0;
                     vec[1] = 1.0 / tex->height0;
                     break;
@@ -749,8 +749,9 @@ void r300_emit_textures_state(struct r300_context *r300,
             OUT_CS_REG(R300_TX_FORMAT2_0 + (i * 4), texstate->format[2]);
 
             OUT_CS_REG_SEQ(R300_TX_OFFSET_0 + (i * 4), 1);
-            OUT_CS_TEX_RELOC(allstate->textures[i], texstate->tile_config,
-                         RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
+            OUT_CS_TEX_RELOC((struct r300_texture *)allstate->fragment_sampler_views[i]->texture,
+                             texstate->tile_config,
+                             RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
         }
     }
     END_CS;
@@ -1042,10 +1043,10 @@ validate:
         }
     }
     /* ...textures... */
-    for (i = 0; i < r300->fragment_sampler_view_count; i++) {
-        if (!r300->fragment_sampler_views[i])
+    for (i = 0; i < texstate->count; i++) {
+        tex = (struct r300_texture*)texstate->fragment_sampler_views[i]->texture;
+        if (!tex || !texstate->sampler_states[i])
             continue;
-        tex = (struct r300_texture *)r300->fragment_sampler_views[i]->texture;
         if (!r300_add_texture(r300->rws, tex,
 			      RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
             r300->context.flush(&r300->context, 0, NULL);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 71ac897..d7d654d 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -938,6 +938,8 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
                                             struct pipe_sampler_view** views)
 {
     struct r300_context* r300 = r300_context(pipe);
+    struct r300_textures_state* state =
+        (struct r300_textures_state*)r300->textures_state.state;
     unsigned i;
     boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
     boolean dirty_tex = FALSE;
@@ -948,16 +950,16 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
     }
 
     for (i = 0; i < count; i++) {
-        if (r300->fragment_sampler_views[i] != views[i]) {
+        if (state->fragment_sampler_views[i] != views[i]) {
             struct r300_texture *texture;
-
-            pipe_sampler_view_reference(&r300->fragment_sampler_views[i],
-                views[i]);
+ 
+            pipe_sampler_view_reference(&state->fragment_sampler_views[i],
+                                        views[i]);
             dirty_tex = TRUE;
 
             texture = (struct r300_texture *)views[i]->texture;
 
-            /* R300-specific - set the texrect factor in a fragment shader */
+            /* R300-specific - set the texrect factor in the fragment shader */
             if (!is_r500 && texture->is_npot) {
                 /* XXX It would be nice to re-emit just 1 constant,
                  * XXX not all of them */
@@ -967,13 +969,13 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
     }
 
     for (i = count; i < 8; i++) {
-        if (r300->fragment_sampler_views[i]) {
-            pipe_sampler_view_reference(&r300->fragment_sampler_views[i],
-                NULL);
+        if (state->fragment_sampler_views[i]) {
+            pipe_sampler_view_reference(&state->fragment_sampler_views[i],
+                                        NULL);
         }
     }
 
-    r300->fragment_sampler_view_count = count;
+    state->texture_count = count;
 
     r300->textures_state.dirty = TRUE;
 
@@ -987,7 +989,6 @@ r300_create_sampler_view(struct pipe_context *pipe,
                          struct pipe_texture *texture,
                          const struct pipe_sampler_view *templ)
 {
-   struct r300_context *r300 = r300_context(pipe);
    struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
 
    if (view) {
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 6b9f61a..7947ec6 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -340,10 +340,10 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
     size = 2;
 
     for (i = 0; i < count; i++) {
-        if (state->textures[i] && state->sampler_states[i]) {
+        if (state->fragment_sampler_views[i] && state->sampler_states[i]) {
             state->tx_enable |= 1 << i;
 
-            tex = state->textures[i];
+            tex = (struct r300_texture *)state->fragment_sampler_views[i]->texture;
             sampler = state->sampler_states[i];
 
             texstate = &state->regs[i];




More information about the mesa-commit mailing list