i965: get rid of clip plane compaction

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
Chris Forbes
2013-07-08 03:46:55 +12:00
parent cf52f6435e
commit ee0b8e0f06
4 changed files with 11 additions and 55 deletions
+2 -1
View File
@@ -158,7 +158,8 @@ brw_upload_clip_prog(struct brw_context *brw)
/* _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;
+7 -33
View File
@@ -662,40 +662,14 @@ vec4_visitor::setup_uniform_clipplane_values()
{
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;
}
}
+2 -12
View File
@@ -394,9 +394,6 @@ brw_vs_debug_recompile(struct brw_context *brw,
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",
@@ -431,15 +428,8 @@ static void brw_upload_vs_prog(struct brw_context *brw)
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 */
-9
View File
@@ -71,15 +71,6 @@ struct brw_vec4_prog_key {
*/
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;