diff options
author | Chad Versace <[email protected]> | 2011-09-26 15:48:54 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2011-10-10 13:23:41 -0700 |
commit | 9559ca600dde0877fe0abd04dd789bd5a3cdfbde (patch) | |
tree | 1c697a2daf4720c37dbee7794760209ab140efb1 /src/mesa/drivers | |
parent | 95fd5e5aba2e21ab20cb971506a81c0049b5a694 (diff) |
i965: Split brw_set_prim into brw/gen6 variants
The "slight optimization to avoid the GS program" in brw_set_prim() is not
used by Gen 6, since Gen 6 doesn't use a GS program. Also, Gen 6 doesn't use
reduced primitives.
Also, document that intel_context.reduced_primitive is only used for Gen < 6
Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw.c | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.h | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index bdb5b672899..39d38a57a4a 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -115,6 +115,19 @@ static GLuint brw_set_prim(struct brw_context *brw, return prim_to_hw_prim[mode]; } +static GLuint gen6_set_prim(struct brw_context *brw, + const struct _mesa_prim *prim) +{ + DBG("PRIM: %s\n", _mesa_lookup_enum_by_nr(prim->mode)); + + if (prim->mode != brw->primitive) { + brw->primitive = prim->mode; + brw->state.dirty.brw |= BRW_NEW_PRIMITIVE; + } + + return prim_to_hw_prim[mode]; +} + static GLuint trim(GLenum prim, GLuint length) { @@ -335,7 +348,11 @@ static GLboolean brw_try_draw_prims( struct gl_context *ctx, */ intel_batchbuffer_require_space(intel, estimated_max_prim_size, false); - hw_prim = brw_set_prim(brw, &prim[i]); + if (intel->gen < 6) + hw_prim = brw_set_prim(brw, &prim[i]); + else + hw_prim = gen6_set_prim(brw, &prim[i]); + if (brw->state.dirty.brw) { brw_validate_state(brw); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index eb78c00f290..cf7ab9e665a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -253,7 +253,7 @@ struct intel_context GLuint RenderIndex; GLmatrix ViewportMatrix; GLenum render_primitive; - GLenum reduced_primitive; + GLenum reduced_primitive; /*< Only gen < 6 */ GLuint vertex_size; GLubyte *verts; /* points to tnl->clipspace.vertex_buf */ |