| … | 120 unchanged lines hidden | ||
| 121 | 121 | Index, | |
| 122 | 122 | Uniform, | |
| 123 | 123 | Storage, | |
| 124 | + | Indirect_Argument, | |
| 124 | 125 | Transfer_Src, | |
| 125 | 126 | Transfer_Dst, | |
| 126 | 127 | } | |
| 127 | 128 | Buffer_Usage_Flags :: bit_set[Buffer_Usage] | |
| 128 | 129 | ||
| 130 | + | Indirect_Draw_Args :: struct { | |
| 131 | + | vertex_count: u32, | |
| 132 | + | instance_count: u32, | |
| 133 | + | first_vertex: u32, | |
| 134 | + | first_instance: u32, | |
| 135 | + | } | |
| 136 | + | ||
| 137 | + | Indirect_Draw_Indexed_Args :: struct { | |
| 138 | + | index_count: u32, | |
| 139 | + | instance_count: u32, | |
| 140 | + | first_index: u32, | |
| 141 | + | vertex_offset: i32, | |
| 142 | + | first_instance: u32, | |
| 143 | + | } | |
| 144 | + | ||
| 145 | + | #assert(size_of(Indirect_Draw_Args) == 16) | |
| 146 | + | #assert(offset_of(Indirect_Draw_Args, vertex_count) == 0) | |
| 147 | + | #assert(offset_of(Indirect_Draw_Args, instance_count) == 4) | |
| 148 | + | #assert(offset_of(Indirect_Draw_Args, first_vertex) == 8) | |
| 149 | + | #assert(offset_of(Indirect_Draw_Args, first_instance) == 12) | |
| 150 | + | #assert(size_of(Indirect_Draw_Indexed_Args) == 20) | |
| 151 | + | #assert(offset_of(Indirect_Draw_Indexed_Args, index_count) == 0) | |
| 152 | + | #assert(offset_of(Indirect_Draw_Indexed_Args, instance_count) == 4) | |
| 153 | + | #assert(offset_of(Indirect_Draw_Indexed_Args, first_index) == 8) | |
| 154 | + | #assert(offset_of(Indirect_Draw_Indexed_Args, vertex_offset) == 12) | |
| 155 | + | #assert(offset_of(Indirect_Draw_Indexed_Args, first_instance) == 16) | |
| 156 | + | ||
| 129 | 157 | Memory_Property :: enum { | |
| 130 | 158 | Device_Local, | |
| 131 | 159 | Host_Visible, | |
| … | 535 unchanged lines hidden | ||
Diff hidden because this file has more than 800 lines.
Diff hidden because this file has more than 800 lines.
Diff hidden because this file has more than 800 lines.
| … | 4 unchanged lines hidden | ||
| 5 | 5 | import ir "../render_ir" | |
| 6 | 6 | import "core:testing" | |
| 7 | 7 | ||
| 8 | + | @(test) | |
| 9 | + | test_indirect_argument_abi_matches_backend_layouts :: proc(t: ^testing.T) { | |
| 10 | + | testing.expect_value(t, size_of(bk.Indirect_Draw_Args), 16) | |
| 11 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Args, vertex_count), uintptr(0)) | |
| 12 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Args, instance_count), uintptr(4)) | |
| 13 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Args, first_vertex), uintptr(8)) | |
| 14 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Args, first_instance), uintptr(12)) | |
| 15 | + | ||
| 16 | + | testing.expect_value(t, size_of(bk.Indirect_Draw_Indexed_Args), 20) | |
| 17 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Indexed_Args, index_count), uintptr(0)) | |
| 18 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Indexed_Args, instance_count), uintptr(4)) | |
| 19 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Indexed_Args, first_index), uintptr(8)) | |
| 20 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Indexed_Args, vertex_offset), uintptr(12)) | |
| 21 | + | testing.expect_value(t, offset_of(bk.Indirect_Draw_Indexed_Args, first_instance), uintptr(16)) | |
| 22 | + | } | |
| 23 | + | ||
| 24 | + | @(test) | |
| 25 | + | test_indirect_argument_usage_maps_to_backend :: proc(t: ^testing.T) { | |
| 26 | + | usage := compiler.buffer_usage_to_backend({.Vertex, .Indirect_Argument}) | |
| 27 | + | testing.expect(t, .Vertex in usage) | |
| 28 | + | testing.expect(t, .Indirect_Argument in usage) | |
| 29 | + | } | |
| 30 | + | ||
| 8 | 31 | mock_imported_draw_resolver :: proc( | |
| 9 | 32 | user_data: rawptr, | |
| 10 | 33 | frame: ^ir.Frame_IR, | |
| … | 691 unchanged lines hidden | ||