You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Again, this is only about extern structs, as far as I'm aware you can still safely @ptrCast from a vector to an array pointer, so there is no problem with the glUniform calls.
Activity
jingkaimori commentedon Jun 19, 2025
could zig make some optimization by altering layout of vector? if so, only vectors passed into pipeline should be changed to aligned fix-width array.
IntegratedQuantum commentedon Jun 19, 2025
This is only about extern structs, which are used to communicate with e.g. glsl, where we must, at all cost, have a fixed memory layout.
jingkaimori commentedon Jun 19, 2025
It seems like most vector is decomposed like here before passing into glsl:
Cubyz/src/renderer.zig
Lines 314 to 315 in 9c33f81
However, vectors could be passed in as a pointer to aligned buffer:
Cubyz/src/renderer/chunk_meshing.zig
Line 213 in 9c33f81
Therefore only some vector should be changed to given layout, which is passed into APIs ending with a
vlikeglUniformxxvIntegratedQuantum commentedon Jun 19, 2025
Again, this is only about extern structs, as far as I'm aware you can still safely
@ptrCastfrom a vector to an array pointer, so there is no problem with theglUniformcalls.Don't use vector types in the GPU buffer.
Make particle struct extern (#2066)
Make particle struct extern (PixelGuys#2066)
Make particle struct extern (PixelGuys#2066)