summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_context.c5
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_context.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index 07f6378c6ae..5e907d73b9a 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -214,8 +214,9 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
if (res->bind & PIPE_BIND_CONSTANT_BUFFER) {
for (s = 0; s < 3; ++s) {
- assert(nv50->num_vtxbufs <= NV50_MAX_PIPE_CONSTBUFS);
- for (i = 0; i < nv50->num_vtxbufs; ++i) {
+ for (i = 0; i < NV50_MAX_PIPE_CONSTBUFS; ++i) {
+ if (!(nv50->constbuf_valid[s] & (1 << i)))
+ continue;
if (!nv50->constbuf[s][i].user &&
nv50->constbuf[s][i].u.buf == res) {
nv50->dirty |= NV50_NEW_CONSTBUF;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
index b33a6731a1c..49a46eac87e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
@@ -232,7 +232,9 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx,
if (res->bind & PIPE_BIND_CONSTANT_BUFFER) {
for (s = 0; s < 5; ++s) {
- for (i = 0; i < nvc0->num_vtxbufs; ++i) {
+ for (i = 0; i < NVC0_MAX_PIPE_CONSTBUFS; ++i) {
+ if (!(nvc0->constbuf_valid[s] & (1 << i)))
+ continue;
if (!nvc0->constbuf[s][i].user &&
nvc0->constbuf[s][i].u.buf == res) {
nvc0->dirty |= NVC0_NEW_CONSTBUF;