Mesa (gallium-0.2): gallium: added draw_texture_samplers() to support texture fetches from vertex shaders
Brian Paul
brianp at kemper.freedesktop.org
Thu Dec 4 17:00:15 UTC 2008
Module: Mesa
Branch: gallium-0.2
Commit: f2bccfd3c806a879abf0c40858806ec3825d0628
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2bccfd3c806a879abf0c40858806ec3825d0628
Author: Brian <brian.paul at tungstengraphics.com>
Date: Tue Dec 2 22:38:46 2008 -0700
gallium: added draw_texture_samplers() to support texture fetches from vertex shaders
This may only be practical for the softpipe driver at this time.
---
src/gallium/auxiliary/draw/draw_context.c | 15 +++++++++++++++
src/gallium/auxiliary/draw/draw_context.h | 8 +++++++-
src/gallium/auxiliary/draw/draw_private.h | 3 +++
src/gallium/auxiliary/draw/draw_vs_exec.c | 4 ++--
4 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 41a4cba..b2a3481 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -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 )
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 3eeb453..8f5cecf 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -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
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 5d53114..6097fff 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -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;
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index 80c3606..b3200df 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -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);
}
}
More information about the mesa-commit
mailing list