summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2013-04-23 19:40:05 +0100
committerJosé Fonseca <[email protected]>2013-04-23 19:42:47 +0100
commit2737abb44efebfa10ac84b183c20fc5818d1514e (patch)
tree32447cf1ab7291a489bca9dd770c3e424785dbd9 /src/gallium/drivers
parentb69207642079fe8ba33c594750415e8d9c66a06f (diff)
gallium: Replace gl_rasterization_rules with lower_left_origin and half_pixel_center.
Squashed commit of the following: commit 04c5fa2cbb8e89d6f2fa5a75af1cca03b1f6b852 Author: José Fonseca <[email protected]> Date: Tue Apr 23 17:37:18 2013 +0100 gallium: s/lower_left_origin/bottom_edge_rule/ commit 4dff4f64fa83b9737def136fffd161d55e4f1722 Author: José Fonseca <[email protected]> Date: Tue Apr 23 17:35:04 2013 +0100 gallium: Move diagram to docs. commit 442a63012c8c3c3797f45e03f2ca20ad5f399832 Author: James Benton <[email protected]> Date: Fri May 11 17:50:55 2012 +0100 gallium: Replace gl_rasterization_rules with lower_left_origin and half_pixel_center. This change is necessary to achieve correct results when using OpenGL FBOs. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_rasterizer.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_line.c11
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c17
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_rasterizer.c19
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_setup.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c2
-rw-r--r--src/gallium/drivers/nvc0/nvc0_surface.c2
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c4
-rw-r--r--src/gallium/drivers/r600/r600_state.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c2
-rw-r--r--src/gallium/drivers/svga/svga_pipe_rasterizer.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_framebuffer.c2
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.c3
17 files changed, 33 insertions, 49 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_rasterizer.c b/src/gallium/drivers/freedreno/freedreno_rasterizer.c
index 32618568c0a..aa6c64a901f 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 c119395a9d6..6b86aae1cb1 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 bottom_edge_rule)
{
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->bottom_edge_rule = bottom_edge_rule;
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 de29601329f..802ab0105e8 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 bottom_edge_rule);
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 b72831bf0e4..efc2ab76813 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 bottom_edge_rule;
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 29c231714e1..54f19cb9f3c 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 cf3d536eb1d..b2c8cb52500 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->bottom_edge_rule == 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->bottom_edge_rule == 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 ca8df7149eb..6148337b72d 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.bottom_edge_rule);
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 edd5d0fb5e7..ed68b984a92 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 cbde4b12d1e..163ead9d90e 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 394f196241c..45e4128ea22 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 d2a20086d24..af98b7b6b30 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 b30e053ce52..b054fef5e9b 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 a39843ca356..be40fdfbc5b 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 08cd4da5bd0..03a2b462180 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 33428004296..a9a23966d6b 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 128f5da4907..8232c328233 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 006082b7470..18d9938a39d 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, bottom_edge_rule);
trace_dump_member(bool, state, rasterizer_discard);
trace_dump_member(bool, state, depth_clip);
trace_dump_member(uint, state, clip_plane_enable);