#define ATI_VENDOR_ID 0x1002
#define SI_NOT_QUERY 0xffffffff
+/* special primitive types */
+#define SI_PRIM_RECTANGLE_LIST PIPE_PRIM_MAX
+
/* The base vertex and primitive restart can be any number, but we must pick
* one which will mean "unknown" for the purpose of state tracking and
* the number shouldn't be a commonly-used one. */
unsigned last_vs_state;
unsigned last_gs_state;
enum pipe_prim_type current_rast_prim; /* primitive type after TES, GS */
+ unsigned gs_out_prim;
struct si_small_prim_cull_info last_small_prim_cull_info;
struct si_resource *small_prim_cull_info_buf;
si_set_rasterized_prim(struct si_context *sctx, enum pipe_prim_type rast_prim)
{
if (rast_prim != sctx->current_rast_prim) {
- if (util_prim_is_points_or_lines(sctx->current_rast_prim) !=
- util_prim_is_points_or_lines(rast_prim))
+ bool is_rect = rast_prim == SI_PRIM_RECTANGLE_LIST;
+ bool is_points = rast_prim == PIPE_PRIM_POINTS;
+ bool is_lines = util_prim_is_lines(rast_prim);
+ bool is_triangles = util_rast_prim_is_triangles(rast_prim);
+
+ if ((is_points || is_lines) != util_prim_is_points_or_lines(sctx->current_rast_prim))
si_mark_atom_dirty(sctx, &sctx->atoms.s.guardband);
sctx->current_rast_prim = rast_prim;
+ sctx->gs_out_prim = is_triangles ? V_028A6C_TRISTRIP :
+ is_lines ? V_028A6C_LINESTRIP :
+ is_rect ? V_028A6C_RECTLIST : V_028A6C_POINTLIST;
sctx->do_update_shaders = true;
}
}
#error "Unknown gfx level"
#endif
-/* special primitive types */
-#define SI_PRIM_RECTANGLE_LIST PIPE_PRIM_MAX
-
template<int NUM_INTERP>
static void si_emit_spi_map(struct si_context *sctx)
{
return ia_multi_vgt_param;
}
-ALWAYS_INLINE
-static unsigned si_conv_prim_to_gs_out(unsigned mode)
-{
- static const int prim_conv[] = {
- [PIPE_PRIM_POINTS] = V_028A6C_POINTLIST,
- [PIPE_PRIM_LINES] = V_028A6C_LINESTRIP,
- [PIPE_PRIM_LINE_LOOP] = V_028A6C_LINESTRIP,
- [PIPE_PRIM_LINE_STRIP] = V_028A6C_LINESTRIP,
- [PIPE_PRIM_TRIANGLES] = V_028A6C_TRISTRIP,
- [PIPE_PRIM_TRIANGLE_STRIP] = V_028A6C_TRISTRIP,
- [PIPE_PRIM_TRIANGLE_FAN] = V_028A6C_TRISTRIP,
- [PIPE_PRIM_QUADS] = V_028A6C_TRISTRIP,
- [PIPE_PRIM_QUAD_STRIP] = V_028A6C_TRISTRIP,
- [PIPE_PRIM_POLYGON] = V_028A6C_TRISTRIP,
- [PIPE_PRIM_LINES_ADJACENCY] = V_028A6C_LINESTRIP,
- [PIPE_PRIM_LINE_STRIP_ADJACENCY] = V_028A6C_LINESTRIP,
- [PIPE_PRIM_TRIANGLES_ADJACENCY] = V_028A6C_TRISTRIP,
- [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_028A6C_TRISTRIP,
- [PIPE_PRIM_PATCHES] = V_028A6C_POINTLIST,
- [SI_PRIM_RECTANGLE_LIST] = V_028A6C_RECTLIST,
- };
- assert(mode < ARRAY_SIZE(prim_conv));
-
- return prim_conv[mode];
-}
-
/* rast_prim is the primitive type after GS. */
template<amd_gfx_level GFX_VERSION, si_has_tess HAS_TESS, si_has_gs HAS_GS, si_has_ngg NGG> ALWAYS_INLINE
static void si_emit_rasterizer_prim_state(struct si_context *sctx)
value);
}
- unsigned gs_out_prim = si_conv_prim_to_gs_out(rast_prim);
+ unsigned gs_out_prim = sctx->gs_out_prim;
if (unlikely(gs_out_prim != sctx->last_gs_out_prim && (NGG || HAS_GS))) {
if (GFX_VERSION >= GFX11)
radeon_set_uconfig_reg(R_030998_VGT_GS_OUT_PRIM_TYPE, gs_out_prim);