aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-03-21 11:42:04 -0400
committerRob Clark <[email protected]>2016-05-15 17:25:48 -0400
commit2f1581059b31a99e8f15dff6339a4bd80baebe1b (patch)
treed29ab8257154adeeff130a21489cbf4dfeb27572 /src/gallium
parent784086f3c1f50ca78fe62f925dfe66fb3aa5f22c (diff)
freedreno/ir3: disable TGSI specific hacks in nir case
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 <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_cmdline.c1
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c4
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_shader.c1
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_shader.h3
4 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
index 7007d20d221..47bcec42751 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
@@ -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);
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index a81aee38f36..33b2b7ba7bf 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -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;
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
index cd596cf25a8..ee0018f5f4c 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
@@ -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);
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
index 077ba5db379..c17a76be189 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
@@ -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;