diff options
author | Ilia Mirkin <[email protected]> | 2015-06-15 15:48:58 -0400 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-06-18 13:43:56 +0100 |
commit | 512927bc021c20235213b8ba4c6ebb5432fecc5e (patch) | |
tree | 40578c72b09fdd70b32561c15c2ceb19270513e1 /src | |
parent | b26bac8b1e094b8400c2f5dfa22283c23dda4080 (diff) |
nv50,nvc0: clamp uniform size to 64k
The state tracker will pass through requests from buggy applications
which will have the buffer size larger than the max allowed (64k). Clamp
the size to 64k so that we don't get errors when uploading the constbuf
data.
Signed-off-by: Ilia Mirkin <[email protected]>
Cc: "10.5 10.6" <[email protected]>
(cherry picked from commit 8b24388647f626a5cad10fd48e61335ed26a8560)
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_state.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index 290750459cf..d4d41af3c61 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -811,12 +811,12 @@ nv50_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, nv50->constbuf[s][i].user = (cb && cb->user_buffer) ? TRUE : FALSE; if (nv50->constbuf[s][i].user) { nv50->constbuf[s][i].u.data = cb->user_buffer; - nv50->constbuf[s][i].size = cb->buffer_size; + nv50->constbuf[s][i].size = MIN2(cb->buffer_size, 0x10000); nv50->constbuf_valid[s] |= 1 << i; } else if (res) { nv50->constbuf[s][i].offset = cb->buffer_offset; - nv50->constbuf[s][i].size = align(cb->buffer_size, 0x100); + nv50->constbuf[s][i].size = MIN2(align(cb->buffer_size, 0x100), 0x10000); nv50->constbuf_valid[s] |= 1 << i; } else { nv50->constbuf_valid[s] &= ~(1 << i); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index dca06f4cddb..bec5aa4e94e 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -811,12 +811,12 @@ nvc0_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, nvc0->constbuf[s][i].user = (cb && cb->user_buffer) ? TRUE : FALSE; if (nvc0->constbuf[s][i].user) { nvc0->constbuf[s][i].u.data = cb->user_buffer; - nvc0->constbuf[s][i].size = cb->buffer_size; + nvc0->constbuf[s][i].size = MIN2(cb->buffer_size, 0x10000); nvc0->constbuf_valid[s] |= 1 << i; } else if (cb) { nvc0->constbuf[s][i].offset = cb->buffer_offset; - nvc0->constbuf[s][i].size = align(cb->buffer_size, 0x100); + nvc0->constbuf[s][i].size = MIN2(align(cb->buffer_size, 0x100), 0x10000); nvc0->constbuf_valid[s] |= 1 << i; } else { |