mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 08:40:11 +01:00
nir/serialize: untangle printf serialization from a particular stage
This allows any stage to carry printf instructions. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26505>
This commit is contained in:
parent
4e4a3820ab
commit
dc3e69af1a
3 changed files with 9 additions and 2 deletions
|
|
@ -2024,7 +2024,7 @@ nir_serialize(struct blob *blob, const nir_shader *nir, bool strip)
|
|||
|
||||
write_xfb_info(&ctx, nir->xfb_info);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_KERNEL)
|
||||
if (nir->info.uses_printf)
|
||||
nir_serialize_printf_info(blob, nir->printf_info, nir->printf_info_count);
|
||||
|
||||
blob_overwrite_uint32(blob, idx_size_offset, ctx.next_idx);
|
||||
|
|
@ -2084,7 +2084,7 @@ nir_deserialize(void *mem_ctx,
|
|||
|
||||
ctx.nir->xfb_info = read_xfb_info(&ctx);
|
||||
|
||||
if (ctx.nir->info.stage == MESA_SHADER_KERNEL) {
|
||||
if (ctx.nir->info.uses_printf) {
|
||||
ctx.nir->printf_info =
|
||||
nir_deserialize_printf_info(ctx.nir, blob,
|
||||
&ctx.nir->printf_info_count);
|
||||
|
|
|
|||
|
|
@ -341,6 +341,11 @@ typedef struct shader_info {
|
|||
*/
|
||||
bool workgroup_size_variable:1;
|
||||
|
||||
/**
|
||||
* Whether the shader uses printf instructions.
|
||||
*/
|
||||
bool uses_printf:1;
|
||||
|
||||
/**
|
||||
* Set if this shader uses legacy (DX9 or ARB assembly) math rules.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -830,6 +830,8 @@ handle_printf(struct vtn_builder *b, uint32_t opcode,
|
|||
nir_def *fmt_idx = nir_imm_int(&b->nb, info_idx);
|
||||
nir_def *ret = nir_printf(&b->nb, fmt_idx, &deref_var->def);
|
||||
vtn_push_nir_ssa(b, w_dest[1], ret);
|
||||
|
||||
b->nb.shader->info.uses_printf = true;
|
||||
}
|
||||
|
||||
static nir_def *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue