summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian König <[email protected]>2010-12-01 18:47:11 +0100
committerChristian König <[email protected]>2010-12-03 19:04:01 +0100
commit29840040af128fe3f3542defd9448e1f66c23f03 (patch)
treefddd59dc38f8125418d6bc3f98ae799bc194c65e /src
parent27016941bca40a6563dd2122369745351102bc0c (diff)
add rasterizer state
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/vl/vl_idct.c19
-rw-r--r--src/gallium/auxiliary/vl/vl_idct.h2
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c16
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h2
4 files changed, 34 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c
index 80894b49bbb..d9872cb0ea2 100644
--- a/src/gallium/auxiliary/vl/vl_idct.c
+++ b/src/gallium/auxiliary/vl/vl_idct.c
@@ -285,9 +285,9 @@ create_matrix_frag_shader(struct vl_idct *idct)
fragment[i] = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, i);
/* pixel center is at 0.5 not 0.0 !!! */
- ureg_ADD(shader, ureg_writemask(t_tc, TGSI_WRITEMASK_Y),
- tex, ureg_imm1f(shader, -2.0f / source->height0));
-
+ //ureg_ADD(shader, ureg_writemask(t_tc, TGSI_WRITEMASK_Y),
+ // tex, ureg_imm1f(shader, -2.0f / source->height0));
+ ureg_MOV(shader, ureg_writemask(t_tc, TGSI_WRITEMASK_Y), tex);
for (i = 0; i < 4; ++i) {
fetch_four(shader, l[i], ureg_src(t_tc), sampler[0], start[0], block, false, false, source->width0);
ureg_MUL(shader, l[i][0], ureg_src(l[i][0]), ureg_imm1f(shader, STAGE1_SCALE));
@@ -472,6 +472,7 @@ static void
init_state(struct vl_idct *idct)
{
struct pipe_sampler_state sampler;
+ struct pipe_rasterizer_state rs_state;
unsigned i;
idct->viewport[0].scale[0] = idct->textures.individual.intermediate->width0;
@@ -528,6 +529,14 @@ init_state(struct vl_idct *idct)
/*sampler.max_anisotropy = ; */
idct->samplers.all[i] = idct->pipe->create_sampler_state(idct->pipe, &sampler);
}
+
+ memset(&rs_state, 0, sizeof(rs_state));
+ /*rs_state.sprite_coord_enable */
+ rs_state.sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT;
+ rs_state.point_quad_rasterization = true;
+ rs_state.point_size = BLOCK_WIDTH;
+ rs_state.gl_rasterization_rules = false;
+ idct->rs_state = idct->pipe->create_rasterizer_state(idct->pipe, &rs_state);
}
static void
@@ -543,6 +552,8 @@ cleanup_state(struct vl_idct *idct)
for (i = 0; i < 4; ++i)
idct->pipe->delete_sampler_state(idct->pipe, idct->samplers.all[i]);
+
+ idct->pipe->delete_rasterizer_state(idct->pipe, idct->rs_state);
}
struct pipe_resource *
@@ -730,6 +741,8 @@ vl_idct_flush(struct vl_idct *idct)
if(num_blocks > 0) {
+ idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
+
/* first stage */
idct->pipe->set_framebuffer_state(idct->pipe, &idct->fb_state[0]);
idct->pipe->set_viewport_state(idct->pipe, &idct->viewport[0]);
diff --git a/src/gallium/auxiliary/vl/vl_idct.h b/src/gallium/auxiliary/vl/vl_idct.h
index 94a5c73977f..462863b0008 100644
--- a/src/gallium/auxiliary/vl/vl_idct.h
+++ b/src/gallium/auxiliary/vl/vl_idct.h
@@ -42,6 +42,8 @@ struct vl_idct
struct pipe_resource *destination;
+ void *rs_state;
+
void *vertex_elems_state;
union
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index 70bb7564131..5e928e894e7 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -270,7 +270,7 @@ fetch_ref(struct ureg_program *shader, struct ureg_dst field, unsigned ref_frame
{
struct ureg_src tc[ref_frames * mv_per_frame], sampler[ref_frames];
struct ureg_dst ref[ref_frames], t_tc, result;
- unsigned i, label;
+ unsigned i;
for (i = 0; i < ref_frames * mv_per_frame; ++i)
tc[i] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_MV0 + i, TGSI_INTERPOLATE_LINEAR);
@@ -443,6 +443,7 @@ static bool
init_pipe_state(struct vl_mpeg12_mc_renderer *r)
{
struct pipe_sampler_state sampler;
+ struct pipe_rasterizer_state rs_state;
unsigned filters[5];
unsigned i;
@@ -469,7 +470,7 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r)
/* Luma filter */
filters[0] = PIPE_TEX_FILTER_NEAREST;
/* Chroma filters */
- if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444 || true) { //TODO
+ if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444) {
filters[1] = PIPE_TEX_FILTER_NEAREST;
filters[2] = PIPE_TEX_FILTER_NEAREST;
}
@@ -504,6 +505,14 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r)
r->samplers.all[i] = r->pipe->create_sampler_state(r->pipe, &sampler);
}
+ memset(&rs_state, 0, sizeof(rs_state));
+ /*rs_state.sprite_coord_enable */
+ rs_state.sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT;
+ rs_state.point_quad_rasterization = true;
+ rs_state.point_size = BLOCK_WIDTH;
+ rs_state.gl_rasterization_rules = true;
+ r->rs_state = r->pipe->create_rasterizer_state(r->pipe, &rs_state);
+
return true;
}
@@ -516,6 +525,8 @@ cleanup_pipe_state(struct vl_mpeg12_mc_renderer *r)
for (i = 0; i < 5; ++i)
r->pipe->delete_sampler_state(r->pipe, r->samplers.all[i]);
+
+ r->pipe->delete_rasterizer_state(r->pipe, r->rs_state);
}
static bool
@@ -875,6 +886,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
upload_vertex_stream(r, num_macroblocks);
+ r->pipe->bind_rasterizer_state(r->pipe, r->rs_state);
r->pipe->set_framebuffer_state(r->pipe, &r->fb_state);
r->pipe->set_viewport_state(r->pipe, &r->viewport);
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
index c6e9ef880ef..2b6c21aa5c2 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
@@ -85,6 +85,8 @@ struct vl_mpeg12_mc_renderer
struct vl_idct idct_y, idct_cb, idct_cr;
+ void *rs_state;
+
union
{
void *all[5];