Added constant buffers
This commit is contained in:
24
README.md
24
README.md
@@ -49,13 +49,22 @@ properties {
|
||||
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 {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
You can also define constant buffers
|
||||
|
||||
```
|
||||
camera :: Constant_Buffer {
|
||||
projection : float4x4;
|
||||
view : float4x4;
|
||||
}
|
||||
```
|
||||
|
||||
## Jai Usage Example
|
||||
|
||||
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 {
|
||||
properties : Properties;
|
||||
|
||||
max_constant_buffers :: 16;
|
||||
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
|
||||
|
||||
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 {
|
||||
fields : [..]Property_Field;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user