1 /* 2 * Copyright © 2016 Red Hat. 3 * Copyright © 2016 Bas Nieuwenhuizen 4 * 5 * based in part on anv driver which is: 6 * Copyright © 2015 Intel Corporation 7 * 8 * SPDX-License-Identifier: MIT 9 */ 10 11 #ifndef RADV_PRINTF_H 12 #define RADV_PRINTF_H 13 14 #include <inttypes.h> 15 #include <stdbool.h> 16 #include <stdio.h> 17 18 #include <vulkan/vulkan_core.h> 19 20 #include "util/u_dynarray.h" 21 22 struct radv_device; 23 typedef struct nir_builder nir_builder; 24 typedef struct nir_shader nir_shader; 25 typedef struct nir_def nir_def; 26 27 struct radv_printf_data { 28 uint32_t buffer_size; 29 VkBuffer buffer; 30 VkDeviceMemory memory; 31 VkDeviceAddress buffer_addr; 32 void *data; 33 struct util_dynarray formats; 34 }; 35 36 struct radv_printf_format { 37 char *string; 38 uint32_t divergence_mask; 39 uint8_t element_sizes[32]; 40 }; 41 42 struct radv_printf_buffer_header { 43 uint32_t offset; 44 uint32_t size; 45 }; 46 47 VkResult radv_printf_data_init(struct radv_device *device); 48 49 void radv_printf_data_finish(struct radv_device *device); 50 51 void radv_build_printf(nir_builder *b, nir_def *cond, const char *format, ...); 52 53 void radv_dump_printf_data(struct radv_device *device, FILE *out); 54 55 void radv_device_associate_nir(struct radv_device *device, nir_shader *nir); 56 57 #endif /* RADV_PRINTF_H */ 58