/* Shader IO unique indices are supported for TGSI_SEMANTIC_GENERIC with an
* index smaller than this.
*/
-#define SI_MAX_IO_GENERIC 43
+#define SI_MAX_IO_GENERIC 32
/* SGPR user data indices */
enum {
};
/* Fields of driver-defined VS state SGPR. */
-/* Clamp vertex color output (only used in VS as VS). */
#define S_VS_STATE_CLAMP_VERTEX_COLOR(x) (((unsigned)(x) & 0x1) << 0)
#define C_VS_STATE_CLAMP_VERTEX_COLOR 0xFFFFFFFE
#define S_VS_STATE_INDEXED(x) (((unsigned)(x) & 0x1) << 1)
#define C_VS_STATE_INDEXED 0xFFFFFFFD
+#define S_VS_STATE_OUTPRIM(x) (((unsigned)(x) & 0x3) << 2)
+#define C_VS_STATE_OUTPRIM 0xFFFFFFF3
+#define S_VS_STATE_PROVOKING_VTX_INDEX(x) (((unsigned)(x) & 0x3) << 4)
+#define C_VS_STATE_PROVOKING_VTX_INDEX 0xFFFFFFCF
+#define S_VS_STATE_STREAMOUT_QUERY_ENABLED(x) (((unsigned)(x) & 0x1) << 6)
+#define C_VS_STATE_STREAMOUT_QUERY_ENABLED 0xFFFFFFBF
#define S_VS_STATE_LS_OUT_PATCH_SIZE(x) (((unsigned)(x) & 0x1FFF) << 8)
#define C_VS_STATE_LS_OUT_PATCH_SIZE 0xFFE000FF
#define S_VS_STATE_LS_OUT_VERTEX_SIZE(x) (((unsigned)(x) & 0xFF) << 24)
/* Values from set_tess_state. */
TGSI_SEMANTIC_DEFAULT_TESSOUTER_SI = TGSI_SEMANTIC_COUNT,
TGSI_SEMANTIC_DEFAULT_TESSINNER_SI,
-
- /* Up to 4 dwords in user SGPRs for compute shaders. */
- TGSI_SEMANTIC_CS_USER_DATA,
};
enum {
/* Use a property enum that CS wouldn't use. */
TGSI_PROPERTY_CS_LOCAL_SIZE = TGSI_PROPERTY_FS_COORD_ORIGIN,
- /* The number of used user data dwords in the range [1, 4]. */
- TGSI_PROPERTY_CS_USER_DATA_DWORDS = TGSI_PROPERTY_FS_COORD_PIXEL_CENTER,
-
- /* Use a property enum that VS wouldn't use. */
- TGSI_PROPERTY_VS_BLIT_SGPRS = TGSI_PROPERTY_FS_COORD_ORIGIN,
-
/* These represent the number of SGPRs the shader uses. */
SI_VS_BLIT_SGPRS_POS = 3,
SI_VS_BLIT_SGPRS_POS_COLOR = 7,
struct si_shader *main_shader_part;
struct si_shader *main_shader_part_ls; /* as_ls is set in the key */
struct si_shader *main_shader_part_es; /* as_es is set in the key */
+ struct si_shader *main_shader_part_ngg; /* as_ngg is set in the key */
+ struct si_shader *main_shader_part_ngg_es; /* for Wave32 TES before legacy GS */
struct si_shader *gs_copy_shader;
struct tgsi_tessctrl_info tcs_info;
/* PIPE_SHADER_[VERTEX|FRAGMENT|...] */
- unsigned type;
+ enum pipe_shader_type type;
bool vs_needs_prolog;
bool force_correct_derivs_after_kill;
bool prim_discard_cs_allowed;
+ bool ngg_writes_edgeflag;
+ bool pos_writes_edgeflag;
unsigned pa_cl_vs_out_cntl;
ubyte clipdist_mask;
ubyte culldist_mask;
+ unsigned rast_prim;
/* ES parameters. */
unsigned esgs_itemsize; /* vertex stride */
unsigned gsvs_vertex_size;
unsigned max_gsvs_emit_size;
unsigned enabled_streamout_buffer_mask;
+ bool tess_turns_off_ngg;
/* PS parameters. */
unsigned color_attr_index[2];
/* Valid shader configurations:
*
- * API shaders VS | TCS | TES | GS |pass| PS
- * are compiled as: | | | |thru|
- * | | | | |
- * Only VS & PS: VS | | | | | PS
- * GFX6 - with GS: ES | | | GS | VS | PS
- * - with tess: LS | HS | VS | | | PS
- * - with both: LS | HS | ES | GS | VS | PS
- * GFX9 - with GS: -> | | | GS | VS | PS
- * - with tess: -> | HS | VS | | | PS
- * - with both: -> | HS | -> | GS | VS | PS
+ * API shaders VS | TCS | TES | GS |pass| PS
+ * are compiled as: | | | |thru|
+ * | | | | |
+ * Only VS & PS: VS | | | | | PS
+ * GFX6 - with GS: ES | | | GS | VS | PS
+ * - with tess: LS | HS | VS | | | PS
+ * - with both: LS | HS | ES | GS | VS | PS
+ * GFX9 - with GS: -> | | | GS | VS | PS
+ * - with tess: -> | HS | VS | | | PS
+ * - with both: -> | HS | -> | GS | VS | PS
+ * | | | | |
+ * NGG - VS & PS: GS | | | | | PS
+ * (GFX10+) - with GS: -> | | | GS | | PS
+ * - with tess: -> | HS | GS | | | PS
+ * - with both: -> | HS | -> | GS | | PS
*
* -> = merged with the next stage
*/
unsigned last_input:4;
unsigned as_ls:1;
unsigned as_es:1;
+ unsigned as_ngg:1;
/* Prologs for monolithic shaders shouldn't set EXEC. */
unsigned is_monolithic:1;
} vs_prolog;
struct si_gs_prolog_bits states;
/* Prologs of monolithic shaders shouldn't set EXEC. */
unsigned is_monolithic:1;
+ unsigned as_ngg:1;
} gs_prolog;
struct {
struct si_ps_prolog_bits states;
} ps;
} part;
- /* These two are initially set according to the NEXT_SHADER property,
+ /* These three are initially set according to the NEXT_SHADER property,
* or guessed if the property doesn't seem correct.
*/
unsigned as_es:1; /* export shader, which precedes GS */
unsigned as_ls:1; /* local shader, which precedes TCS */
+ unsigned as_ngg:1; /* VS, TES, or GS compiled as NGG primitive shader */
/* Flags for monolithic compilation only. */
struct {
unsigned vs_export_prim_id:1;
struct {
unsigned interpolate_at_sample_force_center:1;
- unsigned fbfetch_msaa;
- unsigned fbfetch_is_1D;
- unsigned fbfetch_layered;
+ unsigned fbfetch_msaa:1;
+ unsigned fbfetch_is_1D:1;
+ unsigned fbfetch_layered:1;
} ps;
} u;
} mono;
struct ac_shader_config config;
struct si_shader_info info;
+ struct {
+ uint16_t ngg_emit_size; /* in dwords */
+ uint16_t hw_max_esverts;
+ uint16_t max_gsprims;
+ uint16_t max_out_verts;
+ uint16_t prim_amp_factor;
+ bool max_vert_out_per_gs_instance;
+ } ngg;
+
/* Shader key + LLVM IR + disassembly + statistics.
* Generated for debug contexts only.
*/
unsigned vgt_gsvs_ring_offset_1;
unsigned vgt_gsvs_ring_offset_2;
unsigned vgt_gsvs_ring_offset_3;
- unsigned vgt_gs_out_prim_type;
unsigned vgt_gsvs_ring_itemsize;
unsigned vgt_gs_max_vert_out;
unsigned vgt_gs_vert_itemsize;
unsigned vgt_esgs_ring_itemsize;
} gs;
+ struct {
+ unsigned ge_max_output_per_subgroup;
+ unsigned ge_ngg_subgrp_cntl;
+ unsigned vgt_primitiveid_en;
+ unsigned vgt_gs_onchip_cntl;
+ unsigned vgt_gs_instance_cnt;
+ unsigned vgt_esgs_ring_itemsize;
+ unsigned spi_vs_out_config;
+ unsigned spi_shader_idx_format;
+ unsigned spi_shader_pos_format;
+ unsigned pa_cl_vte_cntl;
+ unsigned pa_cl_ngg_cntl;
+ unsigned vgt_gs_max_vert_out; /* for API GS */
+ } ngg;
+
struct {
unsigned vgt_gs_mode;
unsigned vgt_primitiveid_en;
/*For save precompute registers value */
unsigned vgt_tf_param; /* VGT_TF_PARAM */
unsigned vgt_vertex_reuse_block_cntl; /* VGT_VERTEX_REUSE_BLOCK_CNTL */
+ unsigned ge_cntl;
};
struct si_shader_part {
bool si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader,
uint64_t scratch_va);
void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
- struct pipe_debug_callback *debug, unsigned processor,
+ struct pipe_debug_callback *debug,
FILE *f, bool check_debug_option);
void si_shader_dump_stats_for_shader_db(struct si_screen *screen,
struct si_shader *shader,
struct pipe_debug_callback *debug);
void si_multiwave_lds_size_workaround(struct si_screen *sscreen,
unsigned *lds_size);
-const char *si_get_shader_name(const struct si_shader *shader, unsigned processor);
+const char *si_get_shader_name(const struct si_shader *shader);
void si_shader_binary_clean(struct si_shader_binary *binary);
/* si_shader_nir.c */
struct tgsi_shader_info *info);
void si_nir_scan_tess_ctrl(const struct nir_shader *nir,
struct tgsi_tessctrl_info *out);
-void si_lower_nir(struct si_shader_selector *sel);
+void si_nir_lower_ps_inputs(struct nir_shader *nir);
+void si_lower_nir(struct si_shader_selector *sel, unsigned wave_size);
void si_nir_opts(struct nir_shader *nir);
/* si_state_shaders.c */
{
if (key->as_ls)
return &sel->main_shader_part_ls;
+ if (key->as_es && key->as_ngg)
+ return &sel->main_shader_part_ngg_es;
if (key->as_es)
return &sel->main_shader_part_es;
+ if (key->as_ngg)
+ return &sel->main_shader_part_ngg;
return &sel->main_shader_part;
}