summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv10/nv10_state.c
diff options
context:
space:
mode:
authorPeter Winters <[email protected]>2008-04-20 16:07:04 +0200
committerPeter Winters <[email protected]>2008-04-20 16:07:04 +0200
commite7bdf047f28ea9b928b3890c37d7d20db1e67e96 (patch)
tree6d2c0aa3cb5ad8ceaf67987d1181e3eaf3f0be4d /src/gallium/drivers/nv10/nv10_state.c
parent7d2085bd7d9378703bfff3d974536ff5e9fd9b30 (diff)
nv10: fix random stuff
Diffstat (limited to 'src/gallium/drivers/nv10/nv10_state.c')
-rw-r--r--src/gallium/drivers/nv10/nv10_state.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gallium/drivers/nv10/nv10_state.c b/src/gallium/drivers/nv10/nv10_state.c
index 1d9a202dd7c..4dcb9a31ab1 100644
--- a/src/gallium/drivers/nv10/nv10_state.c
+++ b/src/gallium/drivers/nv10/nv10_state.c
@@ -459,14 +459,18 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
const struct pipe_constant_buffer *buf )
{
struct nv10_context *nv10 = nv10_context(pipe);
+ struct pipe_winsys *ws = pipe->winsys;
- if (shader == PIPE_SHADER_VERTEX) {
- nv10->constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
- nv10->dirty |= NV10_NEW_VERTPROG;
- } else
- if (shader == PIPE_SHADER_FRAGMENT) {
- nv10->constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
- nv10->dirty |= NV10_NEW_FRAGPROG;
+ assert(shader < PIPE_SHADER_TYPES);
+ assert(index == 0);
+
+ if (buf) {
+ void *mapped;
+ if (buf->size && (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+ {
+ memcpy(nv10->constbuf[shader], mapped, buf->size);
+ ws->buffer_unmap(ws, buf->buffer);
+ }
}
}
@@ -507,7 +511,7 @@ nv10_set_viewport_state(struct pipe_context *pipe,
nv10->viewport = (struct pipe_viewport_state*)vpt;
- draw_set_viewport_state(nv10->draw, &nv10->viewport);
+ draw_set_viewport_state(nv10->draw, nv10->viewport);
nv10->dirty |= NV10_NEW_VIEWPORT;
}