nir/printf: add new helper to printf at a specific pixel.
Debugging with nir_printf_fmt can result in overwhelming information. This allows us to filter for a pixel we care about. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34737>
This commit is contained in:
committed by
Marge Bot
parent
43f22110e7
commit
32d9afdf73
@@ -2404,6 +2404,8 @@ nir_gen_rect_vertices(nir_builder *b, nir_def *z, nir_def *w);
|
||||
*/
|
||||
void nir_printf_fmt(nir_builder *b, unsigned ptr_bit_size,
|
||||
const char *fmt, ...);
|
||||
void nir_printf_fmt_at_px(nir_builder *b, unsigned ptr_bit_size,
|
||||
unsigned x, unsigned y, const char *fmt, ...);
|
||||
|
||||
/* Call a serialized function. This is used internally by vtn_bindgen, it is not
|
||||
* intended for end-users of NIR.
|
||||
|
||||
@@ -329,3 +329,18 @@ nir_printf_fmt(nir_builder *b, unsigned ptr_bit_size, const char *fmt, ...)
|
||||
nir_vprintf_fmt(b, ptr_bit_size, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/* Debug helper to allow us to printf at a single pixel */
|
||||
void nir_printf_fmt_at_px(nir_builder *b, unsigned ptr_bit_size, unsigned x_px, unsigned y_px, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
nir_def *xy_px = nir_f2u32(b,nir_load_frag_coord(b));
|
||||
nir_def *is_at_px = nir_ball_iequal(b, nir_imm_ivec2(b, x_px, y_px), xy_px);
|
||||
|
||||
nir_push_if(b, is_at_px);
|
||||
va_start(ap, fmt);
|
||||
nir_vprintf_fmt(b, ptr_bit_size, fmt, ap);
|
||||
va_end(ap);
|
||||
nir_pop_if(b, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user