Using low precision types for push_constants

Greetings,

I build GLSL shaders that are converted to SPIR-V using spirv cross according to the GL_KHR_vulkan_glsl extension:

Now I want to get into push constants but I unfortunately had to realize that several of my shaders break the 128 byte limit my platform provides.

I seek to remedy this problem by converting the colors to 4-component uint8 types which I assume would be the GLSL u8vec4 datatype.

Does anyone know of an example C++ program where this datatype or something comparable is used with push_constants?

Regards.

I know it’s a bit aside of what you asked but if you don’t find the sort of solution you are looking for an index in the push constants might help.

That index could then be used in combination with a buffer that holds the larger piece of info that you need, i.e. colors in your case.

Glsl has pack/unpack for normalised values. As for C++ part, why dont you just multiply the color by 256, convert to char and pack with bitshifts to a 32 bit int? If I recall correctly, push constants just take the memory and give it to the shader

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.