google / amber

Amber is a multi-API shader test framework
Apache License 2.0
192 stars 65 forks source link

source a .spv file instead of asm #931

Open seanbaxter opened 3 years ago

seanbaxter commented 3 years ago

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.

dj2 commented 3 years ago

You can write it in as SPIRV-HEX.

dj2 commented 3 years ago

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

seanbaxter commented 3 years ago

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.

dj2 commented 3 years ago

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.

seanbaxter commented 3 years ago

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

dj2 commented 3 years ago

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.