mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-27 16:20:24 +01:00
i965 VS: Change nr_userclip to nr_userclip_planes.
The only remaining uses of brw_vs_prog_key::nr_userclip only occurred when using clip planes (as opposed to gl_ClipDistance). This patch renames the value to nr_userclip_planes and sets it to zero when gl_ClipDistance is in use. This avoids unnecessary VS recompiles. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
18e2e19b07
commit
f4f686e825
4 changed files with 16 additions and 13 deletions
|
|
@ -1807,7 +1807,7 @@ vec4_visitor::emit_psiz_and_flags(struct brw_reg reg)
|
|||
}
|
||||
|
||||
current_annotation = "Clipping flags";
|
||||
for (i = 0; i < c->key.nr_userclip; i++) {
|
||||
for (i = 0; i < c->key.nr_userclip_planes; i++) {
|
||||
vec4_instruction *inst;
|
||||
|
||||
inst = emit(DP4(dst_null_f(), src_reg(output_reg[VERT_RESULT_HPOS]),
|
||||
|
|
@ -1883,7 +1883,7 @@ vec4_visitor::emit_clip_distances(struct brw_reg reg, int offset)
|
|||
clip_vertex = VERT_RESULT_HPOS;
|
||||
}
|
||||
|
||||
for (int i = 0; i + offset < c->key.nr_userclip && i < 4; ++i) {
|
||||
for (int i = 0; i + offset < c->key.nr_userclip_planes && i < 4; ++i) {
|
||||
emit(DP4(dst_reg(brw_writemask(reg, 1 << i)),
|
||||
src_reg(output_reg[clip_vertex]),
|
||||
src_reg(this->userplane[i + offset])));
|
||||
|
|
|
|||
|
|
@ -289,10 +289,12 @@ static void brw_upload_vs_prog(struct brw_context *brw)
|
|||
*/
|
||||
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)
|
||||
if (!key.uses_clip_distance) {
|
||||
key.userclip_planes_enabled = ctx->Transform.ClipPlanesEnabled;
|
||||
key.nr_userclip_planes
|
||||
= _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
|
||||
}
|
||||
key.copy_edgeflag = (ctx->Polygon.FrontMode != GL_FILL ||
|
||||
ctx->Polygon.BackMode != GL_FILL);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,9 +53,10 @@ struct brw_vs_prog_key {
|
|||
GLuint userclip_active:1;
|
||||
|
||||
/**
|
||||
* Number of user clip planes (or clip distances) that are active.
|
||||
* Number of user clip planes active. Zero if the shader uses
|
||||
* gl_ClipDistance.
|
||||
*/
|
||||
GLuint nr_userclip:4;
|
||||
GLuint nr_userclip_planes:4;
|
||||
|
||||
/**
|
||||
* True if the shader uses gl_ClipDistance, regardless of whether any clip
|
||||
|
|
|
|||
|
|
@ -204,17 +204,17 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
|
|||
*/
|
||||
if (c->key.userclip_active) {
|
||||
if (intel->gen >= 6) {
|
||||
for (i = 0; i < c->key.nr_userclip; i++) {
|
||||
for (i = 0; i < c->key.nr_userclip_planes; i++) {
|
||||
c->userplane[i] = stride(brw_vec4_grf(reg + i / 2,
|
||||
(i % 2) * 4), 0, 4, 1);
|
||||
}
|
||||
reg += ALIGN(c->key.nr_userclip, 2) / 2;
|
||||
reg += ALIGN(c->key.nr_userclip_planes, 2) / 2;
|
||||
} else {
|
||||
for (i = 0; i < c->key.nr_userclip; i++) {
|
||||
for (i = 0; i < c->key.nr_userclip_planes; i++) {
|
||||
c->userplane[i] = stride(brw_vec4_grf(reg + (6 + i) / 2,
|
||||
(i % 2) * 4), 0, 4, 1);
|
||||
}
|
||||
reg += (ALIGN(6 + c->key.nr_userclip, 4) / 4) * 2;
|
||||
reg += (ALIGN(6 + c->key.nr_userclip_planes, 4) / 4) * 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -239,7 +239,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
|
|||
*/
|
||||
if (intel->gen >= 6) {
|
||||
/* We can only load 32 regs of push constants. */
|
||||
max_constant = 32 * 2 - c->key.nr_userclip;
|
||||
max_constant = 32 * 2 - c->key.nr_userclip_planes;
|
||||
} else {
|
||||
max_constant = BRW_MAX_GRF - 20 - c->vp->program.Base.NumTemporaries;
|
||||
}
|
||||
|
|
@ -1565,7 +1565,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
|
|||
|
||||
/* Set the user clip distances in dword 8-15. (m3-4)*/
|
||||
if (c->key.userclip_active) {
|
||||
for (i = 0; i < c->key.nr_userclip; i++) {
|
||||
for (i = 0; i < c->key.nr_userclip_planes; i++) {
|
||||
struct brw_reg m;
|
||||
if (i < 4)
|
||||
m = brw_message_reg(3);
|
||||
|
|
@ -1593,7 +1593,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
|
|||
header1, brw_imm_ud(0x7ff<<8));
|
||||
}
|
||||
|
||||
for (i = 0; i < c->key.nr_userclip; i++) {
|
||||
for (i = 0; i < c->key.nr_userclip_planes; i++) {
|
||||
brw_set_conditionalmod(p, BRW_CONDITIONAL_L);
|
||||
brw_DP4(p, brw_null_reg(), pos, c->userplane[i]);
|
||||
brw_OR(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(1<<i));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue