turnip: add draw_cs to tu_cmd_buffer
[mesa.git] / src / freedreno / vulkan / tu_private.h
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 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
26 */
27
28 #ifndef TU_PRIVATE_H
29 #define TU_PRIVATE_H
30
31 #include <assert.h>
32 #include <pthread.h>
33 #include <stdbool.h>
34 #include <stdint.h>
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <string.h>
38 #ifdef HAVE_VALGRIND
39 #include <memcheck.h>
40 #include <valgrind.h>
41 #define VG(x) x
42 #else
43 #define VG(x)
44 #endif
45
46 #include "c11/threads.h"
47 #include "compiler/shader_enums.h"
48 #include "main/macros.h"
49 #include "util/list.h"
50 #include "util/macros.h"
51 #include "vk_alloc.h"
52 #include "vk_debug_report.h"
53
54 #include "drm/msm_drm.h"
55 #include "ir3/ir3_compiler.h"
56 #include "ir3/ir3_shader.h"
57
58 #include "adreno_common.xml.h"
59 #include "adreno_pm4.xml.h"
60 #include "a6xx.xml.h"
61
62 #include "tu_descriptor_set.h"
63 #include "tu_extensions.h"
64
65 /* Pre-declarations needed for WSI entrypoints */
66 struct wl_surface;
67 struct wl_display;
68 typedef struct xcb_connection_t xcb_connection_t;
69 typedef uint32_t xcb_visualid_t;
70 typedef uint32_t xcb_window_t;
71
72 #include <vulkan/vk_android_native_buffer.h>
73 #include <vulkan/vk_icd.h>
74 #include <vulkan/vulkan.h>
75 #include <vulkan/vulkan_intel.h>
76
77 #include "tu_entrypoints.h"
78
79 #define MAX_VBS 32
80 #define MAX_VERTEX_ATTRIBS 32
81 #define MAX_RTS 8
82 #define MAX_VSC_PIPES 32
83 #define MAX_VIEWPORTS 1
84 #define MAX_SCISSORS 16
85 #define MAX_DISCARD_RECTANGLES 4
86 #define MAX_PUSH_CONSTANTS_SIZE 128
87 #define MAX_PUSH_DESCRIPTORS 32
88 #define MAX_DYNAMIC_UNIFORM_BUFFERS 16
89 #define MAX_DYNAMIC_STORAGE_BUFFERS 8
90 #define MAX_DYNAMIC_BUFFERS \
91 (MAX_DYNAMIC_UNIFORM_BUFFERS + MAX_DYNAMIC_STORAGE_BUFFERS)
92 #define MAX_SAMPLES_LOG2 4
93 #define NUM_META_FS_KEYS 13
94 #define TU_MAX_DRM_DEVICES 8
95 #define MAX_VIEWS 8
96
97 #define NUM_DEPTH_CLEAR_PIPELINES 3
98
99 /*
100 * This is the point we switch from using CP to compute shader
101 * for certain buffer operations.
102 */
103 #define TU_BUFFER_OPS_CS_THRESHOLD 4096
104
105 enum tu_mem_heap
106 {
107 TU_MEM_HEAP_VRAM,
108 TU_MEM_HEAP_VRAM_CPU_ACCESS,
109 TU_MEM_HEAP_GTT,
110 TU_MEM_HEAP_COUNT
111 };
112
113 enum tu_mem_type
114 {
115 TU_MEM_TYPE_VRAM,
116 TU_MEM_TYPE_GTT_WRITE_COMBINE,
117 TU_MEM_TYPE_VRAM_CPU_ACCESS,
118 TU_MEM_TYPE_GTT_CACHED,
119 TU_MEM_TYPE_COUNT
120 };
121
122 #define tu_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
123
124 static inline uint32_t
125 align_u32(uint32_t v, uint32_t a)
126 {
127 assert(a != 0 && a == (a & -a));
128 return (v + a - 1) & ~(a - 1);
129 }
130
131 static inline uint32_t
132 align_u32_npot(uint32_t v, uint32_t a)
133 {
134 return (v + a - 1) / a * a;
135 }
136
137 static inline uint64_t
138 align_u64(uint64_t v, uint64_t a)
139 {
140 assert(a != 0 && a == (a & -a));
141 return (v + a - 1) & ~(a - 1);
142 }
143
144 static inline int32_t
145 align_i32(int32_t v, int32_t a)
146 {
147 assert(a != 0 && a == (a & -a));
148 return (v + a - 1) & ~(a - 1);
149 }
150
151 /** Alignment must be a power of 2. */
152 static inline bool
153 tu_is_aligned(uintmax_t n, uintmax_t a)
154 {
155 assert(a == (a & -a));
156 return (n & (a - 1)) == 0;
157 }
158
159 static inline uint32_t
160 round_up_u32(uint32_t v, uint32_t a)
161 {
162 return (v + a - 1) / a;
163 }
164
165 static inline uint64_t
166 round_up_u64(uint64_t v, uint64_t a)
167 {
168 return (v + a - 1) / a;
169 }
170
171 static inline uint32_t
172 tu_minify(uint32_t n, uint32_t levels)
173 {
174 if (unlikely(n == 0))
175 return 0;
176 else
177 return MAX2(n >> levels, 1);
178 }
179 static inline float
180 tu_clamp_f(float f, float min, float max)
181 {
182 assert(min < max);
183
184 if (f > max)
185 return max;
186 else if (f < min)
187 return min;
188 else
189 return f;
190 }
191
192 static inline bool
193 tu_clear_mask(uint32_t *inout_mask, uint32_t clear_mask)
194 {
195 if (*inout_mask & clear_mask) {
196 *inout_mask &= ~clear_mask;
197 return true;
198 } else {
199 return false;
200 }
201 }
202
203 #define for_each_bit(b, dword) \
204 for (uint32_t __dword = (dword); \
205 (b) = __builtin_ffs(__dword) - 1, __dword; __dword &= ~(1 << (b)))
206
207 #define typed_memcpy(dest, src, count) \
208 ({ \
209 STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
210 memcpy((dest), (src), (count) * sizeof(*(src))); \
211 })
212
213 /* Whenever we generate an error, pass it through this function. Useful for
214 * debugging, where we can break on it. Only call at error site, not when
215 * propagating errors. Might be useful to plug in a stack trace here.
216 */
217
218 struct tu_instance;
219
220 VkResult
221 __vk_errorf(struct tu_instance *instance,
222 VkResult error,
223 const char *file,
224 int line,
225 const char *format,
226 ...);
227
228 #define vk_error(instance, error) \
229 __vk_errorf(instance, error, __FILE__, __LINE__, NULL);
230 #define vk_errorf(instance, error, format, ...) \
231 __vk_errorf(instance, error, __FILE__, __LINE__, format, ##__VA_ARGS__);
232
233 void
234 __tu_finishme(const char *file, int line, const char *format, ...)
235 tu_printflike(3, 4);
236 void
237 tu_loge(const char *format, ...) tu_printflike(1, 2);
238 void
239 tu_loge_v(const char *format, va_list va);
240 void
241 tu_logi(const char *format, ...) tu_printflike(1, 2);
242 void
243 tu_logi_v(const char *format, va_list va);
244
245 /**
246 * Print a FINISHME message, including its source location.
247 */
248 #define tu_finishme(format, ...) \
249 do { \
250 static bool reported = false; \
251 if (!reported) { \
252 __tu_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
253 reported = true; \
254 } \
255 } while (0)
256
257 /* A non-fatal assert. Useful for debugging. */
258 #ifdef DEBUG
259 #define tu_assert(x) \
260 ({ \
261 if (unlikely(!(x))) \
262 fprintf(stderr, "%s:%d ASSERT: %s\n", __FILE__, __LINE__, #x); \
263 })
264 #else
265 #define tu_assert(x)
266 #endif
267
268 /* Suppress -Wunused in stub functions */
269 #define tu_use_args(...) __tu_use_args(0, ##__VA_ARGS__)
270 static inline void
271 __tu_use_args(int ignore, ...)
272 {
273 }
274
275 #define tu_stub() \
276 do { \
277 tu_finishme("stub %s", __func__); \
278 } while (0)
279
280 void *
281 tu_lookup_entrypoint_unchecked(const char *name);
282 void *
283 tu_lookup_entrypoint_checked(
284 const char *name,
285 uint32_t core_version,
286 const struct tu_instance_extension_table *instance,
287 const struct tu_device_extension_table *device);
288
289 struct tu_physical_device
290 {
291 VK_LOADER_DATA _loader_data;
292
293 struct tu_instance *instance;
294
295 char path[20];
296 char name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
297 uint8_t driver_uuid[VK_UUID_SIZE];
298 uint8_t device_uuid[VK_UUID_SIZE];
299 uint8_t cache_uuid[VK_UUID_SIZE];
300
301 int local_fd;
302 int master_fd;
303
304 unsigned gpu_id;
305 uint32_t gmem_size;
306 uint32_t tile_align_w;
307 uint32_t tile_align_h;
308
309 /* This is the drivers on-disk cache used as a fallback as opposed to
310 * the pipeline cache defined by apps.
311 */
312 struct disk_cache *disk_cache;
313
314 struct tu_device_extension_table supported_extensions;
315 };
316
317 enum tu_debug_flags
318 {
319 TU_DEBUG_STARTUP = 1 << 0,
320 TU_DEBUG_NIR = 1 << 1,
321 TU_DEBUG_IR3 = 1 << 2,
322 };
323
324 struct tu_instance
325 {
326 VK_LOADER_DATA _loader_data;
327
328 VkAllocationCallbacks alloc;
329
330 uint32_t api_version;
331 int physical_device_count;
332 struct tu_physical_device physical_devices[TU_MAX_DRM_DEVICES];
333
334 enum tu_debug_flags debug_flags;
335
336 struct vk_debug_report_instance debug_report_callbacks;
337
338 struct tu_instance_extension_table enabled_extensions;
339 };
340
341 bool
342 tu_instance_extension_supported(const char *name);
343 uint32_t
344 tu_physical_device_api_version(struct tu_physical_device *dev);
345 bool
346 tu_physical_device_extension_supported(struct tu_physical_device *dev,
347 const char *name);
348
349 struct cache_entry;
350
351 struct tu_pipeline_cache
352 {
353 struct tu_device *device;
354 pthread_mutex_t mutex;
355
356 uint32_t total_size;
357 uint32_t table_size;
358 uint32_t kernel_count;
359 struct cache_entry **hash_table;
360 bool modified;
361
362 VkAllocationCallbacks alloc;
363 };
364
365 struct tu_pipeline_key
366 {
367 };
368
369 void
370 tu_pipeline_cache_init(struct tu_pipeline_cache *cache,
371 struct tu_device *device);
372 void
373 tu_pipeline_cache_finish(struct tu_pipeline_cache *cache);
374 void
375 tu_pipeline_cache_load(struct tu_pipeline_cache *cache,
376 const void *data,
377 size_t size);
378
379 struct tu_shader_variant;
380
381 bool
382 tu_create_shader_variants_from_pipeline_cache(
383 struct tu_device *device,
384 struct tu_pipeline_cache *cache,
385 const unsigned char *sha1,
386 struct tu_shader_variant **variants);
387
388 void
389 tu_pipeline_cache_insert_shaders(struct tu_device *device,
390 struct tu_pipeline_cache *cache,
391 const unsigned char *sha1,
392 struct tu_shader_variant **variants,
393 const void *const *codes,
394 const unsigned *code_sizes);
395
396 struct tu_meta_state
397 {
398 VkAllocationCallbacks alloc;
399
400 struct tu_pipeline_cache cache;
401 };
402
403 /* queue types */
404 #define TU_QUEUE_GENERAL 0
405
406 #define TU_MAX_QUEUE_FAMILIES 1
407
408 struct tu_fence
409 {
410 bool signaled;
411 int fd;
412 };
413
414 void
415 tu_fence_init(struct tu_fence *fence, bool signaled);
416 void
417 tu_fence_finish(struct tu_fence *fence);
418 void
419 tu_fence_update_fd(struct tu_fence *fence, int fd);
420 void
421 tu_fence_copy(struct tu_fence *fence, const struct tu_fence *src);
422 void
423 tu_fence_signal(struct tu_fence *fence);
424 void
425 tu_fence_wait_idle(struct tu_fence *fence);
426
427 struct tu_queue
428 {
429 VK_LOADER_DATA _loader_data;
430 struct tu_device *device;
431 uint32_t queue_family_index;
432 int queue_idx;
433 VkDeviceQueueCreateFlags flags;
434
435 uint32_t msm_queue_id;
436 struct tu_fence submit_fence;
437 };
438
439 struct tu_device
440 {
441 VK_LOADER_DATA _loader_data;
442
443 VkAllocationCallbacks alloc;
444
445 struct tu_instance *instance;
446
447 struct tu_meta_state meta_state;
448
449 struct tu_queue *queues[TU_MAX_QUEUE_FAMILIES];
450 int queue_count[TU_MAX_QUEUE_FAMILIES];
451
452 struct tu_physical_device *physical_device;
453
454 struct ir3_compiler *compiler;
455
456 /* Backup in-memory cache to be used if the app doesn't provide one */
457 struct tu_pipeline_cache *mem_cache;
458
459 struct list_head shader_slabs;
460 mtx_t shader_slab_mutex;
461
462 struct tu_device_extension_table enabled_extensions;
463 };
464
465 struct tu_bo
466 {
467 uint32_t gem_handle;
468 uint64_t size;
469 uint64_t iova;
470 void *map;
471 };
472
473 VkResult
474 tu_bo_init_new(struct tu_device *dev, struct tu_bo *bo, uint64_t size);
475 VkResult
476 tu_bo_init_dmabuf(struct tu_device *dev,
477 struct tu_bo *bo,
478 uint64_t size,
479 int fd);
480 int
481 tu_bo_export_dmabuf(struct tu_device *dev, struct tu_bo *bo);
482 void
483 tu_bo_finish(struct tu_device *dev, struct tu_bo *bo);
484 VkResult
485 tu_bo_map(struct tu_device *dev, struct tu_bo *bo);
486
487 struct tu_cs_entry
488 {
489 /* No ownership */
490 const struct tu_bo *bo;
491
492 uint32_t size;
493 uint32_t offset;
494 };
495
496 enum tu_cs_mode
497 {
498
499 /*
500 * A command stream in TU_CS_MODE_GROW mode grows automatically whenever it
501 * is full. tu_cs_begin must be called before command packet emission and
502 * tu_cs_end must be called after.
503 *
504 * This mode may create multiple entries internally. The entries must be
505 * submitted together.
506 */
507 TU_CS_MODE_GROW,
508
509 /*
510 * A command stream in TU_CS_MODE_EXTERNAL mode wraps an external,
511 * fixed-size buffer. tu_cs_begin and tu_cs_end are optional and have no
512 * effect on it.
513 *
514 * This mode does not create any entry or any BO.
515 */
516 TU_CS_MODE_EXTERNAL,
517
518 /*
519 * A command stream in TU_CS_MODE_SUB_STREAM mode does not support direct
520 * command packet emission. tu_cs_begin_sub_stream must be called to get a
521 * sub-stream to emit comamnd packets to. When done with the sub-stream,
522 * tu_cs_end_sub_stream must be called.
523 *
524 * This mode does not create any entry internally.
525 */
526 TU_CS_MODE_SUB_STREAM,
527 };
528
529 struct tu_cs
530 {
531 uint32_t *start;
532 uint32_t *cur;
533 uint32_t *reserved_end;
534 uint32_t *end;
535
536 enum tu_cs_mode mode;
537 uint32_t next_bo_size;
538
539 struct tu_cs_entry *entries;
540 uint32_t entry_count;
541 uint32_t entry_capacity;
542
543 struct tu_bo **bos;
544 uint32_t bo_count;
545 uint32_t bo_capacity;
546 };
547
548 struct tu_device_memory
549 {
550 struct tu_bo bo;
551 VkDeviceSize size;
552
553 /* for dedicated allocations */
554 struct tu_image *image;
555 struct tu_buffer *buffer;
556
557 uint32_t type_index;
558 void *map;
559 void *user_ptr;
560 };
561
562 struct tu_descriptor_range
563 {
564 uint64_t va;
565 uint32_t size;
566 };
567
568 struct tu_descriptor_set
569 {
570 const struct tu_descriptor_set_layout *layout;
571 uint32_t size;
572
573 uint64_t va;
574 uint32_t *mapped_ptr;
575 struct tu_descriptor_range *dynamic_descriptors;
576 };
577
578 struct tu_push_descriptor_set
579 {
580 struct tu_descriptor_set set;
581 uint32_t capacity;
582 };
583
584 struct tu_descriptor_pool_entry
585 {
586 uint32_t offset;
587 uint32_t size;
588 struct tu_descriptor_set *set;
589 };
590
591 struct tu_descriptor_pool
592 {
593 uint8_t *mapped_ptr;
594 uint64_t current_offset;
595 uint64_t size;
596
597 uint8_t *host_memory_base;
598 uint8_t *host_memory_ptr;
599 uint8_t *host_memory_end;
600
601 uint32_t entry_count;
602 uint32_t max_entry_count;
603 struct tu_descriptor_pool_entry entries[0];
604 };
605
606 struct tu_descriptor_update_template_entry
607 {
608 VkDescriptorType descriptor_type;
609
610 /* The number of descriptors to update */
611 uint32_t descriptor_count;
612
613 /* Into mapped_ptr or dynamic_descriptors, in units of the respective array
614 */
615 uint32_t dst_offset;
616
617 /* In dwords. Not valid/used for dynamic descriptors */
618 uint32_t dst_stride;
619
620 uint32_t buffer_offset;
621
622 /* Only valid for combined image samplers and samplers */
623 uint16_t has_sampler;
624
625 /* In bytes */
626 size_t src_offset;
627 size_t src_stride;
628
629 /* For push descriptors */
630 const uint32_t *immutable_samplers;
631 };
632
633 struct tu_descriptor_update_template
634 {
635 uint32_t entry_count;
636 VkPipelineBindPoint bind_point;
637 struct tu_descriptor_update_template_entry entry[0];
638 };
639
640 struct tu_buffer
641 {
642 VkDeviceSize size;
643
644 VkBufferUsageFlags usage;
645 VkBufferCreateFlags flags;
646
647 struct tu_bo *bo;
648 VkDeviceSize bo_offset;
649 };
650
651 enum tu_dynamic_state_bits
652 {
653 TU_DYNAMIC_VIEWPORT = 1 << 0,
654 TU_DYNAMIC_SCISSOR = 1 << 1,
655 TU_DYNAMIC_LINE_WIDTH = 1 << 2,
656 TU_DYNAMIC_DEPTH_BIAS = 1 << 3,
657 TU_DYNAMIC_BLEND_CONSTANTS = 1 << 4,
658 TU_DYNAMIC_DEPTH_BOUNDS = 1 << 5,
659 TU_DYNAMIC_STENCIL_COMPARE_MASK = 1 << 6,
660 TU_DYNAMIC_STENCIL_WRITE_MASK = 1 << 7,
661 TU_DYNAMIC_STENCIL_REFERENCE = 1 << 8,
662 TU_DYNAMIC_DISCARD_RECTANGLE = 1 << 9,
663 TU_DYNAMIC_ALL = (1 << 10) - 1,
664 };
665
666 struct tu_vertex_binding
667 {
668 struct tu_buffer *buffer;
669 VkDeviceSize offset;
670 };
671
672 struct tu_viewport_state
673 {
674 uint32_t count;
675 VkViewport viewports[MAX_VIEWPORTS];
676 };
677
678 struct tu_scissor_state
679 {
680 uint32_t count;
681 VkRect2D scissors[MAX_SCISSORS];
682 };
683
684 struct tu_discard_rectangle_state
685 {
686 uint32_t count;
687 VkRect2D rectangles[MAX_DISCARD_RECTANGLES];
688 };
689
690 struct tu_dynamic_state
691 {
692 /**
693 * Bitmask of (1 << VK_DYNAMIC_STATE_*).
694 * Defines the set of saved dynamic state.
695 */
696 uint32_t mask;
697
698 struct tu_viewport_state viewport;
699
700 struct tu_scissor_state scissor;
701
702 float line_width;
703
704 struct
705 {
706 float bias;
707 float clamp;
708 float slope;
709 } depth_bias;
710
711 float blend_constants[4];
712
713 struct
714 {
715 float min;
716 float max;
717 } depth_bounds;
718
719 struct
720 {
721 uint32_t front;
722 uint32_t back;
723 } stencil_compare_mask;
724
725 struct
726 {
727 uint32_t front;
728 uint32_t back;
729 } stencil_write_mask;
730
731 struct
732 {
733 uint32_t front;
734 uint32_t back;
735 } stencil_reference;
736
737 struct tu_discard_rectangle_state discard_rectangle;
738 };
739
740 extern const struct tu_dynamic_state default_dynamic_state;
741
742 const char *
743 tu_get_debug_option_name(int id);
744
745 const char *
746 tu_get_perftest_option_name(int id);
747
748 /**
749 * Attachment state when recording a renderpass instance.
750 *
751 * The clear value is valid only if there exists a pending clear.
752 */
753 struct tu_attachment_state
754 {
755 VkImageAspectFlags pending_clear_aspects;
756 uint32_t cleared_views;
757 VkClearValue clear_value;
758 VkImageLayout current_layout;
759 };
760
761 struct tu_descriptor_state
762 {
763 struct tu_descriptor_set *sets[MAX_SETS];
764 uint32_t dirty;
765 uint32_t valid;
766 struct tu_push_descriptor_set push_set;
767 bool push_dirty;
768 uint32_t dynamic_buffers[4 * MAX_DYNAMIC_BUFFERS];
769 };
770
771 struct tu_tile
772 {
773 uint8_t pipe;
774 uint8_t slot;
775 VkOffset2D begin;
776 VkOffset2D end;
777 };
778
779 struct tu_tiling_config
780 {
781 VkRect2D render_area;
782 uint32_t buffer_cpp[MAX_RTS + 2];
783 uint32_t buffer_count;
784
785 /* position and size of the first tile */
786 VkRect2D tile0;
787 /* number of tiles */
788 VkExtent2D tile_count;
789
790 uint32_t gmem_offsets[MAX_RTS + 2];
791
792 /* size of the first VSC pipe */
793 VkExtent2D pipe0;
794 /* number of VSC pipes */
795 VkExtent2D pipe_count;
796
797 /* pipe register values */
798 uint32_t pipe_config[MAX_VSC_PIPES];
799 uint32_t pipe_sizes[MAX_VSC_PIPES];
800 };
801
802 struct tu_cmd_state
803 {
804 /* Vertex descriptors */
805 uint64_t vb_va;
806 unsigned vb_size;
807
808 struct tu_dynamic_state dynamic;
809
810 /* Index buffer */
811 struct tu_buffer *index_buffer;
812 uint64_t index_offset;
813 uint32_t index_type;
814 uint32_t max_index_count;
815 uint64_t index_va;
816
817 const struct tu_render_pass *pass;
818 const struct tu_subpass *subpass;
819 const struct tu_framebuffer *framebuffer;
820 struct tu_attachment_state *attachments;
821
822 struct tu_tiling_config tiling_config;
823
824 struct tu_cs_entry tile_load_ib;
825 struct tu_cs_entry tile_store_ib;
826 };
827
828 struct tu_cmd_pool
829 {
830 VkAllocationCallbacks alloc;
831 struct list_head cmd_buffers;
832 struct list_head free_cmd_buffers;
833 uint32_t queue_family_index;
834 };
835
836 struct tu_cmd_buffer_upload
837 {
838 uint8_t *map;
839 unsigned offset;
840 uint64_t size;
841 struct list_head list;
842 };
843
844 enum tu_cmd_buffer_status
845 {
846 TU_CMD_BUFFER_STATUS_INVALID,
847 TU_CMD_BUFFER_STATUS_INITIAL,
848 TU_CMD_BUFFER_STATUS_RECORDING,
849 TU_CMD_BUFFER_STATUS_EXECUTABLE,
850 TU_CMD_BUFFER_STATUS_PENDING,
851 };
852
853 struct tu_bo_list
854 {
855 uint32_t count;
856 uint32_t capacity;
857 struct drm_msm_gem_submit_bo *bo_infos;
858 };
859
860 #define TU_BO_LIST_FAILED (~0)
861
862 void
863 tu_bo_list_init(struct tu_bo_list *list);
864 void
865 tu_bo_list_destroy(struct tu_bo_list *list);
866 void
867 tu_bo_list_reset(struct tu_bo_list *list);
868 uint32_t
869 tu_bo_list_add(struct tu_bo_list *list,
870 const struct tu_bo *bo,
871 uint32_t flags);
872 VkResult
873 tu_bo_list_merge(struct tu_bo_list *list, const struct tu_bo_list *other);
874
875 struct tu_cmd_buffer
876 {
877 VK_LOADER_DATA _loader_data;
878
879 struct tu_device *device;
880
881 struct tu_cmd_pool *pool;
882 struct list_head pool_link;
883
884 VkCommandBufferUsageFlags usage_flags;
885 VkCommandBufferLevel level;
886 enum tu_cmd_buffer_status status;
887
888 struct tu_cmd_state state;
889 struct tu_vertex_binding vertex_bindings[MAX_VBS];
890 uint32_t queue_family_index;
891
892 uint8_t push_constants[MAX_PUSH_CONSTANTS_SIZE];
893 VkShaderStageFlags push_constant_stages;
894 struct tu_descriptor_set meta_push_descriptors;
895
896 struct tu_descriptor_state descriptors[VK_PIPELINE_BIND_POINT_RANGE_SIZE];
897
898 struct tu_cmd_buffer_upload upload;
899
900 VkResult record_result;
901
902 struct tu_bo_list bo_list;
903 struct tu_cs cs;
904 struct tu_cs draw_cs;
905 struct tu_cs tile_cs;
906
907 uint16_t marker_reg;
908 uint32_t marker_seqno;
909
910 struct tu_bo scratch_bo;
911 uint32_t scratch_seqno;
912
913 bool wait_for_idle;
914 };
915
916 void
917 tu6_emit_event_write(struct tu_cmd_buffer *cmd,
918 struct tu_cs *cs,
919 enum vgt_event_type event,
920 bool need_seqno);
921
922 bool
923 tu_get_memory_fd(struct tu_device *device,
924 struct tu_device_memory *memory,
925 int *pFD);
926
927 /*
928 * Takes x,y,z as exact numbers of invocations, instead of blocks.
929 *
930 * Limitations: Can't call normal dispatch functions without binding or
931 * rebinding
932 * the compute pipeline.
933 */
934 void
935 tu_unaligned_dispatch(struct tu_cmd_buffer *cmd_buffer,
936 uint32_t x,
937 uint32_t y,
938 uint32_t z);
939
940 struct tu_event
941 {
942 uint64_t *map;
943 };
944
945 struct tu_shader_module;
946
947 #define TU_HASH_SHADER_IS_GEOM_COPY_SHADER (1 << 0)
948 #define TU_HASH_SHADER_SISCHED (1 << 1)
949 #define TU_HASH_SHADER_UNSAFE_MATH (1 << 2)
950 void
951 tu_hash_shaders(unsigned char *hash,
952 const VkPipelineShaderStageCreateInfo **stages,
953 const struct tu_pipeline_layout *layout,
954 const struct tu_pipeline_key *key,
955 uint32_t flags);
956
957 static inline gl_shader_stage
958 vk_to_mesa_shader_stage(VkShaderStageFlagBits vk_stage)
959 {
960 assert(__builtin_popcount(vk_stage) == 1);
961 return ffs(vk_stage) - 1;
962 }
963
964 static inline VkShaderStageFlagBits
965 mesa_to_vk_shader_stage(gl_shader_stage mesa_stage)
966 {
967 return (1 << mesa_stage);
968 }
969
970 #define TU_STAGE_MASK ((1 << MESA_SHADER_STAGES) - 1)
971
972 #define tu_foreach_stage(stage, stage_bits) \
973 for (gl_shader_stage stage, \
974 __tmp = (gl_shader_stage)((stage_bits) &TU_STAGE_MASK); \
975 stage = __builtin_ffs(__tmp) - 1, __tmp; __tmp &= ~(1 << (stage)))
976
977 struct tu_shader_module
978 {
979 unsigned char sha1[20];
980
981 uint32_t code_size;
982 const uint32_t *code[0];
983 };
984
985 struct tu_shader_compile_options
986 {
987 struct ir3_shader_key key;
988
989 bool optimize;
990 bool include_binning_pass;
991 };
992
993 struct tu_shader
994 {
995 struct ir3_shader ir3_shader;
996
997 /* This may be true for vertex shaders. When true, variants[1] is the
998 * binning variant and binning_binary is non-NULL.
999 */
1000 bool has_binning_pass;
1001
1002 void *binary;
1003 void *binning_binary;
1004
1005 struct ir3_shader_variant variants[0];
1006 };
1007
1008 struct tu_shader *
1009 tu_shader_create(struct tu_device *dev,
1010 gl_shader_stage stage,
1011 const VkPipelineShaderStageCreateInfo *stage_info,
1012 const VkAllocationCallbacks *alloc);
1013
1014 void
1015 tu_shader_destroy(struct tu_device *dev,
1016 struct tu_shader *shader,
1017 const VkAllocationCallbacks *alloc);
1018
1019 void
1020 tu_shader_compile_options_init(
1021 struct tu_shader_compile_options *options,
1022 const VkGraphicsPipelineCreateInfo *pipeline_info);
1023
1024 VkResult
1025 tu_shader_compile(struct tu_device *dev,
1026 struct tu_shader *shader,
1027 const struct tu_shader *next_stage,
1028 const struct tu_shader_compile_options *options,
1029 const VkAllocationCallbacks *alloc);
1030
1031 struct tu_pipeline
1032 {
1033 struct tu_cs cs;
1034
1035 struct tu_dynamic_state dynamic_state;
1036
1037 struct tu_pipeline_layout *layout;
1038
1039 bool need_indirect_descriptor_sets;
1040 VkShaderStageFlags active_stages;
1041
1042 struct
1043 {
1044 struct tu_bo binary_bo;
1045 struct tu_cs_entry state_ib;
1046 struct tu_cs_entry binning_state_ib;
1047 } program;
1048
1049 struct
1050 {
1051 uint8_t bindings[MAX_VERTEX_ATTRIBS];
1052 uint16_t strides[MAX_VERTEX_ATTRIBS];
1053 uint16_t offsets[MAX_VERTEX_ATTRIBS];
1054 uint32_t count;
1055
1056 uint8_t binning_bindings[MAX_VERTEX_ATTRIBS];
1057 uint16_t binning_strides[MAX_VERTEX_ATTRIBS];
1058 uint16_t binning_offsets[MAX_VERTEX_ATTRIBS];
1059 uint32_t binning_count;
1060
1061 struct tu_cs_entry state_ib;
1062 struct tu_cs_entry binning_state_ib;
1063 } vi;
1064
1065 struct
1066 {
1067 enum pc_di_primtype primtype;
1068 bool primitive_restart;
1069 } ia;
1070
1071 struct
1072 {
1073 struct tu_cs_entry state_ib;
1074 } vp;
1075
1076 struct
1077 {
1078 uint32_t gras_su_cntl;
1079 struct tu_cs_entry state_ib;
1080 } rast;
1081
1082 struct
1083 {
1084 struct tu_cs_entry state_ib;
1085 } ds;
1086
1087 struct
1088 {
1089 struct tu_cs_entry state_ib;
1090 } blend;
1091 };
1092
1093 void
1094 tu6_emit_viewport(struct tu_cs *cs, const VkViewport *viewport);
1095
1096 void
1097 tu6_emit_scissor(struct tu_cs *cs, const VkRect2D *scissor);
1098
1099 void
1100 tu6_emit_gras_su_cntl(struct tu_cs *cs,
1101 uint32_t gras_su_cntl,
1102 float line_width);
1103
1104 void
1105 tu6_emit_depth_bias(struct tu_cs *cs,
1106 float constant_factor,
1107 float clamp,
1108 float slope_factor);
1109
1110 void
1111 tu6_emit_stencil_compare_mask(struct tu_cs *cs,
1112 uint32_t front,
1113 uint32_t back);
1114
1115 void
1116 tu6_emit_stencil_write_mask(struct tu_cs *cs, uint32_t front, uint32_t back);
1117
1118 void
1119 tu6_emit_stencil_reference(struct tu_cs *cs, uint32_t front, uint32_t back);
1120
1121 void
1122 tu6_emit_blend_constants(struct tu_cs *cs, const float constants[4]);
1123
1124 struct tu_userdata_info *
1125 tu_lookup_user_sgpr(struct tu_pipeline *pipeline,
1126 gl_shader_stage stage,
1127 int idx);
1128
1129 struct tu_shader_variant *
1130 tu_get_shader(struct tu_pipeline *pipeline, gl_shader_stage stage);
1131
1132 struct tu_graphics_pipeline_create_info
1133 {
1134 bool use_rectlist;
1135 bool db_depth_clear;
1136 bool db_stencil_clear;
1137 bool db_depth_disable_expclear;
1138 bool db_stencil_disable_expclear;
1139 bool db_flush_depth_inplace;
1140 bool db_flush_stencil_inplace;
1141 bool db_resummarize;
1142 uint32_t custom_blend_mode;
1143 };
1144
1145 struct tu_native_format
1146 {
1147 int vtx; /* VFMTn_xxx or -1 */
1148 int tex; /* TFMTn_xxx or -1 */
1149 int rb; /* RBn_xxx or -1 */
1150 int swap; /* enum a3xx_color_swap */
1151 bool present; /* internal only; always true to external users */
1152 };
1153
1154 const struct tu_native_format *
1155 tu6_get_native_format(VkFormat format);
1156
1157 int
1158 tu_pack_clear_value(const VkClearValue *val,
1159 VkFormat format,
1160 uint32_t buf[4]);
1161 enum a6xx_2d_ifmt tu6_rb_fmt_to_ifmt(enum a6xx_color_fmt fmt);
1162
1163 struct tu_image_level
1164 {
1165 VkDeviceSize offset;
1166 VkDeviceSize size;
1167 uint32_t pitch;
1168 };
1169
1170 struct tu_image
1171 {
1172 VkImageType type;
1173 /* The original VkFormat provided by the client. This may not match any
1174 * of the actual surface formats.
1175 */
1176 VkFormat vk_format;
1177 VkImageAspectFlags aspects;
1178 VkImageUsageFlags usage; /**< Superset of VkImageCreateInfo::usage. */
1179 VkImageTiling tiling; /** VkImageCreateInfo::tiling */
1180 VkImageCreateFlags flags; /** VkImageCreateInfo::flags */
1181 VkExtent3D extent;
1182 uint32_t level_count;
1183 uint32_t layer_count;
1184
1185 VkDeviceSize size;
1186 uint32_t alignment;
1187
1188 /* memory layout */
1189 VkDeviceSize layer_size;
1190 struct tu_image_level levels[15];
1191 unsigned tile_mode;
1192
1193 unsigned queue_family_mask;
1194 bool exclusive;
1195 bool shareable;
1196
1197 /* For VK_ANDROID_native_buffer, the WSI image owns the memory, */
1198 VkDeviceMemory owned_memory;
1199
1200 /* Set when bound */
1201 const struct tu_bo *bo;
1202 VkDeviceSize bo_offset;
1203 };
1204
1205 unsigned
1206 tu_image_queue_family_mask(const struct tu_image *image,
1207 uint32_t family,
1208 uint32_t queue_family);
1209
1210 static inline uint32_t
1211 tu_get_layerCount(const struct tu_image *image,
1212 const VkImageSubresourceRange *range)
1213 {
1214 return range->layerCount == VK_REMAINING_ARRAY_LAYERS
1215 ? image->layer_count - range->baseArrayLayer
1216 : range->layerCount;
1217 }
1218
1219 static inline uint32_t
1220 tu_get_levelCount(const struct tu_image *image,
1221 const VkImageSubresourceRange *range)
1222 {
1223 return range->levelCount == VK_REMAINING_MIP_LEVELS
1224 ? image->level_count - range->baseMipLevel
1225 : range->levelCount;
1226 }
1227
1228 struct tu_image_view
1229 {
1230 struct tu_image *image; /**< VkImageViewCreateInfo::image */
1231
1232 VkImageViewType type;
1233 VkImageAspectFlags aspect_mask;
1234 VkFormat vk_format;
1235 uint32_t base_layer;
1236 uint32_t layer_count;
1237 uint32_t base_mip;
1238 uint32_t level_count;
1239 VkExtent3D extent; /**< Extent of VkImageViewCreateInfo::baseMipLevel. */
1240
1241 uint32_t descriptor[16];
1242
1243 /* Descriptor for use as a storage image as opposed to a sampled image.
1244 * This has a few differences for cube maps (e.g. type).
1245 */
1246 uint32_t storage_descriptor[16];
1247 };
1248
1249 struct tu_sampler
1250 {
1251 };
1252
1253 struct tu_image_create_info
1254 {
1255 const VkImageCreateInfo *vk_info;
1256 bool scanout;
1257 bool no_metadata_planes;
1258 };
1259
1260 VkResult
1261 tu_image_create(VkDevice _device,
1262 const struct tu_image_create_info *info,
1263 const VkAllocationCallbacks *alloc,
1264 VkImage *pImage);
1265
1266 VkResult
1267 tu_image_from_gralloc(VkDevice device_h,
1268 const VkImageCreateInfo *base_info,
1269 const VkNativeBufferANDROID *gralloc_info,
1270 const VkAllocationCallbacks *alloc,
1271 VkImage *out_image_h);
1272
1273 void
1274 tu_image_view_init(struct tu_image_view *view,
1275 struct tu_device *device,
1276 const VkImageViewCreateInfo *pCreateInfo);
1277
1278 struct tu_buffer_view
1279 {
1280 VkFormat vk_format;
1281 uint64_t range; /**< VkBufferViewCreateInfo::range */
1282 uint32_t state[4];
1283 };
1284 void
1285 tu_buffer_view_init(struct tu_buffer_view *view,
1286 struct tu_device *device,
1287 const VkBufferViewCreateInfo *pCreateInfo);
1288
1289 static inline struct VkExtent3D
1290 tu_sanitize_image_extent(const VkImageType imageType,
1291 const struct VkExtent3D imageExtent)
1292 {
1293 switch (imageType) {
1294 case VK_IMAGE_TYPE_1D:
1295 return (VkExtent3D) { imageExtent.width, 1, 1 };
1296 case VK_IMAGE_TYPE_2D:
1297 return (VkExtent3D) { imageExtent.width, imageExtent.height, 1 };
1298 case VK_IMAGE_TYPE_3D:
1299 return imageExtent;
1300 default:
1301 unreachable("invalid image type");
1302 }
1303 }
1304
1305 static inline struct VkOffset3D
1306 tu_sanitize_image_offset(const VkImageType imageType,
1307 const struct VkOffset3D imageOffset)
1308 {
1309 switch (imageType) {
1310 case VK_IMAGE_TYPE_1D:
1311 return (VkOffset3D) { imageOffset.x, 0, 0 };
1312 case VK_IMAGE_TYPE_2D:
1313 return (VkOffset3D) { imageOffset.x, imageOffset.y, 0 };
1314 case VK_IMAGE_TYPE_3D:
1315 return imageOffset;
1316 default:
1317 unreachable("invalid image type");
1318 }
1319 }
1320
1321 struct tu_attachment_info
1322 {
1323 struct tu_image_view *attachment;
1324 };
1325
1326 struct tu_framebuffer
1327 {
1328 uint32_t width;
1329 uint32_t height;
1330 uint32_t layers;
1331
1332 uint32_t attachment_count;
1333 struct tu_attachment_info attachments[0];
1334 };
1335
1336 struct tu_subpass_barrier
1337 {
1338 VkPipelineStageFlags src_stage_mask;
1339 VkAccessFlags src_access_mask;
1340 VkAccessFlags dst_access_mask;
1341 };
1342
1343 void
1344 tu_subpass_barrier(struct tu_cmd_buffer *cmd_buffer,
1345 const struct tu_subpass_barrier *barrier);
1346
1347 struct tu_subpass_attachment
1348 {
1349 uint32_t attachment;
1350 VkImageLayout layout;
1351 };
1352
1353 struct tu_subpass
1354 {
1355 uint32_t input_count;
1356 uint32_t color_count;
1357 struct tu_subpass_attachment *input_attachments;
1358 struct tu_subpass_attachment *color_attachments;
1359 struct tu_subpass_attachment *resolve_attachments;
1360 struct tu_subpass_attachment depth_stencil_attachment;
1361
1362 /** Subpass has at least one resolve attachment */
1363 bool has_resolve;
1364
1365 struct tu_subpass_barrier start_barrier;
1366
1367 uint32_t view_mask;
1368 VkSampleCountFlagBits max_sample_count;
1369 };
1370
1371 struct tu_render_pass_attachment
1372 {
1373 VkFormat format;
1374 uint32_t samples;
1375 VkAttachmentLoadOp load_op;
1376 VkAttachmentLoadOp stencil_load_op;
1377 VkImageLayout initial_layout;
1378 VkImageLayout final_layout;
1379 uint32_t view_mask;
1380 };
1381
1382 struct tu_render_pass
1383 {
1384 uint32_t attachment_count;
1385 uint32_t subpass_count;
1386 struct tu_subpass_attachment *subpass_attachments;
1387 struct tu_render_pass_attachment *attachments;
1388 struct tu_subpass_barrier end_barrier;
1389 struct tu_subpass subpasses[0];
1390 };
1391
1392 VkResult
1393 tu_device_init_meta(struct tu_device *device);
1394 void
1395 tu_device_finish_meta(struct tu_device *device);
1396
1397 struct tu_query_pool
1398 {
1399 uint32_t stride;
1400 uint32_t availability_offset;
1401 uint64_t size;
1402 char *ptr;
1403 VkQueryType type;
1404 uint32_t pipeline_stats_mask;
1405 };
1406
1407 struct tu_semaphore
1408 {
1409 uint32_t syncobj;
1410 uint32_t temp_syncobj;
1411 };
1412
1413 void
1414 tu_set_descriptor_set(struct tu_cmd_buffer *cmd_buffer,
1415 VkPipelineBindPoint bind_point,
1416 struct tu_descriptor_set *set,
1417 unsigned idx);
1418
1419 void
1420 tu_update_descriptor_sets(struct tu_device *device,
1421 struct tu_cmd_buffer *cmd_buffer,
1422 VkDescriptorSet overrideSet,
1423 uint32_t descriptorWriteCount,
1424 const VkWriteDescriptorSet *pDescriptorWrites,
1425 uint32_t descriptorCopyCount,
1426 const VkCopyDescriptorSet *pDescriptorCopies);
1427
1428 void
1429 tu_update_descriptor_set_with_template(
1430 struct tu_device *device,
1431 struct tu_cmd_buffer *cmd_buffer,
1432 struct tu_descriptor_set *set,
1433 VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate,
1434 const void *pData);
1435
1436 void
1437 tu_meta_push_descriptor_set(struct tu_cmd_buffer *cmd_buffer,
1438 VkPipelineBindPoint pipelineBindPoint,
1439 VkPipelineLayout _layout,
1440 uint32_t set,
1441 uint32_t descriptorWriteCount,
1442 const VkWriteDescriptorSet *pDescriptorWrites);
1443
1444 int
1445 tu_drm_get_gpu_id(const struct tu_physical_device *dev, uint32_t *id);
1446
1447 int
1448 tu_drm_get_gmem_size(const struct tu_physical_device *dev, uint32_t *size);
1449
1450 int
1451 tu_drm_submitqueue_new(const struct tu_device *dev,
1452 int priority,
1453 uint32_t *queue_id);
1454
1455 void
1456 tu_drm_submitqueue_close(const struct tu_device *dev, uint32_t queue_id);
1457
1458 uint32_t
1459 tu_gem_new(const struct tu_device *dev, uint64_t size, uint32_t flags);
1460 uint32_t
1461 tu_gem_import_dmabuf(const struct tu_device *dev,
1462 int prime_fd,
1463 uint64_t size);
1464 int
1465 tu_gem_export_dmabuf(const struct tu_device *dev, uint32_t gem_handle);
1466 void
1467 tu_gem_close(const struct tu_device *dev, uint32_t gem_handle);
1468 uint64_t
1469 tu_gem_info_offset(const struct tu_device *dev, uint32_t gem_handle);
1470 uint64_t
1471 tu_gem_info_iova(const struct tu_device *dev, uint32_t gem_handle);
1472
1473 #define TU_DEFINE_HANDLE_CASTS(__tu_type, __VkType) \
1474 \
1475 static inline struct __tu_type *__tu_type##_from_handle(__VkType _handle) \
1476 { \
1477 return (struct __tu_type *) _handle; \
1478 } \
1479 \
1480 static inline __VkType __tu_type##_to_handle(struct __tu_type *_obj) \
1481 { \
1482 return (__VkType) _obj; \
1483 }
1484
1485 #define TU_DEFINE_NONDISP_HANDLE_CASTS(__tu_type, __VkType) \
1486 \
1487 static inline struct __tu_type *__tu_type##_from_handle(__VkType _handle) \
1488 { \
1489 return (struct __tu_type *) (uintptr_t) _handle; \
1490 } \
1491 \
1492 static inline __VkType __tu_type##_to_handle(struct __tu_type *_obj) \
1493 { \
1494 return (__VkType)(uintptr_t) _obj; \
1495 }
1496
1497 #define TU_FROM_HANDLE(__tu_type, __name, __handle) \
1498 struct __tu_type *__name = __tu_type##_from_handle(__handle)
1499
1500 TU_DEFINE_HANDLE_CASTS(tu_cmd_buffer, VkCommandBuffer)
1501 TU_DEFINE_HANDLE_CASTS(tu_device, VkDevice)
1502 TU_DEFINE_HANDLE_CASTS(tu_instance, VkInstance)
1503 TU_DEFINE_HANDLE_CASTS(tu_physical_device, VkPhysicalDevice)
1504 TU_DEFINE_HANDLE_CASTS(tu_queue, VkQueue)
1505
1506 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_cmd_pool, VkCommandPool)
1507 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_buffer, VkBuffer)
1508 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_buffer_view, VkBufferView)
1509 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_descriptor_pool, VkDescriptorPool)
1510 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_descriptor_set, VkDescriptorSet)
1511 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_descriptor_set_layout,
1512 VkDescriptorSetLayout)
1513 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_descriptor_update_template,
1514 VkDescriptorUpdateTemplateKHR)
1515 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_device_memory, VkDeviceMemory)
1516 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_fence, VkFence)
1517 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_event, VkEvent)
1518 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_framebuffer, VkFramebuffer)
1519 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_image, VkImage)
1520 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_image_view, VkImageView);
1521 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_pipeline_cache, VkPipelineCache)
1522 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_pipeline, VkPipeline)
1523 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_pipeline_layout, VkPipelineLayout)
1524 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_query_pool, VkQueryPool)
1525 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_render_pass, VkRenderPass)
1526 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_sampler, VkSampler)
1527 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_shader_module, VkShaderModule)
1528 TU_DEFINE_NONDISP_HANDLE_CASTS(tu_semaphore, VkSemaphore)
1529
1530 #endif /* TU_PRIVATE_H */