summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2011-10-20 22:42:59 +0200
committerChristoph Bumiller <[email protected]>2011-10-21 23:00:40 +0200
commitd988361ead27ce61615669bd428b04d2aac7af4f (patch)
treecf038c67142bf4352489fd0a80bb89df76c58c97 /src/gallium/drivers/nouveau
parent28271fd00dc5dd83f95b5cb890e0ab2c0ff6159d (diff)
nouveau,nvc0: fix/improve handling of multiple constant buffers
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.c17
-rw-r--r--src/gallium/drivers/nouveau/nouveau_context.h6
2 files changed, 19 insertions, 4 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 60d8e37a554..f822625af90 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -24,14 +24,19 @@ static INLINE boolean
nouveau_buffer_allocate(struct nouveau_screen *screen,
struct nv04_resource *buf, unsigned domain)
{
+ uint32_t size = buf->base.width0;
+
+ if (buf->base.bind & PIPE_BIND_CONSTANT_BUFFER)
+ size = align(size, 0x100);
+
if (domain == NOUVEAU_BO_VRAM) {
- buf->mm = nouveau_mm_allocate(screen->mm_VRAM, buf->base.width0,
+ buf->mm = nouveau_mm_allocate(screen->mm_VRAM, size,
&buf->bo, &buf->offset);
if (!buf->bo)
return nouveau_buffer_allocate(screen, buf, NOUVEAU_BO_GART);
} else
if (domain == NOUVEAU_BO_GART) {
- buf->mm = nouveau_mm_allocate(screen->mm_GART, buf->base.width0,
+ buf->mm = nouveau_mm_allocate(screen->mm_GART, size,
&buf->bo, &buf->offset);
if (!buf->bo)
return FALSE;
@@ -129,8 +134,12 @@ nouveau_buffer_upload(struct nouveau_context *nv, struct nv04_resource *buf,
uint32_t offset;
if (size <= 192) {
- nv->push_data(nv, buf->bo, buf->offset + start, buf->domain,
- size, buf->data + start);
+ if (buf->base.bind & PIPE_BIND_CONSTANT_BUFFER)
+ nv->push_cb(nv, buf->bo, buf->domain, buf->offset, buf->base.width0,
+ start, size / 4, (const uint32_t *)(buf->data + start));
+ else
+ nv->push_data(nv, buf->bo, buf->offset + start, buf->domain,
+ size, buf->data + start);
return TRUE;
}
diff --git a/src/gallium/drivers/nouveau/nouveau_context.h b/src/gallium/drivers/nouveau/nouveau_context.h
index 7b5f3f1ec39..92aea76b424 100644
--- a/src/gallium/drivers/nouveau/nouveau_context.h
+++ b/src/gallium/drivers/nouveau/nouveau_context.h
@@ -8,6 +8,7 @@ struct nouveau_context {
struct nouveau_screen *screen;
boolean vbo_dirty;
+ boolean cb_dirty;
void (*copy_data)(struct nouveau_context *,
struct nouveau_bo *dst, unsigned, unsigned,
@@ -15,6 +16,11 @@ struct nouveau_context {
void (*push_data)(struct nouveau_context *,
struct nouveau_bo *dst, unsigned, unsigned,
unsigned, const void *);
+ /* base, size refer to the whole constant buffer */
+ void (*push_cb)(struct nouveau_context *,
+ struct nouveau_bo *, unsigned domain,
+ unsigned base, unsigned size,
+ unsigned offset, unsigned words, const uint32_t *);
};
static INLINE struct nouveau_context *