i965/nir: Do lower_io late for fragment shaders
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 17 Feb 2016 21:23:45 +0000 (13:23 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Feb 2016 23:55:59 +0000 (15:55 -0800)
The Vulkan driver wants to be able to delete fragment outputs that are
beyond key.nr_color_regions; this is a lot easier if we lower outputs at
specialization time rather than link time.

(Rationale added to commit message by Ken)

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_nir.c

index b5060408d9542dc7064846868011e575847eafb7..6c9ba36a696ce4fb27285387ed547dbf0b1e2488 100644 (file)
@@ -5594,6 +5594,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
    nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
    shader = brw_nir_apply_sampler_key(shader, compiler->devinfo, &key->tex,
                                       true);
+   shader = brw_nir_lower_io(shader, compiler->devinfo, true, false, NULL);
    shader = brw_postprocess_nir(shader, compiler->devinfo, true);
 
    /* key->alpha_test_func means simulating alpha testing via discards,
index 41059b3227e53ab74d0ee8d28fb0cd83493f57b7..61acf38988c2a137ce157be45af92e8eb9343695 100644 (file)
@@ -627,7 +627,8 @@ brw_create_nir(struct brw_context *brw,
 
    if (nir->stage != MESA_SHADER_VERTEX &&
        nir->stage != MESA_SHADER_TESS_CTRL &&
-       nir->stage != MESA_SHADER_TESS_EVAL) {
+       nir->stage != MESA_SHADER_TESS_EVAL &&
+       nir->stage != MESA_SHADER_FRAGMENT) {
       nir = brw_nir_lower_io(nir, devinfo, is_scalar, false, NULL);
    }