gallium: added draw_texture_samplers() to support texture fetches from vertex shaders
authorBrian <brian.paul@tungstengraphics.com>
Wed, 3 Dec 2008 05:38:46 +0000 (22:38 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Thu, 4 Dec 2008 16:58:54 +0000 (09:58 -0700)
This may only be practical for the softpipe driver at this time.

src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/auxiliary/draw/draw_private.h
src/gallium/auxiliary/draw/draw_vs_exec.c

index 41a4cba1ddde4a8af635b3d3191233f0980ba151..b2a34811c2de5e403c775ba43655a3e9de1ef7c6 100644 (file)
@@ -331,6 +331,21 @@ draw_num_vs_outputs(const struct draw_context *draw)
 }
 
 
+/**
+ * Provide TGSI sampler objects for vertex shaders that use texture fetches.
+ * This might only be used by software drivers for the time being.
+ */
+void
+draw_texture_samplers(struct draw_context *draw,
+                      uint num_samplers,
+                      struct tgsi_sampler **samplers)
+{
+   draw->vs.num_samplers = num_samplers;
+   draw->vs.samplers = samplers;
+}
+
+
+
 
 void draw_set_render( struct draw_context *draw, 
                      struct vbuf_render *render )
index 3eeb45353112db7b5c9549da2712fc2b90a4dd31..8f5cecf4387da8c736c6808a811d1ff8a93ee95a 100644 (file)
@@ -45,7 +45,7 @@ struct pipe_context;
 struct draw_context;
 struct draw_stage;
 struct draw_vertex_shader;
-
+struct tgsi_sampler;
 
 
 struct draw_context *draw_create( void );
@@ -91,6 +91,12 @@ uint
 draw_num_vs_outputs(const struct draw_context *draw);
 
 
+void
+draw_texture_samplers(struct draw_context *draw,
+                      uint num_samplers,
+                      struct tgsi_sampler **samplers);
+
+
 
 /*
  * Vertex shader functions
index 5d531146c5fe76b7dcc109b8b30c6390944e1ee2..6097fff2c63a59aff19ad0674dd98bedee9bc02e 100644 (file)
@@ -185,6 +185,9 @@ struct draw_context
       /** TGSI program interpreter runtime state */
       struct tgsi_exec_machine machine;
 
+      uint num_samplers;
+      struct tgsi_sampler **samplers;
+
       /* This (and the tgsi_exec_machine struct) probably need to be moved somewhere private.
        */
       struct gallivm_cpu_engine *engine;   
index 80c360665777bdaf4b71d0775e4ae1c2ff86b2f0..b3200df8112ea3a36a0d50801254ef9191078655 100644 (file)
@@ -68,8 +68,8 @@ vs_exec_prepare( struct draw_vertex_shader *shader,
    if (evs->machine->Tokens != shader->state.tokens) {
       tgsi_exec_machine_bind_shader(evs->machine,
                                     shader->state.tokens,
-                                    PIPE_MAX_SAMPLERS,
-                                    NULL /*samplers*/ );
+                                    draw->vs.num_samplers,
+                                    draw->vs.samplers);
    }
 }