fix fd.o bug #11804
authorZou Nan hai <nanhai.zou@intel.com>
Thu, 2 Aug 2007 07:27:13 +0000 (15:27 +0800)
committerZou Nan hai <nanhai.zou@intel.com>
Thu, 2 Aug 2007 07:27:13 +0000 (15:27 +0800)
 glPolygonMode with point sprite on i965

src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_sf_emit.c
src/mesa/drivers/dri/i965/brw_sf_state.c

index e8f878a70180813ddef1a6c3ec2c1fcbff6070cf..9bb7d2f703d8e8136496528564e32e692eecdb03 100644 (file)
 #define BRW_FRONTWINDING_CW      0
 #define BRW_FRONTWINDING_CCW     1
 
+#define BRW_SPRITE_POINT_ENABLE  16
+
 #define BRW_INDEX_BYTE     0
 #define BRW_INDEX_WORD     1
 #define BRW_INDEX_DWORD    2
index 7ecf9bb560d515a14915b0567deef1d1e1d84b01..22911a46494fba2925688225d188c8dc95793a01 100644 (file)
@@ -641,6 +641,7 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c )
    struct brw_compile *p = &c->func;
    struct brw_reg ip = brw_ip_reg();
    struct brw_reg payload_prim = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0);
+   struct brw_reg payload_attr = get_element_ud(brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0), 0); 
    struct brw_reg primmask;
    struct brw_instruction *jmp;
    struct brw_reg v1_null_ud = vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
@@ -681,6 +682,14 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c )
    }
    brw_land_fwd_jump(p, jmp); 
 
+   brw_set_conditionalmod(p, BRW_CONDITIONAL_Z);
+   brw_AND(p, v1_null_ud, payload_attr, brw_imm_ud(1<<BRW_SPRITE_POINT_ENABLE));
+   jmp = brw_JMPI(p, ip, ip, brw_imm_w(0));
+   {
+      brw_emit_point_sprite_setup( c );
+   }
+   brw_land_fwd_jump(p, jmp); 
+
    brw_emit_point_setup( c );
 }
 
index 307fb63785132960e5c197f6d75ba3de65d5a27f..236c6fd42a5604b4a23dce5977fca9b03c2f56ef 100644 (file)
@@ -185,6 +185,8 @@ static void upload_sf_unit( struct brw_context *brw )
    /* _NEW_POINT */
    sf.sf6.point_rast_rule = 1; /* opengl conventions */
    /* XXX clamp max depends on AA vs. non-AA */
+
+   sf.sf7.sprite_point = brw->attribs.Point->PointSprite;
    sf.sf7.point_size = CLAMP(brw->attribs.Point->Size, 1.0, 255.0) * (1<<3);
    sf.sf7.use_point_size_state = !brw->attribs.Point->_Attenuated;