mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-27 04:04:23 +08:00
radeonsi: prepare for making SI_NGG_CULL_TRIANGLES/LINES VS only, rename them
They will have no effect on TES and GS, so this will make it more obvious. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32257>
This commit is contained in:
parent
1b03b78bf8
commit
691a9ccb33
@ -18,7 +18,7 @@ unsigned gfx10_ngg_get_vertices_per_prim(struct si_shader *shader)
|
||||
if (info->base.vs.blit_sgprs_amd) {
|
||||
/* Blits always use axis-aligned rectangles with 3 vertices. */
|
||||
return 3;
|
||||
} else if (shader->key.ge.opt.ngg_culling & SI_NGG_CULL_LINES)
|
||||
} else if (shader->key.ge.opt.ngg_culling & SI_NGG_CULL_VS_LINES)
|
||||
return 2;
|
||||
else {
|
||||
/* The shader compiler replaces 0 with 3. The generated code will be correct regardless
|
||||
|
@ -673,7 +673,7 @@ static bool lower_intrinsic(nir_builder *b, nir_instr *instr, struct lower_abi_s
|
||||
replacement = ac_nir_unpack_arg(b, &args->ac, args->ac.gs_tg_info, 22, 9);
|
||||
break;
|
||||
case nir_intrinsic_load_initial_edgeflags_amd:
|
||||
if (shader->key.ge.opt.ngg_culling & SI_NGG_CULL_LINES ||
|
||||
if (shader->key.ge.opt.ngg_culling & SI_NGG_CULL_VS_LINES ||
|
||||
(shader->selector->stage == MESA_SHADER_VERTEX &&
|
||||
shader->selector->info.base.vs.blit_sgprs_amd)) {
|
||||
/* Line primitives and blits don't need edge flags. */
|
||||
|
@ -328,10 +328,13 @@ enum
|
||||
MAX_SI_VS_BLIT_SGPRS = 10, /* +1 for the attribute ring address */
|
||||
};
|
||||
|
||||
#define SI_NGG_CULL_TRIANGLES (1 << 0) /* this implies W, view.xy, and small prim culling */
|
||||
#define SI_NGG_CULL_BACK_FACE (1 << 1) /* back faces */
|
||||
#define SI_NGG_CULL_FRONT_FACE (1 << 2) /* front faces */
|
||||
#define SI_NGG_CULL_LINES (1 << 3) /* the primitive type is lines */
|
||||
/* The following two are only set for vertex shaders that cull.
|
||||
* TES and GS get the primitive type from shader_info.
|
||||
*/
|
||||
#define SI_NGG_CULL_VS_TRIANGLES (1 << 0) /* this implies W, view.xy, and small prim culling */
|
||||
#define SI_NGG_CULL_VS_LINES (1 << 1) /* this implies W and view.xy culling */
|
||||
#define SI_NGG_CULL_BACK_FACE (1 << 2) /* back faces */
|
||||
#define SI_NGG_CULL_FRONT_FACE (1 << 3) /* front faces */
|
||||
#define SI_NGG_CULL_SMALL_LINES_DIAMOND_EXIT (1 << 4) /* cull small lines according to the diamond exit rule */
|
||||
#define SI_NGG_CULL_CLIP_PLANE_ENABLE(enable) (((enable) & 0xff) << 5)
|
||||
#define SI_NGG_CULL_GET_CLIP_PLANE_ENABLE(x) (((x) >> 5) & 0xff)
|
||||
@ -1118,7 +1121,7 @@ static inline bool gfx10_edgeflags_have_effect(struct si_shader *shader)
|
||||
{
|
||||
if (shader->selector->stage == MESA_SHADER_VERTEX &&
|
||||
!shader->selector->info.base.vs.blit_sgprs_amd &&
|
||||
!(shader->key.ge.opt.ngg_culling & SI_NGG_CULL_LINES))
|
||||
!(shader->key.ge.opt.ngg_culling & SI_NGG_CULL_VS_LINES))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -1015,12 +1015,10 @@ static void *si_create_rs_state(struct pipe_context *ctx, const struct pipe_rast
|
||||
S_028810_DX_RASTERIZATION_KILL(state->rasterizer_discard) |
|
||||
S_028810_DX_LINEAR_ATTR_CLIP_ENA(1);
|
||||
|
||||
rs->ngg_cull_flags_tris = SI_NGG_CULL_TRIANGLES |
|
||||
SI_NGG_CULL_CLIP_PLANE_ENABLE(state->clip_plane_enable);
|
||||
rs->ngg_cull_flags_tris = SI_NGG_CULL_CLIP_PLANE_ENABLE(state->clip_plane_enable);
|
||||
rs->ngg_cull_flags_tris_y_inverted = rs->ngg_cull_flags_tris;
|
||||
|
||||
rs->ngg_cull_flags_lines = SI_NGG_CULL_LINES |
|
||||
(!rs->perpendicular_end_caps ? SI_NGG_CULL_SMALL_LINES_DIAMOND_EXIT : 0) |
|
||||
rs->ngg_cull_flags_lines = (!rs->perpendicular_end_caps ? SI_NGG_CULL_SMALL_LINES_DIAMOND_EXIT : 0) |
|
||||
SI_NGG_CULL_CLIP_PLANE_ENABLE(state->clip_plane_enable);
|
||||
|
||||
if (rs->rasterizer_discard) {
|
||||
|
@ -2249,10 +2249,11 @@ static void si_draw(struct pipe_context *ctx,
|
||||
if (util_prim_is_lines(sctx->current_rast_prim)) {
|
||||
/* Overwrite it to mask out face cull flags. */
|
||||
ngg_culling = rs->ngg_cull_flags_lines;
|
||||
ngg_culling |= SI_NGG_CULL_VS_LINES;
|
||||
} else {
|
||||
ngg_culling = sctx->viewport0_y_inverted ? rs->ngg_cull_flags_tris_y_inverted :
|
||||
rs->ngg_cull_flags_tris;
|
||||
assert(ngg_culling); /* rasterizer state should always set this to non-zero */
|
||||
ngg_culling |= SI_NGG_CULL_VS_TRIANGLES;
|
||||
}
|
||||
|
||||
if (ngg_culling != old_ngg_culling) {
|
||||
|
@ -1365,7 +1365,7 @@ unsigned si_get_input_prim(const struct si_shader_selector *gs, const union si_s
|
||||
return MESA_PRIM_TRIANGLES;
|
||||
}
|
||||
|
||||
if (key->ge.opt.ngg_culling & SI_NGG_CULL_LINES)
|
||||
if (key->ge.opt.ngg_culling & SI_NGG_CULL_VS_LINES)
|
||||
return MESA_PRIM_LINES;
|
||||
|
||||
return MESA_PRIM_TRIANGLES; /* worst case for all callers */
|
||||
|
Loading…
Reference in New Issue
Block a user