mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-19 13:38:19 +02:00
Minor adjustments to formatting of the copyright line, but keep dates and holders. "Authors" entries that could be obtained via Git logs were also removed. The license in brw_disasm.c and elk_disasm.c don't match directly any SPDX pattern I could find, so kept as is. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39503>
41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
/*
|
|
* Copyright © 2024 Intel Corporation
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include "intel_nir.h"
|
|
#include "intel_shader_enums.h"
|
|
#include "compiler/nir/nir_builder.h"
|
|
|
|
static bool
|
|
lower_printf_intrinsics(nir_builder *b, nir_intrinsic_instr *intrin, void *_)
|
|
{
|
|
b->cursor = nir_before_instr(&intrin->instr);
|
|
|
|
switch (intrin->intrinsic) {
|
|
case nir_intrinsic_load_printf_buffer_address:
|
|
nir_def_replace(
|
|
&intrin->def,
|
|
nir_pack_64_2x32_split(
|
|
b,
|
|
nir_load_reloc_const_intel(b, BRW_SHADER_RELOC_PRINTF_BUFFER_ADDR_LOW),
|
|
nir_load_reloc_const_intel(b, BRW_SHADER_RELOC_PRINTF_BUFFER_ADDR_HIGH)));
|
|
return true;
|
|
|
|
case nir_intrinsic_load_printf_buffer_size:
|
|
nir_def_replace(
|
|
&intrin->def,
|
|
nir_load_reloc_const_intel(b, BRW_SHADER_RELOC_PRINTF_BUFFER_SIZE));
|
|
return true;
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool
|
|
intel_nir_lower_printf(nir_shader *nir)
|
|
{
|
|
return nir_shader_intrinsics_pass(nir, lower_printf_intrinsics,
|
|
nir_metadata_control_flow, NULL);
|
|
}
|