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 <hoegsberg@google.com> Acked-by: Eric Anholt <eric@anholt.net> Reviewed-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
77b96b843e
commit
8621fbc37b
|
@ -104,7 +104,7 @@ ir3_key_lowers_nir(const struct ir3_shader_key *key)
|
||||||
key->vsaturate_s | key->vsaturate_t | key->vsaturate_r |
|
key->vsaturate_s | key->vsaturate_t | key->vsaturate_r |
|
||||||
key->ucp_enables | key->color_two_side |
|
key->ucp_enables | key->color_two_side |
|
||||||
key->fclamp_color | key->vclamp_color |
|
key->fclamp_color | key->vclamp_color |
|
||||||
key->has_gs;
|
key->tessellation | key->has_gs;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OPT(nir, pass, ...) ({ \
|
#define OPT(nir, pass, ...) ({ \
|
||||||
|
|
|
@ -249,6 +249,17 @@ struct ir3_shader_key {
|
||||||
unsigned rasterflat : 1;
|
unsigned rasterflat : 1;
|
||||||
unsigned fclamp_color : 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;
|
unsigned has_gs : 1;
|
||||||
};
|
};
|
||||||
uint32_t global;
|
uint32_t global;
|
||||||
|
@ -348,6 +359,7 @@ ir3_normalize_key(struct ir3_shader_key *key, gl_shader_stage type)
|
||||||
key->vastc_srgb = 0;
|
key->vastc_srgb = 0;
|
||||||
key->vsamples = 0;
|
key->vsamples = 0;
|
||||||
key->has_gs = false; /* FS doesn't care */
|
key->has_gs = false; /* FS doesn't care */
|
||||||
|
key->tessellation = IR3_TESS_NONE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MESA_SHADER_VERTEX:
|
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->fastc_srgb = 0;
|
||||||
key->fsamples = 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;
|
break;
|
||||||
default:
|
default:
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
|
@ -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,
|
.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)
|
if (emit.key.gs)
|
||||||
emit.key.key.has_gs = true;
|
emit.key.key.has_gs = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue