Skip to content

Commit

Permalink
[WGSL] Fix binding indices
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Oct 7, 2023
1 parent 662e476 commit 802d696
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Sources/backends/wgsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,27 +555,25 @@ static void wgsl_export_everything(char *directory) {
}

void wgsl_export(char *directory) {
int cbuffer_index = 0;
int texture_index = 0;
int sampler_index = 0;
int binding_index = 0;

memset(global_register_indices, 0, sizeof(global_register_indices));

for (global_id i = 0; get_global(i).type != NO_TYPE; ++i) {
global g = get_global(i);
if (g.type == sampler_type_id) {
global_register_indices[i] = sampler_index;
sampler_index += 1;
global_register_indices[i] = binding_index;
binding_index += 1;
}
else if (g.type == tex2d_type_id || g.type == texcube_type_id) {
global_register_indices[i] = texture_index;
texture_index += 1;
global_register_indices[i] = binding_index;
binding_index += 1;
}
else if (g.type == float_id) {
}
else {
global_register_indices[i] = cbuffer_index;
cbuffer_index += 1;
global_register_indices[i] = binding_index;
binding_index += 1;
}
}

Expand Down

0 comments on commit 802d696

Please sign in to comment.