#Sampler2D in GLSL struct?
9 messages · Page 1 of 1 (latest)
I have always kept them outside. Texture and buffer bindings are descriptor / bind group like stuff, so they are different from other stuff
I would reorder members to match the layout rules - groups of 4 components, so vec3 should always start at multiple of 4 components, and be followed by one component, dummy padding if nothing else exists.
by dummy padding do you mean like a fundamental type that's never called?
vec3 cameraPosition; float dummy;
perfect, thank you for the advice! Its great to know
Note that using sampler array consumes multiple texture units. You could use array texture instead - that way it consumes only one texture unit.
Great to know as well, I did not know about array textures.
you can only put them in structs if your structs are part of a regular uniform. you cannot use structs containing opaque types in buffer backed interface blocks unless you are using bindless, which I'm assuming you probably aren't