c.func.single_program_flow = 1;
c.key = *key;
- brw_compute_vue_map(&c.vue_map, intel, c.key.nr_userclip, c.key.attrs);
+ brw_compute_vue_map(&c.vue_map, intel, c.key.nr_userclip > 0, c.key.attrs);
/* nr_regs is the number of registers filled by reading data from the VUE.
* This program accesses the entire VUE, so nr_regs needs to be the size of
/* brw_vs.c */
void brw_compute_vue_map(struct brw_vue_map *vue_map,
- const struct intel_context *intel, int nr_userclip,
+ const struct intel_context *intel,
+ bool userclip_active,
GLbitfield64 outputs_written);
gl_clip_plane *brw_select_clip_planes(struct gl_context *ctx);
c.key = *key;
/* The geometry shader needs to access the entire VUE. */
struct brw_vue_map vue_map;
- brw_compute_vue_map(&vue_map, intel, c.key.nr_userclip, c.key.attrs);
+ brw_compute_vue_map(&vue_map, intel, c.key.userclip_active, c.key.attrs);
c.nr_regs = (vue_map.num_slots + 1)/2;
mem_ctx = NULL;
}
/* _NEW_TRANSFORM */
- key->nr_userclip = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
+ key->userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
key->need_gs_prog = (intel->gen >= 6)
? 0
GLuint primitive:4;
GLuint pv_first:1;
GLuint need_gs_prog:1;
- GLuint nr_userclip:4;
- GLuint pad:22;
+ GLuint userclip_active:1;
};
struct brw_gs_compile {
brw_init_compile(brw, &c.func, mem_ctx);
c.key = *key;
- brw_compute_vue_map(&c.vue_map, intel, c.key.nr_userclip, c.key.attrs);
+ brw_compute_vue_map(&c.vue_map, intel, c.key.userclip_active, c.key.attrs);
c.urb_entry_read_offset = brw_sf_compute_urb_entry_read_offset(intel);
c.nr_attr_regs = (c.vue_map.num_slots + 1)/2 - c.urb_entry_read_offset;
c.nr_setup_regs = c.nr_attr_regs;
}
/* _NEW_TRANSFORM */
- key.nr_userclip = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
+ key.userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
/* _NEW_POINT */
key.do_point_sprite = ctx->Point.PointSprite;
GLuint frontface_ccw:1;
GLuint do_point_sprite:1;
GLuint sprite_origin_lower_left:1;
- GLuint nr_userclip:4;
- GLuint pad:20;
+ GLuint userclip_active:1;
};
struct brw_sf_compile {
bool
vec4_visitor::run()
{
- if (c->key.nr_userclip && !c->key.uses_clip_distance)
+ if (c->key.userclip_active && !c->key.uses_clip_distance)
setup_uniform_clipplane_values();
/* Generate VS IR for main(). (the visitor only descends into
{
if (intel->gen < 6 &&
((c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) ||
- c->key.nr_userclip || brw->has_negative_rhw_bug)) {
+ c->key.userclip_active || brw->has_negative_rhw_bug)) {
dst_reg header1 = dst_reg(this, glsl_type::uvec4_type);
dst_reg header1_w = header1;
header1_w.writemask = WRITEMASK_W;
/* FINISHME: edgeflag */
- brw_compute_vue_map(&c->vue_map, intel, c->key.nr_userclip,
+ brw_compute_vue_map(&c->vue_map, intel, c->key.userclip_active,
c->prog_data.outputs_written);
/* First mrf is the g0-based message header containing URB handles and such,
*/
void
brw_compute_vue_map(struct brw_vue_map *vue_map,
- const struct intel_context *intel, int nr_userclip,
+ const struct intel_context *intel,
+ bool userclip_active,
GLbitfield64 outputs_written)
{
int i;
*/
assign_vue_slot(vue_map, VERT_RESULT_PSIZ);
assign_vue_slot(vue_map, VERT_RESULT_HPOS);
- if (nr_userclip) {
+ if (userclip_active) {
assign_vue_slot(vue_map, VERT_RESULT_CLIP_DIST0);
assign_vue_slot(vue_map, VERT_RESULT_CLIP_DIST1);
}
* the inputs it asks for, whether they are varying or not.
*/
key.program_string_id = vp->id;
+ key.userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
key.nr_userclip = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
key.uses_clip_distance = vp->program.UsesClipDistance;
if (!key.uses_clip_distance)
uint8_t gl_fixed_input_size[VERT_ATTRIB_MAX];
/**
+ * True if at least one clip flag is enabled, regardless of whether the
+ * shader uses clip planes or gl_ClipDistance.
+ */
+ GLuint userclip_active:1;
+
+ /**
* Number of user clip planes (or clip distances) that are active.
*/
GLuint nr_userclip:4;
/* User clip planes from curbe:
*/
- if (c->key.nr_userclip) {
+ if (c->key.userclip_active) {
if (intel->gen >= 6) {
for (i = 0; i < c->key.nr_userclip; i++) {
c->userplane[i] = stride(brw_vec4_grf(reg + i / 2,
/* Allocate outputs. The non-position outputs go straight into message regs.
*/
- brw_compute_vue_map(&c->vue_map, intel, c->key.nr_userclip,
+ brw_compute_vue_map(&c->vue_map, intel, c->key.userclip_active,
c->prog_data.outputs_written);
c->first_output = reg;
}
/* Set the user clip distances in dword 8-15. (m3-4)*/
- if (c->key.nr_userclip) {
+ if (c->key.userclip_active) {
for (i = 0; i < c->key.nr_userclip; i++) {
struct brw_reg m;
if (i < 4)
}
} else if ((c->prog_data.outputs_written &
BITFIELD64_BIT(VERT_RESULT_PSIZ)) ||
- c->key.nr_userclip || brw->has_negative_rhw_bug) {
+ c->key.userclip_active || brw->has_negative_rhw_bug) {
struct brw_reg header1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
GLuint i;
*/
brw_MOV(p, brw_message_reg(2), pos);
len_vertex_header = 1;
- if (c->key.nr_userclip > 0)
+ if (c->key.userclip_active)
len_vertex_header += 2;
} else if (intel->gen == 5) {
/* There are 20 DWs (D0-D19) in VUE header on Ironlake:
int urb_entry_read_offset = 1;
float point_size;
uint16_t attr_overrides[FRAG_ATTRIB_MAX];
- int nr_userclip;
+ bool userclip_active;
/* _NEW_TRANSFORM */
- nr_userclip = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
+ userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
- brw_compute_vue_map(&vue_map, intel, nr_userclip, vs_outputs_written);
+ brw_compute_vue_map(&vue_map, intel, userclip_active, vs_outputs_written);
urb_entry_read_length = (vue_map.num_slots + 1)/2 - urb_entry_read_offset;
if (urb_entry_read_length == 0) {
/* Setting the URB entry read length to 0 causes undefined behavior, so
int attr = 0, input_index = 0;
/* _NEW_TRANSFORM */
int urb_entry_read_offset = 1;
- int nr_userclip = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
+ bool userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
uint16_t attr_overrides[FRAG_ATTRIB_MAX];
- brw_compute_vue_map(&vue_map, intel, nr_userclip, vs_outputs_written);
+ brw_compute_vue_map(&vue_map, intel, userclip_active, vs_outputs_written);
urb_entry_read_length = (vue_map.num_slots + 1)/2 - urb_entry_read_offset;
if (urb_entry_read_length == 0) {
/* Setting the URB entry read length to 0 causes undefined behavior, so