diff options
author | Marek Olšák <[email protected]> | 2012-05-11 22:25:03 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-05-12 00:50:52 +0200 |
commit | bdba35befac74a0bef0d1be657e4e77de628e28b (patch) | |
tree | 20533517872a8c219f509583b19424fd34eae725 /src/gallium/drivers/r300/r300_state.c | |
parent | 550de24c17fd4873b0200c0d4a61656e184631ac (diff) |
r300g: fix breakage after gallium-userbuf merge
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 566bc443807..a9a76c5fed8 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1822,11 +1822,12 @@ static void r300_set_constant_buffer(struct pipe_context *pipe, struct pipe_constant_buffer *cb) { struct r300_context* r300 = r300_context(pipe); - struct pipe_resource *buf = cb ? cb->buffer : NULL; struct r300_constant_buffer *cbuf; - struct r300_resource *rbuf = r300_resource(buf); uint32_t *mapped; + if (!cb) + return; + switch (shader) { case PIPE_SHADER_VERTEX: cbuf = (struct r300_constant_buffer*)r300->vs_constants.state; @@ -1838,15 +1839,17 @@ static void r300_set_constant_buffer(struct pipe_context *pipe, return; } - if (buf == NULL || buf->width0 == 0) - return; if (cb->user_buffer) mapped = (uint32_t*)cb->user_buffer; - else if (rbuf->constant_buffer) - mapped = (uint32_t*)rbuf->constant_buffer; - else - return; + else { + struct r300_resource *rbuf = r300_resource(cb->buffer); + + if (rbuf && rbuf->constant_buffer) + mapped = (uint32_t*)rbuf->constant_buffer; + else + return; + } if (shader == PIPE_SHADER_FRAGMENT || (shader == PIPE_SHADER_VERTEX && r300->screen->caps.has_tcl)) { @@ -1873,7 +1876,7 @@ static void r300_set_constant_buffer(struct pipe_context *pipe, r300_mark_atom_dirty(r300, &r300->vs_constants); } else if (r300->draw) { draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX, - 0, mapped, buf->width0); + 0, mapped, cb->buffer_size); } } else if (shader == PIPE_SHADER_FRAGMENT) { r300_mark_atom_dirty(r300, &r300->fs_constants); |