This is especially useful when switching from compute to 3D. v2: - get rid of one loop with 'x |= (1ULL << y) - 1' instead
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com> --- Tested with Elemental on GK208, works fine. src/gallium/drivers/nouveau/nvc0/nvc0_compute.c | 6 +++--- src/gallium/drivers/nouveau/nvc0/nvc0_tex.c | 11 +++++++---- src/gallium/drivers/nouveau/nvc0/nve4_compute.c | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c index 11635c9..08fa23f 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c @@ -151,7 +151,7 @@ nvc0_compute_validate_samplers(struct nvc0_context *nvc0) /* Invalidate all 3D samplers because they are aliased. */ for (int s = 0; s < 5; s++) - nvc0->samplers_dirty[s] = ~0; + nvc0->samplers_dirty[s] |= (1ULL << nvc0->num_samplers[5]) - 1; nvc0->dirty_3d |= NVC0_NEW_3D_SAMPLERS; } @@ -166,9 +166,9 @@ nvc0_compute_validate_textures(struct nvc0_context *nvc0) /* Invalidate all 3D textures because they are aliased. */ for (int s = 0; s < 5; s++) { - for (int i = 0; i < nvc0->num_textures[s]; i++) + for (int i = 0; i < nvc0->num_textures[5]; i++) nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(s, i)); - nvc0->textures_dirty[s] = ~0; + nvc0->textures_dirty[s] |= (1ULL << nvc0->num_textures[5]) - 1; } nvc0->dirty_3d |= NVC0_NEW_3D_TEXTURES; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c index e57391e..8d620a9 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c @@ -606,9 +606,11 @@ void nvc0_validate_textures(struct nvc0_context *nvc0) } /* Invalidate all CP textures because they are aliased. */ - for (int i = 0; i < nvc0->num_textures[5]; i++) - nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_TEX(i)); - nvc0->textures_dirty[5] = ~0; + for (int s = 0; s < 5; s++) { + for (int i = 0; i < nvc0->num_textures[s]; i++) + nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_TEX(i)); + nvc0->textures_dirty[5] |= (1ULL << nvc0->num_textures[s]) - 1; + } nvc0->dirty_cp |= NVC0_NEW_CP_TEXTURES; } @@ -715,7 +717,8 @@ void nvc0_validate_samplers(struct nvc0_context *nvc0) } /* Invalidate all CP samplers because they are aliased. */ - nvc0->samplers_dirty[5] = ~0; + for (int s = 0; s < 5; s++) + nvc0->samplers_dirty[5] |= (1ULL << nvc0->num_samplers[s]) - 1; nvc0->dirty_cp |= NVC0_NEW_CP_SAMPLERS; } diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c index d661c00..33e0ab0 100644 --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c @@ -307,7 +307,7 @@ nve4_compute_validate_samplers(struct nvc0_context *nvc0) /* Invalidate all 3D samplers because they are aliased. */ for (int s = 0; s < 5; s++) - nvc0->samplers_dirty[s] = ~0; + nvc0->samplers_dirty[s] |= (1ULL << nvc0->num_samplers[5]) - 1; nvc0->dirty_3d |= NVC0_NEW_3D_SAMPLERS; } @@ -764,9 +764,9 @@ nve4_compute_validate_textures(struct nvc0_context *nvc0) /* Invalidate all 3D textures because they are aliased. */ for (int s = 0; s < 5; s++) { - for (int i = 0; i < nvc0->num_textures[s]; i++) + for (int i = 0; i < nvc0->num_textures[5]; i++) nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(s, i)); - nvc0->textures_dirty[s] = ~0; + nvc0->textures_dirty[s] |= (1ULL << nvc0->num_textures[5]) - 1; } nvc0->dirty_3d |= NVC0_NEW_3D_TEXTURES; } -- 2.10.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev