Simdify 24.24 — 6/23/2024

Release details are described below.

Simdify Platform

Refactored allocation concepts in <ShaderBufferBindNode>. Previously, the <ShaderBufferNode> stored the buffer size in a data member named c_uBufferSize, and the <ShaderBufferBindNode> also stored a buffer size in a data member named c_uBufferSize. This was necessary because shader buffers can have variably sized allocations. In the previous implementation, the buffer size specified by the <ShaderBufferNode> and <ShaderBufferBindNode> were added together to determine the final size of the allocation. Using c_uBufferSize as the data member name for both nodes turned out to be confusing.

buffer my_buffer
{
   float data[]; // Variable sized allocation. When querying OpenGL relection, the buffer size is reported as 4, which is as if this were.
                 // declared as float data[1]. The shader buffer bind can specify 'extra bytes' to determine how many floats to allocate.
                 // For example: buffer size is reported as 4 bytes. You specify an additional 12 bytes, for a total of 16 bytes.
                 // That means the count of this array will be 4.
};

The new allocation concept is that <ShaderBufferNode> still uses the c_uBufferSize data member. This always refers to the size of the buffer specified by an OpenGL reflection query. The final allocation will be this size at minimum. The <ShaderBufferBindNode> now uses the data member named c_uExtraBytes. This makes is very clear that the <ShaderBufferBindNode> may specify extra bytes as needed for a particular allocation, and helps keep the concepts separate.

As part of these changes, <ShaderBufferBindNode> now uses the data member c_ePaddingAlignment and a new data member called c_uPaddingBytes.

enum PaddingMode
{
   PaddingMode_None = 0,
   PaddingMode_4 = 1,
   PaddingMode_8 = 2,
   PaddingMode_16 = 3,
   PaddingMode_32 = 4,
   PaddingMode_64 = 5,
   PaddingMode_128 = 6,
   PaddingMode_256 = 7,
   PaddingMode_Max = 8
};

You can set the padding alignment in the <ShaderBufferBindNode> property editor (or with Simdify Scripting Language). During the buffer allocation process, the unpaddded allocation size is determined by summing c_uBufferSize and c_uExtraBytes. The padding alignment bytes are then computed using the sum of c_uBufferSize and c_uExtraBytes. The padding bytes are then added to the total allocation size. Note that you cannot directly set the value of c_uPaddingBytes. You can only affect its value by changing c_ePaddingAlignment.