memset(&sel, 0, sizeof(sel));
sel.screen = program->screen;
- tgsi_scan_shader(program->tokens, &sel.info);
- sel.tokens = program->tokens;
+
+ if (program->ir_type == PIPE_SHADER_IR_TGSI) {
+ tgsi_scan_shader(program->ir.tgsi, &sel.info);
+ sel.tokens = program->ir.tgsi;
+ } else {
+ assert(program->ir_type == PIPE_SHADER_IR_NIR);
+ sel.nir = program->ir.nir;
+
+ si_nir_scan_shader(sel.nir, &sel.info);
+ si_lower_nir(&sel);
+ }
+
+
sel.type = PIPE_SHADER_COMPUTE;
sel.local_size = program->local_size;
si_get_active_slot_masks(&sel.info,
sel.info.properties[TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH] == 0;
}
- FREE(program->tokens);
+ if (program->ir_type == PIPE_SHADER_IR_TGSI)
+ FREE(program->ir.tgsi);
+
program->shader.selector = NULL;
}
program->input_size = cso->req_input_mem;
program->use_code_object_v2 = cso->ir_type == PIPE_SHADER_IR_NATIVE;
- if (cso->ir_type == PIPE_SHADER_IR_TGSI) {
- program->tokens = tgsi_dup_tokens(cso->prog);
- if (!program->tokens) {
- FREE(program);
- return NULL;
+ if (cso->ir_type != PIPE_SHADER_IR_NATIVE) {
+ if (cso->ir_type == PIPE_SHADER_IR_TGSI) {
+ program->ir.tgsi = tgsi_dup_tokens(cso->prog);
+ if (!program->ir.tgsi) {
+ FREE(program);
+ return NULL;
+ }
+ } else {
+ assert(cso->ir_type == PIPE_SHADER_IR_NIR);
+ program->ir.nir = (struct nir_shader *) cso->prog;
}
program->compiler_ctx_state.debug = sctx->debug;
return;
/* Wait because we need active slot usage masks. */
- if (program->ir_type == PIPE_SHADER_IR_TGSI)
+ if (program->ir_type != PIPE_SHADER_IR_NATIVE)
util_queue_fence_wait(&program->ready);
si_set_active_descriptors(sctx,
sctx->cs_shader_state.offset == offset)
return true;
- if (program->ir_type == PIPE_SHADER_IR_TGSI) {
+ if (program->ir_type != PIPE_SHADER_IR_NATIVE) {
config = &shader->config;
} else {
unsigned lds_blocks;
sctx->b.flags |= SI_CONTEXT_PS_PARTIAL_FLUSH |
SI_CONTEXT_CS_PARTIAL_FLUSH;
- if (program->ir_type == PIPE_SHADER_IR_TGSI &&
+ if (program->ir_type != PIPE_SHADER_IR_NATIVE &&
program->shader.compilation_failed)
return;
RADEON_PRIO_COMPUTE_GLOBAL);
}
- if (program->ir_type == PIPE_SHADER_IR_TGSI)
+ if (program->ir_type != PIPE_SHADER_IR_NATIVE)
si_setup_tgsi_grid(sctx, info);
si_emit_dispatch_packets(sctx, info);
void si_destroy_compute(struct si_compute *program)
{
- if (program->ir_type == PIPE_SHADER_IR_TGSI) {
+ if (program->ir_type != PIPE_SHADER_IR_NATIVE) {
util_queue_drop_job(&program->screen->shader_compiler_queue,
&program->ready);
util_queue_fence_destroy(&program->ready);
static unsigned get_max_threads_per_block(struct si_screen *screen,
enum pipe_shader_ir ir_type)
{
- if (ir_type != PIPE_SHADER_IR_TGSI)
+ if (ir_type == PIPE_SHADER_IR_NATIVE)
return 256;
/* Only 16 waves per thread-group on gfx9. */
case PIPE_COMPUTE_CAP_MAX_VARIABLE_THREADS_PER_BLOCK:
if (ret) {
uint64_t *max_variable_threads_per_block = ret;
- if (ir_type == PIPE_SHADER_IR_TGSI)
- *max_variable_threads_per_block = SI_MAX_VARIABLE_THREADS_PER_BLOCK;
- else
+ if (ir_type == PIPE_SHADER_IR_NATIVE)
*max_variable_threads_per_block = 0;
+ else
+ *max_variable_threads_per_block = SI_MAX_VARIABLE_THREADS_PER_BLOCK;
}
return sizeof(uint64_t);
}