[ad_1]
I’ve a small subject with my shaders. Sorry if it’s not the appropriate place for this query. Usually, the essence is that for my utility on dx12, I’ve shaders in glsl (I am too lazy to rewrite them as a result of there are numerous, and they aren’t just for dx12), and I compile them into hlsl utilizing spirv-cross (I get roughly what I count on). My drawback is as follows: I do not fairly perceive how you can appropriately arrange the format for bindings in shaders. If the binding is only a construction, all the pieces is ok. But when it is an array of buildings, all the pieces breaks. On the C++ facet, all my buildings are aligned (alignas(16)).
For instance, I’ve a binding, in hlsl it seems like this:
struct vert_in
{
float4 Pos;
float4 Tangent;
float4 Bitangent;
float2 TexPos;
uint Regular;
};
ByteAddressBuffer _41 : register(t1, space0); // That is the place vert_in is getting used
Initially vert_in was utilized by storage buffer, so it was utilizing std430 format.
I’ve tried including paddings (for instance, added one uint within the instance with vert_in), nevertheless it did not actually assist.
After I added paddings to all array of buildings bindings,it occurred that nothing rendered in any respect. Apparently, in vulkan/glsl all the pieces working is ok.
Both I do not perceive one thing, or I am simply doing it fallacious. I attempted including paddings, however I suppose, it is not the appropriate strategy.
[ad_2]