summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_draw_arrays.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-08-22 12:24:51 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-08-22 12:26:46 -0600
commitc0bb4ba9e665e40a325d82aa2ee48d7b8abd603b (patch)
tree48338074f07042599856e95b4529e0ffbca4be63 /src/mesa/pipe/softpipe/sp_draw_arrays.c
parentd1fbf621dc48a488c0f860c5851332d269e6d637 (diff)
Rework of shader constant buffers.
They're now totally independent of the actual shaders. Also, implemented in terms of pipe_buffer_handles/objects.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_draw_arrays.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_draw_arrays.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mesa/pipe/softpipe/sp_draw_arrays.c b/src/mesa/pipe/softpipe/sp_draw_arrays.c
index 0392b6b64e..5198a493da 100644
--- a/src/mesa/pipe/softpipe/sp_draw_arrays.c
+++ b/src/mesa/pipe/softpipe/sp_draw_arrays.c
@@ -43,6 +43,34 @@
+static void
+softpipe_map_constant_buffers(struct softpipe_context *sp)
+{
+ struct pipe_winsys *ws = sp->pipe.winsys;
+ uint i;
+ for (i = 0; i < 2; i++) {
+ if (sp->constants[i].size)
+ sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
+ PIPE_BUFFER_FLAG_READ);
+ }
+
+ draw_set_mapped_constant_buffer(sp->draw,
+ sp->mapped_constants[PIPE_SHADER_VERTEX]);
+}
+
+static void
+softpipe_unmap_constant_buffers(struct softpipe_context *sp)
+{
+ struct pipe_winsys *ws = sp->pipe.winsys;
+ uint i;
+ for (i = 0; i < 2; i++) {
+ if (sp->constants[i].size)
+ ws->buffer_unmap(ws, sp->constants[i].buffer);
+ sp->mapped_constants[i] = NULL;
+ }
+}
+
+
boolean
softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
unsigned start, unsigned count)
@@ -81,6 +109,8 @@ softpipe_draw_elements(struct pipe_context *pipe,
softpipe_map_surfaces(sp);
+ softpipe_map_constant_buffers(sp);
+
/*
* Map vertex buffers
*/
@@ -123,6 +153,7 @@ softpipe_draw_elements(struct pipe_context *pipe,
}
softpipe_unmap_surfaces(sp);
+ softpipe_unmap_constant_buffers(sp);
return TRUE;
}