summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-09-20 13:48:02 -0600
committerBrian Paul <brianp@vmware.com>2010-09-20 13:48:02 -0600
commit61fcd9aaa2bf91eb400eeb4df2ab2c7e48b3bb6c (patch)
treefdeef8f3437d3f9fd074e9b48538149be8e50e62 /src
parentc3982c6bcdeb88f7fb1b20f8bd300db31cd7288d (diff)
llvmpipe: implement sprite coord origin modes
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_point.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index f8f411f4f1..bb6b88069b 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -71,7 +71,8 @@ perspective_coef(struct lp_setup_context *setup,
const struct point_info *info,
unsigned slot,
unsigned vert_attr,
- unsigned i)
+ unsigned i,
+ unsigned sprite_coord_origin)
{
if (i == 0) {
float dadx = FIXED_ONE / (float)info->dx12;
@@ -83,14 +84,18 @@ perspective_coef(struct lp_setup_context *setup,
dady * ((float)info->v0[0][1] - setup->pixel_offset)));
}
else if (i == 1) {
- float dadx = 0.0f;
- float dady = FIXED_ONE / (float)info->dx12;
+ float dadx = 0.0f;
+ float dady = FIXED_ONE / (float)info->dx12;
+
+ if (sprite_coord_origin == PIPE_SPRITE_COORD_LOWER_LEFT) {
+ dady = -dady;
+ }
point->inputs.dadx[slot][i] = dadx;
point->inputs.dady[slot][i] = dady;
point->inputs.a0[slot][i] = (0.5 -
- (dadx * ((float)info->v0[0][0] - setup->pixel_offset) +
- dady * ((float)info->v0[0][1] - setup->pixel_offset)));
+ (dadx * ((float)info->v0[0][0] - setup->pixel_offset) +
+ dady * ((float)info->v0[0][1] - setup->pixel_offset)));
}
else if (i == 2) {
point->inputs.a0[slot][i] = 0.0f;
@@ -187,7 +192,8 @@ setup_point_coefficients( struct lp_setup_context *setup,
if (setup->sprite_coord_enable & (1 << index)) {
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- perspective_coef(setup, point, info, slot+1, vert_attr, i);
+ perspective_coef(setup, point, info, slot+1, vert_attr, i,
+ setup->sprite_coord_origin);
fragcoord_usage_mask |= TGSI_WRITEMASK_W;
break;
}