I can't think of any complex game codebase I worked on that has shaders all in one file. They all need #include support. When I try to compile our GL shaders (really Vulkan), I get the following failures. Can I use this offline compiler on real .vert and .frag files? I'm trying to figure out why Mali driver puts out VK_DEVICE_LOST on our terrain shaders, and thought seeing the shader analysis might help.
malioc -c Mali-G76 --vulkan --vertex DebugMesh.vert
ERROR: 0X0000: SPIR-V require version 310 or higher. <- fixed below
ERROR: 0:4: X0000: '#include' : required extension not requested: GL_GOOGLE_include_directive
ERROR: 0:4: X0000: '#include' : must be followed by a header name
ERROR: 0ssing entry point: X0000: Each stage requires one entry point <- printing problem
After putting #version 310 es at the top of the file. We don't typically do this, since we need to compile the shaders using spriv-opt for many different versions. There also doesn't seem to be a compile option for this.
ERROR: 0ssing entry point: X0000: Each stage requires one entry point. <- how to specify this ?
Here are the reported extensions, but include support isn't in there.
Vulkan SPIR-V Extensions
========================
SPV_EXT_descriptor_indexing
SPV_EXT_fragment_invocation_density
SPV_EXT_physical_storage_buffer
SPV_EXT_shader_viewport_index_layer
SPV_KHR_16bit_storage
SPV_KHR_8bit_storage
SPV_KHR_device_group
SPV_KHR_float_controls
SPV_KHR_multiview
SPV_KHR_physical_storage_buffer
SPV_KHR_shader_ballot
SPV_KHR_shader_draw_parameters
SPV_KHR_storage_buffer_storage_class
SPV_KHR_subgroup_vote
SPV_KHR_variable_pointers
SPV_KHR_vulkan_memory_model
Seems like we can hand off spv files to the compiler, and those already have everything concatenated. I need to be able to process several hundred shader variants with minimal effort, so modifying the sources isn't possible. Now I can automate it off the spv files. I couldn't tell what formats were inputs vs. outputs in the help.
Now at least we can get a little analysis on the shaders.
--spirv
Compile a SPIR-V binary module.
Shouldn't the compiler tell me how many varyings a shader uses if that's critical to the 180MB limit on Mali driver? I don't see anything related to that in the output. Or is that "Work registers"?
Varying variant
---------------
Work registers: 30
Uniform registers: 102
Stack spilling: false
16-bit arithmetic: 0%