* This happens before the shader is uploaded, since LDS relocations during
* upload depend on the subgroup size.
*/
-void gfx10_ngg_calculate_subgroup_info(struct si_shader *shader)
+bool gfx10_ngg_calculate_subgroup_info(struct si_shader *shader)
{
const struct si_shader_selector *gs_sel = shader->selector;
const struct si_shader_selector *es_sel =
shader->ngg.ngg_emit_size = max_gsprims * gsprim_lds_size;
assert(shader->ngg.hw_max_esverts >= 24); /* HW limitation */
+
+ /* If asserts are disabled, we use the same conditions to return false */
+ return max_esverts >= max_verts_per_prim && max_gsprims >= 1 &&
+ max_out_vertices <= 256 &&
+ shader->ngg.hw_max_esverts >= 24;
}
if (shader->key.as_ngg) {
assert(!shader->key.as_es && !shader->key.as_ls);
- gfx10_ngg_calculate_subgroup_info(shader);
+ if (!gfx10_ngg_calculate_subgroup_info(shader)) {
+ fprintf(stderr, "Failed to compute subgroup info\n");
+ return false;
+ }
} else if (sscreen->info.chip_class >= GFX9 && sel->type == PIPE_SHADER_GEOMETRY) {
gfx9_get_gs_info(shader->previous_stage_sel, sel, &shader->gs_info);
}
void gfx10_ngg_gs_emit_vertex(struct si_shader_context *ctx, unsigned stream, LLVMValueRef *addrs);
void gfx10_ngg_gs_emit_prologue(struct si_shader_context *ctx);
void gfx10_ngg_gs_emit_epilogue(struct si_shader_context *ctx);
-void gfx10_ngg_calculate_subgroup_info(struct si_shader *shader);
+bool gfx10_ngg_calculate_subgroup_info(struct si_shader *shader);
/* si_shader_llvm.c */
bool si_compile_llvm(struct si_screen *sscreen, struct si_shader_binary *binary,