From 43af02ac731dac7d80f7e47feb0c80e4da156769 Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Mon, 27 Feb 2012 15:46:32 +0800 Subject: i965: handle gl_PointCoord for Gen4 and Gen5 platforms This patch add the support of gl_PointCoord gl builtin variable for platform gen4 and gen5(ILK). Unlike gen6+, we don't have a hardware support of gl_PointCoord, means hardware will not calculate the interpolation coefficient for you. Instead, you should handle it yourself in sf shader stage. But badly, gl_PointCoord is a FS instead of VS builtin variable, thus it's not included in c.vue_map generated in VS stage. Thus the current code doesn't aware of this attribute. And to handle it correctly, we need add it to c.vue_map manually to let SF shader generate the needed interpolation coefficient for FS shader. SF stage has it's own copy of vue_map, thus I think it's safe to do it manually. Since handling gl_PointCoord for gen4 and gen5 platforms is somehow a little special, I added a lot of comments and hope I didn't overdo it ;) v2: add a /* _NEW_BUFFERS */ comment to note the state flag dependency and also add the _NEW_BUFFERS dirty mask (Eric). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45975 Piglit: glsl-fs-pointcoord and fbo-gl_pointcoord NOTE: This is a candidate for stable release branches. Signed-off-by: Yuanhan Liu Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/brw_sf_emit.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mesa/drivers/dri/i965/brw_sf_emit.c') diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c index 1ee0098..ff6383b 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c @@ -386,6 +386,8 @@ calculate_point_sprite_mask(struct brw_sf_compile *c, GLuint reg) if (c->key.point_sprite_coord_replace & (1 << (vert_result1 - VERT_RESULT_TEX0))) pc |= 0x0f; } + if (vert_result1 == BRW_VERT_RESULT_PNTC) + pc |= 0x0f; vert_result2 = vert_reg_to_vert_result(c, reg, 1); if (vert_result2 >= VERT_RESULT_TEX0 && vert_result2 <= VERT_RESULT_TEX7) { @@ -393,6 +395,8 @@ calculate_point_sprite_mask(struct brw_sf_compile *c, GLuint reg) VERT_RESULT_TEX0))) pc |= 0xf0; } + if (vert_result2 == BRW_VERT_RESULT_PNTC) + pc |= 0xf0; return pc; } -- cgit v1.1