/* _NEW_LIGHT */
key.pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION);
/* _NEW_TRANSFORM (also part of VUE map)*/
- key.nr_userclip = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
+ if (ctx->Transform.ClipPlanesEnabled)
+ key.nr_userclip = _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
if (brw->gen == 5)
key.clip_mode = BRW_CLIPMODE_KERNEL_CLIP;
{
gl_clip_plane *clip_planes = brw_select_clip_planes(ctx);
- if (brw->gen < 6) {
- /* Pre-Gen6, we compact clip planes. For example, if the user
- * enables just clip planes 0, 1, and 3, we will enable clip planes
- * 0, 1, and 2 in the hardware, and we'll move clip plane 3 to clip
- * plane 2. This simplifies the implementation of the Gen6 clip
- * thread.
- */
- int compacted_clipplane_index = 0;
- for (int i = 0; i < MAX_CLIP_PLANES; ++i) {
- if (!(key->userclip_planes_enabled_gen_4_5 & (1 << i)))
- continue;
-
- this->uniform_vector_size[this->uniforms] = 4;
- this->userplane[compacted_clipplane_index] = dst_reg(UNIFORM, this->uniforms);
- this->userplane[compacted_clipplane_index].type = BRW_REGISTER_TYPE_F;
- for (int j = 0; j < 4; ++j) {
- prog_data->param[this->uniforms * 4 + j] = &clip_planes[i][j];
- }
- ++compacted_clipplane_index;
- ++this->uniforms;
- }
- } else {
- /* In Gen6 and later, we don't compact clip planes, because this
- * simplifies the implementation of gl_ClipDistance.
- */
- for (int i = 0; i < key->nr_userclip_plane_consts; ++i) {
- this->uniform_vector_size[this->uniforms] = 4;
- this->userplane[i] = dst_reg(UNIFORM, this->uniforms);
- this->userplane[i].type = BRW_REGISTER_TYPE_F;
- for (int j = 0; j < 4; ++j) {
- prog_data->param[this->uniforms * 4 + j] = &clip_planes[i][j];
- }
- ++this->uniforms;
+ for (int i = 0; i < key->nr_userclip_plane_consts; ++i) {
+ this->uniform_vector_size[this->uniforms] = 4;
+ this->userplane[i] = dst_reg(UNIFORM, this->uniforms);
+ this->userplane[i].type = BRW_REGISTER_TYPE_F;
+ for (int j = 0; j < 4; ++j) {
+ prog_data->param[this->uniforms * 4 + j] = &clip_planes[i][j];
}
+ ++this->uniforms;
}
}
found |= key_debug(brw, "clip distance enable",
old_key->base.uses_clip_distance, key->base.uses_clip_distance);
- found |= key_debug(brw, "clip plane enable bitfield",
- old_key->base.userclip_planes_enabled_gen_4_5,
- key->base.userclip_planes_enabled_gen_4_5);
found |= key_debug(brw, "copy edgeflag",
old_key->copy_edgeflag, key->copy_edgeflag);
found |= key_debug(brw, "PointCoord replace",
key.base.userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
key.base.uses_clip_distance = vp->program.UsesClipDistance;
if (key.base.userclip_active && !key.base.uses_clip_distance) {
- if (brw->gen < 6) {
- key.base.nr_userclip_plane_consts
- = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
- key.base.userclip_planes_enabled_gen_4_5
- = ctx->Transform.ClipPlanesEnabled;
- } else {
- key.base.nr_userclip_plane_consts
- = _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
- }
+ key.base.nr_userclip_plane_consts
+ = _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
}
/* _NEW_POLYGON */
*/
GLuint uses_clip_distance:1;
- /**
- * For pre-Gen6 hardware, a bitfield indicating which clipping planes are
- * enabled. This is used to compact clip planes.
- *
- * For Gen6 and later hardware, clip planes are not compacted, so this
- * value is zero to avoid provoking unnecessary shader recompiles.
- */
- GLuint userclip_planes_enabled_gen_4_5:MAX_CLIP_PLANES;
-
GLuint clamp_vertex_color:1;
struct brw_sampler_prog_key_data tex;