aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-02-05 10:22:30 -0800
committerEric Anholt <[email protected]>2019-02-05 12:12:33 -0800
commitaaef12702f3b3a9e0464468948b1cbfaf4a66cd2 (patch)
tree9c4762e7e55b4108a7d4b25764952df89329f15a /src/gallium
parent8943eb8f03fe67710ce65fc0a54024751ff2b5bd (diff)
nir: Move V3D's "the shader was TGSI, ignore FS output types" flag to NIR.
Ken's rework of mesa/st builtins to NIR means that we'll have more NIR shaders with color output types that are mismatched with the render target types. Since this is behavior that GLSL doesn't require, add it as a shader_info option so the driver can know that it needs to ignore the FS output's base type in favor of the actual render target's. This prevents needing additional variants in several mesa/st paths (clear, pbo upload, pbo download), given that the driver already has to handle the variants for any TGSI being passed to it (from u_blitter, for example). Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c3
-rw-r--r--src/gallium/drivers/v3d/v3d_context.h7
-rw-r--r--src/gallium/drivers/v3d/v3d_program.c5
3 files changed, 5 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 10e24387849..4f30714a746 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -1798,6 +1798,9 @@ tgsi_to_nir(const void *tgsi_tokens,
options);
s = c->build.shader;
+ if (s->info.stage == MESA_SHADER_FRAGMENT)
+ s->info.fs.untyped_color_outputs = true;
+
s->num_inputs = scan.file_max[TGSI_FILE_INPUT] + 1;
s->num_uniforms = scan.const_file_max[0] + 1;
s->num_outputs = scan.file_max[TGSI_FILE_OUTPUT] + 1;
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h
index f8f0e64ef9d..f3309cc3e51 100644
--- a/src/gallium/drivers/v3d/v3d_context.h
+++ b/src/gallium/drivers/v3d/v3d_context.h
@@ -176,13 +176,6 @@ struct v3d_uncompiled_shader {
uint16_t tf_specs[16];
uint16_t tf_specs_psiz[16];
uint32_t num_tf_specs;
-
- /**
- * Flag for if the NIR in this shader originally came from TGSI. If
- * so, we need to do some fixups at compile time, due to missing
- * information in TGSI that exists in NIR.
- */
- bool was_tgsi;
};
struct v3d_compiled_shader {
diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c
index 567af2ead44..bebcf196ee8 100644
--- a/src/gallium/drivers/v3d/v3d_program.c
+++ b/src/gallium/drivers/v3d/v3d_program.c
@@ -277,8 +277,6 @@ v3d_shader_state_create(struct pipe_context *pctx,
fprintf(stderr, "\n");
}
s = tgsi_to_nir(cso->tokens, &v3d_nir_options);
-
- so->was_tgsi = true;
}
nir_variable_mode lower_mode = nir_var_all & ~nir_var_uniform;
@@ -488,6 +486,7 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode)
struct v3d_job *job = v3d->job;
struct v3d_fs_key local_key;
struct v3d_fs_key *key = &local_key;
+ nir_shader *s = v3d->prog.bind_fs->base.ir.nir;
if (!(v3d->dirty & (VC5_DIRTY_PRIM_MODE |
VC5_DIRTY_BLEND |
@@ -546,7 +545,7 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode)
key->f32_color_rb |= 1 << i;
}
- if (v3d->prog.bind_fs->was_tgsi) {
+ if (s->info.fs.untyped_color_outputs) {
if (util_format_is_pure_uint(cbuf->format))
key->uint_color_rb |= 1 << i;
else if (util_format_is_pure_sint(cbuf->format))