amber icon indicating copy to clipboard operation
amber copied to clipboard

source a .spv file instead of asm

Open seanbaxter opened this issue 4 years ago • 6 comments

How do I source a .spv file directly in the amber script? I don't want to dump the SPIRV-ASM into the script because the module is too enormous for that.

seanbaxter avatar Dec 14 '20 17:12 seanbaxter

You can write it in as SPIRV-HEX.

dj2 avatar Dec 14 '20 17:12 dj2

If you mean load an external file, that doesn't exist at this point as it hasn't been a high priority for folks.

dj2 avatar Dec 14 '20 17:12 dj2

https://gist.github.com/seanbaxter/84bc81ec1f9142374dc7ed249d7aba27

I tried SPIRV-HEX here. Amber enters an infinite loop in shader_compiler.cc:194. If I'm using it wrongly, that's because there are no scripts in tests/ that show how to use it.

seanbaxter avatar Dec 14 '20 18:12 seanbaxter

Yes, the hex format hasn't really been used, so there are possibly bugs down that path. You can see the test file at https://github.com/google/amber/blob/main/src/shader_compiler_test.cc#L31 which shows the format it's expecting. We have an open issue to write documentation for the HEX format.

dj2 avatar Dec 14 '20 18:12 dj2

I used xxd -ps to generate hex. I don't think it will even print a format that accords with what's in amber.

seanbaxter avatar Dec 14 '20 18:12 seanbaxter

I believe the values were from the -x flag to GLSLang. I can't help you with xdd -ps as I have not used it in a long time.

dj2 avatar Dec 14 '20 18:12 dj2