summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/ir3
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2017-05-23 09:09:41 -0400
committerRob Clark <[email protected]>2017-05-23 12:26:35 -0400
commitc712a637b9c77c1372a721ce2f3094e999ee02ff (patch)
treedb39dec49139552c4b52861906246773f3a25e05 /src/gallium/drivers/freedreno/ir3
parent4531e67c47b44514a931e44a58a00284222fd305 (diff)
freedreno/ir3: need different compiler options for a5xx
vertex_id_zero_based differs.. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_cmdline.c8
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_nir.c21
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_nir.h2
3 files changed, 27 insertions, 4 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
index ba1bfa8b3b3..10cf9c45568 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
@@ -96,6 +96,8 @@ fixup_varying_slots(struct exec_list *var_list)
}
}
+static struct ir3_compiler *compiler;
+
static nir_shader *
load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage)
{
@@ -109,7 +111,7 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage)
if (!prog)
errx(1, "couldn't parse `%s'", files[0]);
- nir_shader *nir = glsl_to_nir(prog, stage, ir3_get_compiler_options());
+ nir_shader *nir = glsl_to_nir(prog, stage, ir3_get_compiler_options(compiler));
standalone_compiler_cleanup(prog);
@@ -366,6 +368,8 @@ int main(int argc, char **argv)
nir_shader *nir;
+ compiler = ir3_compiler_create(NULL, gpu_id);
+
if (s.from_tgsi) {
struct tgsi_token toks[65536];
@@ -392,7 +396,7 @@ int main(int argc, char **argv)
return -1;
}
- s.compiler = ir3_compiler_create(NULL, gpu_id);
+ s.compiler = compiler;
s.nir = ir3_optimize_nir(&s, nir, NULL);
v.key = key;
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
index d0083d8fc8d..9fb41fcce0c 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
@@ -52,6 +52,23 @@ static const nir_shader_compiler_options options = {
.lower_extract_word = true,
};
+static const nir_shader_compiler_options options_5xx = {
+ .lower_fpow = true,
+ .lower_fsat = true,
+ .lower_scmp = true,
+ .lower_flrp32 = true,
+ .lower_flrp64 = true,
+ .lower_ffract = true,
+ .lower_fmod32 = true,
+ .lower_fmod64 = true,
+ .lower_fdiv = true,
+ .fuse_ffma = true,
+ .native_integers = true,
+ .vertex_id_zero_based = false,
+ .lower_extract_byte = true,
+ .lower_extract_word = true,
+};
+
struct nir_shader *
ir3_tgsi_to_nir(const struct tgsi_token *tokens)
{
@@ -59,8 +76,10 @@ ir3_tgsi_to_nir(const struct tgsi_token *tokens)
}
const nir_shader_compiler_options *
-ir3_get_compiler_options(void)
+ir3_get_compiler_options(struct ir3_compiler *compiler)
{
+ if (compiler->gpu_id >= 500)
+ return &options_5xx;
return &options;
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.h b/src/gallium/drivers/freedreno/ir3/ir3_nir.h
index e1e95238c20..2e2e093b098 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.h
@@ -38,7 +38,7 @@ bool ir3_nir_lower_if_else(nir_shader *shader);
bool ir3_nir_apply_trig_workarounds(nir_shader *shader);
struct nir_shader * ir3_tgsi_to_nir(const struct tgsi_token *tokens);
-const nir_shader_compiler_options * ir3_get_compiler_options(void);
+const nir_shader_compiler_options * ir3_get_compiler_options(struct ir3_compiler *compiler);
bool ir3_key_lowers_nir(const struct ir3_shader_key *key);
struct nir_shader * ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
const struct ir3_shader_key *key);