I was interested in both the design of the code and the performance aspect, if it is better to have dedicated buffers when sending data to the GPU in HLSL or to another high-level shader language.
Here, a particular shader should have a lot of variable data that changes at runtime, and, as such, information should be passed in buffers.
I give a very simple example:
cbuffer SomeLargeBuffer : register(cb0)
{
float3 data;
float someData;
float4 largeArray[2500];
float moreData;
...
...
...
...
...
}
or have
cbuffer SamllerBuffer: register(cb0)
{
float3 data;
float someRelatedData;
}
cbuffer SecondSmallerBuffer : register(cb1)
{
float4 largeArray[2500];
float moreData;
}
cbuffer ThirdBuffer: register(cb2)
{
...
...
...
}
source
share