g3dvl: add scissor setting
authorCooper Yuan <cooperyuan@gmail.com>
Thu, 5 Nov 2009 07:59:27 +0000 (15:59 +0800)
committerCooper Yuan <cooperyuan@gmail.com>
Thu, 5 Nov 2009 07:59:27 +0000 (15:59 +0800)
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h

index b36dbeb20885bfe5038639f6152633fef3850137..cda6dc134a05530b667af978405ac433cdee782b 100644 (file)
@@ -473,8 +473,12 @@ void vl_compositor_render(struct vl_compositor          *compositor,
    compositor->viewport.translate[2] = 0;
    compositor->viewport.translate[3] = 0;
 
+   compositor->scissor.maxx = compositor->fb_state.width;
+   compositor->scissor.maxy = compositor->fb_state.height;
+
    compositor->pipe->set_framebuffer_state(compositor->pipe, &compositor->fb_state);
    compositor->pipe->set_viewport_state(compositor->pipe, &compositor->viewport);
+   compositor->pipe->set_scissor_state(compositor->pipe, &compositor->scissor);
    compositor->pipe->bind_sampler_states(compositor->pipe, 1, &compositor->sampler);
    compositor->pipe->set_sampler_textures(compositor->pipe, 1, &src_surface);
    compositor->pipe->bind_vs_state(compositor->pipe, compositor->vertex_shader);
index 17e2afd353932af83d23758b52ecc09afa547a85..f441901a7510c33b33159a87923b038f1401f772 100644 (file)
@@ -44,6 +44,7 @@ struct vl_compositor
    void *vertex_shader;
    void *fragment_shader;
    struct pipe_viewport_state viewport;
+   struct pipe_scissor_state scissor;
    struct pipe_vertex_buffer vertex_bufs[2];
    struct pipe_vertex_element vertex_elems[2];
    struct pipe_constant_buffer vs_const_buf, fs_const_buf;
index 6b3614821cc5134785b7ed38d2a192f5f05c1abd..12eef78b762da81233ed11e1ec93fc4a77a3142e 100644 (file)
@@ -721,6 +721,11 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r)
    r->viewport.translate[2] = 0;
    r->viewport.translate[3] = 0;
 
+   r->scissor.maxx = r->pot_buffers ?
+      util_next_power_of_two(r->picture_width) : r->picture_width;
+   r->scissor.maxy = r->pot_buffers ?
+      util_next_power_of_two(r->picture_height) : r->picture_height;
+
    r->fb_state.width = r->pot_buffers ?
       util_next_power_of_two(r->picture_width) : r->picture_width;
    r->fb_state.height = r->pot_buffers ?
@@ -1270,6 +1275,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
 
    r->pipe->set_framebuffer_state(r->pipe, &r->fb_state);
    r->pipe->set_viewport_state(r->pipe, &r->viewport);
+   r->pipe->set_scissor_state(r->pipe, &r->scissor);
 
    vs_consts = pipe_buffer_map
    (
@@ -1386,6 +1392,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
       vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24;
    }
 
+   r->pipe->clear(r->pipe, 1, a, 1, 0);
    r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence);
    pipe_surface_reference(&r->fb_state.cbufs[0], NULL);
 
index 5d2c1273ee37b12370e8677b6d1ef128e297964f..64184337a069042aa5141f7e91e62b44854c5f9e 100644 (file)
@@ -62,6 +62,7 @@ struct vl_mpeg12_mc_renderer
    unsigned macroblocks_per_batch;
 
    struct pipe_viewport_state viewport;
+   struct pipe_scissor_state scissor;
    struct pipe_constant_buffer vs_const_buf;
    struct pipe_constant_buffer fs_const_buf;
    struct pipe_framebuffer_state fb_state;