v3d: Don't forget to include RT writes in precompiles.
authorEric Anholt <eric@anholt.net>
Sun, 30 Dec 2018 16:59:54 +0000 (08:59 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 2 Jan 2019 22:12:29 +0000 (14:12 -0800)
Looking at some assembly dumps for an optimization, we were clearly
missing important parts of the shader!

src/gallium/drivers/v3d/v3d_program.c

index ef80069..ec9d033 100644 (file)
@@ -197,6 +197,16 @@ v3d_shader_precompile(struct v3d_context *v3d,
                         .base.shader_state = so,
                 };
 
+                nir_foreach_variable(var, &s->outputs) {
+                        if (var->data.location == FRAG_RESULT_COLOR) {
+                                key.nr_cbufs = 1;
+                        } else if (var->data.location == FRAG_RESULT_DATA0) {
+                                key.nr_cbufs = MAX2(key.nr_cbufs,
+                                                    var->data.location -
+                                                    FRAG_RESULT_DATA0 + 1);
+                        }
+                }
+
                 v3d_setup_shared_precompile_key(so, &key.base);
                 v3d_get_compiled_shader(v3d, &key.base);
         } else {