Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpvReflectInterfaceVariable seems to be missing a size property #130

Open
Saalvage opened this issue Nov 6, 2021 · 2 comments
Open

SpvReflectInterfaceVariable seems to be missing a size property #130

Saalvage opened this issue Nov 6, 2021 · 2 comments

Comments

@Saalvage
Copy link

Saalvage commented Nov 6, 2021

So the only ways I can see of determing the size of a SpvReflectInterfaceVariable seems to be either:

  1. Combining the numeric, array and members members manually which sounds pretty hard to get right and definitely cumbersome.
  2. Using the format member and mapping it to a size manually, although I assume that'd disregard the possibility of the variable being an array or possessing members of its own.

This makes it very hard to determine the offset of vertex properties.

I could totally be missing something though, in which case I'm sorry!

@chaoticbob
Copy link
Contributor

Hi,

No you're not missing any information. Figuring out the size of interface variables is a bit cumbersome. In most cases, SPIRV-Reflect can only understand simple case for this, i.e. variables are aways 4 components and 32-bits. There's some historical reason for this but I'm not able to recall precisely what it was.

Do you have an example of the shader code that I can use to examine the behavior?

Thanks,
Hai

@Saalvage
Copy link
Author

Hey, thanks for getting back to me!

Hmm, in that case I assume it might be a good idea to provide some sort of utility function utilizing one of the methods I described above?

I'm sorry but I don't exactly understand what you mean by an example shader? I can't seem to find any way to get the total size of a SpvReflectInterfaceVariable in any way directly, be it as simple as can be.

If you just need any concrete example, here's a shader and the code we use to read the size of the vertex input variables.

If you could be a bit more concrete I'd happily provide some more concrete examples or isolate the issue further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants