Mesa (arb_geometry_shader4): gs: initialize the machine

Zack Rusin zack at kemper.freedesktop.org
Tue Jul 14 04:23:03 UTC 2009


Module: Mesa
Branch: arb_geometry_shader4
Commit: 92b8a37bbe827c8191af385c84cd876c68da4074
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=92b8a37bbe827c8191af385c84cd876c68da4074

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Jul 14 00:02:46 2009 -0400

gs: initialize the machine

---

 src/gallium/auxiliary/draw/draw_context.c |    3 +++
 src/gallium/auxiliary/draw/draw_gs.c      |   20 ++++++++++++++++++++
 src/gallium/auxiliary/draw/draw_private.h |    5 +++++
 3 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index a4f1fcd..d891b92 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -67,6 +67,9 @@ struct draw_context *draw_create( void )
    if (!draw_vs_init( draw ))
       goto fail;
 
+   if (!draw_gs_init( draw ))
+      goto fail;
+
    return draw;
 
 fail:
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 3911766..a51cae9 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -36,6 +36,26 @@
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
+#define MAX_PRIM_VERTICES 6
+
+boolean
+draw_gs_init( struct draw_context *draw )
+{
+   tgsi_exec_machine_init(&draw->gs.machine);
+
+   draw->gs.machine.Inputs = align_malloc(MAX_PRIM_VERTICES *
+                                          PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16);
+   if (!draw->gs.machine.Inputs)
+      return FALSE;
+
+   draw->gs.machine.Outputs = align_malloc(MAX_PRIM_VERTICES *
+                                           PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16);
+   if (!draw->gs.machine.Outputs)
+      return FALSE;
+
+   return TRUE;
+}
+
 
 struct draw_geometry_shader *
 draw_create_geometry_shader(struct draw_context *draw,
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 44050bd..260e191 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -262,6 +262,11 @@ void draw_vs_set_constants( struct draw_context *,
 
 
 
+/*******************************************************************************
+ * Geometry shading (was passthrough) code:
+ */
+boolean draw_gs_init( struct draw_context *draw );
+
 
 /*******************************************************************************
  * Vertex processing (was passthrough) code:




More information about the mesa-commit mailing list