I have some small questions about the usage of constant buffers in HLSL.
Currently, I distribute my data over constant buffers depending on the per-frame or per-draw character of that data. I wonder, if it is advisable to distribute the data additionally on the per-shader character of that data? For example: I could bind 2 constant buffers to both the VS and PS, or I could bind 4 constant buffers exclusively to the VS or PS. Note that the latter would require an additional map/unmap per draw and per frame. Due to this performance penalty, I assume this would not result in any benefits. But maybe someone has different thoughts on this?
Could it be beneficiary to use float3x3 instead of matrix (float4x4) in a constant buffer to reduce the size and thus bandwidth requirements? All codes samples, I have seen so far, use float4x4 for transforming normals and texture coordinates, whereas in both cases float3x3 would suffice. Due to the packing, float3x3 needs 3x float4s, whereas float4x4 needs 4x float4s. So in case I have 1 separate float4 available, I could add this float4 between the float3x3s.
↧