freedreno/ir3: Pass stream output info to ir3_shader_from_nir

We need shader->stream_output filled out when we layout the push
constants in ir3_setup_const_state(). Otherwise
const_state->offsets.tfbo ends up as ~0, which doesn't work.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4562>
This commit is contained in:
Kristian H. Kristensen 2020-04-30 23:24:27 -07:00 committed by Marge Bot
parent 07f89126cd
commit a16ee14f37
3 changed files with 10 additions and 5 deletions

View file

@ -290,7 +290,8 @@ ir3_shader_destroy(struct ir3_shader *shader)
}
struct ir3_shader *
ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir)
ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir,
struct ir3_stream_output_info *stream_output)
{
struct ir3_shader *shader = CALLOC_STRUCT(ir3_shader);
@ -298,6 +299,8 @@ ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir)
shader->compiler = compiler;
shader->id = p_atomic_inc_return(&shader->compiler->shader_count);
shader->type = nir->info.stage;
if (stream_output)
memcpy(&shader->stream_output, stream_output, sizeof(shader->stream_output));
NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size,
(nir_lower_io_options)0);

View file

@ -662,7 +662,8 @@ struct ir3_shader {
void * ir3_shader_assemble(struct ir3_shader_variant *v, uint32_t gpu_id);
struct ir3_shader_variant * ir3_shader_get_variant(struct ir3_shader *shader,
struct ir3_shader_key *key, bool binning_pass, bool *created);
struct ir3_shader * ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir);
struct ir3_shader * ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir,
struct ir3_stream_output_info *stream_output);
void ir3_shader_destroy(struct ir3_shader *shader);
void ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out);
uint64_t ir3_shader_outputs(const struct ir3_shader *so);

View file

@ -131,9 +131,10 @@ ir3_shader_create(struct ir3_compiler *compiler,
nir = tgsi_to_nir(cso->tokens, screen);
}
struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir);
struct ir3_stream_output_info stream_output;
copy_stream_out(&stream_output, &cso->stream_output);
copy_stream_out(&shader->stream_output, &cso->stream_output);
struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, &stream_output);
if (fd_mesa_debug & FD_DBG_SHADERDB) {
/* if shader-db run, create a standard variant immediately
@ -171,7 +172,7 @@ ir3_shader_create_compute(struct ir3_compiler *compiler,
nir = tgsi_to_nir(cso->prog, screen);
}
struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir);
struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, NULL);
if (fd_mesa_debug & FD_DBG_SHADERDB) {
/* if shader-db run, create a standard variant immediately