freedreno/ir3: disable TGSI specific hacks in nir case
authorRob Clark <robclark@freedesktop.org>
Mon, 21 Mar 2016 15:42:04 +0000 (11:42 -0400)
committerRob Clark <robclark@freedesktop.org>
Sun, 15 May 2016 21:25:48 +0000 (17:25 -0400)
When we got NIR directly from state tracker (vs using tgsi_to_nir) we
need to realize this and skip some TGSI specific hacks.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
src/gallium/drivers/freedreno/ir3/ir3_shader.c
src/gallium/drivers/freedreno/ir3/ir3_shader.h

index 7007d20d221a2390790993a1a258a564d35ccf64..47bcec42751d9e8a00cf6fb0fa77832edd0cb488 100644 (file)
@@ -241,6 +241,7 @@ int main(int argc, char **argv)
                tgsi_dump(toks, 0);
 
        nir_shader *nir = ir3_tgsi_to_nir(toks);
+       s.from_tgsi = true;
        s.compiler = ir3_compiler_create(NULL, gpu_id);
        s.nir = ir3_optimize_nir(&s, nir, NULL);
 
index a81aee38f36d9fdc20e37fe4d88f2008fb19798f..33b2b7ba7bffa69e22bb97970d065cf929812500 100644 (file)
@@ -2488,8 +2488,8 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
                /* preserve hack for depth output.. tgsi writes depth to .z,
                 * but what we give the hw is the scalar register:
                 */
-               if ((so->type == SHADER_FRAGMENT) &&
-                       (so->outputs[i].slot == FRAG_RESULT_DEPTH))
+               if (so->shader->from_tgsi && (so->type == SHADER_FRAGMENT) &&
+                               (so->outputs[i].slot == FRAG_RESULT_DEPTH))
                        so->outputs[i].regid += 2;
        }
 
index cd596cf25a8fd67886d6bbfecf1fbdc9b14bc061..ee0018f5f4ced397447caa3ae7c1025507d83aba 100644 (file)
@@ -294,6 +294,7 @@ ir3_shader_create(struct ir3_compiler *compiler,
                        tgsi_dump(cso->tokens, 0);
                }
                nir = ir3_tgsi_to_nir(cso->tokens);
+               shader->from_tgsi = true;
        }
        /* do first pass optimization, ignoring the key: */
        shader->nir = ir3_optimize_nir(shader, nir, NULL);
index 077ba5db3797e1186895097a62dae8a99de4f212..c17a76be18998140b1973c90792876c961f95310 100644 (file)
@@ -252,6 +252,9 @@ struct ir3_shader {
        uint32_t id;
        uint32_t variant_count;
 
+       /* so we know when we can disable TGSI related hacks: */
+       bool from_tgsi;
+
        struct ir3_compiler *compiler;
 
        nir_shader *nir;