bd325d2984
Currently, the diff tool matches types bottom up, so on every instruction it expects to know if its operands are already matched or not. With cyclical references, it cannot know that. Type matching would need significant rework to be able to support such a use case; for example, it may need to maintain a set of plausable matches between type pointers that are forward-referenced, and potentially back track when later the types turn out to be incompatible. In this change, OpTypeForwardPointer is supported in the more common and trivial case. Firstly, forwarded type pointers are only matched if they have they have the same storage class and point to the same type opcode: - In the presence of debug info, matching is done only if the names are unique in both src and dst. - In the absence of debug info, matching is done only if there is only one possible matching. Fixes: #4754 |
||
---|---|---|
.. | ||
.gitignore | ||
basic_autogen.cpp | ||
basic_dst.spvasm | ||
basic_src.spvasm | ||
constant_array_size_autogen.cpp | ||
constant_array_size_dst.spvasm | ||
constant_array_size_src.spvasm | ||
diff_test_files_autogen.cmake | ||
different_decorations_fragment_autogen.cpp | ||
different_decorations_fragment_dst.spvasm | ||
different_decorations_fragment_src.spvasm | ||
different_decorations_vertex_autogen.cpp | ||
different_decorations_vertex_dst.spvasm | ||
different_decorations_vertex_src.spvasm | ||
extra_if_block_autogen.cpp | ||
extra_if_block_dst.spvasm | ||
extra_if_block_src.spvasm | ||
generate_tests.py | ||
index_signedness_autogen.cpp | ||
index_signedness_dst.spvasm | ||
index_signedness_src.spvasm | ||
int_vs_uint_constants_autogen.cpp | ||
int_vs_uint_constants_dst.spvasm | ||
int_vs_uint_constants_src.spvasm | ||
large_functions_large_diffs_autogen.cpp | ||
large_functions_large_diffs_dst.spvasm | ||
large_functions_large_diffs_src.spvasm | ||
large_functions_small_diffs_autogen.cpp | ||
large_functions_small_diffs_dst.spvasm | ||
large_functions_small_diffs_src.spvasm | ||
multiple_different_entry_points_autogen.cpp | ||
multiple_different_entry_points_dst.spvasm | ||
multiple_different_entry_points_src.spvasm | ||
multiple_same_entry_points_autogen.cpp | ||
multiple_same_entry_points_dst.spvasm | ||
multiple_same_entry_points_src.spvasm | ||
OpExtInst_in_dst_only_autogen.cpp | ||
OpExtInst_in_dst_only_dst.spvasm | ||
OpExtInst_in_dst_only_src.spvasm | ||
OpExtInst_in_src_only_autogen.cpp | ||
OpExtInst_in_src_only_dst.spvasm | ||
OpExtInst_in_src_only_src.spvasm | ||
OpTypeForwardPointer_basic_autogen.cpp | ||
OpTypeForwardPointer_basic_dst.spvasm | ||
OpTypeForwardPointer_basic_src.spvasm | ||
OpTypeForwardPointer_intertwined_autogen.cpp | ||
OpTypeForwardPointer_intertwined_dst.spvasm | ||
OpTypeForwardPointer_intertwined_src.spvasm | ||
OpTypeForwardPointer_mismatching_class_autogen.cpp | ||
OpTypeForwardPointer_mismatching_class_dst.spvasm | ||
OpTypeForwardPointer_mismatching_class_src.spvasm | ||
OpTypeForwardPointer_mismatching_type_autogen.cpp | ||
OpTypeForwardPointer_mismatching_type_dst.spvasm | ||
OpTypeForwardPointer_mismatching_type_src.spvasm | ||
OpTypeForwardPointer_nested_autogen.cpp | ||
OpTypeForwardPointer_nested_dst.spvasm | ||
OpTypeForwardPointer_nested_src.spvasm | ||
OpTypeForwardPointer_onesided_debug_autogen.cpp | ||
OpTypeForwardPointer_onesided_debug_dst.spvasm | ||
OpTypeForwardPointer_onesided_debug_src.spvasm | ||
README.md | ||
reordered_if_blocks_autogen.cpp | ||
reordered_if_blocks_dst.spvasm | ||
reordered_if_blocks_src.spvasm | ||
reordered_switch_blocks_autogen.cpp | ||
reordered_switch_blocks_dst.spvasm | ||
reordered_switch_blocks_src.spvasm | ||
small_functions_small_diffs_autogen.cpp | ||
small_functions_small_diffs_dst.spvasm | ||
small_functions_small_diffs_src.spvasm | ||
spec_constant_array_size_autogen.cpp | ||
spec_constant_array_size_dst.spvasm | ||
spec_constant_array_size_src.spvasm | ||
spec_constant_composite_autogen.cpp | ||
spec_constant_composite_dst.spvasm | ||
spec_constant_composite_src.spvasm | ||
unrelated_shaders_autogen.cpp | ||
unrelated_shaders_dst.spvasm | ||
unrelated_shaders_src.spvasm |
Diff tests
This directory contains files used to ensure correctness of the spirv-diff
implementation. The
generate_tests.py
script takes name_src.spvasm
and name_dst.spvasm
(for each name
) and
produces unit test files in the form of name_autogen.cpp
.
The unit test files test the diff between the src and dst inputs, as well as between debug-stripped
versions of those. Additionally, based on the {variant}_TESTS
lists defined in
generate_tests.py
, extra unit tests are added to exercise different options of spirv-diff.
New tests are added simply by placing a new name_src.spvasm
and name_dst.spvasm
pair in this
directory and running generate_tests.py
. Note that this script needs the path to the spirv-diff
executable that is built.
The generate_tests.py
script additionally expects name_src.spvasm
to include a heading where the
purpose of the test is explained. This heading is parsed as a block of lines starting with ;;
at
the top of the file.