Fixes for texture and sampler codegen

- Moved textures and samplers out of property cbuffer for hlsl
- Fixed register indices for resources
This commit is contained in:
2024-07-01 07:58:13 +02:00
parent 274cb379b4
commit 92c1f593c2
3 changed files with 66 additions and 22 deletions

View File

@@ -72,6 +72,7 @@ Field :: struct {
name : string;
type : Field_Type;
resource_index : u32;
hints : [..]Field_Hint;
}
@@ -240,9 +241,13 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
}
case .Texture2D; {
type.kind = Field_Kind.Texture2D;
field.resource_index = variable.resource_index;
}
case .Sampler; {
type.kind = Field_Kind.Sampler;
field.resource_index = variable.resource_index;
}
case .Struct; {
type.kind = Field_Kind.Struct;
@@ -374,11 +379,11 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
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));;
field.base_field = type_variable_to_field(*checker, h2tv(*checker, child));;
array_add(*cb.fields, field);
}
cb.buffer_index = variable.buffer_index;
cb.buffer_index = variable.resource_index;
}
find_result := find_symbol(*check_result.scope_stack, "properties", xx 1);
@@ -392,7 +397,7 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
prop_field.base_field = field;
array_add(*result.collection.properties.fields, prop_field);
}
result.collection.properties.buffer_index = property_variable.buffer_index;
result.collection.properties.buffer_index = property_variable.resource_index;
}
if checker.result.pixel_entry_point {