[Mesa-dev] [PATCH 2/2] gallium: Replaced gl_rasterization_rules with lower_left_origin and half_pixel_center.
Marek Olšák
maraeo at gmail.com
Sat Apr 20 17:41:16 PDT 2013
Do we really need the lower_left_origin state? I think I can't
implement it for radeon and it's the kind of stuff that should be
taken care of by the state tracker anyway. Isn't it sufficient to just
set a viewport which is upside down, like we do now?
Marek
On Sun, Apr 21, 2013 at 12:37 AM, <jfonseca at vmware.com> wrote:
> From: James Benton <jbenton at vmware.com>
>
> This change is necessary to achieve correct results when using OpenGL
> FBOs.
>
> Signed-off-by: José Fonseca <jfonseca at vmware.com>
> ---
> src/gallium/auxiliary/draw/draw_context.c | 3 +-
> src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 10 ++--
> src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 2 +-
> .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 6 +-
> .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 6 +-
> src/gallium/auxiliary/hud/hud_context.c | 3 +-
> src/gallium/auxiliary/postprocess/pp_program.c | 3 +-
> src/gallium/auxiliary/util/u_blit.c | 3 +-
> src/gallium/auxiliary/util/u_blitter.c | 3 +-
> src/gallium/auxiliary/util/u_dump_state.c | 3 +-
> src/gallium/auxiliary/util/u_gen_mipmap.c | 3 +-
> src/gallium/auxiliary/util/u_inlines.h | 3 +-
> src/gallium/auxiliary/vl/vl_compositor.c | 3 +-
> src/gallium/auxiliary/vl/vl_idct.c | 3 +-
> src/gallium/auxiliary/vl/vl_matrix_filter.c | 3 +-
> src/gallium/auxiliary/vl/vl_mc.c | 3 +-
> src/gallium/auxiliary/vl/vl_median_filter.c | 3 +-
> src/gallium/auxiliary/vl/vl_zscan.c | 3 +-
> src/gallium/docs/source/cso/rasterizer.rst | 5 +-
> src/gallium/docs/source/tgsi.rst | 2 +-
> .../drivers/freedreno/freedreno_rasterizer.c | 2 +-
> src/gallium/drivers/llvmpipe/lp_setup.c | 6 +-
> src/gallium/drivers/llvmpipe/lp_setup.h | 3 +-
> src/gallium/drivers/llvmpipe/lp_setup_context.h | 1 +
> src/gallium/drivers/llvmpipe/lp_setup_line.c | 11 ----
> src/gallium/drivers/llvmpipe/lp_setup_tri.c | 17 +-----
> src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 19 +++---
> src/gallium/drivers/llvmpipe/lp_state_setup.c | 2 +-
> src/gallium/drivers/nv50/nv50_state.c | 2 +-
> src/gallium/drivers/nvc0/nvc0_surface.c | 2 +-
> src/gallium/drivers/r600/evergreen_state.c | 4 +-
> src/gallium/drivers/r600/r600_state.c | 2 +-
> src/gallium/drivers/radeonsi/si_state.c | 2 +-
> src/gallium/drivers/softpipe/sp_setup.c | 2 +-
> src/gallium/drivers/svga/svga_pipe_rasterizer.c | 2 +-
> src/gallium/drivers/svga/svga_state_framebuffer.c | 2 +-
> src/gallium/drivers/trace/tr_dump_state.c | 3 +-
> src/gallium/include/pipe/p_state.h | 62 ++++++++++++++++++--
> src/gallium/state_trackers/vega/renderer.c | 3 +-
> src/gallium/state_trackers/xa/xa_renderer.c | 3 +-
> src/gallium/state_trackers/xorg/xorg_renderer.c | 3 +-
> src/gallium/tests/graw/fs-test.c | 3 +-
> src/gallium/tests/graw/graw_util.h | 3 +-
> src/gallium/tests/graw/gs-test.c | 3 +-
> src/gallium/tests/graw/quad-sample.c | 3 +-
> src/gallium/tests/graw/quad-tex.c | 3 +-
> src/gallium/tests/graw/shader-leak.c | 3 +-
> src/gallium/tests/graw/tri-gs.c | 3 +-
> src/gallium/tests/graw/tri-instanced.c | 3 +-
> src/gallium/tests/graw/tri.c | 3 +-
> src/gallium/tests/graw/vs-test.c | 3 +-
> src/gallium/tests/trivial/quad-tex.c | 3 +-
> src/gallium/tests/trivial/tri.c | 3 +-
> src/mesa/state_tracker/st_atom_rasterizer.c | 5 +-
> src/mesa/state_tracker/st_cb_bitmap.c | 3 +-
> src/mesa/state_tracker/st_cb_clear.c | 3 +-
> src/mesa/state_tracker/st_cb_drawpixels.c | 3 +-
> 57 files changed, 173 insertions(+), 103 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
> index 5272951..fb27dec 100644
> --- a/src/gallium/auxiliary/draw/draw_context.c
> +++ b/src/gallium/auxiliary/draw/draw_context.c
> @@ -711,7 +711,8 @@ draw_get_rasterizer_no_cull( struct draw_context *draw,
> rast.scissor = scissor;
> rast.flatshade = flatshade;
> rast.front_ccw = 1;
> - rast.gl_rasterization_rules = draw->rasterizer->gl_rasterization_rules;
> + rast.half_pixel_center = draw->rasterizer->half_pixel_center;
> + rast.lower_left_origin = draw->rasterizer->lower_left_origin;
> rast.clip_halfz = draw->rasterizer->clip_halfz;
>
> draw->rasterizer_no_cull[scissor][flatshade] =
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> index 98da9cf..8daefa4 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
> @@ -77,11 +77,11 @@ static void wideline_line( struct draw_stage *stage,
> const float dx = fabsf(pos0[0] - pos2[0]);
> const float dy = fabsf(pos0[1] - pos2[1]);
>
> - const boolean gl_rasterization_rules =
> - stage->draw->rasterizer->gl_rasterization_rules;
> + const boolean half_pixel_center =
> + stage->draw->rasterizer->half_pixel_center;
>
> /* small tweak to meet GL specification */
> - const float bias = gl_rasterization_rules ? 0.125f : 0.0f;
> + const float bias = half_pixel_center ? 0.125f : 0.0f;
>
> /*
> * Draw wide line as a quad (two tris) by "stretching" the line along
> @@ -95,7 +95,7 @@ static void wideline_line( struct draw_stage *stage,
> pos1[1] = pos1[1] + half_width - bias;
> pos2[1] = pos2[1] - half_width - bias;
> pos3[1] = pos3[1] + half_width - bias;
> - if (gl_rasterization_rules) {
> + if (half_pixel_center) {
> if (pos0[0] < pos2[0]) {
> /* left to right line */
> pos0[0] -= 0.5f;
> @@ -118,7 +118,7 @@ static void wideline_line( struct draw_stage *stage,
> pos1[0] = pos1[0] + half_width + bias;
> pos2[0] = pos2[0] - half_width + bias;
> pos3[0] = pos3[0] + half_width + bias;
> - if (gl_rasterization_rules) {
> + if (half_pixel_center) {
> if (pos0[1] < pos2[1]) {
> /* top to bottom line */
> pos0[1] -= 0.5f;
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
> index 0d3fee4..321106c 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
> @@ -207,7 +207,7 @@ widepoint_first_point(struct draw_stage *stage,
> wide->xbias = 0.0;
> wide->ybias = 0.0;
>
> - if (rast->gl_rasterization_rules) {
> + if (rast->half_pixel_center) {
> wide->xbias = 0.125;
> wide->ybias = -0.125;
> }
> diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
> index 8e48f46..f068117 100644
> --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
> +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
> @@ -106,9 +106,9 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
> fpme->vertex_size,
> instance_id_index );
> draw_pt_post_vs_prepare( fpme->post_vs,
> - draw->clip_xy,
> - draw->clip_z,
> - draw->clip_user,
> + draw->clip_xy,
> + draw->clip_z,
> + draw->clip_user,
> draw->guard_band_xy,
> draw->identity_viewport,
> draw->rasterizer->clip_halfz,
> diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> index 4dff4f8..16ac0a6 100644
> --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> @@ -157,9 +157,9 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
>
>
> draw_pt_post_vs_prepare( fpme->post_vs,
> - draw->clip_xy,
> - draw->clip_z,
> - draw->clip_user,
> + draw->clip_xy,
> + draw->clip_z,
> + draw->clip_user,
> draw->guard_band_xy,
> draw->identity_viewport,
> draw->rasterizer->clip_halfz,
> diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
> index 5ba80a1..bab5127 100644
> --- a/src/gallium/auxiliary/hud/hud_context.c
> +++ b/src/gallium/auxiliary/hud/hud_context.c
> @@ -990,7 +990,8 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso)
> }
>
> /* rasterizer */
> - hud->rasterizer.gl_rasterization_rules = 1;
> + hud->rasterizer.half_pixel_center = 1;
> + hud->rasterizer.lower_left_origin = 1;
> hud->rasterizer.depth_clip = 1;
> hud->rasterizer.line_width = 1;
> hud->rasterizer.line_last_pixel = 1;
> diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c
> index 7044e34..62f23da 100644
> --- a/src/gallium/auxiliary/postprocess/pp_program.c
> +++ b/src/gallium/auxiliary/postprocess/pp_program.c
> @@ -87,7 +87,8 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
> PIPE_BLENDFACTOR_INV_SRC_ALPHA;
>
> p->rasterizer.cull_face = PIPE_FACE_NONE;
> - p->rasterizer.gl_rasterization_rules = 1;
> + p->rasterizer.half_pixel_center = 1;
> + p->rasterizer.lower_left_origin = 1;
> p->rasterizer.depth_clip = 1;
>
> p->sampler.wrap_s = p->sampler.wrap_t = p->sampler.wrap_r =
> diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
> index 9fe15b8..6e858ed 100644
> --- a/src/gallium/auxiliary/util/u_blit.c
> +++ b/src/gallium/auxiliary/util/u_blit.c
> @@ -118,7 +118,8 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
>
> /* rasterizer */
> ctx->rasterizer.cull_face = PIPE_FACE_NONE;
> - ctx->rasterizer.gl_rasterization_rules = 1;
> + ctx->rasterizer.half_pixel_center = 1;
> + ctx->rasterizer.lower_left_origin = 1;
> ctx->rasterizer.depth_clip = 1;
>
> /* samplers */
> diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
> index 2a4a13e..fc5d736 100644
> --- a/src/gallium/auxiliary/util/u_blitter.c
> +++ b/src/gallium/auxiliary/util/u_blitter.c
> @@ -239,7 +239,8 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
> /* rasterizer state */
> memset(&rs_state, 0, sizeof(rs_state));
> rs_state.cull_face = PIPE_FACE_NONE;
> - rs_state.gl_rasterization_rules = 1;
> + rs_state.half_pixel_center = 1;
> + rs_state.lower_left_origin = 1;
> rs_state.flatshade = 1;
> rs_state.depth_clip = 1;
> ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state);
> diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
> index 2f28f3c..994a989 100644
> --- a/src/gallium/auxiliary/util/u_dump_state.c
> +++ b/src/gallium/auxiliary/util/u_dump_state.c
> @@ -327,7 +327,8 @@ util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *sta
> util_dump_member(stream, uint, state, line_stipple_pattern);
> util_dump_member(stream, bool, state, line_last_pixel);
> util_dump_member(stream, bool, state, flatshade_first);
> - util_dump_member(stream, bool, state, gl_rasterization_rules);
> + util_dump_member(stream, bool, state, half_pixel_center);
> + util_dump_member(stream, bool, state, lower_left_origin);
> util_dump_member(stream, bool, state, rasterizer_discard);
> util_dump_member(stream, bool, state, depth_clip);
> util_dump_member(stream, uint, state, clip_plane_enable);
> diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
> index e1f18f3..57b5789 100644
> --- a/src/gallium/auxiliary/util/u_gen_mipmap.c
> +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
> @@ -1271,7 +1271,8 @@ util_create_gen_mipmap(struct pipe_context *pipe,
> /* rasterizer */
> memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
> ctx->rasterizer.cull_face = PIPE_FACE_NONE;
> - ctx->rasterizer.gl_rasterization_rules = 1;
> + ctx->rasterizer.half_pixel_center = 1;
> + ctx->rasterizer.lower_left_origin = 1;
> ctx->rasterizer.depth_clip = 1;
>
> /* sampler state */
> diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
> index 7770cd5..6e65ee6 100644
> --- a/src/gallium/auxiliary/util/u_inlines.h
> +++ b/src/gallium/auxiliary/util/u_inlines.h
> @@ -485,8 +485,7 @@ util_get_min_point_size(const struct pipe_rasterizer_state *state)
> {
> /* The point size should be clamped to this value at the rasterizer stage.
> */
> - return state->gl_rasterization_rules &&
> - !state->point_quad_rasterization &&
> + return !state->point_quad_rasterization &&
> !state->point_smooth &&
> !state->multisample ? 1.0f : 0.0f;
> }
> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
> index fecf3c9..9504e33 100644
> --- a/src/gallium/auxiliary/vl/vl_compositor.c
> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
> @@ -453,7 +453,8 @@ init_pipe_state(struct vl_compositor *c)
> rast.point_size_per_vertex = 1;
> rast.offset_units = 1;
> rast.offset_scale = 1;
> - rast.gl_rasterization_rules = 1;
> + rast.half_pixel_center = 1;
> + rast.lower_left_origin = 1;
> rast.depth_clip = 1;
>
> c->rast = c->pipe->create_rasterizer_state(c->pipe, &rast);
> diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c
> index a0c243f..e5a6282 100644
> --- a/src/gallium/auxiliary/vl/vl_idct.c
> +++ b/src/gallium/auxiliary/vl/vl_idct.c
> @@ -516,7 +516,8 @@ init_state(struct vl_idct *idct)
>
> memset(&rs_state, 0, sizeof(rs_state));
> rs_state.point_size = 1;
> - rs_state.gl_rasterization_rules = true;
> + rs_state.half_pixel_center = true;
> + rs_state.lower_left_origin = true;
> rs_state.depth_clip = 1;
> idct->rs_state = idct->pipe->create_rasterizer_state(idct->pipe, &rs_state);
> if (!idct->rs_state)
> diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c
> index 438beda..ca87da0 100644
> --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c
> +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c
> @@ -168,7 +168,8 @@ vl_matrix_filter_init(struct vl_matrix_filter *filter, struct pipe_context *pipe
> filter->pipe = pipe;
>
> memset(&rs_state, 0, sizeof(rs_state));
> - rs_state.gl_rasterization_rules = true;
> + rs_state.half_pixel_center = true;
> + rs_state.lower_left_origin = true;
> rs_state.depth_clip = 1;
> filter->rs_state = pipe->create_rasterizer_state(pipe, &rs_state);
> if (!filter->rs_state)
> diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c
> index d395cc2..c01cfad 100644
> --- a/src/gallium/auxiliary/vl/vl_mc.c
> +++ b/src/gallium/auxiliary/vl/vl_mc.c
> @@ -428,7 +428,8 @@ init_pipe_state(struct vl_mc *r)
> rs_state.sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT;
> rs_state.point_quad_rasterization = true;
> rs_state.point_size = VL_BLOCK_WIDTH;
> - rs_state.gl_rasterization_rules = true;
> + rs_state.half_pixel_center = true;
> + rs_state.lower_left_origin = true;
> rs_state.depth_clip = 1;
> r->rs_state = r->pipe->create_rasterizer_state(r->pipe, &rs_state);
> if (!r->rs_state)
> diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c
> index dfa280a..3f55b2b 100644
> --- a/src/gallium/auxiliary/vl/vl_median_filter.c
> +++ b/src/gallium/auxiliary/vl/vl_median_filter.c
> @@ -254,7 +254,8 @@ vl_median_filter_init(struct vl_median_filter *filter, struct pipe_context *pipe
> filter->pipe = pipe;
>
> memset(&rs_state, 0, sizeof(rs_state));
> - rs_state.gl_rasterization_rules = true;
> + rs_state.half_pixel_center = true;
> + rs_state.lower_left_origin = true;
> rs_state.depth_clip = 1;
> filter->rs_state = pipe->create_rasterizer_state(pipe, &rs_state);
> if (!filter->rs_state)
> diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c
> index 53c2e80..a318f20 100644
> --- a/src/gallium/auxiliary/vl/vl_zscan.c
> +++ b/src/gallium/auxiliary/vl/vl_zscan.c
> @@ -270,7 +270,8 @@ init_state(struct vl_zscan *zscan)
> assert(zscan);
>
> memset(&rs_state, 0, sizeof(rs_state));
> - rs_state.gl_rasterization_rules = true;
> + rs_state.half_pixel_center = true;
> + rs_state.lower_left_origin = true;
> rs_state.depth_clip = 1;
> zscan->rs_state = zscan->pipe->create_rasterizer_state(zscan->pipe, &rs_state);
> if (!zscan->rs_state)
> diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst
> index be4bad5..93f6b8e 100644
> --- a/src/gallium/docs/source/cso/rasterizer.rst
> +++ b/src/gallium/docs/source/cso/rasterizer.rst
> @@ -238,10 +238,13 @@ scissor
> multisample
> Whether :term:`MSAA` is enabled.
>
> -gl_rasterization_rules
> +half_pixel_center
> Whether the rasterizer should use (0.5, 0.5) pixel centers. When not set,
> the rasterizer will use (0, 0) for pixel centers.
>
> +lower_left_origin
> + Determine where is the origin, for the top-left rasterization rule.
> +
> clip_halfz
> When true clip space in the z axis goes from [0..1] (D3D). When false
> [-1, 1] (GL)
> diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
> index b7180f8..ac205f0 100644
> --- a/src/gallium/docs/source/tgsi.rst
> +++ b/src/gallium/docs/source/tgsi.rst
> @@ -2123,7 +2123,7 @@ If HALF_INTEGER, the fractionary part of the position will be 0.5
> If INTEGER, the fractionary part of the position will be 0.0
>
> Note that this does not affect the set of fragments generated by
> -rasterization, which is instead controlled by gl_rasterization_rules in the
> +rasterization, which is instead controlled by half_pixel_center in the
> rasterizer.
>
> OpenGL defaults to HALF_INTEGER, and is configurable with the
> diff --git a/src/gallium/drivers/freedreno/freedreno_rasterizer.c b/src/gallium/drivers/freedreno/freedreno_rasterizer.c
> index 3261856..aa6c64a 100644
> --- a/src/gallium/drivers/freedreno/freedreno_rasterizer.c
> +++ b/src/gallium/drivers/freedreno/freedreno_rasterizer.c
> @@ -81,7 +81,7 @@ fd_rasterizer_state_create(struct pipe_context *pctx,
> so->pa_cl_clip_cntl = 0; // TODO
>
> so->pa_su_vtx_cntl =
> - A2XX_PA_SU_VTX_CNTL_PIX_CENTER(cso->gl_rasterization_rules ? PIXCENTER_OGL : PIXCENTER_D3D) |
> + A2XX_PA_SU_VTX_CNTL_PIX_CENTER(cso->half_pixel_center ? PIXCENTER_OGL : PIXCENTER_D3D) |
> A2XX_PA_SU_VTX_CNTL_QUANT_MODE(ONE_SIXTEENTH);
>
> so->pa_su_point_size =
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
> index c119395..49f2c33 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup.c
> +++ b/src/gallium/drivers/llvmpipe/lp_setup.c
> @@ -491,14 +491,16 @@ lp_setup_set_triangle_state( struct lp_setup_context *setup,
> unsigned cull_mode,
> boolean ccw_is_frontface,
> boolean scissor,
> - boolean gl_rasterization_rules)
> + boolean half_pixel_center,
> + boolean lower_left_origin)
> {
> LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
>
> setup->ccw_is_frontface = ccw_is_frontface;
> setup->cullmode = cull_mode;
> setup->triangle = first_triangle;
> - setup->pixel_offset = gl_rasterization_rules ? 0.5f : 0.0f;
> + setup->pixel_offset = half_pixel_center ? 0.5f : 0.0f;
> + setup->lower_left_origin = lower_left_origin;
>
> if (setup->scissor_test != scissor) {
> setup->dirty |= LP_SETUP_NEW_SCISSOR;
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
> index de29601..da4f4fe 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup.h
> +++ b/src/gallium/drivers/llvmpipe/lp_setup.h
> @@ -77,7 +77,8 @@ lp_setup_set_triangle_state( struct lp_setup_context *setup,
> unsigned cullmode,
> boolean front_is_ccw,
> boolean scissor,
> - boolean gl_rasterization_rules );
> + boolean half_pixel_center,
> + boolean lower_left_origin);
>
> void
> lp_setup_set_line_state( struct lp_setup_context *setup,
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
> index b72831b..901da91 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
> +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
> @@ -98,6 +98,7 @@ struct lp_setup_context
> boolean point_size_per_vertex;
> boolean rasterizer_discard;
> unsigned cullmode;
> + unsigned lower_left_origin;
> float pixel_offset;
> float line_width;
> float point_size;
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
> index 29c2317..54f19cb 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
> +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
> @@ -621,17 +621,6 @@ try_setup_line( struct lp_setup_context *setup,
>
>
> /* correct for top-left vs. bottom-left fill convention.
> - *
> - * note that we're overloading gl_rasterization_rules to mean
> - * both (0.5,0.5) pixel centers *and* bottom-left filling
> - * convention.
> - *
> - * GL actually has a top-left filling convention, but GL's
> - * notion of "top" differs from gallium's...
> - *
> - * Also, sometimes (in FBO cases) GL will render upside down
> - * to its usual method, in which case it will probably want
> - * to use the opposite, top-left convention.
> */
> if (plane[i].dcdx < 0) {
> /* both fill conventions want this - adjust for left edges */
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> index cf3d536..60eb423 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
> @@ -365,7 +365,7 @@ do_triangle_ccw(struct lp_setup_context *setup,
> dcdx_zero_mask = _mm_cmpeq_epi32(dcdx, zero);
> dcdy_neg_mask = _mm_srai_epi32(dcdy, 31);
>
> - top_left_flag = _mm_set1_epi32((setup->pixel_offset == 0) ? ~0 : 0);
> + top_left_flag = _mm_set1_epi32((setup->lower_left_origin == 0) ? ~0 : 0);
>
> c_inc_mask = _mm_or_si128(dcdx_neg_mask,
> _mm_and_si128(dcdx_zero_mask,
> @@ -417,25 +417,14 @@ do_triangle_ccw(struct lp_setup_context *setup,
> */
> plane[i].c = plane[i].dcdx * position->x[i] - plane[i].dcdy * position->y[i];
>
> - /* correct for top-left vs. bottom-left fill convention.
> - *
> - * note that we're overloading gl_rasterization_rules to mean
> - * both (0.5,0.5) pixel centers *and* bottom-left filling
> - * convention.
> - *
> - * GL actually has a top-left filling convention, but GL's
> - * notion of "top" differs from gallium's...
> - *
> - * Also, sometimes (in FBO cases) GL will render upside down
> - * to its usual method, in which case it will probably want
> - * to use the opposite, top-left convention.
> + /* correct for top-left vs. bottom-left fill convention.
> */
> if (plane[i].dcdx < 0) {
> /* both fill conventions want this - adjust for left edges */
> plane[i].c++;
> }
> else if (plane[i].dcdx == 0) {
> - if (setup->pixel_offset == 0) {
> + if (setup->lower_left_origin == 0){
> /* correct for top-left fill convention:
> */
> if (plane[i].dcdy > 0) plane[i].c++;
> diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
> index ca8df71..4b9b906 100644
> --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
> +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
> @@ -114,21 +114,22 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle)
> /* XXX: just pass lp_state directly to setup.
> */
> lp_setup_set_triangle_state( llvmpipe->setup,
> - state->lp_state.cull_face,
> - state->lp_state.front_ccw,
> - state->lp_state.scissor,
> - state->lp_state.gl_rasterization_rules);
> + state->lp_state.cull_face,
> + state->lp_state.front_ccw,
> + state->lp_state.scissor,
> + state->lp_state.half_pixel_center,
> + state->lp_state.lower_left_origin);
> lp_setup_set_flatshade_first( llvmpipe->setup,
> state->lp_state.flatshade_first);
> lp_setup_set_rasterizer_discard( llvmpipe->setup,
> state->lp_state.rasterizer_discard);
> lp_setup_set_line_state( llvmpipe->setup,
> - state->lp_state.line_width);
> + state->lp_state.line_width);
> lp_setup_set_point_state( llvmpipe->setup,
> - state->lp_state.point_size,
> - state->lp_state.point_size_per_vertex,
> - state->lp_state.sprite_coord_enable,
> - state->lp_state.sprite_coord_mode);
> + state->lp_state.point_size,
> + state->lp_state.point_size_per_vertex,
> + state->lp_state.sprite_coord_enable,
> + state->lp_state.sprite_coord_mode);
> }
> else {
> llvmpipe->rasterizer = NULL;
> diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c
> index edd5d0f..ed68b98 100644
> --- a/src/gallium/drivers/llvmpipe/lp_state_setup.c
> +++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c
> @@ -807,7 +807,7 @@ lp_make_setup_variant_key(struct llvmpipe_context *lp,
>
> key->num_inputs = fs->info.base.num_inputs;
> key->flatshade_first = lp->rasterizer->flatshade_first;
> - key->pixel_center_half = lp->rasterizer->gl_rasterization_rules;
> + key->pixel_center_half = lp->rasterizer->half_pixel_center;
> key->twoside = lp->rasterizer->light_twoside;
> key->size = Offset(struct lp_setup_variant_key,
> inputs[key->num_inputs]);
> diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
> index cbde4b1..163ead9 100644
> --- a/src/gallium/drivers/nv50/nv50_state.c
> +++ b/src/gallium/drivers/nv50/nv50_state.c
> @@ -57,7 +57,7 @@
> * ! pipe_rasterizer_state.flatshade_first also applies to QUADS
> * (There's a GL query for that, forcing an exception is just ridiculous.)
> *
> - * ! pipe_rasterizer_state.gl_rasterization_rules is ignored - pixel centers
> + * ! pipe_rasterizer_state.half_pixel_center is ignored - pixel centers
> * are always at half integer coordinates and the top-left rule applies
> * (There does not seem to be a hardware switch for this.)
> *
> diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c
> index 394f196..45e4128 100644
> --- a/src/gallium/drivers/nvc0/nvc0_surface.c
> +++ b/src/gallium/drivers/nvc0/nvc0_surface.c
> @@ -1241,7 +1241,7 @@ nvc0_blitctx_create(struct nvc0_context *nvc0)
>
> nvc0->blit->nvc0 = nvc0;
>
> - nvc0->blit->rast.pipe.gl_rasterization_rules = 1;
> + nvc0->blit->rast.pipe.half_pixel_center = 1;
>
> return TRUE;
> }
> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
> index d2a2008..af98b7b 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -970,11 +970,11 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx,
>
> if (rctx->chip_class == CAYMAN) {
> r600_store_context_reg(&rs->buffer, CM_R_028BE4_PA_SU_VTX_CNTL,
> - S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
> + S_028C08_PIX_CENTER_HALF(state->half_pixel_center) |
> S_028C08_QUANT_MODE(V_028C08_X_1_256TH));
> } else {
> r600_store_context_reg(&rs->buffer, R_028C08_PA_SU_VTX_CNTL,
> - S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
> + S_028C08_PIX_CENTER_HALF(state->half_pixel_center) |
> S_028C08_QUANT_MODE(V_028C08_X_1_256TH));
> }
>
> diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
> index b30e053..b054fef 100644
> --- a/src/gallium/drivers/r600/r600_state.c
> +++ b/src/gallium/drivers/r600/r600_state.c
> @@ -960,7 +960,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
> r600_store_context_reg(&rs->buffer, R_0286D4_SPI_INTERP_CONTROL_0, spi_interp);
> r600_store_context_reg(&rs->buffer, R_028A4C_PA_SC_MODE_CNTL, sc_mode_cntl);
> r600_store_context_reg(&rs->buffer, R_028C08_PA_SU_VTX_CNTL,
> - S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
> + S_028C08_PIX_CENTER_HALF(state->half_pixel_center) |
> S_028C08_QUANT_MODE(V_028C08_X_1_256TH));
> r600_store_context_reg(&rs->buffer, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, fui(state->offset_clamp));
> r600_store_context_reg(&rs->buffer, R_028814_PA_SU_SC_MODE_CNTL,
> diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
> index a39843c..be40fdf 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -460,7 +460,7 @@ static void *si_create_rs_state(struct pipe_context *ctx,
>
> si_pm4_set_reg(pm4, R_028BDC_PA_SC_LINE_CNTL, 0x00000400);
> si_pm4_set_reg(pm4, R_028BE4_PA_SU_VTX_CNTL,
> - S_028BE4_PIX_CENTER(state->gl_rasterization_rules));
> + S_028BE4_PIX_CENTER(state->half_pixel_center));
> si_pm4_set_reg(pm4, R_028BE8_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000);
> si_pm4_set_reg(pm4, R_028BEC_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000);
> si_pm4_set_reg(pm4, R_028BF0_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000);
> diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
> index 08cd4da..03a2b46 100644
> --- a/src/gallium/drivers/softpipe/sp_setup.c
> +++ b/src/gallium/drivers/softpipe/sp_setup.c
> @@ -394,7 +394,7 @@ setup_sort_vertices(struct setup_context *setup,
> * - pixel center (0.5, 0.5) for GL, or
> * - assume (0.0, 0.0) for other APIs.
> */
> - if (setup->softpipe->rasterizer->gl_rasterization_rules) {
> + if (setup->softpipe->rasterizer->half_pixel_center) {
> setup->pixel_offset = 0.5f;
> } else {
> setup->pixel_offset = 0.0f;
> diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
> index 3342800..a9a2396 100644
> --- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c
> +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
> @@ -78,7 +78,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
> /* point_size_per_vertex - ? */
> /* sprite_coord_mode - ??? */
> /* flatshade_first - handled by index translation */
> - /* gl_rasterization_rules - XXX - viewport code */
> + /* half_pixel_center - XXX - viewport code */
> /* line_width - draw module */
> /* fill_cw, fill_ccw - draw module or index translation */
>
> diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c
> index 128f5da..8232c32 100644
> --- a/src/gallium/drivers/svga/svga_state_framebuffer.c
> +++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
> @@ -305,7 +305,7 @@ emit_viewport( struct svga_context *svga,
> * screen-space coordinates slightly relative to D3D which is
> * what hardware implements natively.
> */
> - if (svga->curr.rast->templ.gl_rasterization_rules) {
> + if (svga->curr.rast->templ.half_pixel_center) {
> float adjust_x = 0.0;
> float adjust_y = 0.0;
>
> diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
> index 006082b..bd0a3ff 100644
> --- a/src/gallium/drivers/trace/tr_dump_state.c
> +++ b/src/gallium/drivers/trace/tr_dump_state.c
> @@ -146,7 +146,8 @@ void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
> trace_dump_member(uint, state, line_stipple_pattern);
> trace_dump_member(bool, state, line_last_pixel);
> trace_dump_member(bool, state, flatshade_first);
> - trace_dump_member(bool, state, gl_rasterization_rules);
> + trace_dump_member(bool, state, half_pixel_center);
> + trace_dump_member(bool, state, lower_left_origin);
> trace_dump_member(bool, state, rasterizer_discard);
> trace_dump_member(bool, state, depth_clip);
> trace_dump_member(uint, state, clip_plane_enable);
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
> index 5da3a53..4c9eae0 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -109,16 +109,66 @@ struct pipe_rasterizer_state
>
> /**
> * When true, triangle rasterization uses (0.5, 0.5) pixel centers
> - * for determining pixel ownership.
> + * for determining pixel ownership (e.g, OpenGL, D3D10 and higher)
> + *
> + * 0 0.5 1
> + * 0 +-----+
> + * | |
> + * 0.5 | X |
> + * | |
> + * 1 +-----+
> *
> * When false, triangle rasterization uses (0,0) pixel centers for
> - * determining pixel ownership.
> + * determining pixel ownership (e.g., D3D9 or ealier)
> + *
> + * -0.5 0 0.5
> + * -0.5 +-----+
> + * | |
> + * 0 | X |
> + * | |
> + * 0.5 +-----+
> + *
> + */
> + unsigned half_pixel_center:1;
> +
> + /**
> + * Triangle rasterization always uses a 'top,left' rule for pixel ownership,
> + * this just alters what we consider to be the top edge for that test.
> + *
> + * When true, screen coordinates origin is considered to be at bottom-left
> + * (e.g., OpenGL drawables):
> + *
> + * y ^
> + * |
> + * | +=============+ <- top edge
> + * | | |
> + * | | |
> + * | | |
> + * | +-------------+
> + * |
> + * 0 +--------------------->
> + * 0 x
> + *
> + * When false, screen coordinates origin is considered to be at top-left
> + * (e.g., OpenGL FBOs, D3D):
> + *
> + * 0 x
> + * 0 +--------------------->
> + * |
> + * | +=============+ <- top edge
> + * | | |
> + * | | |
> + * | | |
> + * | +-------------+
> + * |
> + * y V
> *
> - * Triangle rasterization always uses a 'top,left' rule for pixel
> - * ownership, this just alters which point we consider the pixel
> - * center for that test.
> + * See also:
> + * - http://www.opengl.org/registry/specs/ARB/fragment_coord_conventions.txt
> + * - http://msdn.microsoft.com/en-us/library/windows/desktop/cc627092.aspx
> + * - http://msdn.microsoft.com/en-us/library/windows/desktop/bb147314.aspx
> */
> - unsigned gl_rasterization_rules:1;
> + unsigned lower_left_origin:1;
>
> /**
> * When true, rasterization is disabled and no pixels are written.
> diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
> index 61e3105..2dd2ac2 100644
> --- a/src/gallium/state_trackers/vega/renderer.c
> +++ b/src/gallium/state_trackers/vega/renderer.c
> @@ -1175,7 +1175,8 @@ struct renderer * renderer_create(struct vg_context *owner)
> /* GL rasterization rules */
> raster = &renderer->g3d.rasterizer;
> memset(raster, 0, sizeof(*raster));
> - raster->gl_rasterization_rules = 1;
> + raster->half_pixel_center = 1;
> + raster->lower_left_origin = 1;
> raster->depth_clip = 1;
> cso_set_rasterizer(renderer->cso, raster);
>
> diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c
> index 23345fe..cf7b0b3 100644
> --- a/src/gallium/state_trackers/xa/xa_renderer.c
> +++ b/src/gallium/state_trackers/xa/xa_renderer.c
> @@ -108,7 +108,8 @@ renderer_init_state(struct xa_context *r)
>
> /* XXX: move to renderer_init_state? */
> memset(&raster, 0, sizeof(struct pipe_rasterizer_state));
> - raster.gl_rasterization_rules = 1;
> + raster.half_pixel_center = 1;
> + raster.lower_left_origin = 1;
> raster.depth_clip = 1;
> cso_set_rasterizer(r->cso, &raster);
>
> diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
> index 286ab34..569fb77 100644
> --- a/src/gallium/state_trackers/xorg/xorg_renderer.c
> +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
> @@ -81,7 +81,8 @@ renderer_init_state(struct xorg_renderer *r)
>
> /* XXX: move to renderer_init_state? */
> memset(&raster, 0, sizeof(struct pipe_rasterizer_state));
> - raster.gl_rasterization_rules = 1;
> + raster.half_pixel_center = 1;
> + raster.lower_left_origin = 1;
> raster.depth_clip = 1;
> cso_set_rasterizer(r->cso, &raster);
>
> diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
> index 0d6e5d3..00ebdfe 100644
> --- a/src/gallium/tests/graw/fs-test.c
> +++ b/src/gallium/tests/graw/fs-test.c
> @@ -458,7 +458,8 @@ static void init( void )
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = 1;
> handle = ctx->create_rasterizer_state(ctx, &rasterizer);
> ctx->bind_rasterizer_state(ctx, handle);
> diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h
> index 1ff7a3f..7877e7b 100644
> --- a/src/gallium/tests/graw/graw_util.h
> +++ b/src/gallium/tests/graw/graw_util.h
> @@ -173,7 +173,8 @@ graw_util_default_state(struct graw_info *info, boolean depth_test)
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> handle = info->ctx->create_rasterizer_state(info->ctx, &rasterizer);
> info->ctx->bind_rasterizer_state(info->ctx, handle);
> }
> diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
> index 8af0c37..addb6d2 100644
> --- a/src/gallium/tests/graw/gs-test.c
> +++ b/src/gallium/tests/graw/gs-test.c
> @@ -565,7 +565,8 @@ static void init( void )
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = 1;
> handle = ctx->create_rasterizer_state(ctx, &rasterizer);
> ctx->bind_rasterizer_state(ctx, handle);
> diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c
> index 2722dd5..6bd03de 100644
> --- a/src/gallium/tests/graw/quad-sample.c
> +++ b/src/gallium/tests/graw/quad-sample.c
> @@ -373,7 +373,8 @@ static void init( void )
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = 1;
> handle = ctx->create_rasterizer_state(ctx, &rasterizer);
> ctx->bind_rasterizer_state(ctx, handle);
> diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c
> index 46f8be0..1ff1282 100644
> --- a/src/gallium/tests/graw/quad-tex.c
> +++ b/src/gallium/tests/graw/quad-tex.c
> @@ -188,7 +188,8 @@ static void init( void )
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = 1;
> handle = info.ctx->create_rasterizer_state(info.ctx, &rasterizer);
> info.ctx->bind_rasterizer_state(info.ctx, handle);
> diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c
> index e612e62..37d2f6e 100644
> --- a/src/gallium/tests/graw/shader-leak.c
> +++ b/src/gallium/tests/graw/shader-leak.c
> @@ -250,7 +250,8 @@ static void init( void )
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = 1;
> handle = ctx->create_rasterizer_state(ctx, &rasterizer);
> ctx->bind_rasterizer_state(ctx, handle);
> diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c
> index 7379340..9fbbcb7 100644
> --- a/src/gallium/tests/graw/tri-gs.c
> +++ b/src/gallium/tests/graw/tri-gs.c
> @@ -255,7 +255,8 @@ static void init( void )
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = 1;
> handle = ctx->create_rasterizer_state(ctx, &rasterizer);
> ctx->bind_rasterizer_state(ctx, handle);
> diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c
> index 3f29c9b..5c6be41 100644
> --- a/src/gallium/tests/graw/tri-instanced.c
> +++ b/src/gallium/tests/graw/tri-instanced.c
> @@ -306,7 +306,8 @@ static void init( void )
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = 1;
> handle = ctx->create_rasterizer_state(ctx, &rasterizer);
> ctx->bind_rasterizer_state(ctx, handle);
> diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c
> index 22b3de8..fb14426e 100644
> --- a/src/gallium/tests/graw/tri.c
> +++ b/src/gallium/tests/graw/tri.c
> @@ -125,7 +125,8 @@ static void init( void )
> void *handle;
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.flatshade = FlatShade;
> rasterizer.depth_clip = 1;
> handle = info.ctx->create_rasterizer_state(info.ctx, &rasterizer);
> diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c
> index 0274ee0..291987e 100644
> --- a/src/gallium/tests/graw/vs-test.c
> +++ b/src/gallium/tests/graw/vs-test.c
> @@ -453,7 +453,8 @@ static void init( void )
> memset(&rasterizer, 0, sizeof rasterizer);
> rasterizer.cull_face = PIPE_FACE_NONE;
> rasterizer.point_size = 8.0;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = 1;
> handle = ctx->create_rasterizer_state(ctx, &rasterizer);
> ctx->bind_rasterizer_state(ctx, handle);
> diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
> index e9e1f0e..343542e 100644
> --- a/src/gallium/tests/trivial/quad-tex.c
> +++ b/src/gallium/tests/trivial/quad-tex.c
> @@ -197,7 +197,8 @@ static void init_prog(struct program *p)
> /* rasterizer */
> memset(&p->rasterizer, 0, sizeof(p->rasterizer));
> p->rasterizer.cull_face = PIPE_FACE_NONE;
> - p->rasterizer.gl_rasterization_rules = 1;
> + p->rasterizer.half_pixel_center = 1;
> + p->rasterizer.lower_left_origin = 1;
> p->rasterizer.depth_clip = 1;
>
> /* sampler */
> diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
> index 9acf2e1..82a30d6 100644
> --- a/src/gallium/tests/trivial/tri.c
> +++ b/src/gallium/tests/trivial/tri.c
> @@ -152,7 +152,8 @@ static void init_prog(struct program *p)
> /* rasterizer */
> memset(&p->rasterizer, 0, sizeof(p->rasterizer));
> p->rasterizer.cull_face = PIPE_FACE_NONE;
> - p->rasterizer.gl_rasterization_rules = 1;
> + p->rasterizer.half_pixel_center = 1;
> + p->rasterizer.lower_left_origin = 1;
> p->rasterizer.depth_clip = 1;
>
> surf_tmpl.format = PIPE_FORMAT_B8G8R8A8_UNORM;
> diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
> index 62464b4..e15203b 100644
> --- a/src/mesa/state_tracker/st_atom_rasterizer.c
> +++ b/src/mesa/state_tracker/st_atom_rasterizer.c
> @@ -228,7 +228,10 @@ static void update_raster_state( struct st_context *st )
> /* _NEW_FRAG_CLAMP */
> raster->clamp_fragment_color = !st->clamp_frag_color_in_shader &&
> ctx->Color._ClampFragmentColor;
> - raster->gl_rasterization_rules = 1;
> +
> + raster->half_pixel_center = 1;
> + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
> + raster->lower_left_origin = 1;
>
> /* _NEW_RASTERIZER_DISCARD */
> raster->rasterizer_discard = ctx->RasterDiscard;
> diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
> index 4569336..9e7686f 100644
> --- a/src/mesa/state_tracker/st_cb_bitmap.c
> +++ b/src/mesa/state_tracker/st_cb_bitmap.c
> @@ -825,7 +825,8 @@ st_init_bitmap(struct st_context *st)
>
> /* init baseline rasterizer state once */
> memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer));
> - st->bitmap.rasterizer.gl_rasterization_rules = 1;
> + st->bitmap.rasterizer.half_pixel_center = 1;
> + st->bitmap.rasterizer.lower_left_origin = 1;
> st->bitmap.rasterizer.depth_clip = 1;
>
> /* find a usable texture format */
> diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
> index a5aa8f4..8ea1e68 100644
> --- a/src/mesa/state_tracker/st_cb_clear.c
> +++ b/src/mesa/state_tracker/st_cb_clear.c
> @@ -67,7 +67,8 @@ st_init_clear(struct st_context *st)
> {
> memset(&st->clear, 0, sizeof(st->clear));
>
> - st->clear.raster.gl_rasterization_rules = 1;
> + st->clear.raster.half_pixel_center = 1;
> + st->clear.raster.lower_left_origin = 1;
> st->clear.raster.depth_clip = 1;
> }
>
> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
> index de7b91f..54663a8 100644
> --- a/src/mesa/state_tracker/st_cb_drawpixels.c
> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
> @@ -710,7 +710,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
> memset(&rasterizer, 0, sizeof(rasterizer));
> rasterizer.clamp_fragment_color = !st->clamp_frag_color_in_shader &&
> ctx->Color._ClampFragmentColor;
> - rasterizer.gl_rasterization_rules = 1;
> + rasterizer.half_pixel_center = 1;
> + rasterizer.lower_left_origin = 1;
> rasterizer.depth_clip = !ctx->Transform.DepthClamp;
> rasterizer.scissor = ctx->Scissor.Enabled;
> cso_set_rasterizer(cso, &rasterizer);
> --
> 1.7.9.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list