summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
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/llvmpipe
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/llvmpipe')
-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
7 files changed, 21 insertions, 38 deletions
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]);