1 /* Copyright © 2023 Intel Corporation 2 * SPDX-License-Identifier: MIT 3 */ 4 5 #ifndef _LIBANV_SHADERS_H_ 6 #define _LIBANV_SHADERS_H_ 7 8 /* Define stdint types compatible between the CPU and GPU for shared headers */ 9 #ifndef __OPENCL_VERSION__ 10 #include <stdint.h> 11 12 #include <vulkan/vulkan_core.h> 13 14 #include "util/macros.h" 15 16 #else 17 18 #define _MESA_LIBCL_ASSERT_IGNORE 1 19 #include "libcl_vk.h" 20 21 #include "genxml/gen_macros.h" 22 #include "genxml/genX_cl_pack.h" 23 24 #define PRAGMA_POISON(param) 25 #endif 26 27 /** 28 * Flags for generated_draws.cl 29 */ 30 enum anv_generated_draw_flags { 31 ANV_GENERATED_FLAG_INDEXED = BITFIELD_BIT(0), 32 ANV_GENERATED_FLAG_PREDICATED = BITFIELD_BIT(1), 33 /* Only used on Gfx9, means the pipeline is using gl_DrawID */ 34 ANV_GENERATED_FLAG_DRAWID = BITFIELD_BIT(2), 35 /* Only used on Gfx9, means the pipeline is using gl_BaseVertex or 36 * gl_BaseInstance 37 */ 38 ANV_GENERATED_FLAG_BASE = BITFIELD_BIT(3), 39 /* Whether the count is indirect */ 40 ANV_GENERATED_FLAG_COUNT = BITFIELD_BIT(4), 41 /* Whether the generation shader writes to the ring buffer */ 42 ANV_GENERATED_FLAG_RING_MODE = BITFIELD_BIT(5), 43 /* Whether TBIMR tile-based rendering shall be enabled. */ 44 ANV_GENERATED_FLAG_TBIMR = BITFIELD_BIT(6), 45 /* Wa_16011107343 */ 46 ANV_GENERATED_FLAG_WA_16011107343 = BITFIELD_BIT(7), 47 /* Wa_22018402687 */ 48 ANV_GENERATED_FLAG_WA_22018402687 = BITFIELD_BIT(8), 49 }; 50 51 /** 52 * Flags for query_copy.cl 53 */ 54 #define ANV_COPY_QUERY_FLAG_RESULT64 BITFIELD_BIT(0) 55 #define ANV_COPY_QUERY_FLAG_AVAILABLE BITFIELD_BIT(1) 56 #define ANV_COPY_QUERY_FLAG_DELTA BITFIELD_BIT(2) 57 #define ANV_COPY_QUERY_FLAG_PARTIAL BITFIELD_BIT(3) 58 59 #ifdef __OPENCL_VERSION__ 60 61 void genX(write_3DSTATE_VERTEX_BUFFERS)(global void *dst_ptr, 62 uint32_t buffer_count); 63 64 void genX(write_VERTEX_BUFFER_STATE)(global void *dst_ptr, 65 uint32_t mocs, 66 uint32_t buffer_idx, 67 uint64_t address, 68 uint32_t size, 69 uint32_t stride); 70 71 void genX(write_3DPRIMITIVE)(global void *dst_ptr, 72 bool is_predicated, 73 bool is_indexed, 74 bool use_tbimr, 75 uint32_t vertex_count_per_instance, 76 uint32_t start_vertex_location, 77 uint32_t instance_count, 78 uint32_t start_instance_location, 79 uint32_t base_vertex_location); 80 81 #if GFX_VER >= 11 82 void genX(write_3DPRIMITIVE_EXTENDED)(global void *dst_ptr, 83 bool is_predicated, 84 bool is_indexed, 85 bool use_tbimr, 86 uint32_t vertex_count_per_instance, 87 uint32_t start_vertex_location, 88 uint32_t instance_count, 89 uint32_t start_instance_location, 90 uint32_t base_vertex_location, 91 uint32_t param_base_vertex, 92 uint32_t param_base_instance, 93 uint32_t param_draw_id); 94 #endif 95 96 void genX(write_MI_BATCH_BUFFER_START)(global void *dst_ptr, uint64_t addr); 97 98 void genX(write_draw)(global uint32_t *dst_ptr, 99 global void *indirect_ptr, 100 global uint32_t *draw_id_ptr, 101 uint32_t draw_id, 102 uint32_t instance_multiplier, 103 bool is_indexed, 104 bool is_predicated, 105 bool uses_tbimr, 106 bool uses_base, 107 bool uses_draw_id, 108 uint32_t mocs); 109 110 111 void genX(copy_data)(global void *dst_ptr, 112 global void *src_ptr, 113 uint32_t size); 114 115 #endif /* __OPENCL_VERSION__ */ 116 117 #endif /* _LIBANV_SHADERS_H_ */ 118