Mesa (master): iris: Zero shs->cbuf0 when binding a passthrough TCS

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 7 22:25:28 UTC 2019


Module: Mesa
Branch: master
Commit: 30314270d4695a8fd157e286014c5052f43135ae
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=30314270d4695a8fd157e286014c5052f43135ae

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jun  7 12:41:28 2019 -0700

iris: Zero shs->cbuf0 when binding a passthrough TCS

Fixes valgrind errors when running two CTS tests back to back:
- KHR-GL45.shader_image_load_store.basic-allTargets-loadStoreT*
(The first test has an actual TCS, the second uses passthrough.)

---

 src/gallium/drivers/iris/iris_program.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index 24feb66fff7..691fb1fb258 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -1204,6 +1204,22 @@ iris_update_compiled_tcs(struct iris_context *ice)
       ice->state.dirty |= IRIS_DIRTY_TCS |
                           IRIS_DIRTY_BINDINGS_TCS |
                           IRIS_DIRTY_CONSTANTS_TCS;
+
+      if (!tcs) {
+         /* We're binding a passthrough TCS, which doesn't have uniforms.
+          * Since there's no actual TCS, the state tracker doesn't bother
+          * to call set_constant_buffers to clear stale constant buffers.
+          *
+          * We do upload TCS constants for the default tesslevel system
+          * values, however.  In this case, we would see stale constant
+          * data and try and read a dangling cbuf0->user_buffer pointer.
+          * Just zero out the stale constants to avoid the upload.
+          */
+         struct iris_shader_state *shs =
+            &ice->state.shaders[MESA_SHADER_TESS_CTRL];
+
+         memset(&shs->cbuf0, 0, sizeof(shs->cbuf0));
+      }
    }
 }
 




More information about the mesa-commit mailing list