summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c32
-rw-r--r--src/gallium/drivers/vc4/vc4_screen.c3
-rw-r--r--src/gallium/drivers/vc4/vc4_screen.h4
3 files changed, 31 insertions, 8 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 1e8542fc27f..dd8c4210eee 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1971,8 +1971,16 @@ static const nir_shader_compiler_options nir_options = {
.lower_fsat = true,
.lower_fsqrt = true,
.lower_negate = true,
+ .native_integers = true,
};
+const void *
+vc4_screen_get_compiler_options(struct pipe_screen *pscreen,
+ enum pipe_shader_ir ir, unsigned shader)
+{
+ return &nir_options;
+}
+
static int
count_nir_instrs(nir_shader *nir)
{
@@ -2181,14 +2189,24 @@ vc4_shader_state_create(struct pipe_context *pctx,
so->program_id = vc4->next_uncompiled_program_id++;
- if (vc4_debug & VC4_DEBUG_TGSI) {
- fprintf(stderr, "prog %d TGSI:\n",
- so->program_id);
- tgsi_dump(cso->tokens, 0);
- fprintf(stderr, "\n");
- }
+ nir_shader *s;
- nir_shader *s = tgsi_to_nir(cso->tokens, &nir_options);
+ if (cso->type == PIPE_SHADER_IR_NIR) {
+ /* The backend takes ownership of the NIR shader on state
+ * creation.
+ */
+ s = cso->ir.nir;
+ } else {
+ assert(cso->type == PIPE_SHADER_IR_TGSI);
+
+ if (vc4_debug & VC4_DEBUG_TGSI) {
+ fprintf(stderr, "prog %d TGSI:\n",
+ so->program_id);
+ tgsi_dump(cso->tokens, 0);
+ fprintf(stderr, "\n");
+ }
+ s = tgsi_to_nir(cso->tokens, &nir_options);
+ }
NIR_PASS_V(s, nir_opt_global_to_local);
NIR_PASS_V(s, nir_convert_to_ssa);
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 1c3c605c2da..9e08e561c3e 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -386,7 +386,7 @@ vc4_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
return VC4_MAX_TEXTURE_SAMPLERS;
case PIPE_SHADER_CAP_PREFERRED_IR:
- return PIPE_SHADER_IR_TGSI;
+ return PIPE_SHADER_IR_NIR;
case PIPE_SHADER_CAP_SUPPORTED_IRS:
return 0;
case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT:
@@ -633,6 +633,7 @@ vc4_screen_create(int fd)
pscreen->get_name = vc4_screen_get_name;
pscreen->get_vendor = vc4_screen_get_vendor;
pscreen->get_device_vendor = vc4_screen_get_vendor;
+ pscreen->get_compiler_options = vc4_screen_get_compiler_options;
return pscreen;
diff --git a/src/gallium/drivers/vc4/vc4_screen.h b/src/gallium/drivers/vc4/vc4_screen.h
index 1bbede25422..36fe1c74e95 100644
--- a/src/gallium/drivers/vc4/vc4_screen.h
+++ b/src/gallium/drivers/vc4/vc4_screen.h
@@ -100,6 +100,10 @@ struct vc4_bo *
vc4_screen_bo_from_handle(struct pipe_screen *pscreen,
struct winsys_handle *whandle);
+const void *
+vc4_screen_get_compiler_options(struct pipe_screen *pscreen,
+ enum pipe_shader_ir ir, unsigned shader);
+
extern uint32_t vc4_debug;
void