nCine::RHI::RSX::RsxShaderProgram::RsxInstanceField struct

One field of a batched instance element, and where it sits on each side.

A batched instance array cannot go through RsxBlockUpload, because the two sides disagree about the element layout. The engine writes std140, which packs a trailing vec2 and float into one 16-byte slot; cgcomp gives every field its own constant register. For the sprite element that is 7 vec4 on the engine's side and 8 registers on the shader's - so the element cannot be handed over as one block, and its 5 fields cannot be handed over one register write each either without costing 5 writes per sprite.

Instead the draw path repacks: it gathers an element's fields out of the std140 range into a scratch buffer laid out the way the registers are, and issues one rsxSetVertexProgramConstants() per element. This structure is what that repacking is driven by.

Public variables

std::uint32_t SourceOffset
std::uint32_t RegisterOffset
std::uint32_t RegisterCount
std::uint32_t ByteSize
const char* Name