diff options
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_emit.c | 14 |
4 files changed, 16 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 71053060cbc..680bd7d0520 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -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]))); diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index e01752cdb71..14e91d87b2d 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index bd81764cb99..b8d11dfa954 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -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 diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index e78cb6c60d4..88455807ba3 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -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)); |