summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-02-15 12:57:25 -0800
committerEric Anholt <[email protected]>2012-02-21 11:54:10 -0800
commit83871566207d6692d1f20e4b666adb5dd0628dc3 (patch)
treed85ee4a4e774e6d5839e4e34e182fedbeaade698 /src
parente9cfaed1a50665690534ef3d89c4ad37a3e34bed (diff)
i965/gen6+: Avoid recomputing whether we use noperspective.
Improves VS state change microbenchmark performance 2.38246% +/- 1.15046% (n=20). Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h4
-rw-r--r--src/mesa/drivers/dri/i965/gen6_clip_state.c31
-rw-r--r--src/mesa/drivers/dri/i965/gen7_clip_state.c11
3 files changed, 10 insertions, 36 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index a5a98b257a9..98f68e7c381 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1063,10 +1063,6 @@ brw_update_sol_surface(struct brw_context *brw,
uint32_t *out_offset, unsigned num_vector_components,
unsigned stride_dwords, unsigned offset_dwords);
-/* gen6_clip_state.c */
-bool
-brw_fprog_uses_noperspective(const struct gl_fragment_program *fprog);
-
/* gen6_sol.c */
void
brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index b3bb8aee3ec..abf1d762eb5 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -31,26 +31,6 @@
#include "brw_util.h"
#include "intel_batchbuffer.h"
-/**
- * Return true if at least one of the inputs used by the given fragment
- * program has the GLSL "noperspective" interpolation qualifier.
- */
-bool
-brw_fprog_uses_noperspective(const struct gl_fragment_program *fprog)
-{
- int attr;
- for (attr = 0; attr < FRAG_ATTRIB_MAX; ++attr) {
- /* Ignore unused inputs. */
- if (!(fprog->Base.InputsRead & BITFIELD64_BIT(attr)))
- continue;
-
- if (fprog->InterpQualifier[attr] == INTERP_QUALIFIER_NOPERSPECTIVE)
- return true;
- }
- return false;
-}
-
-
static void
upload_clip_state(struct brw_context *brw)
{
@@ -59,10 +39,10 @@ upload_clip_state(struct brw_context *brw)
uint32_t depth_clamp = 0;
uint32_t provoking, userclip;
uint32_t nonperspective_barycentric_enable_flag = 0;
- /* BRW_NEW_FRAGMENT_PROGRAM */
- const struct gl_fragment_program *fprog = brw->fragment_program;
- if (brw_fprog_uses_noperspective(fprog)) {
+ /* CACHE_NEW_WM_PROG */
+ if (brw->wm.prog_data->barycentric_interp_modes &
+ (1 << BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC)) {
nonperspective_barycentric_enable_flag =
GEN6_CLIP_NON_PERSPECTIVE_BARYCENTRIC_ENABLE;
}
@@ -106,9 +86,8 @@ upload_clip_state(struct brw_context *brw)
const struct brw_tracked_state gen6_clip_state = {
.dirty = {
.mesa = _NEW_TRANSFORM | _NEW_LIGHT,
- .brw = (BRW_NEW_CONTEXT |
- BRW_NEW_FRAGMENT_PROGRAM),
- .cache = 0
+ .brw = (BRW_NEW_CONTEXT),
+ .cache = CACHE_NEW_WM_PROG
},
.emit = upload_clip_state,
};
diff --git a/src/mesa/drivers/dri/i965/gen7_clip_state.c b/src/mesa/drivers/dri/i965/gen7_clip_state.c
index c32cd988297..f78b089484d 100644
--- a/src/mesa/drivers/dri/i965/gen7_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_clip_state.c
@@ -36,13 +36,13 @@ upload_clip_state(struct brw_context *brw)
uint32_t provoking, userclip;
uint32_t dw1 = GEN6_CLIP_STATISTICS_ENABLE;
uint32_t nonperspective_barycentric_enable_flag = 0;
- /* BRW_NEW_FRAGMENT_PROGRAM */
- const struct gl_fragment_program *fprog = brw->fragment_program;
/* _NEW_BUFFERS */
bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
- if (brw_fprog_uses_noperspective(fprog)) {
+ /* CACHE_NEW_WM_PROG */
+ if (brw->wm.prog_data->barycentric_interp_modes &
+ (1 << BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC)) {
nonperspective_barycentric_enable_flag =
GEN6_CLIP_NON_PERSPECTIVE_BARYCENTRIC_ENABLE;
}
@@ -115,9 +115,8 @@ const struct brw_tracked_state gen7_clip_state = {
_NEW_POLYGON |
_NEW_LIGHT |
_NEW_TRANSFORM),
- .brw = (BRW_NEW_CONTEXT |
- BRW_NEW_FRAGMENT_PROGRAM),
- .cache = 0
+ .brw = BRW_NEW_CONTEXT,
+ .cache = CACHE_NEW_WM_PROG
},
.emit = upload_clip_state,
};