Go to the source code of this file.
#define ATTR_SIZE (4*4) |
Definition at line 122 of file brw_clip.h.
#define CLIP_CULL 3 |
Definition at line 69 of file brw_clip.h.
#define CLIP_FILL 2 |
Definition at line 68 of file brw_clip.h.
#define CLIP_LINE 0 |
Definition at line 66 of file brw_clip.h.
#define CLIP_POINT 1 |
Definition at line 67 of file brw_clip.h.
#define MAX_VERTS (3+6+6) |
Definition at line 39 of file brw_clip.h.
#define PRIM_MASK (0x1f) |
Definition at line 72 of file brw_clip.h.
void brw_clip_copy_colors | ( | struct brw_clip_compile * | c, | |
unsigned | to, | |||
unsigned | from | |||
) |
Definition at line 297 of file brw_clip_util.c.
References brw_MOV(), byte_offset(), brw_clip_compile::func, brw_clip_compile::offset, brw_clip_compile::reg, and brw_clip_compile::vertex.
00299 { 00300 #if 0 00301 struct brw_compile *p = &c->func; 00302 00303 if (c->offset[VERT_RESULT_COL0]) 00304 brw_MOV(p, 00305 byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_COL0]), 00306 byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_COL0])); 00307 00308 if (c->offset[VERT_RESULT_COL1]) 00309 brw_MOV(p, 00310 byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_COL1]), 00311 byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_COL1])); 00312 00313 if (c->offset[VERT_RESULT_BFC0]) 00314 brw_MOV(p, 00315 byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_BFC0]), 00316 byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_BFC0])); 00317 00318 if (c->offset[VERT_RESULT_BFC1]) 00319 brw_MOV(p, 00320 byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_BFC1]), 00321 byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_BFC1])); 00322 #else 00323 #warning "disabled" 00324 #endif 00325 }
void brw_clip_emit_vue | ( | struct brw_clip_compile * | c, | |
struct brw_indirect | vert, | |||
boolean | allocate, | |||
boolean | eot, | |||
unsigned | header | |||
) |
Definition at line 198 of file brw_clip_util.c.
References assert, brw_copy_from_indirect(), brw_imm_ud(), brw_message_reg(), brw_MOV(), brw_null_reg(), BRW_REGISTER_TYPE_UD, BRW_URB_SWIZZLE_NONE, brw_urb_WRITE(), brw_clip_compile::func, get_element_ud(), brw_clip_compile::last_mrf, MAX_MRF, brw_clip_compile::nr_regs, brw_clip_compile::R0, brw_clip_compile::reg, and retype().
00203 { 00204 struct brw_compile *p = &c->func; 00205 unsigned start = c->last_mrf; 00206 00207 assert(!(allocate && eot)); 00208 00209 /* Cycle through mrf regs - probably futile as we have to wait for 00210 * the allocation response anyway. Also, the order this function 00211 * is invoked doesn't correspond to the order the instructions will 00212 * be executed, so it won't have any effect in many cases. 00213 */ 00214 #if 0 00215 if (start + c->nr_regs + 1 >= MAX_MRF) 00216 start = 0; 00217 00218 c->last_mrf = start + c->nr_regs + 1; 00219 #endif 00220 00221 /* Copy the vertex from vertn into m1..mN+1: 00222 */ 00223 brw_copy_from_indirect(p, brw_message_reg(start+1), vert, c->nr_regs); 00224 00225 /* Overwrite PrimType and PrimStart in the message header, for 00226 * each vertex in turn: 00227 */ 00228 brw_MOV(p, get_element_ud(c->reg.R0, 2), brw_imm_ud(header)); 00229 00230 00231 /* Send each vertex as a seperate write to the urb. This 00232 * is different to the concept in brw_sf_emit.c, where 00233 * subsequent writes are used to build up a single urb 00234 * entry. Each of these writes instantiates a seperate 00235 * urb entry - (I think... what about 'allocate'?) 00236 */ 00237 brw_urb_WRITE(p, 00238 allocate ? c->reg.R0 : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD), 00239 start, 00240 c->reg.R0, 00241 allocate, 00242 1, /* used */ 00243 c->nr_regs + 1, /* msg length */ 00244 allocate ? 1 : 0, /* response_length */ 00245 eot, /* eot */ 00246 1, /* writes_complete */ 00247 0, /* urb offset */ 00248 BRW_URB_SWIZZLE_NONE); 00249 }
void brw_clip_init_clipmask | ( | struct brw_clip_compile * | c | ) |
Definition at line 329 of file brw_clip_util.c.
References brw_AND(), brw_imm_ud(), brw_OR(), BRW_REGISTER_TYPE_UD, brw_SHR(), brw_clip_compile::func, get_element_ud(), get_tmp(), brw_clip_compile::key, brw_clip_prog_key::nr_userclip, brw_clip_compile::planemask, brw_clip_compile::R0, brw_clip_compile::reg, release_tmp(), retype(), and vec1().
00330 { 00331 struct brw_compile *p = &c->func; 00332 struct brw_reg incoming = get_element_ud(c->reg.R0, 2); 00333 00334 /* Shift so that lowest outcode bit is rightmost: 00335 */ 00336 brw_SHR(p, c->reg.planemask, incoming, brw_imm_ud(26)); 00337 00338 if (c->key.nr_userclip) { 00339 struct brw_reg tmp = retype(vec1(get_tmp(c)), BRW_REGISTER_TYPE_UD); 00340 00341 /* Rearrange userclip outcodes so that they come directly after 00342 * the fixed plane bits. 00343 */ 00344 brw_AND(p, tmp, incoming, brw_imm_ud(0x3f<<14)); 00345 brw_SHR(p, tmp, tmp, brw_imm_ud(8)); 00346 brw_OR(p, c->reg.planemask, c->reg.planemask, tmp); 00347 00348 release_tmp(c, tmp); 00349 } 00350 }
void brw_clip_init_planes | ( | struct brw_clip_compile * | c | ) |
Definition at line 66 of file brw_clip_util.c.
References brw_MOV(), brw_clip_compile::fixed_planes, brw_clip_compile::func, get_element_ud(), brw_clip_compile::key, make_plane_ud(), brw_clip_prog_key::nr_userclip, and brw_clip_compile::reg.
00067 { 00068 struct brw_compile *p = &c->func; 00069 00070 if (!c->key.nr_userclip) { 00071 brw_MOV(p, get_element_ud(c->reg.fixed_planes, 0), make_plane_ud( 0, 0, 0xff, 1)); 00072 brw_MOV(p, get_element_ud(c->reg.fixed_planes, 1), make_plane_ud( 0, 0, 1, 1)); 00073 brw_MOV(p, get_element_ud(c->reg.fixed_planes, 2), make_plane_ud( 0, 0xff, 0, 1)); 00074 brw_MOV(p, get_element_ud(c->reg.fixed_planes, 3), make_plane_ud( 0, 1, 0, 1)); 00075 brw_MOV(p, get_element_ud(c->reg.fixed_planes, 4), make_plane_ud(0xff, 0, 0, 1)); 00076 brw_MOV(p, get_element_ud(c->reg.fixed_planes, 5), make_plane_ud( 1, 0, 0, 1)); 00077 } 00078 }
void brw_clip_interp_vertex | ( | struct brw_clip_compile * | c, | |
struct brw_indirect | dest_ptr, | |||
struct brw_indirect | v0_ptr, | |||
struct brw_indirect | v1_ptr, | |||
struct brw_reg | t0, | |||
boolean | force_edgeflag | |||
) |
Definition at line 128 of file brw_clip_util.c.
References brw_ADD(), brw_clip_project_vertex(), brw_copy_indirect_to_indirect(), brw_imm_f(), brw_MAC(), brw_MOV(), brw_MUL(), brw_null_reg(), deref_4f(), brw_clip_compile::func, get_tmp(), negate(), brw_clip_compile::nr_attrs, brw_clip_compile::offset, release_tmp(), and vec4().
00134 { 00135 #if 0 00136 struct brw_compile *p = &c->func; 00137 struct brw_reg tmp = get_tmp(c); 00138 unsigned i; 00139 00140 /* Just copy the vertex header: 00141 */ 00142 brw_copy_indirect_to_indirect(p, dest_ptr, v0_ptr, 1); 00143 00144 /* Iterate over each attribute (could be done in pairs?) 00145 */ 00146 for (i = 0; i < c->nr_attrs; i++) { 00147 unsigned delta = i*16 + 32; 00148 00149 if (delta == c->offset[VERT_RESULT_EDGE]) { 00150 if (force_edgeflag) 00151 brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(1)); 00152 else 00153 brw_MOV(p, deref_4f(dest_ptr, delta), deref_4f(v0_ptr, delta)); 00154 } 00155 else { 00156 /* Interpolate: 00157 * 00158 * New = attr0 + t*attr1 - t*attr0 00159 */ 00160 brw_MUL(p, 00161 vec4(brw_null_reg()), 00162 deref_4f(v1_ptr, delta), 00163 t0); 00164 00165 brw_MAC(p, 00166 tmp, 00167 negate(deref_4f(v0_ptr, delta)), 00168 t0); 00169 00170 brw_ADD(p, 00171 deref_4f(dest_ptr, delta), 00172 deref_4f(v0_ptr, delta), 00173 tmp); 00174 } 00175 } 00176 00177 if (i & 1) { 00178 unsigned delta = i*16 + 32; 00179 brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(0)); 00180 } 00181 00182 release_tmp(c, tmp); 00183 00184 /* Recreate the projected (NDC) coordinate in the new vertex 00185 * header: 00186 */ 00187 brw_clip_project_vertex(c, dest_ptr ); 00188 #else 00189 #warning "disabled" 00190 #endif 00191 }
void brw_clip_kill_thread | ( | struct brw_clip_compile * | c | ) |
Definition at line 253 of file brw_clip_util.c.
References brw_null_reg(), BRW_REGISTER_TYPE_UD, BRW_URB_SWIZZLE_NONE, brw_urb_WRITE(), brw_clip_compile::func, brw_clip_compile::R0, brw_clip_compile::reg, and retype().
00254 { 00255 struct brw_compile *p = &c->func; 00256 00257 /* Send an empty message to kill the thread and release any 00258 * allocated urb entry: 00259 */ 00260 brw_urb_WRITE(p, 00261 retype(brw_null_reg(), BRW_REGISTER_TYPE_UD), 00262 0, 00263 c->reg.R0, 00264 0, /* allocate */ 00265 0, /* used */ 00266 0, /* msg len */ 00267 0, /* response len */ 00268 1, /* eot */ 00269 1, /* writes complete */ 00270 0, 00271 BRW_URB_SWIZZLE_NONE); 00272 }
struct brw_reg brw_clip_plane0_address | ( | struct brw_clip_compile * | c | ) | [read] |
Definition at line 277 of file brw_clip_util.c.
References brw_address().
00278 { 00279 return brw_address(c->reg.fixed_planes); 00280 }
struct brw_reg brw_clip_plane_stride | ( | struct brw_clip_compile * | c | ) | [read] |
Definition at line 283 of file brw_clip_util.c.
References brw_imm_uw().
00284 { 00285 if (c->key.nr_userclip) { 00286 return brw_imm_uw(16); 00287 } 00288 else { 00289 return brw_imm_uw(4); 00290 } 00291 }
void brw_clip_tri | ( | struct brw_clip_compile * | c | ) |
Definition at line 201 of file brw_clip_tri.c.
References brw_ADD(), brw_address(), brw_AND(), brw_clip_interp_vertex(), brw_clip_plane0_address(), brw_clip_plane_stride(), brw_CMP(), BRW_CONDITIONAL_EQ, BRW_CONDITIONAL_GE, BRW_CONDITIONAL_L, BRW_CONDITIONAL_NZ, brw_DO(), brw_DP4(), brw_ELSE(), brw_ENDIF(), BRW_EXECUTE_1, brw_IF(), brw_imm_d(), brw_imm_ud(), brw_imm_uw(), brw_imm_w(), brw_indirect(), brw_math_invert(), brw_MOV(), brw_MUL(), brw_null_reg(), BRW_PREDICATE_NONE, brw_set_conditionalmod(), brw_set_predicate_control(), brw_SHR(), brw_vec8_grf(), brw_WHILE(), deref_1uw(), deref_4b(), deref_4f(), brw_clip_compile::dp, brw_clip_compile::dpPrev, FALSE, brw_clip_compile::func, get_addr_reg(), brw_clip_compile::inlist, brw_clip_compile::key, brw_clip_compile::loopcount, negate(), brw_reg::nr, brw_clip_compile::nr_regs, brw_clip_prog_key::nr_userclip, brw_clip_compile::nr_verts, brw_clip_compile::offset, brw_clip_compile::outlist, brw_clip_compile::plane_equation, brw_clip_compile::planemask, brw_clip_compile::reg, REG_SIZE, brw_clip_compile::t, TRUE, vec1(), vec4(), and brw_clip_compile::vertex.
00202 { 00203 #if 0 00204 struct brw_compile *p = &c->func; 00205 struct brw_indirect vtx = brw_indirect(0, 0); 00206 struct brw_indirect vtxPrev = brw_indirect(1, 0); 00207 struct brw_indirect vtxOut = brw_indirect(2, 0); 00208 struct brw_indirect plane_ptr = brw_indirect(3, 0); 00209 struct brw_indirect inlist_ptr = brw_indirect(4, 0); 00210 struct brw_indirect outlist_ptr = brw_indirect(5, 0); 00211 struct brw_indirect freelist_ptr = brw_indirect(6, 0); 00212 struct brw_instruction *plane_loop; 00213 struct brw_instruction *plane_active; 00214 struct brw_instruction *vertex_loop; 00215 struct brw_instruction *next_test; 00216 struct brw_instruction *prev_test; 00217 00218 brw_MOV(p, get_addr_reg(vtxPrev), brw_address(c->reg.vertex[2]) ); 00219 brw_MOV(p, get_addr_reg(plane_ptr), brw_clip_plane0_address(c)); 00220 brw_MOV(p, get_addr_reg(inlist_ptr), brw_address(c->reg.inlist)); 00221 brw_MOV(p, get_addr_reg(outlist_ptr), brw_address(c->reg.outlist)); 00222 00223 brw_MOV(p, get_addr_reg(freelist_ptr), brw_address(c->reg.vertex[3]) ); 00224 00225 plane_loop = brw_DO(p, BRW_EXECUTE_1); 00226 { 00227 /* if (planemask & 1) 00228 */ 00229 brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); 00230 brw_AND(p, vec1(brw_null_reg()), c->reg.planemask, brw_imm_ud(1)); 00231 00232 plane_active = brw_IF(p, BRW_EXECUTE_1); 00233 { 00234 /* vtxOut = freelist_ptr++ 00235 */ 00236 brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(freelist_ptr) ); 00237 brw_ADD(p, get_addr_reg(freelist_ptr), get_addr_reg(freelist_ptr), brw_imm_uw(c->nr_regs * REG_SIZE)); 00238 00239 if (c->key.nr_userclip) 00240 brw_MOV(p, c->reg.plane_equation, deref_4f(plane_ptr, 0)); 00241 else 00242 brw_MOV(p, c->reg.plane_equation, deref_4b(plane_ptr, 0)); 00243 00244 brw_MOV(p, c->reg.loopcount, c->reg.nr_verts); 00245 brw_MOV(p, c->reg.nr_verts, brw_imm_ud(0)); 00246 00247 vertex_loop = brw_DO(p, BRW_EXECUTE_1); 00248 { 00249 /* vtx = *input_ptr; 00250 */ 00251 brw_MOV(p, get_addr_reg(vtx), deref_1uw(inlist_ptr, 0)); 00252 00253 /* IS_NEGATIVE(prev) */ 00254 brw_set_conditionalmod(p, BRW_CONDITIONAL_L); 00255 brw_DP4(p, vec4(c->reg.dpPrev), deref_4f(vtxPrev, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); 00256 prev_test = brw_IF(p, BRW_EXECUTE_1); 00257 { 00258 /* IS_POSITIVE(next) 00259 */ 00260 brw_set_conditionalmod(p, BRW_CONDITIONAL_GE); 00261 brw_DP4(p, vec4(c->reg.dp), deref_4f(vtx, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); 00262 next_test = brw_IF(p, BRW_EXECUTE_1); 00263 { 00264 00265 /* Coming back in. 00266 */ 00267 brw_ADD(p, c->reg.t, c->reg.dpPrev, negate(c->reg.dp)); 00268 brw_math_invert(p, c->reg.t, c->reg.t); 00269 brw_MUL(p, c->reg.t, c->reg.t, c->reg.dpPrev); 00270 00271 /* If (vtxOut == 0) vtxOut = vtxPrev 00272 */ 00273 brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_EQ, get_addr_reg(vtxOut), brw_imm_uw(0) ); 00274 brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtxPrev) ); 00275 brw_set_predicate_control(p, BRW_PREDICATE_NONE); 00276 00277 brw_clip_interp_vertex(c, vtxOut, vtxPrev, vtx, c->reg.t, FALSE); 00278 00279 /* *outlist_ptr++ = vtxOut; 00280 * nr_verts++; 00281 * vtxOut = 0; 00282 */ 00283 brw_MOV(p, deref_1uw(outlist_ptr, 0), get_addr_reg(vtxOut)); 00284 brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_uw(sizeof(short))); 00285 brw_ADD(p, c->reg.nr_verts, c->reg.nr_verts, brw_imm_ud(1)); 00286 brw_MOV(p, get_addr_reg(vtxOut), brw_imm_uw(0) ); 00287 } 00288 brw_ENDIF(p, next_test); 00289 00290 } 00291 prev_test = brw_ELSE(p, prev_test); 00292 { 00293 /* *outlist_ptr++ = vtxPrev; 00294 * nr_verts++; 00295 */ 00296 brw_MOV(p, deref_1uw(outlist_ptr, 0), get_addr_reg(vtxPrev)); 00297 brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_uw(sizeof(short))); 00298 brw_ADD(p, c->reg.nr_verts, c->reg.nr_verts, brw_imm_ud(1)); 00299 00300 /* IS_NEGATIVE(next) 00301 */ 00302 brw_set_conditionalmod(p, BRW_CONDITIONAL_L); 00303 brw_DP4(p, vec4(c->reg.dp), deref_4f(vtx, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); 00304 next_test = brw_IF(p, BRW_EXECUTE_1); 00305 { 00306 /* Going out of bounds. Avoid division by zero as we 00307 * know dp != dpPrev from DIFFERENT_SIGNS, above. 00308 */ 00309 brw_ADD(p, c->reg.t, c->reg.dp, negate(c->reg.dpPrev)); 00310 brw_math_invert(p, c->reg.t, c->reg.t); 00311 brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp); 00312 00313 /* If (vtxOut == 0) vtxOut = vtx 00314 */ 00315 brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_EQ, get_addr_reg(vtxOut), brw_imm_uw(0) ); 00316 brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtx) ); 00317 brw_set_predicate_control(p, BRW_PREDICATE_NONE); 00318 00319 brw_clip_interp_vertex(c, vtxOut, vtx, vtxPrev, c->reg.t, TRUE); 00320 00321 /* *outlist_ptr++ = vtxOut; 00322 * nr_verts++; 00323 * vtxOut = 0; 00324 */ 00325 brw_MOV(p, deref_1uw(outlist_ptr, 0), get_addr_reg(vtxOut)); 00326 brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_uw(sizeof(short))); 00327 brw_ADD(p, c->reg.nr_verts, c->reg.nr_verts, brw_imm_ud(1)); 00328 brw_MOV(p, get_addr_reg(vtxOut), brw_imm_uw(0) ); 00329 } 00330 brw_ENDIF(p, next_test); 00331 } 00332 brw_ENDIF(p, prev_test); 00333 00334 /* vtxPrev = vtx; 00335 * inlist_ptr++; 00336 */ 00337 brw_MOV(p, get_addr_reg(vtxPrev), get_addr_reg(vtx)); 00338 brw_ADD(p, get_addr_reg(inlist_ptr), get_addr_reg(inlist_ptr), brw_imm_uw(sizeof(short))); 00339 00340 /* while (--loopcount != 0) 00341 */ 00342 brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); 00343 brw_ADD(p, c->reg.loopcount, c->reg.loopcount, brw_imm_d(-1)); 00344 } 00345 brw_WHILE(p, vertex_loop); 00346 00347 /* vtxPrev = *(outlist_ptr-1) OR: outlist[nr_verts-1] 00348 * inlist = outlist 00349 * inlist_ptr = &inlist[0] 00350 * outlist_ptr = &outlist[0] 00351 */ 00352 brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_w(-2)); 00353 brw_MOV(p, get_addr_reg(vtxPrev), deref_1uw(outlist_ptr, 0)); 00354 brw_MOV(p, brw_vec8_grf(c->reg.inlist.nr, 0), brw_vec8_grf(c->reg.outlist.nr, 0)); 00355 brw_MOV(p, get_addr_reg(inlist_ptr), brw_address(c->reg.inlist)); 00356 brw_MOV(p, get_addr_reg(outlist_ptr), brw_address(c->reg.outlist)); 00357 } 00358 brw_ENDIF(p, plane_active); 00359 00360 /* plane_ptr++; 00361 */ 00362 brw_ADD(p, get_addr_reg(plane_ptr), get_addr_reg(plane_ptr), brw_clip_plane_stride(c)); 00363 00364 /* nr_verts >= 3 00365 */ 00366 brw_CMP(p, 00367 vec1(brw_null_reg()), 00368 BRW_CONDITIONAL_GE, 00369 c->reg.nr_verts, 00370 brw_imm_ud(3)); 00371 00372 /* && (planemask>>=1) != 0 00373 */ 00374 brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); 00375 brw_SHR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(1)); 00376 } 00377 brw_WHILE(p, plane_loop); 00378 #else 00379 #warning "disabled" 00380 #endif 00381 }
void brw_clip_tri_alloc_regs | ( | struct brw_clip_compile * | c, | |
unsigned | nr_verts | |||
) |
Definition at line 54 of file brw_clip_tri.c.
References BRW_GENERAL_REGISTER_FILE, brw_imm_f(), brw_MOV(), BRW_REGISTER_TYPE_UD, brw_uw16_reg(), brw_vec1_grf(), brw_vec4_grf(), brw_vec8_grf(), byte_offset(), brw_clip_prog_data::curb_read_length, brw_clip_compile::dir, brw_clip_prog_key::do_unfilled, brw_clip_compile::dp, brw_clip_compile::dpPrev, brw_clip_compile::first_tmp, brw_clip_compile::fixed_planes, brw_clip_compile::freelist, brw_clip_compile::func, brw_clip_compile::inlist, brw_clip_compile::key, brw_clip_compile::last_tmp, brw_clip_compile::loopcount, brw_clip_compile::nr_attrs, brw_clip_compile::nr_regs, brw_clip_prog_key::nr_userclip, brw_clip_compile::nr_verts, brw_clip_compile::offset, brw_clip_compile::outlist, brw_clip_compile::plane_equation, brw_clip_compile::planemask, brw_clip_compile::prog_data, brw_clip_compile::R0, brw_clip_compile::reg, retype(), brw_clip_compile::t, brw_clip_compile::tmp1, brw_clip_prog_data::total_grf, brw_clip_prog_data::urb_read_length, and brw_clip_compile::vertex.
00056 { 00057 unsigned i = 0,j; 00058 00059 /* Register usage is static, precompute here: 00060 */ 00061 c->reg.R0 = retype(brw_vec8_grf(i, 0), BRW_REGISTER_TYPE_UD); i++; 00062 00063 if (c->key.nr_userclip) { 00064 c->reg.fixed_planes = brw_vec4_grf(i, 0); 00065 i += (6 + c->key.nr_userclip + 1) / 2; 00066 00067 c->prog_data.curb_read_length = (6 + c->key.nr_userclip + 1) / 2; 00068 } 00069 else 00070 c->prog_data.curb_read_length = 0; 00071 00072 00073 /* Payload vertices plus space for more generated vertices: 00074 */ 00075 for (j = 0; j < nr_verts; j++) { 00076 c->reg.vertex[j] = brw_vec4_grf(i, 0); 00077 i += c->nr_regs; 00078 } 00079 00080 if (c->nr_attrs & 1) { 00081 for (j = 0; j < 3; j++) { 00082 unsigned delta = c->nr_attrs*16 + 32; 00083 brw_MOV(&c->func, byte_offset(c->reg.vertex[j], delta), brw_imm_f(0)); 00084 } 00085 } 00086 00087 c->reg.t = brw_vec1_grf(i, 0); 00088 c->reg.loopcount = retype(brw_vec1_grf(i, 1), BRW_REGISTER_TYPE_UD); 00089 c->reg.nr_verts = retype(brw_vec1_grf(i, 2), BRW_REGISTER_TYPE_UD); 00090 c->reg.planemask = retype(brw_vec1_grf(i, 3), BRW_REGISTER_TYPE_UD); 00091 c->reg.plane_equation = brw_vec4_grf(i, 4); 00092 i++; 00093 00094 c->reg.dpPrev = brw_vec1_grf(i, 0); /* fixme - dp4 will clobber r.1,2,3 */ 00095 c->reg.dp = brw_vec1_grf(i, 4); 00096 i++; 00097 00098 c->reg.inlist = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, i, 0); 00099 i++; 00100 00101 c->reg.outlist = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, i, 0); 00102 i++; 00103 00104 c->reg.freelist = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, i, 0); 00105 i++; 00106 00107 if (!c->key.nr_userclip) { 00108 c->reg.fixed_planes = brw_vec8_grf(i, 0); 00109 i++; 00110 } 00111 00112 if (c->key.do_unfilled) { 00113 c->reg.dir = brw_vec4_grf(i, 0); 00114 c->reg.offset = brw_vec4_grf(i, 4); 00115 i++; 00116 c->reg.tmp0 = brw_vec4_grf(i, 0); 00117 c->reg.tmp1 = brw_vec4_grf(i, 4); 00118 i++; 00119 } 00120 00121 c->first_tmp = i; 00122 c->last_tmp = i; 00123 00124 c->prog_data.urb_read_length = c->nr_regs; /* ? */ 00125 c->prog_data.total_grf = i; 00126 }
void brw_clip_tri_emit_polygon | ( | struct brw_clip_compile * | c | ) |
Definition at line 385 of file brw_clip_tri.c.
References _3DPRIM_TRIFAN, brw_ADD(), brw_address(), brw_clip_emit_vue(), BRW_CONDITIONAL_G, BRW_CONDITIONAL_NZ, brw_DO(), brw_ENDIF(), BRW_EXECUTE_1, brw_IF(), brw_imm_d(), brw_imm_uw(), brw_indirect(), brw_MOV(), brw_set_conditionalmod(), brw_WHILE(), deref_1uw(), brw_clip_compile::func, get_addr_reg(), brw_clip_compile::inlist, brw_clip_compile::loopcount, brw_clip_compile::nr_verts, R02_PRIM_END, R02_PRIM_START, and brw_clip_compile::reg.
00386 { 00387 struct brw_compile *p = &c->func; 00388 struct brw_instruction *loop, *if_insn; 00389 00390 /* for (loopcount = nr_verts-2; loopcount > 0; loopcount--) 00391 */ 00392 brw_set_conditionalmod(p, BRW_CONDITIONAL_G); 00393 brw_ADD(p, 00394 c->reg.loopcount, 00395 c->reg.nr_verts, 00396 brw_imm_d(-2)); 00397 00398 if_insn = brw_IF(p, BRW_EXECUTE_1); 00399 { 00400 struct brw_indirect v0 = brw_indirect(0, 0); 00401 struct brw_indirect vptr = brw_indirect(1, 0); 00402 00403 brw_MOV(p, get_addr_reg(vptr), brw_address(c->reg.inlist)); 00404 brw_MOV(p, get_addr_reg(v0), deref_1uw(vptr, 0)); 00405 00406 brw_clip_emit_vue(c, v0, 1, 0, ((_3DPRIM_TRIFAN << 2) | R02_PRIM_START)); 00407 00408 brw_ADD(p, get_addr_reg(vptr), get_addr_reg(vptr), brw_imm_uw(2)); 00409 brw_MOV(p, get_addr_reg(v0), deref_1uw(vptr, 0)); 00410 00411 loop = brw_DO(p, BRW_EXECUTE_1); 00412 { 00413 brw_clip_emit_vue(c, v0, 1, 0, (_3DPRIM_TRIFAN << 2)); 00414 00415 brw_ADD(p, get_addr_reg(vptr), get_addr_reg(vptr), brw_imm_uw(2)); 00416 brw_MOV(p, get_addr_reg(v0), deref_1uw(vptr, 0)); 00417 00418 brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); 00419 brw_ADD(p, c->reg.loopcount, c->reg.loopcount, brw_imm_d(-1)); 00420 } 00421 brw_WHILE(p, loop); 00422 00423 brw_clip_emit_vue(c, v0, 0, 1, ((_3DPRIM_TRIFAN << 2) | R02_PRIM_END)); 00424 } 00425 brw_ENDIF(p, if_insn); 00426 }
void brw_clip_tri_flat_shade | ( | struct brw_clip_compile * | c | ) |
Definition at line 171 of file brw_clip_tri.c.
References _3DPRIM_POLYGON, brw_AND(), brw_clip_copy_colors(), brw_CMP(), BRW_CONDITIONAL_EQ, brw_ELSE(), brw_ENDIF(), BRW_EXECUTE_1, brw_IF(), brw_imm_ud(), brw_null_reg(), brw_clip_compile::func, get_element_ud(), brw_clip_compile::loopcount, PRIM_MASK, brw_clip_compile::R0, brw_clip_compile::reg, and vec1().
00172 { 00173 struct brw_compile *p = &c->func; 00174 struct brw_instruction *is_poly; 00175 struct brw_reg tmp0 = c->reg.loopcount; /* handy temporary */ 00176 00177 brw_AND(p, tmp0, get_element_ud(c->reg.R0, 2), brw_imm_ud(PRIM_MASK)); 00178 brw_CMP(p, 00179 vec1(brw_null_reg()), 00180 BRW_CONDITIONAL_EQ, 00181 tmp0, 00182 brw_imm_ud(_3DPRIM_POLYGON)); 00183 00184 is_poly = brw_IF(p, BRW_EXECUTE_1); 00185 { 00186 brw_clip_copy_colors(c, 1, 0); 00187 brw_clip_copy_colors(c, 2, 0); 00188 } 00189 is_poly = brw_ELSE(p, is_poly); 00190 { 00191 brw_clip_copy_colors(c, 0, 2); 00192 brw_clip_copy_colors(c, 1, 2); 00193 } 00194 brw_ENDIF(p, is_poly); 00195 }
void brw_clip_tri_init_vertices | ( | struct brw_clip_compile * | c | ) |
Definition at line 130 of file brw_clip_tri.c.
References _3DPRIM_TRISTRIP_REVERSE, brw_address(), brw_AND(), brw_CMP(), BRW_CONDITIONAL_EQ, brw_ELSE(), brw_ENDIF(), BRW_EXECUTE_1, brw_IF(), brw_imm_f(), brw_imm_ud(), brw_MOV(), brw_null_reg(), brw_vec8_grf(), brw_clip_compile::dir, brw_clip_compile::func, get_element(), get_element_ud(), brw_clip_compile::inlist, brw_clip_compile::loopcount, brw_clip_compile::need_direction, brw_reg::nr, brw_clip_compile::nr_verts, brw_clip_compile::outlist, PRIM_MASK, brw_clip_compile::R0, brw_clip_compile::reg, vec1(), and brw_clip_compile::vertex.
00131 { 00132 struct brw_compile *p = &c->func; 00133 struct brw_reg tmp0 = c->reg.loopcount; /* handy temporary */ 00134 struct brw_instruction *is_rev; 00135 00136 /* Initial list of indices for incoming vertexes: 00137 */ 00138 brw_AND(p, tmp0, get_element_ud(c->reg.R0, 2), brw_imm_ud(PRIM_MASK)); 00139 brw_CMP(p, 00140 vec1(brw_null_reg()), 00141 BRW_CONDITIONAL_EQ, 00142 tmp0, 00143 brw_imm_ud(_3DPRIM_TRISTRIP_REVERSE)); 00144 00145 /* XXX: Is there an easier way to do this? Need to reverse every 00146 * second tristrip element: Can ignore sometimes? 00147 */ 00148 is_rev = brw_IF(p, BRW_EXECUTE_1); 00149 { 00150 brw_MOV(p, get_element(c->reg.inlist, 0), brw_address(c->reg.vertex[1]) ); 00151 brw_MOV(p, get_element(c->reg.inlist, 1), brw_address(c->reg.vertex[0]) ); 00152 if (c->need_direction) 00153 brw_MOV(p, c->reg.dir, brw_imm_f(-1)); 00154 } 00155 is_rev = brw_ELSE(p, is_rev); 00156 { 00157 brw_MOV(p, get_element(c->reg.inlist, 0), brw_address(c->reg.vertex[0]) ); 00158 brw_MOV(p, get_element(c->reg.inlist, 1), brw_address(c->reg.vertex[1]) ); 00159 if (c->need_direction) 00160 brw_MOV(p, c->reg.dir, brw_imm_f(1)); 00161 } 00162 brw_ENDIF(p, is_rev); 00163 00164 brw_MOV(p, get_element(c->reg.inlist, 2), brw_address(c->reg.vertex[2]) ); 00165 brw_MOV(p, brw_vec8_grf(c->reg.outlist.nr, 0), brw_imm_f(0)); 00166 brw_MOV(p, c->reg.nr_verts, brw_imm_ud(3)); 00167 }
void brw_emit_line_clip | ( | struct brw_clip_compile * | c | ) |
Definition at line 237 of file brw_clip_line.c.
References brw_clip_copy_colors(), brw_clip_line_alloc_regs(), clip_and_emit_line(), brw_clip_prog_key::do_flat_shading, and brw_clip_compile::key.
00238 { 00239 brw_clip_line_alloc_regs(c); 00240 00241 if (c->key.do_flat_shading) 00242 brw_clip_copy_colors(c, 0, 1); 00243 00244 clip_and_emit_line(c); 00245 }
void brw_emit_point_clip | ( | struct brw_clip_compile * | c | ) |
Definition at line 41 of file brw_clip_point.c.
References brw_clip_kill_thread(), and brw_clip_tri_alloc_regs().
00042 { 00043 /* Send an empty message to kill the thread: 00044 */ 00045 brw_clip_tri_alloc_regs(c, 0); 00046 brw_clip_kill_thread(c); 00047 }
void brw_emit_tri_clip | ( | struct brw_clip_compile * | c | ) |
Definition at line 530 of file brw_clip_tri.c.
References brw_AND(), brw_clip_init_clipmask(), brw_clip_kill_thread(), brw_clip_test(), brw_clip_tri_alloc_regs(), brw_clip_tri_emit_polygon(), brw_clip_tri_flat_shade(), brw_clip_tri_init_vertices(), BRW_CLIPMODE_NORMAL, BRW_CONDITIONAL_NZ, brw_ENDIF(), BRW_EXECUTE_1, brw_IF(), brw_imm_ud(), brw_null_reg(), brw_set_conditionalmod(), brw_clip_prog_key::clip_mode, do_clip_tri(), brw_clip_prog_key::do_flat_shading, brw_clip_compile::func, get_element_ud(), brw_clip_compile::key, maybe_do_clip_tri(), brw_clip_prog_key::nr_userclip, brw_clip_compile::R0, and brw_clip_compile::reg.
00531 { 00532 struct brw_instruction *neg_rhw; 00533 struct brw_compile *p = &c->func; 00534 brw_clip_tri_alloc_regs(c, 3 + c->key.nr_userclip + 6); 00535 brw_clip_tri_init_vertices(c); 00536 brw_clip_init_clipmask(c); 00537 00538 /* if -ve rhw workaround bit is set, 00539 do cliptest */ 00540 brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); 00541 brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2), 00542 brw_imm_ud(1<<20)); 00543 neg_rhw = brw_IF(p, BRW_EXECUTE_1); 00544 { 00545 brw_clip_test(c); 00546 } 00547 brw_ENDIF(p, neg_rhw); 00548 00549 /* Can't push into do_clip_tri because with polygon (or quad) 00550 * flatshading, need to apply the flatshade here because we don't 00551 * respect the PV when converting to trifan for emit: 00552 */ 00553 if (c->key.do_flat_shading) 00554 brw_clip_tri_flat_shade(c); 00555 00556 if (c->key.clip_mode == BRW_CLIPMODE_NORMAL) 00557 do_clip_tri(c); 00558 else 00559 maybe_do_clip_tri(c); 00560 00561 brw_clip_tri_emit_polygon(c); 00562 00563 /* Send an empty message to kill the thread: 00564 */ 00565 brw_clip_kill_thread(c); 00566 }
void brw_emit_unfilled_clip | ( | struct brw_clip_compile * | c | ) |
Definition at line 414 of file brw_clip_unfilled.c.
References assert, brw_clip_init_clipmask(), brw_clip_init_planes(), brw_clip_kill_thread(), brw_clip_tri(), brw_clip_tri_alloc_regs(), brw_clip_tri_flat_shade(), brw_clip_tri_init_vertices(), brw_CMP(), BRW_CONDITIONAL_NZ, brw_ENDIF(), BRW_EXECUTE_1, brw_IF(), brw_imm_ud(), brw_null_reg(), check_nr_verts(), CLIP_CULL, compute_offset(), compute_tri_direction(), copy_bfc(), brw_clip_prog_key::copy_bfc_ccw, brw_clip_prog_key::copy_bfc_cw, cull_direction(), brw_clip_prog_key::do_flat_shading, emit_unfilled_primitives(), brw_clip_prog_key::fill_ccw, brw_clip_prog_key::fill_cw, brw_clip_compile::func, brw_clip_compile::key, merge_edgeflags(), brw_clip_compile::need_direction, brw_clip_prog_key::nr_userclip, brw_clip_compile::offset, brw_clip_prog_key::offset_ccw, brw_clip_prog_key::offset_cw, brw_clip_compile::planemask, brw_clip_compile::reg, and vec1().
00415 { 00416 struct brw_compile *p = &c->func; 00417 struct brw_instruction *do_clip; 00418 00419 00420 c->need_direction = ((c->key.offset_ccw || c->key.offset_cw) || 00421 (c->key.fill_ccw != c->key.fill_cw) || 00422 c->key.fill_ccw == CLIP_CULL || 00423 c->key.fill_cw == CLIP_CULL || 00424 c->key.copy_bfc_cw || 00425 c->key.copy_bfc_ccw); 00426 00427 brw_clip_tri_alloc_regs(c, 3 + c->key.nr_userclip + 6); 00428 brw_clip_tri_init_vertices(c); 00429 00430 assert(c->offset[VERT_RESULT_EDGE]); 00431 00432 if (c->key.fill_ccw == CLIP_CULL && 00433 c->key.fill_cw == CLIP_CULL) { 00434 brw_clip_kill_thread(c); 00435 return; 00436 } 00437 00438 merge_edgeflags(c); 00439 00440 /* Need to use the inlist indirection here: 00441 */ 00442 if (c->need_direction) 00443 compute_tri_direction(c); 00444 00445 if (c->key.fill_ccw == CLIP_CULL || 00446 c->key.fill_cw == CLIP_CULL) 00447 cull_direction(c); 00448 00449 if (c->key.offset_ccw || 00450 c->key.offset_cw) 00451 compute_offset(c); 00452 00453 if (c->key.copy_bfc_ccw || 00454 c->key.copy_bfc_cw) 00455 copy_bfc(c); 00456 00457 /* Need to do this whether we clip or not: 00458 */ 00459 if (c->key.do_flat_shading) 00460 brw_clip_tri_flat_shade(c); 00461 00462 brw_clip_init_clipmask(c); 00463 brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_NZ, c->reg.planemask, brw_imm_ud(0)); 00464 do_clip = brw_IF(p, BRW_EXECUTE_1); 00465 { 00466 brw_clip_init_planes(c); 00467 brw_clip_tri(c); 00468 check_nr_verts(c); 00469 } 00470 brw_ENDIF(p, do_clip); 00471 00472 emit_unfilled_primitives(c); 00473 brw_clip_kill_thread(c); 00474 }