[g3dvl] use four component fetch also for idct source
authorChristian König <deathsimple@vodafone.de>
Fri, 26 Nov 2010 20:50:14 +0000 (21:50 +0100)
committerChristian König <deathsimple@vodafone.de>
Fri, 26 Nov 2010 20:50:14 +0000 (21:50 +0100)
src/gallium/auxiliary/vl/vl_idct.c
src/gallium/auxiliary/vl/vl_idct.h

index 9efe43269262bd4b720db8853eaeea77aed29fd9..99887277a3f5c22f1cb9e818159f53f28c9a2691 100644 (file)
@@ -263,7 +263,7 @@ create_transpose_frag_shader(struct vl_idct *idct)
    fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
 
    tmp = matrix_mul(shader, m);
-   ureg_MUL(shader, fragment, ureg_src(tmp), ureg_imm1f(shader, STAGE1_SCALE));
+   ureg_MUL(shader, fragment, ureg_src(tmp), ureg_imm1f(shader, STAGE2_SCALE));
 
    ureg_release_temporary(shader, tmp);
    ureg_release_temporary(shader, m[0][0]);
@@ -300,13 +300,13 @@ create_matrix_frag_shader(struct vl_idct *idct)
    start[0] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_START, TGSI_INTERPOLATE_CONSTANT);
    start[1] = ureg_imm1f(shader, 0.0f);
 
-   fetch_one(shader, m[0], tc[0], sampler[0], start[0], false, idct->destination->width0);
+   fetch_four(shader, m[0], tc[0], sampler[0], start[0], false, idct->destination->width0);
    fetch_four(shader, m[1], tc[1], sampler[1], start[1], true, BLOCK_HEIGHT);
 
    fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
 
    tmp = matrix_mul(shader, m);
-   ureg_MUL(shader, fragment, ureg_src(tmp), ureg_imm1f(shader, STAGE2_SCALE));
+   ureg_MUL(shader, fragment, ureg_src(tmp), ureg_imm1f(shader, STAGE1_SCALE));
 
    ureg_release_temporary(shader, tmp);
    ureg_release_temporary(shader, m[0][0]);
@@ -425,13 +425,14 @@ init_buffers(struct vl_idct *idct)
    template.bind = PIPE_BIND_SAMPLER_VIEW;
    template.flags = 0;
 
-   template.format = idct->destination->format;
+   template.format = PIPE_FORMAT_R16G16B16A16_SNORM;
    template.width0 = idct->destination->width0;
    template.height0 = idct->destination->height0;
    template.depth0 = idct->destination->depth0;
-   template.usage = PIPE_USAGE_DYNAMIC;
+   template.usage = PIPE_USAGE_STREAM;
    idct->textures.individual.source = idct->pipe->screen->resource_create(idct->pipe->screen, &template);
 
+   template.format = idct->destination->format;
    template.usage = PIPE_USAGE_STATIC;
    idct->textures.individual.intermediate = idct->pipe->screen->resource_create(idct->pipe->screen, &template);
 
@@ -689,10 +690,10 @@ vl_idct_add_block(struct vl_idct *idct, unsigned x, unsigned y, short *block)
 
    if(block) {
       tex_pitch = idct->tex_transfer->stride / util_format_get_blocksize(idct->tex_transfer->resource->format);
-      texels = idct->texels + y * tex_pitch * BLOCK_HEIGHT + x * BLOCK_WIDTH;
+      texels = idct->texels + (y * tex_pitch * BLOCK_HEIGHT + x * BLOCK_WIDTH) * 4;
 
       for (i = 0; i < BLOCK_HEIGHT; ++i)
-         memcpy(texels + i * tex_pitch, block + i * BLOCK_WIDTH, BLOCK_WIDTH * 2);
+         memcpy(texels + i * tex_pitch * 4, block + i * BLOCK_WIDTH, BLOCK_WIDTH * 2);
 
       /* non empty blocks fills the vector buffer from left to right */
       v_dst = idct->vectors + idct->num_blocks * 4;
@@ -732,7 +733,7 @@ vl_idct_flush(struct vl_idct *idct)
       idct->pipe->set_fragment_sampler_views(idct->pipe, 2, idct->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->vs);
-      idct->pipe->bind_fs_state(idct->pipe, idct->transpose_fs);
+      idct->pipe->bind_fs_state(idct->pipe, idct->matrix_fs);
 
       util_draw_arrays(idct->pipe, PIPE_PRIM_QUADS, 0, idct->num_blocks * 4);
 
@@ -746,7 +747,7 @@ vl_idct_flush(struct vl_idct *idct)
       idct->pipe->set_fragment_sampler_views(idct->pipe, 2, idct->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->vs);
-      idct->pipe->bind_fs_state(idct->pipe, idct->matrix_fs);
+      idct->pipe->bind_fs_state(idct->pipe, idct->transpose_fs);
 
       util_draw_arrays(idct->pipe, PIPE_PRIM_QUADS, 0, idct->num_blocks * 4);
    }
index da9bfef6fe5059ea506820c0de3eab524a7f1835..084ac36d3e1f7489aa58b4a4dcadb0d24242570f 100644 (file)
@@ -48,8 +48,8 @@ struct vl_idct
       void *all[4];
       void *stage[2][2];
       struct {
-         void *transpose, *source;
-         void *matrix, *intermediate;
+         void *matrix, *source;
+         void *transpose, *intermediate;
       } individual;
    } samplers;
 
@@ -58,8 +58,8 @@ struct vl_idct
       struct pipe_sampler_view *all[4];
       struct pipe_sampler_view *stage[2][2];
       struct {
-         struct pipe_sampler_view *transpose, *source;
-         struct pipe_sampler_view *matrix, *intermediate;
+         struct pipe_sampler_view *matrix, *source;
+         struct pipe_sampler_view *transpose, *intermediate;
       } individual;
    } sampler_views;
 
@@ -71,8 +71,8 @@ struct vl_idct
       struct pipe_resource *all[4];
       struct pipe_resource *stage[2][2];
       struct {
-         struct pipe_resource *transpose, *source;
-         struct pipe_resource *matrix, *intermediate;
+         struct pipe_resource *matrix, *source;
+         struct pipe_resource *transpose, *intermediate;
       } individual;
    } textures;