From: Kristian H. Kristensen Date: Fri, 1 May 2020 06:24:27 +0000 (-0700) Subject: freedreno/ir3: Pass stream output info to ir3_shader_from_nir X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a16ee14f37fca71c0c14d468db690aa410ac4ce4;p=mesa.git 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: --- diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index 8d768e21c30..420d4ea492a 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -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); diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index a3b8f917af6..2a9d7962248 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -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); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index 8b8a403b5f4..b52328e2f06 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -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