diff options
author | Kristian H. Kristensen <[email protected]> | 2019-10-22 17:16:09 -0700 |
---|---|---|
committer | Kristian H. Kristensen <[email protected]> | 2019-11-07 16:36:56 -0800 |
commit | 8621fbc37b205b142639a582cf6a2a76d68b25cb (patch) | |
tree | 47ea88798ef80e6b6ea9f0de93cb99c77ebb5cc6 | |
parent | 77b96b843e4d58a1462976dacf6ae314de815881 (diff) |
freedreno/ir3: Add tessellation field to shader key
Whether we're tessellating and which primitives the TES outputs
affects the entire pipeline so let's add a field to the key to track
that.
Signed-off-by: Kristian H. Kristensen <[email protected]>
Acked-by: Eric Anholt <[email protected]>
Reviewed-by: Rob Clark <[email protected]>
-rw-r--r-- | src/freedreno/ir3/ir3_nir.c | 2 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_shader.h | 33 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_draw.c | 17 |
3 files changed, 51 insertions, 1 deletions
diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 99659a7ddef..ab092ff1eda 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -104,7 +104,7 @@ ir3_key_lowers_nir(const struct ir3_shader_key *key) key->vsaturate_s | key->vsaturate_t | key->vsaturate_r | key->ucp_enables | key->color_two_side | key->fclamp_color | key->vclamp_color | - key->has_gs; + key->tessellation | key->has_gs; } #define OPT(nir, pass, ...) ({ \ diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index 84a7807a0c8..c829422ca4d 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -249,6 +249,17 @@ struct ir3_shader_key { unsigned rasterflat : 1; unsigned fclamp_color : 1; + /* Indicates that this is a tessellation pipeline which requires a + * whole different kind of vertex shader. In case of + * tessellation, this field also tells us which kind of output + * topology the TES uses, which the TCS needs to know. + */ +#define IR3_TESS_NONE 0 +#define IR3_TESS_TRIANGLES 1 +#define IR3_TESS_QUADS 2 +#define IR3_TESS_ISOLINES 3 + unsigned tessellation : 2; + unsigned has_gs : 1; }; uint32_t global; @@ -348,6 +359,7 @@ ir3_normalize_key(struct ir3_shader_key *key, gl_shader_stage type) key->vastc_srgb = 0; key->vsamples = 0; key->has_gs = false; /* FS doesn't care */ + key->tessellation = IR3_TESS_NONE; } break; case MESA_SHADER_VERTEX: @@ -362,6 +374,27 @@ ir3_normalize_key(struct ir3_shader_key *key, gl_shader_stage type) key->fastc_srgb = 0; key->fsamples = 0; } + + /* VS and GS only care about whether or not we're tessellating. */ + key->tessellation = !!key->tessellation; + break; + case MESA_SHADER_TESS_CTRL: + case MESA_SHADER_TESS_EVAL: + key->color_two_side = false; + key->half_precision = false; + key->rasterflat = false; + if (key->has_per_samp) { + key->fsaturate_s = 0; + key->fsaturate_t = 0; + key->fsaturate_r = 0; + key->fastc_srgb = 0; + key->fsamples = 0; + key->vsaturate_s = 0; + key->vsaturate_t = 0; + key->vsaturate_r = 0; + key->vastc_srgb = 0; + key->vsamples = 0; + } break; default: /* TODO */ diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c index fcf0dc19233..a635e66d932 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c @@ -157,6 +157,23 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info, .sprite_coord_mode = ctx->rasterizer->sprite_coord_mode, }; + if (info->mode == PIPE_PRIM_PATCHES) { + shader_info *ds_info = &emit.key.ds->nir->info; + switch (ds_info->tess.primitive_mode) { + case GL_ISOLINES: + emit.key.key.tessellation = IR3_TESS_ISOLINES; + break; + case GL_TRIANGLES: + emit.key.key.tessellation = IR3_TESS_TRIANGLES; + break; + case GL_QUADS: + emit.key.key.tessellation = IR3_TESS_QUADS; + break; + default: + unreachable("bad tessmode"); + } + } + if (emit.key.gs) emit.key.key.has_gs = true; |