[g3dvl] no need for individual samplers for idct stage 1 & 2
authorChristian König <deathsimple@vodafone.de>
Sun, 27 Mar 2011 00:53:04 +0000 (01:53 +0100)
committerChristian König <deathsimple@vodafone.de>
Sun, 27 Mar 2011 00:53:04 +0000 (01:53 +0100)
src/gallium/auxiliary/vl/vl_idct.c
src/gallium/auxiliary/vl/vl_idct.h

index a21e06b777607107ef9dc97022fda219c2358131..075b892628fef0442a69e3ede7fbda70205d93f6 100644 (file)
@@ -416,7 +416,7 @@ init_state(struct vl_idct *idct)
    if (!idct->rs_state)
       goto error_rs_state;
 
-   for (i = 0; i < 4; ++i) {
+   for (i = 0; i < 2; ++i) {
       memset(&sampler, 0, sizeof(sampler));
       sampler.wrap_s = PIPE_TEX_WRAP_REPEAT;
       sampler.wrap_t = PIPE_TEX_WRAP_REPEAT;
@@ -427,17 +427,17 @@ init_state(struct vl_idct *idct)
       sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
       sampler.compare_func = PIPE_FUNC_ALWAYS;
       sampler.normalized_coords = 1;
-      idct->samplers.all[i] = idct->pipe->create_sampler_state(idct->pipe, &sampler);
-      if (!idct->samplers.all[i])
+      idct->samplers[i] = idct->pipe->create_sampler_state(idct->pipe, &sampler);
+      if (!idct->samplers[i])
          goto error_samplers;
    }
 
    return true;
 
 error_samplers:
-   for (i = 0; i < 4; ++i)
-      if (idct->samplers.all[i])
-         idct->pipe->delete_sampler_state(idct->pipe, idct->samplers.all[i]);
+   for (i = 0; i < 2; ++i)
+      if (idct->samplers[i])
+         idct->pipe->delete_sampler_state(idct->pipe, idct->samplers[i]);
 
    idct->pipe->delete_rasterizer_state(idct->pipe, idct->rs_state);
 
@@ -450,8 +450,8 @@ cleanup_state(struct vl_idct *idct)
 {
    unsigned i;
 
-   for (i = 0; i < 4; ++i)
-      idct->pipe->delete_sampler_state(idct->pipe, idct->samplers.all[i]);
+   for (i = 0; i < 2; ++i)
+      idct->pipe->delete_sampler_state(idct->pipe, idct->samplers[i]);
 
    idct->pipe->delete_rasterizer_state(idct->pipe, idct->rs_state);
 }
@@ -795,12 +795,12 @@ vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_
       num_verts = idct->blocks_x * idct->blocks_y * 4;
 
       idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
+      idct->pipe->bind_fragment_sampler_states(idct->pipe, 2, idct->samplers);
 
       /* first stage */
       idct->pipe->set_framebuffer_state(idct->pipe, &buffer->fb_state[0]);
       idct->pipe->set_viewport_state(idct->pipe, &buffer->viewport[0]);
       idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[0]);
-      idct->pipe->bind_fragment_sampler_states(idct->pipe, 2, idct->samplers.stage[0]);
       idct->pipe->bind_vs_state(idct->pipe, idct->matrix_vs);
       idct->pipe->bind_fs_state(idct->pipe, idct->matrix_fs);
       util_draw_arrays_instanced(idct->pipe, PIPE_PRIM_QUADS, 0, num_verts, 0, num_instances);
@@ -809,7 +809,6 @@ vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_
       idct->pipe->set_framebuffer_state(idct->pipe, &buffer->fb_state[1]);
       idct->pipe->set_viewport_state(idct->pipe, &buffer->viewport[1]);
       idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[1]);
-      idct->pipe->bind_fragment_sampler_states(idct->pipe, 2, idct->samplers.stage[1]);
       idct->pipe->bind_vs_state(idct->pipe, idct->transpose_vs);
       idct->pipe->bind_fs_state(idct->pipe, idct->transpose_fs);
       util_draw_arrays_instanced(idct->pipe, PIPE_PRIM_QUADS, 0, num_verts, 0, num_instances);
index 913034e7ab408d1cb4a54a174ae9b242df93f478..14f66f858eb638e27ab2b8007d2427e28fc5dec2 100644 (file)
@@ -44,15 +44,7 @@ struct vl_idct
 
    void *rs_state;
 
-   union
-   {
-      void *all[4];
-      void *stage[2][2];
-      struct {
-         void *matrix, *source;
-         void *transpose, *intermediate;
-      } individual;
-   } samplers;
+   void *samplers[2];
 
    void *matrix_vs, *transpose_vs;
    void *matrix_fs, *transpose_fs;