Fix static array. Add constant buffers. Beginning of textures.

This commit is contained in:
2024-06-26 13:42:13 +02:00
parent 3bbbc1d556
commit 1bf829d42f
8 changed files with 217 additions and 59 deletions

View File

@@ -116,13 +116,16 @@ Constant_Buffer :: struct {
name : string;
fields : Property_Field;
fields : Static_Array(Property_Field, 16);
buffer_index : u32;
}
Shader_Variant_Collection :: struct {
properties : Properties;
cbuffers : [..]Constant_Buffer;
max_constant_buffers :: 16;
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
variants : [..]Shader_Variant;
}
@@ -357,14 +360,26 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
for child : field_list.children {
tv := h2tv(*checker, child.type_variable);
field := type_variable_to_field(*checker, tv);
print("%\n", pretty_print_field(*field));
array_add(*variant.vertex_entry_point.input, field);
}
}
}
}
for buffer_variable : to_array(*check_result.constant_buffers) {
variable := h2tv(check_result.type_variables, buffer_variable);
cb := array_add(*result.collection.cbuffers);
for i : 0..variable.child_count - 1 {
child := variable.children[i];
field : Property_Field;
field.base_field = type_variable_to_field(*checker, h2tv(*checker, child));;
array_add(*cb.fields, field);
}
cb.buffer_index = variable.buffer_index;
}
find_result := find_symbol(*check_result.scope_stack, "properties", xx 1);
if find_result {
@@ -411,7 +426,6 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
}
variant.pixel_entry_point.return_value = field;
print("%\n", pretty_print_field(*field));
}
array_add(*result.collection.variants, variant);