Skip to content

generated_tests: Generate SPIR-V equivalents for builtin tests

Adds a script based on gen_builtin_uniform_tests.py which directly generates the equivalent SPIR-V assembly to test with the ARB_gl_spirv extension. The main reason to do this rather than converting the GLSL tests with glslang is that not all of the GLSL builtins have direct equivalents in SPIR-V. For example most of them only work when the operands all have the same type. If we tested different combinations of types we’d just be testing glslang’s ability to add the opcodes needed to promote the arguments. Additionally it’s nice not to depend on glslang which tends to change a lot between versions.

Note that the script has the code needed to generate tests for vertex, geometry, tessellation, fragment and compute shaders but everything but the fragment shaders is commented out. This reduces the number of test cases to a fifth. The assumption is that there probably isn’t that much difference between the codepaths taken for the builtins in the driver for the different stages so it’s not really worth testing all of them.

v2: stop to use OriginLowerLeft always, as it is only valid for fragment shaders, and mesa has recently added an assert for it (Alejandro)

Merge request reports

Loading