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

How to get reflection info? #11

Open
Wolfos opened this issue Nov 13, 2019 · 1 comment
Open

How to get reflection info? #11

Wolfos opened this issue Nov 13, 2019 · 1 comment

Comments

@Wolfos
Copy link

Wolfos commented Nov 13, 2019

The API's recommended usage (I.E. through ResourceFactory) doesn't output the compilation results needed to get the reflection info. I looked at the code a bit and this doesn't seem easy to implement. Especially given how differently Vulkan compilation is handled.

@AntiBlueQuirk
Copy link

Is it possible to create dummy "Spir-V to Spir-V" compiler in the native library that just passes the shader through unmodified? The code in the Spirv-Cross CLI for handling reflection seems to support this.

Something like this in libveldrid-spirv.cpp?

case SPIRV:
{
    auto ret = new CompilerReflection(spirvBytes); // Special reflection compiler.
    return ret;
}

Then you can probably skip over most of the logic in CompileVertexFragment. At the end, you would just leave the CompilationResult DataBuffers empty, then collect the reflection information as normal. On the C# side, collect the reflection info from the compilation result and return the input shaders unmodified.

This would mean that reflection info would be available no matter the target backend, so it could be added to the public API.

(I don't have a dev environment available for this project, so I can't test this, but it seems like it would work.)

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