https://github.com/g-truc/glm
I compiled a C99 cglm static lib for FreeBASIC which are not usable, the SSE, NEON, AVX stuff are in lined in the headers not in the static lib itself.
https://github.com/recp/cglm
Than I compiled shared 32/64-bit lib's now the problem are vec4() and mat(2) and mat(4) must be minimum aligned(16) SINGLE/float arrays !
Code: Select all
typedef float vec2[2];
typedef float vec3[3];
typedef int ivec3[3];
typedef CGLM_ALIGN_IF(16) float vec4[4];
typedef vec4 versor; /* |x, y, z, w| -> w is the last */
typedef vec3 mat3[3];
typedef CGLM_ALIGN_IF(16) vec2 mat2[2];
typedef CGLM_ALIGN_MAT vec4 mat4[4];
Is it the same for fbc ARM (NEON) and what is if an fixed size array are dim'ed temporary inside of sub/functions are they allocated aligned on stack ?
Joshy
Code: Select all
#include "fbc-int/array.bi"
function flagsString(flags as uinteger) as string
return str(flags and &h0000000f) & " allocated dims " & _
iif(flags and &h00000010,"dimensions are fixed " ," ") & _
iif(flags and &h00000020,"memory is fixed lenght" ,"")
end function
function alignedString(adr as uinteger) as string
if (adr and 31) = 0 then return " aligned(32)"
if (adr and 15) = 0 then return " aligned(16)"
if (adr and 7) = 0 then return " aligned(8)"
return " not SSE aligned !"
end function
sub printArrayInfo(array() as const single)
var p=FBC.ArrayConstDescriptorPtr(array())
print "index_ptr " & str(p->index_ptr) & alignedString(cast(uinteger,p->index_ptr))
print "base_ptr " & p->base_ptr & alignedString(cast(uinteger,p->base_ptr))
print "size " & p->size
print "element_len " & p->element_len
print "dimensions " & p->dimensions
print "flags " & p->flags & " " & flagsString(p->flags)
if p->dimensions<1 then return
for i as uinteger = 0 to p->dimensions-1
print "dimtb(" & i & ").elements " & p->dimtb(i).elements
print "dimtb(" & i & ").lbound " & p->dimtb(i).lbound
print "dimtb(" & i & ").ubound " & p->dimtb(i).ubound
print
next
end sub
dim as single vec3(2)
dim as single vec4(3)
dim as single mat4(15)
print "vec3()"
printArrayInfo(vec3())
print
print "vec4()"
printArrayInfo(vec4())
print
print "mat4()"
printArrayInfo(mat4())
print
sleep