1 /* 2 * Copyright 2024 Alyssa Rosenzweig 3 * Copyright 2024 Valve Corporation 4 * Copyright 2022 Collabora Ltd. and Red Hat Inc. 5 * SPDX-License-Identifier: MIT 6 */ 7 #include "libagx.h" 8 9 #pragma once 10 11 struct libagx_copy_query_push { 12 GLOBAL(uint32_t) availability; 13 GLOBAL(uint64_t) results; 14 GLOBAL(uint16_t) oq_index; 15 uint64_t dst_addr; 16 uint64_t dst_stride; 17 uint32_t first_query; 18 19 /* Flags. Could specialize the shader? */ 20 uint16_t partial; 21 uint16_t _64; 22 uint16_t with_availability; 23 uint16_t reports_per_query; 24 }; 25 26 struct libagx_xfb_counter_copy { 27 GLOBAL(uint32_t) dest[4]; 28 GLOBAL(uint32_t) src[4]; 29 }; 30 31 struct libagx_increment_params { 32 /* Pointer to the invocation statistic */ 33 GLOBAL(uint32_t) statistic; 34 35 /* Value to increment by */ 36 uint32_t delta; 37 }; 38 39 struct libagx_cs_invocation_params { 40 /* Pointer to the indirect dispatch grid */ 41 GLOBAL(uint32_t) grid; 42 43 /* Pointer to the compute shader invocation statistic */ 44 GLOBAL(uint32_t) statistic; 45 46 /* Local workgroup size in threads */ 47 uint32_t local_size_threads; 48 }; 49 50 static inline uint32_t libagx_cs_invocations(uint32_t local_size_threads,uint32_t x,uint32_t y,uint32_t z)51libagx_cs_invocations(uint32_t local_size_threads, uint32_t x, uint32_t y, 52 uint32_t z) 53 { 54 return local_size_threads * x * y * z; 55 } 56 57 struct libagx_increment_ia_counters { 58 /* Statistics */ 59 GLOBAL(uint32_t) ia_vertices; 60 GLOBAL(uint32_t) vs_invocations; 61 62 /* Input draw */ 63 CONSTANT(uint32_t) draw; 64 65 /* Index buffer */ 66 uint64_t index_buffer; 67 uint32_t index_buffer_range_el; 68 uint32_t restart_index; 69 }; 70