From: Christian König Date: Wed, 10 Nov 2010 23:39:30 +0000 (+0100) Subject: [g3dvl] cleanup vert_stream_0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1be1aa7ba16b377c065cbb0b49ed4271604ce26a;p=mesa.git [g3dvl] cleanup vert_stream_0 --- diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index ff71e4f21c3..6843df052f7 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -60,9 +60,9 @@ struct fragment_shader_consts struct vert_stream_0 { struct vertex2f pos; - struct vertex2f luma_tc; - struct vertex2f cb_tc; - struct vertex2f cr_tc; + float luma_eb; + float cb_eb; + float cr_eb; }; enum MACROBLOCK_TYPE @@ -642,7 +642,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) r->sampler_views.all[i] = r->pipe->create_sampler_view(r->pipe, r->textures.all[i], &sampler_view); } - r->vertex_bufs.individual.ycbcr.stride = sizeof(struct vertex2f) * 4; + r->vertex_bufs.individual.ycbcr.stride = sizeof(struct vert_stream_0); r->vertex_bufs.individual.ycbcr.max_index = 24 * r->macroblocks_per_batch - 1; r->vertex_bufs.individual.ycbcr.buffer_offset = 0; /* XXX: Create with usage DYNAMIC or STREAM */ @@ -650,7 +650,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) ( r->pipe->screen, PIPE_BIND_VERTEX_BUFFER, - sizeof(struct vertex2f) * 4 * 24 * r->macroblocks_per_batch + sizeof(struct vert_stream_0) * 24 * r->macroblocks_per_batch ); for (i = 1; i < 3; ++i) { @@ -678,19 +678,19 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) vertex_elems[1].src_offset = sizeof(struct vertex2f); vertex_elems[1].instance_divisor = 0; vertex_elems[1].vertex_buffer_index = 0; - vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT; + vertex_elems[1].src_format = PIPE_FORMAT_R32_FLOAT; /* Chroma Cr texcoord element */ - vertex_elems[2].src_offset = sizeof(struct vertex2f) * 2; + vertex_elems[2].src_offset = sizeof(struct vertex2f) + sizeof(float); vertex_elems[2].instance_divisor = 0; vertex_elems[2].vertex_buffer_index = 0; - vertex_elems[2].src_format = PIPE_FORMAT_R32G32_FLOAT; + vertex_elems[2].src_format = PIPE_FORMAT_R32_FLOAT; /* Chroma Cb texcoord element */ - vertex_elems[3].src_offset = sizeof(struct vertex2f) * 3; + vertex_elems[3].src_offset = sizeof(struct vertex2f) + sizeof(float) * 2; vertex_elems[3].instance_divisor = 0; vertex_elems[3].vertex_buffer_index = 0; - vertex_elems[3].src_format = PIPE_FORMAT_R32G32_FLOAT; + vertex_elems[3].src_format = PIPE_FORMAT_R32_FLOAT; /* First ref surface top field texcoord element */ vertex_elems[4].src_offset = 0; @@ -774,7 +774,7 @@ get_macroblock_type(struct pipe_mpeg12_macroblock *mb) return -1; } -static void +void gen_block_verts(struct vert_stream_0 *vb, struct pipe_mpeg12_macroblock *mb, const struct vertex2f *offset, unsigned luma_mask, unsigned cb_mask, unsigned cr_mask, @@ -818,72 +818,48 @@ gen_block_verts(struct vert_stream_0 *vb, struct pipe_mpeg12_macroblock *mb, if (!use_zeroblocks || cbp & luma_mask || mb->dct_type == PIPE_MPEG12_DCT_TYPE_FIELD) { v.x = 0.0f; - v.y = 0.0f; } else { v.x = -1.0f; - v.y = 0.0f; } - vb[0].luma_tc.x = v.x; - vb[0].luma_tc.y = v.y; - vb[1].luma_tc.x = v.x; - vb[1].luma_tc.y = v.y;// + half.y; - vb[2].luma_tc.x = v.x;// + half.x; - vb[2].luma_tc.y = v.y; - vb[3].luma_tc.x = v.x;// + half.x; - vb[3].luma_tc.y = v.y; - vb[4].luma_tc.x = v.x; - vb[4].luma_tc.y = v.y;// + half.y; - vb[5].luma_tc.x = v.x;// + half.x; - vb[5].luma_tc.y = v.y;// + half.y; + vb[0].luma_eb = v.x; + vb[1].luma_eb = v.x; + vb[2].luma_eb = v.x; + vb[3].luma_eb = v.x; + vb[4].luma_eb = v.x; + vb[5].luma_eb = v.x; if (!use_zeroblocks || cbp & cb_mask) { v.x = 0.0f; - v.y = 0.0f; } else { v.x = -1.0f; - v.y = 0.0f; } - vb[0].cb_tc.x = v.x; - vb[0].cb_tc.y = v.y; - vb[1].cb_tc.x = v.x; - vb[1].cb_tc.y = v.y;// + half.y; - vb[2].cb_tc.x = v.x;// + half.x; - vb[2].cb_tc.y = v.y; - vb[3].cb_tc.x = v.x;// + half.x; - vb[3].cb_tc.y = v.y; - vb[4].cb_tc.x = v.x; - vb[4].cb_tc.y = v.y;// + half.y; - vb[5].cb_tc.x = v.x;// + half.x; - vb[5].cb_tc.y = v.y;// + half.y; + vb[0].cb_eb = v.x; + vb[1].cb_eb = v.x; + vb[2].cb_eb = v.x; + vb[3].cb_eb = v.x; + vb[4].cb_eb = v.x; + vb[5].cb_eb = v.x; if (!use_zeroblocks || cbp & cr_mask) { v.x = 0.0f; - v.y = 0.0f; } else { v.x = -1.0f; - v.y = 0.0f; } - vb[0].cr_tc.x = v.x; - vb[0].cr_tc.y = v.y; - vb[1].cr_tc.x = v.x; - vb[1].cr_tc.y = v.y; // + half.y; - vb[2].cr_tc.x = v.x; // + half.x; - vb[2].cr_tc.y = v.y; - vb[3].cr_tc.x = v.x; // + half.x; - vb[3].cr_tc.y = v.y; - vb[4].cr_tc.x = v.x; - vb[4].cr_tc.y = v.y; // + half.y; - vb[5].cr_tc.x = v.x; // + half.x; - vb[5].cr_tc.y = v.y; // + half.y; + vb[0].cr_eb = v.x; + vb[1].cr_eb = v.x; + vb[2].cr_eb = v.x; + vb[3].cr_eb = v.x; + vb[4].cr_eb = v.x; + vb[5].cr_eb = v.x; } -static void +void gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, struct pipe_mpeg12_macroblock *mb, unsigned pos, struct vert_stream_0 *ycbcr_vb, struct vertex2f **ref_vb) @@ -1284,12 +1260,12 @@ grab_field_coded_block(short *src, short *dst, unsigned dst_pitch) static void fill_frame_zero_block(short *dst, unsigned dst_pitch) { - unsigned y; - - assert(dst); + //unsigned y; + // + //assert(dst); - for (y = 0; y < BLOCK_HEIGHT; ++y) - memset(dst + y * dst_pitch, 0, BLOCK_WIDTH * 2); + //for (y = 0; y < BLOCK_HEIGHT; ++y) + // memset(dst + y * dst_pitch, 0, BLOCK_WIDTH * 2); } static void