st/mesa: rename some vertex/fragment state fields for better consistency
authorBrian Paul <brianp@vmware.com>
Mon, 6 Aug 2012 14:35:20 +0000 (08:35 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 6 Aug 2012 14:41:07 +0000 (08:41 -0600)
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h

index 84fbd9d465118e88caa47a84ddc15c7d69ae3c78..e83483273264fda97e0d74dd366248cd6794285e 100644 (file)
@@ -235,13 +235,13 @@ update_fragment_samplers(struct st_context *st)
    struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
    GLuint su;
    GLuint samplers_used = fprog->Base.SamplersUsed;
-   GLuint old_max = st->state.num_samplers;
+   GLuint old_max = st->state.num_fragment_samplers;
 
-   st->state.num_samplers = 0;
+   st->state.num_fragment_samplers = 0;
 
    /* loop over sampler units (aka tex image units) */
    for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
-      struct pipe_sampler_state *sampler = st->state.samplers + su;
+      struct pipe_sampler_state *sampler = st->state.fragment_samplers + su;
 
       if (samplers_used & 1) {
          GLuint texUnit;
@@ -250,7 +250,7 @@ update_fragment_samplers(struct st_context *st)
 
          convert_sampler(st, sampler, texUnit);
 
-         st->state.num_samplers = su + 1;
+         st->state.num_fragment_samplers = su + 1;
 
          /*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
          cso_single_sampler(st->cso_context, PIPE_SHADER_FRAGMENT, su, sampler);
index f5db65ae120e2073cc39408a9e51a5242cebf836..69f9f1d458e6a2661509750485a5a1b4be4edb9e 100644 (file)
@@ -281,7 +281,7 @@ update_vertex_textures(struct st_context *st)
 
          st->state.num_vertex_textures = su + 1;
       }
-      pipe_sampler_view_reference(&st->state.sampler_vertex_views[su],
+      pipe_sampler_view_reference(&st->state.vertex_sampler_views[su],
                                   sampler_view);
    }
 
@@ -291,7 +291,7 @@ update_vertex_textures(struct st_context *st)
       cso_set_sampler_views(st->cso_context,
                             PIPE_SHADER_VERTEX,
                             numUnits,
-                            st->state.sampler_vertex_views);
+                            st->state.vertex_sampler_views);
    }
 }
 
@@ -302,10 +302,10 @@ update_fragment_textures(struct st_context *st)
    const struct gl_context *ctx = st->ctx;
    struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
    GLuint su;
-   int old_max = st->state.num_textures;
+   int old_max = st->state.num_fragment_textures;
    GLbitfield samplers_used = fprog->Base.SamplersUsed;
 
-   st->state.num_textures = 0;
+   st->state.num_fragment_textures = 0;
 
    /* loop over sampler units (aka tex image units) */
    for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
@@ -321,19 +321,20 @@ update_fragment_textures(struct st_context *st)
          if (retval == GL_FALSE)
             continue;
 
-         st->state.num_textures = su + 1;
+         st->state.num_fragment_textures = su + 1;
       } else if (samplers_used == 0 && su >= old_max) {
          /* if we've reset all the old views and we have no more new ones */
          break;
       }
 
-      pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
+      pipe_sampler_view_reference(&st->state.fragment_sampler_views[su],
+                                  sampler_view);
    }
 
    cso_set_sampler_views(st->cso_context,
                          PIPE_SHADER_FRAGMENT,
-                         st->state.num_textures,
-                         st->state.sampler_views);
+                         st->state.num_fragment_textures,
+                         st->state.fragment_sampler_views);
 }
 
 
index 131efcabc6b712905fca9be1dfe75659e2f161d9..3c17bd6c359fed7fd6eea9bb4fc323bb0f6c2817 100644 (file)
@@ -480,10 +480,10 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
    /* user samplers, plus our bitmap sampler */
    {
       struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
-      uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_samplers);
+      uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_fragment_samplers);
       uint i;
-      for (i = 0; i < st->state.num_samplers; i++) {
-         samplers[i] = &st->state.samplers[i];
+      for (i = 0; i < st->state.num_fragment_samplers; i++) {
+         samplers[i] = &st->state.fragment_samplers[i];
       }
       samplers[fpv->bitmap_sampler] =
          &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT];
@@ -494,8 +494,10 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
    /* user textures, plus the bitmap texture */
    {
       struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
-      uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_textures);
-      memcpy(sampler_views, st->state.sampler_views, sizeof(sampler_views));
+      uint num = MAX2(fpv->bitmap_sampler + 1,
+                      st->state.num_fragment_textures);
+      memcpy(sampler_views, st->state.fragment_sampler_views,
+             sizeof(sampler_views));
       sampler_views[fpv->bitmap_sampler] = sv;
       cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views);
    }
index 6b7c047ed0165aed7797933e70e77ca6b69197ff..2f951617829bc8d759b54414abae3d96545caa34 100644 (file)
@@ -248,8 +248,14 @@ static void st_destroy_context_priv( struct st_context *st )
    st_destroy_drawpix(st);
    st_destroy_drawtex(st);
 
-   for (i = 0; i < Elements(st->state.sampler_views); i++) {
-      pipe_sampler_view_release(st->pipe, &st->state.sampler_views[i]);
+   for (i = 0; i < Elements(st->state.fragment_sampler_views); i++) {
+      pipe_sampler_view_release(st->pipe,
+                                &st->state.fragment_sampler_views[i]);
+   }
+
+   for (i = 0; i < Elements(st->state.vertex_sampler_views); i++) {
+      pipe_sampler_view_release(st->pipe,
+                                &st->state.vertex_sampler_views[i]);
    }
 
    if (st->default_texture) {
index cdac5a1c7c939f30009ccd3497d4b47de9cf56a8..0dfd81c1b7983a83708b1c083bae9852963a8082 100644 (file)
@@ -98,23 +98,23 @@ struct st_context
       struct pipe_blend_state               blend;
       struct pipe_depth_stencil_alpha_state depth_stencil;
       struct pipe_rasterizer_state          rasterizer;
-      struct pipe_sampler_state             samplers[PIPE_MAX_SAMPLERS];
-      struct pipe_sampler_state             vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
+      struct pipe_sampler_state    fragment_samplers[PIPE_MAX_SAMPLERS];
+      struct pipe_sampler_state    vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
       struct pipe_clip_state clip;
       struct {
          void *ptr;
          unsigned size;
       } constants[PIPE_SHADER_TYPES];
       struct pipe_framebuffer_state framebuffer;
-      struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
-      struct pipe_sampler_view *sampler_vertex_views[PIPE_MAX_VERTEX_SAMPLERS];
+      struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
+      struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
       struct pipe_scissor_state scissor;
       struct pipe_viewport_state viewport;
       unsigned sample_mask;
 
-      GLuint num_samplers;
+      GLuint num_fragment_samplers;
       GLuint num_vertex_samplers;
-      GLuint num_textures;
+      GLuint num_fragment_textures;
       GLuint num_vertex_textures;
 
       GLuint poly_stipple[32];  /**< In OpenGL's bottom-to-top order */