Merge branch 'dev' of git.nbross.com:nielsbross/Shader-Compiler into dev

This commit is contained in:
2024-06-28 08:56:29 +02:00

View File

@@ -49,13 +49,22 @@ properties {
view : float4x4; view : float4x4;
} }
``` ```
which will be exposed in the compiled result. In the future `properties` can be renamed to a custom/shorter name like which will be exposed in the compiled result. `properties` can be renamed to a custom/shorter name like
``` ```
p :: properties { p :: properties {
... ...
} }
``` ```
You can also define constant buffers
```
camera :: Constant_Buffer {
projection : float4x4;
view : float4x4;
}
```
## Jai Usage Example ## Jai Usage Example
To compile a shader and use the result, you can do the following in jai To compile a shader and use the result, you can do the following in jai
@@ -95,6 +104,9 @@ A `Shader_Variant_Collection` looks as follows
Shader_Variant_Collection :: struct { Shader_Variant_Collection :: struct {
properties : Properties; properties : Properties;
max_constant_buffers :: 16;
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
variants : [..]Shader_Variant; variants : [..]Shader_Variant;
} }
@@ -114,6 +126,16 @@ Shader_Variant :: struct {
} }
} }
Constant_Buffer :: struct {
register : int;
name : string;
fields : Static_Array(Property_Field, 16);
buffer_index : u32;
}
Properties :: struct { Properties :: struct {
fields : [..]Property_Field; fields : [..]Property_Field;