[Mesa-dev] [PATCH] i965: Fix SHADER_OPCODE_UNTYPED_SURFACE_WRITE to mark written surfaces

Iago Toral Quiroga itoral at igalia.com
Tue May 5 04:30:30 PDT 2015

We can do this when the surface index is an immediate, as we do for
reads. Otherwise the visitor should handle this.
Francisco, maybe you choose not to do this for a reason? It seems a bit
inconsistent with the reads though. Also, other read/write messages seem
to mark surfaces in the generator when the surface index is an immediate
and leave the visitor to handle non-immediate scenarios.

 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index b8b8ed1..cf4b9ae 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -2247,6 +2247,8 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
          assert(src[2].file == BRW_IMMEDIATE_VALUE);
          brw_untyped_surface_write(p, src[0], src[1],
                                    inst->mlen, src[2].dw1.ud);
+         if (src[1].file == BRW_IMMEDIATE_VALUE)
+            brw_mark_surface_used(prog_data, src[1].dw1.ud);

More information about the mesa-dev mailing list