summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@collabora.com>2022-01-24 11:49:33 +0100
committerMarge Bot <emma+marge@anholt.net>2022-01-31 20:21:25 +0000
commit27790c4a7a659057c802e254e44cd0bb8b60192f (patch)
treec83b88c5b50a95b651fd85ae75524707cb965f80
parentd85a9d658faad07ec24a0466396648489623e032 (diff)
microsoft/spirv_to_dxil: Remove dead variables after the struct split pass
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
-rw-r--r--src/microsoft/ci/spirv2dxil_reference.txt340
-rw-r--r--src/microsoft/spirv_to_dxil/spirv_to_dxil.c5
2 files changed, 43 insertions, 302 deletions
diff --git a/src/microsoft/ci/spirv2dxil_reference.txt b/src/microsoft/ci/spirv2dxil_reference.txt
index ad099416e23..c2835065de8 100644
--- a/src/microsoft/ci/spirv2dxil_reference.txt
+++ b/src/microsoft/ci/spirv2dxil_reference.txt
@@ -335,46 +335,11 @@ Test:SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm:m
Test:SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm:main|Fragment: Pass
-Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm:main|Vertex: Fail
-Assertion failed: glsl_get_components(type) == 4
-
-
+Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm:main|Vertex: Pass
Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm:main|Vertex: Fail
Assertion failed: glsl_get_components(type) == 4
@@ -383,14 +348,8 @@ Test:SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessCh
Assertion failed: glsl_get_components(type) == 4
-Test:SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm:main|Vertex: Fail
-Assertion failed: glsl_get_components(type) == 4
-
-
-Test:SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm:main|Vertex: Fail
-Assertion failed: glsl_get_components(type) == 4
-
-
+Test:SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm:main|Vertex: Pass
Test:SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm:main|Vertex: Fail
Assertion failed: glsl_get_components(type) == 4
@@ -407,211 +366,44 @@ Test:SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessCh
Assertion failed: glsl_get_components(type) == 4
-Test:SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
+Test:SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm:main|Vertex: Pass
Test:SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm:main|Fragment: Pass
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm:main|Vertex: Pass
Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm:main|Fragment: Pass
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm:main|Fragment: Fail
-DXIL: SV_Coverage must be uint
-
-Validation failed.
-
-Failed to validate DXIL
-
-
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm:main|Fragment: Pass
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm:main|Fragment: Fail
-Assertion failed: !"unexpected glsl type"
-
-
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm:main|Fragment: Fail
-Assertion failed: !"unexpected glsl type"
-
-
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm:main|Fragment: Fail
-Assertion failed: !"unexpected glsl type"
-
-
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm:main|Fragment: Pass
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm:main|Fragment: Pass
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm:main|Fragment: Pass
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm:main|Vertex: Pass
Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm:main|Fragment: Pass
-Test:SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm:main|Fragment: Fail
-DXIL: Semantic 'UNDEFINED' is invalid as ps Output
-Pixel Shader allows output semantics to be SV_Target, SV_Depth, SV_DepthGreaterEqual, SV_DepthLessEqual, SV_Coverage or SV_StencilRef, UNDEFINED found
-Not all elements of output UNDEFINED were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm:main|Vertex: Fail
-Assertion failed: !"unexpected glsl type"
-
-
+Test:SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm:main|Fragment: Pass
+Test:SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm:main|Vertex: Pass
Test:SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm:main|Fragment: Pass
-Test:SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
+Test:SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm:main|Vertex: Pass
Test:SpvModuleScopeVarParserTest_MatrixInitializer.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_NoVar.spvasm:main|Fragment: Pass
-Test:SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm:main|Vertex: Fail
-Assertion failed: !"unexpected glsl type"
-
-
+Test:SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm:main|Vertex: Pass
Test:SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_PrivateVar.spvasm:main|Fragment: Pass
@@ -677,60 +469,12 @@ Test:SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm:main|Fragment
Test:SpvModuleScopeVarParserTest_VectorInitializer.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm:main|Fragment: Pass
Test:SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm:main|Fragment: Pass
-Test:SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
-Test:SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
+Test:SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm:main|Vertex: Pass
+Test:SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm:main|Vertex: Pass
Test:SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm:main|Fragment: Pass
Test:SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm:main|Fragment: Pass
Test:SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm:main|Fragment: Pass
@@ -1198,15 +942,7 @@ Test:SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm:main|GLCom
Test:SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm:comp_main|GLCompute: Pass
Test:SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm:comp_main|GLCompute: Pass
Test:SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm:first_shader|Fragment: Pass
-Test:SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm:main|Vertex: Fail
-DXIL: Not all elements of output SV_Position were written
-Not all elements of SV_Position were written
-
-Validation failed.
-
-Failed to validate DXIL
-
-
+Test:SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm:main|Vertex: Pass
Test:SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm:comp_main|GLCompute: Pass
Test:SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm:comp_main|GLCompute: Pass
Test:SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm:comp_main|GLCompute: Pass
diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
index 1b6fc429f9b..17ae5edded9 100644
--- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
+++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
@@ -226,6 +226,11 @@ spirv_to_dxil(const uint32_t *words, size_t word_count,
NIR_PASS_V(nir, nir_split_per_member_structs);
+ NIR_PASS_V(nir, nir_remove_dead_variables,
+ nir_var_shader_in | nir_var_shader_out |
+ nir_var_system_value | nir_var_mem_shared,
+ NULL);
+
NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_ubo | nir_var_mem_ssbo,
nir_address_format_32bit_index_offset);