[g3dvl] give mc and ycbcr stage its own vertex element state
authorChristian König <deathsimple@vodafone.de>
Fri, 15 Apr 2011 20:15:17 +0000 (22:15 +0200)
committerChristian König <deathsimple@vodafone.de>
Fri, 15 Apr 2011 20:15:17 +0000 (22:15 +0200)
src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
src/gallium/auxiliary/vl/vl_vertex_buffers.c
src/gallium/auxiliary/vl/vl_vertex_buffers.h

index 906be3775c4458a7286532e7690d5876f992fbb2..9e0d40e7f5bb961e1f9d7c48bc6bc4c800114178 100644 (file)
@@ -715,10 +715,10 @@ vl_create_mpeg12_decoder(struct pipe_video_context *context,
 
    dec->quads = vl_vb_upload_quads(dec->pipe, 2, 2);
    for (i = 0; i < VL_MAX_PLANES; ++i)
-      dec->ves_eb[i] = vl_vb_get_elems_state(dec->pipe, i, 0);
+      dec->ves_eb[i] = vl_vb_get_ves_eb(dec->pipe, i);
 
    for (i = 0; i < 2; ++i)
-      dec->ves_mv[i] = vl_vb_get_elems_state(dec->pipe, 0, i);
+      dec->ves_mv[i] = vl_vb_get_ves_mv(dec->pipe, i);
 
    dec->base.width = align(width, MACROBLOCK_WIDTH);
    dec->base.height = align(height, MACROBLOCK_HEIGHT);
index 925ad10c6e038cb5df6d131379fc51b4284a426e..fc30e85a4d77fb7d610f927ad2c8faaa092ce40d 100644 (file)
@@ -130,10 +130,12 @@ vl_vb_element_helper(struct pipe_vertex_element* elements, unsigned num_elements
 }
 
 void *
-vl_vb_get_elems_state(struct pipe_context *pipe, int component, int motionvector)
+vl_vb_get_ves_eb(struct pipe_context *pipe, int component)
 {
    struct pipe_vertex_element vertex_elems[NUM_VS_INPUTS];
 
+   assert(pipe);
+
    memset(&vertex_elems, 0, sizeof(vertex_elems));
    vertex_elems[VS_I_RECT] = vl_vb_get_quad_vertex_element();
 
@@ -144,11 +146,29 @@ vl_vb_get_elems_state(struct pipe_context *pipe, int component, int motionvector
    vertex_elems[VS_I_FLAGS].src_format = PIPE_FORMAT_R8G8B8A8_USCALED;
 
    /* empty block element of selected component */
-   vertex_elems[VS_I_EB].src_offset = 8 + component * 4;
+   vertex_elems[VS_I_EB].src_offset = offsetof(struct vl_vertex_stream, eb[component]);
    vertex_elems[VS_I_EB].src_format = PIPE_FORMAT_R8G8B8A8_USCALED;
 
+   vl_vb_element_helper(&vertex_elems[VS_I_VPOS], NUM_VS_INPUTS - 1, 1);
+
+   return pipe->create_vertex_elements_state(pipe, NUM_VS_INPUTS, vertex_elems);
+}
+
+void *
+vl_vb_get_ves_mv(struct pipe_context *pipe, int motionvector)
+{
+   struct pipe_vertex_element vertex_elems[NUM_VS_INPUTS];
+
+   memset(&vertex_elems, 0, sizeof(vertex_elems));
+   vertex_elems[VS_I_RECT] = vl_vb_get_quad_vertex_element();
+
+   assert(pipe);
+
+   /* Position element */
+   vertex_elems[VS_I_VPOS].src_format = PIPE_FORMAT_R16G16_SSCALED;
+
    /* motion vector TOP element */
-   vertex_elems[VS_I_MV_TOP].src_offset = 20 + motionvector * 16;
+   vertex_elems[VS_I_MV_TOP].src_offset = offsetof(struct vl_vertex_stream, mv[motionvector * 2]);
    vertex_elems[VS_I_MV_TOP].src_format = PIPE_FORMAT_R16G16B16A16_SSCALED;
 
    /* motion vector BOTTOM element */
index 6cbda7cc9b1dad5a6b1a73c236f4f12539220bda..62f7bf0050820d2a0d42ef369840a95b6eebaf4b 100644 (file)
@@ -42,10 +42,12 @@ enum VS_INPUT
 {
    VS_I_RECT,
    VS_I_VPOS,
+
    VS_I_FLAGS,
    VS_I_EB,
-   VS_I_MV_TOP,
-   VS_I_MV_BOTTOM,
+
+   VS_I_MV_TOP = VS_I_FLAGS,
+   VS_I_MV_BOTTOM = VS_I_EB,
 
    NUM_VS_INPUTS
 };
@@ -64,7 +66,9 @@ struct vl_vertex_buffer
 struct pipe_vertex_buffer vl_vb_upload_quads(struct pipe_context *pipe,
                                              unsigned blocks_x, unsigned blocks_y);
 
-void *vl_vb_get_elems_state(struct pipe_context *pipe, int component, int motionvector);
+void *vl_vb_get_ves_eb(struct pipe_context *pipe, int component);
+
+void *vl_vb_get_ves_mv(struct pipe_context *pipe, int motionvector);
 
 struct pipe_vertex_buffer vl_vb_init(struct vl_vertex_buffer *buffer,
                                      struct pipe_context *pipe,