@@ -15,36 +15,85 @@ void kore_kompjuta_command_list_destroy(kore_gpu_command_list *list) {}
1515
1616void kore_kompjuta_command_list_begin_render_pass (kore_gpu_command_list * list , const kore_gpu_render_pass_parameters * parameters ) {
1717 assert (list -> kompjuta .current_command < list -> kompjuta .commands_count );
18+
1819 kompjuta_gpu_command * command = & list -> kompjuta .commands [list -> kompjuta .current_command ];
1920 command -> kind = KOMPJUTA_GPU_COMMAND_CLEAR ;
2021 command -> data .clear .r = parameters -> color_attachments [0 ].clear_value .r ;
2122 command -> data .clear .g = parameters -> color_attachments [0 ].clear_value .g ;
2223 command -> data .clear .b = parameters -> color_attachments [0 ].clear_value .b ;
2324 command -> data .clear .a = parameters -> color_attachments [0 ].clear_value .a ;
25+
2426 ++ list -> kompjuta .current_command ;
2527}
2628
2729void kore_kompjuta_command_list_end_render_pass (kore_gpu_command_list * list ) {}
2830
2931void kore_kompjuta_command_list_present (kore_gpu_command_list * list ) {
3032 assert (list -> kompjuta .current_command < list -> kompjuta .commands_count );
33+
3134 kompjuta_gpu_command * command = & list -> kompjuta .commands [list -> kompjuta .current_command ];
3235 command -> kind = KOMPJUTA_GPU_COMMAND_PRESENT ;
36+
3337 ++ list -> kompjuta .current_command ;
3438}
3539
36- void kore_kompjuta_command_list_set_index_buffer (kore_gpu_command_list * list , kore_gpu_buffer * buffer , kore_gpu_index_format index_format , uint64_t offset ) {}
40+ void kore_kompjuta_command_list_set_index_buffer (kore_gpu_command_list * list , kore_gpu_buffer * buffer , kore_gpu_index_format index_format , uint64_t offset ) {
41+ assert (list -> kompjuta .current_command < list -> kompjuta .commands_count );
42+
43+ kompjuta_gpu_command * command = & list -> kompjuta .commands [list -> kompjuta .current_command ];
44+ command -> kind = KOMPJUTA_GPU_COMMAND_SET_INDEX_BUFFER ;
45+
46+ uint8_t * data = (uint8_t * )buffer -> kompjuta .data ;
47+ command -> data .set_index_buffer .data = & data [offset ];
48+
49+ command -> data .set_index_buffer .index_format = index_format ;
50+
51+ ++ list -> kompjuta .current_command ;
52+ }
3753
3854void kore_kompjuta_command_list_set_vertex_buffer (kore_gpu_command_list * list , uint32_t slot , kore_kompjuta_buffer * buffer , uint64_t offset , uint64_t size ,
39- uint64_t stride ) {}
55+ uint64_t stride ) {
56+ assert (list -> kompjuta .current_command < list -> kompjuta .commands_count );
57+
58+ kompjuta_gpu_command * command = & list -> kompjuta .commands [list -> kompjuta .current_command ];
59+ command -> kind = KOMPJUTA_GPU_COMMAND_SET_VERTEX_BUFFER ;
4060
41- void kore_kompjuta_command_list_set_render_pipeline (kore_gpu_command_list * list , kore_kompjuta_render_pipeline * pipeline ) {}
61+ uint8_t * data = (uint8_t * )buffer -> data ;
62+ command -> data .set_vertex_buffer .data = & data [offset ];
63+
64+ command -> data .set_vertex_buffer .stride = stride ;
65+
66+ ++ list -> kompjuta .current_command ;
67+ }
68+
69+ void kore_kompjuta_command_list_set_render_pipeline (kore_gpu_command_list * list , kore_kompjuta_render_pipeline * pipeline ) {
70+ assert (list -> kompjuta .current_command < list -> kompjuta .commands_count );
71+
72+ kompjuta_gpu_command * command = & list -> kompjuta .commands [list -> kompjuta .current_command ];
73+ command -> kind = KOMPJUTA_GPU_COMMAND_SET_RENDER_PIPELINE ;
74+ command -> data .set_render_pipeline .vertex_shader = pipeline -> vertex_shader .function ;
75+ command -> data .set_render_pipeline .fragment_shader = pipeline -> fragment_shader .function ;
76+
77+ ++ list -> kompjuta .current_command ;
78+ }
4279
4380void kore_kompjuta_command_list_draw (kore_gpu_command_list * list , uint32_t vertex_count , uint32_t instance_count , uint32_t first_vertex ,
4481 uint32_t first_instance ) {}
4582
4683void kore_kompjuta_command_list_draw_indexed (kore_gpu_command_list * list , uint32_t index_count , uint32_t instance_count , uint32_t first_index ,
47- int32_t base_vertex , uint32_t first_instance ) {}
84+ int32_t base_vertex , uint32_t first_instance ) {
85+ assert (list -> kompjuta .current_command < list -> kompjuta .commands_count );
86+
87+ kompjuta_gpu_command * command = & list -> kompjuta .commands [list -> kompjuta .current_command ];
88+ command -> kind = KOMPJUTA_GPU_COMMAND_DRAW_INDEXED ;
89+ command -> data .draw_indexed .index_count = index_count ;
90+ command -> data .draw_indexed .instance_count = instance_count ;
91+ command -> data .draw_indexed .first_index = first_index ;
92+ command -> data .draw_indexed .base_vertex = base_vertex ;
93+ command -> data .draw_indexed .first_instance = first_instance ;
94+
95+ ++ list -> kompjuta .current_command ;
96+ }
4897
4998void kore_kompjuta_command_list_set_bind_group (kore_gpu_command_list * list , uint32_t index , kore_kompjuta_descriptor_set * set , uint32_t dynamic_count ,
5099 uint32_t * dynamic_offsets ) {}
0 commit comments