[Mesa-dev] [i965] i965/draw: Move constant formation outside of for loop and use an enum.

mmueller markkmueller at gmail.com
Tue Aug 6 11:56:39 PDT 2013


The content of this patch is trivial, the real objective is to become familiar with
the process and to introduce myself. All of my dealings with Mesa3D over the last
~14 years have been in the proprietary arena, specifically developing optimized
Mesa3D/Gallium based proprietary drivers for specialized embedded applications.
The focus of my future Mesa-dev contributions will be on i965 performance issues,
specifically with current/new Intel hardware.

Signed-off-by: mmueller <MarkKMueller at gmail.com>
---
 src/mesa/drivers/dri/i965/brw_draw.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 6170d07..e11d0d8 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -367,6 +367,15 @@ static bool brw_try_draw_prims( struct gl_context *ctx,
    bool retval = true;
    GLuint i;
    bool fail_next = false;
+   enum {
+       estimated_max_prim_size =
+           512 + /* batchbuffer commands */
+           ((BRW_MAX_TEX_UNIT * (sizeof(struct brw_sampler_state) + sizeof(struct gen5_sampler_default_color)))) +
+           1024 + /* gen6 VS push constants */
+           1024 + /* gen6 WM push constants */
+           512 /* misc. pad */
+   };
+
 
    if (ctx->NewState)
       _mesa_update_state( ctx );
@@ -405,15 +414,6 @@ static bool brw_try_draw_prims( struct gl_context *ctx,
    brw->state.dirty.brw |= BRW_NEW_VERTICES;
 
    for (i = 0; i < nr_prims; i++) {
-      int estimated_max_prim_size;
-
-      estimated_max_prim_size = 512; /* batchbuffer commands */
-      estimated_max_prim_size += (BRW_MAX_TEX_UNIT *
-				  (sizeof(struct brw_sampler_state) +
-				   sizeof(struct gen5_sampler_default_color)));
-      estimated_max_prim_size += 1024; /* gen6 VS push constants */
-      estimated_max_prim_size += 1024; /* gen6 WM push constants */
-      estimated_max_prim_size += 512; /* misc. pad */
 
       /* Flush the batch if it's approaching full, so that we don't wrap while
        * we've got validated state that needs to be in the same batch as the
-- 
1.8.3.1



More information about the mesa-dev mailing list