HLSL: Fix #802: Preserve promoted child under ! operator.
This commit is contained in:
		
							parent
							
								
									7e997e2612
								
							
						
					
					
						commit
						18958f6cd2
					
				
							
								
								
									
										233
									
								
								Test/baseResults/hlsl.logicalConvert.frag.out
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										233
									
								
								Test/baseResults/hlsl.logicalConvert.frag.out
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,233 @@ | |||||||
|  | hlsl.logicalConvert.frag | ||||||
|  | Shader version: 450 | ||||||
|  | gl_FragCoord origin is upper left | ||||||
|  | 0:? Sequence | ||||||
|  | 0:2  Function Definition: @main( ( temp 4-component vector of float) | ||||||
|  | 0:2    Function Parameters:  | ||||||
|  | 0:?     Sequence | ||||||
|  | 0:3      Test condition and select ( temp void) | ||||||
|  | 0:3        Condition | ||||||
|  | 0:3        Constant: | ||||||
|  | 0:3          false (const bool) | ||||||
|  | 0:3        true case | ||||||
|  | 0:4        Branch: Return with expression | ||||||
|  | 0:4          Constant: | ||||||
|  | 0:4            0.000000 | ||||||
|  | 0:4            0.000000 | ||||||
|  | 0:4            0.000000 | ||||||
|  | 0:4            0.000000 | ||||||
|  | 0:5      Test condition and select ( temp void) | ||||||
|  | 0:5        Condition | ||||||
|  | 0:5        Constant: | ||||||
|  | 0:5          false (const bool) | ||||||
|  | 0:5        true case | ||||||
|  | 0:6        Branch: Return with expression | ||||||
|  | 0:6          Constant: | ||||||
|  | 0:6            0.000000 | ||||||
|  | 0:6            0.000000 | ||||||
|  | 0:6            0.000000 | ||||||
|  | 0:6            0.000000 | ||||||
|  | 0:7      Test condition and select ( temp void) | ||||||
|  | 0:7        Condition | ||||||
|  | 0:7        Constant: | ||||||
|  | 0:7          true (const bool) | ||||||
|  | 0:7        true case | ||||||
|  | 0:8        Branch: Return with expression | ||||||
|  | 0:8          Constant: | ||||||
|  | 0:8            0.000000 | ||||||
|  | 0:8            0.000000 | ||||||
|  | 0:8            0.000000 | ||||||
|  | 0:8            0.000000 | ||||||
|  | 0:9      Test condition and select ( temp void) | ||||||
|  | 0:9        Condition | ||||||
|  | 0:9        Constant: | ||||||
|  | 0:9          true (const bool) | ||||||
|  | 0:9        true case | ||||||
|  | 0:10        Branch: Return with expression | ||||||
|  | 0:10          Constant: | ||||||
|  | 0:10            0.000000 | ||||||
|  | 0:10            0.000000 | ||||||
|  | 0:10            0.000000 | ||||||
|  | 0:10            0.000000 | ||||||
|  | 0:11      Test condition and select ( temp void) | ||||||
|  | 0:11        Condition | ||||||
|  | 0:11        Constant: | ||||||
|  | 0:11          false (const bool) | ||||||
|  | 0:11        true case | ||||||
|  | 0:12        Branch: Return with expression | ||||||
|  | 0:12          Constant: | ||||||
|  | 0:12            0.000000 | ||||||
|  | 0:12            0.000000 | ||||||
|  | 0:12            0.000000 | ||||||
|  | 0:12            0.000000 | ||||||
|  | 0:13      Test condition and select ( temp void) | ||||||
|  | 0:13        Condition | ||||||
|  | 0:13        Constant: | ||||||
|  | 0:13          false (const bool) | ||||||
|  | 0:13        true case | ||||||
|  | 0:14        Branch: Return with expression | ||||||
|  | 0:14          Constant: | ||||||
|  | 0:14            0.000000 | ||||||
|  | 0:14            0.000000 | ||||||
|  | 0:14            0.000000 | ||||||
|  | 0:14            0.000000 | ||||||
|  | 0:2  Function Definition: main( ( temp void) | ||||||
|  | 0:2    Function Parameters:  | ||||||
|  | 0:?     Sequence | ||||||
|  | 0:2      move second child to first child ( temp 4-component vector of float) | ||||||
|  | 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float) | ||||||
|  | 0:2        Function Call: @main( ( temp 4-component vector of float) | ||||||
|  | 0:?   Linker Objects | ||||||
|  | 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Linked fragment stage: | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Shader version: 450 | ||||||
|  | gl_FragCoord origin is upper left | ||||||
|  | 0:? Sequence | ||||||
|  | 0:2  Function Definition: @main( ( temp 4-component vector of float) | ||||||
|  | 0:2    Function Parameters:  | ||||||
|  | 0:?     Sequence | ||||||
|  | 0:3      Test condition and select ( temp void) | ||||||
|  | 0:3        Condition | ||||||
|  | 0:3        Constant: | ||||||
|  | 0:3          false (const bool) | ||||||
|  | 0:3        true case | ||||||
|  | 0:4        Branch: Return with expression | ||||||
|  | 0:4          Constant: | ||||||
|  | 0:4            0.000000 | ||||||
|  | 0:4            0.000000 | ||||||
|  | 0:4            0.000000 | ||||||
|  | 0:4            0.000000 | ||||||
|  | 0:5      Test condition and select ( temp void) | ||||||
|  | 0:5        Condition | ||||||
|  | 0:5        Constant: | ||||||
|  | 0:5          false (const bool) | ||||||
|  | 0:5        true case | ||||||
|  | 0:6        Branch: Return with expression | ||||||
|  | 0:6          Constant: | ||||||
|  | 0:6            0.000000 | ||||||
|  | 0:6            0.000000 | ||||||
|  | 0:6            0.000000 | ||||||
|  | 0:6            0.000000 | ||||||
|  | 0:7      Test condition and select ( temp void) | ||||||
|  | 0:7        Condition | ||||||
|  | 0:7        Constant: | ||||||
|  | 0:7          true (const bool) | ||||||
|  | 0:7        true case | ||||||
|  | 0:8        Branch: Return with expression | ||||||
|  | 0:8          Constant: | ||||||
|  | 0:8            0.000000 | ||||||
|  | 0:8            0.000000 | ||||||
|  | 0:8            0.000000 | ||||||
|  | 0:8            0.000000 | ||||||
|  | 0:9      Test condition and select ( temp void) | ||||||
|  | 0:9        Condition | ||||||
|  | 0:9        Constant: | ||||||
|  | 0:9          true (const bool) | ||||||
|  | 0:9        true case | ||||||
|  | 0:10        Branch: Return with expression | ||||||
|  | 0:10          Constant: | ||||||
|  | 0:10            0.000000 | ||||||
|  | 0:10            0.000000 | ||||||
|  | 0:10            0.000000 | ||||||
|  | 0:10            0.000000 | ||||||
|  | 0:11      Test condition and select ( temp void) | ||||||
|  | 0:11        Condition | ||||||
|  | 0:11        Constant: | ||||||
|  | 0:11          false (const bool) | ||||||
|  | 0:11        true case | ||||||
|  | 0:12        Branch: Return with expression | ||||||
|  | 0:12          Constant: | ||||||
|  | 0:12            0.000000 | ||||||
|  | 0:12            0.000000 | ||||||
|  | 0:12            0.000000 | ||||||
|  | 0:12            0.000000 | ||||||
|  | 0:13      Test condition and select ( temp void) | ||||||
|  | 0:13        Condition | ||||||
|  | 0:13        Constant: | ||||||
|  | 0:13          false (const bool) | ||||||
|  | 0:13        true case | ||||||
|  | 0:14        Branch: Return with expression | ||||||
|  | 0:14          Constant: | ||||||
|  | 0:14            0.000000 | ||||||
|  | 0:14            0.000000 | ||||||
|  | 0:14            0.000000 | ||||||
|  | 0:14            0.000000 | ||||||
|  | 0:2  Function Definition: main( ( temp void) | ||||||
|  | 0:2    Function Parameters:  | ||||||
|  | 0:?     Sequence | ||||||
|  | 0:2      move second child to first child ( temp 4-component vector of float) | ||||||
|  | 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float) | ||||||
|  | 0:2        Function Call: @main( ( temp 4-component vector of float) | ||||||
|  | 0:?   Linker Objects | ||||||
|  | 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float) | ||||||
|  | 
 | ||||||
|  | // Module Version 10000 | ||||||
|  | // Generated by (magic number): 80001 | ||||||
|  | // Id's are bound by 38 | ||||||
|  | 
 | ||||||
|  |                               Capability Shader | ||||||
|  |                1:             ExtInstImport  "GLSL.std.450" | ||||||
|  |                               MemoryModel Logical GLSL450 | ||||||
|  |                               EntryPoint Fragment 4  "main" 36 | ||||||
|  |                               ExecutionMode 4 OriginUpperLeft | ||||||
|  |                               Name 4  "main" | ||||||
|  |                               Name 9  "@main(" | ||||||
|  |                               Name 36  "@entryPointOutput" | ||||||
|  |                               Decorate 36(@entryPointOutput) Location 0 | ||||||
|  |                2:             TypeVoid | ||||||
|  |                3:             TypeFunction 2 | ||||||
|  |                6:             TypeFloat 32 | ||||||
|  |                7:             TypeVector 6(float) 4 | ||||||
|  |                8:             TypeFunction 7(fvec4) | ||||||
|  |               11:             TypeBool | ||||||
|  |               12:    11(bool) ConstantFalse | ||||||
|  |               15:    6(float) Constant 0 | ||||||
|  |               16:    7(fvec4) ConstantComposite 15 15 15 15 | ||||||
|  |               21:    11(bool) ConstantTrue | ||||||
|  |               35:             TypePointer Output 7(fvec4) | ||||||
|  | 36(@entryPointOutput):     35(ptr) Variable Output | ||||||
|  |          4(main):           2 Function None 3 | ||||||
|  |                5:             Label | ||||||
|  |               37:    7(fvec4) FunctionCall 9(@main() | ||||||
|  |                               Store 36(@entryPointOutput) 37 | ||||||
|  |                               Return | ||||||
|  |                               FunctionEnd | ||||||
|  |        9(@main():    7(fvec4) Function None 8 | ||||||
|  |               10:             Label | ||||||
|  |                               SelectionMerge 14 None | ||||||
|  |                               BranchConditional 12 13 14 | ||||||
|  |               13:               Label | ||||||
|  |                                 ReturnValue 16 | ||||||
|  |               14:             Label | ||||||
|  |                               SelectionMerge 19 None | ||||||
|  |                               BranchConditional 12 18 19 | ||||||
|  |               18:               Label | ||||||
|  |                                 ReturnValue 16 | ||||||
|  |               19:             Label | ||||||
|  |                               SelectionMerge 23 None | ||||||
|  |                               BranchConditional 21 22 23 | ||||||
|  |               22:               Label | ||||||
|  |                                 ReturnValue 16 | ||||||
|  |               23:             Label | ||||||
|  |                               SelectionMerge 26 None | ||||||
|  |                               BranchConditional 21 25 26 | ||||||
|  |               25:               Label | ||||||
|  |                                 ReturnValue 16 | ||||||
|  |               26:             Label | ||||||
|  |                               SelectionMerge 29 None | ||||||
|  |                               BranchConditional 12 28 29 | ||||||
|  |               28:               Label | ||||||
|  |                                 ReturnValue 16 | ||||||
|  |               29:             Label | ||||||
|  |                               SelectionMerge 32 None | ||||||
|  |                               BranchConditional 12 31 32 | ||||||
|  |               31:               Label | ||||||
|  |                                 ReturnValue 16 | ||||||
|  |               32:             Label | ||||||
|  |               34:    7(fvec4) Undef | ||||||
|  |                               ReturnValue 34 | ||||||
|  |                               FunctionEnd | ||||||
							
								
								
									
										15
									
								
								Test/hlsl.logicalConvert.frag
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								Test/hlsl.logicalConvert.frag
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | float4 main() : SV_TARGET | ||||||
|  | { | ||||||
|  | 	if (!(0) && (0) || (!1)) | ||||||
|  | 	    return 0.0.xxxx;  | ||||||
|  | 	if (0) | ||||||
|  | 	    return 0.0.xxxx;  | ||||||
|  | 	if (!(bool)0) | ||||||
|  | 		return 0.0.xxxx; | ||||||
|  | 	if (!0) | ||||||
|  | 		return 0.0.xxxx; | ||||||
|  | 	if (!(bool)1) | ||||||
|  | 		return 0.0.xxxx; | ||||||
|  | 	if (!1) | ||||||
|  | 		return 0.0.xxxx; | ||||||
|  | } | ||||||
| @ -356,12 +356,12 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo | |||||||
|     node->updatePrecision(); |     node->updatePrecision(); | ||||||
| 
 | 
 | ||||||
|     // If it's a (non-specialization) constant, it must be folded.
 |     // If it's a (non-specialization) constant, it must be folded.
 | ||||||
|     if (child->getAsConstantUnion()) |     if (node->getOperand()->getAsConstantUnion()) | ||||||
|         return child->getAsConstantUnion()->fold(op, node->getType()); |         return node->getOperand()->getAsConstantUnion()->fold(op, node->getType()); | ||||||
| 
 | 
 | ||||||
|     // If it's a specialization constant, the result is too,
 |     // If it's a specialization constant, the result is too,
 | ||||||
|     // if the operation is allowed for specialization constants.
 |     // if the operation is allowed for specialization constants.
 | ||||||
|     if (child->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node)) |     if (node->getOperand()->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node)) | ||||||
|         node->getWritableType().getQualifier().makeSpecConstant(); |         node->getWritableType().getQualifier().makeSpecConstant(); | ||||||
| 
 | 
 | ||||||
|     return node; |     return node; | ||||||
|  | |||||||
| @ -159,9 +159,10 @@ INSTANTIATE_TEST_CASE_P( | |||||||
|         {"hlsl.load.rwtexture.array.dx10.frag", "main"}, |         {"hlsl.load.rwtexture.array.dx10.frag", "main"}, | ||||||
|         {"hlsl.load.offset.dx10.frag", "main"}, |         {"hlsl.load.offset.dx10.frag", "main"}, | ||||||
|         {"hlsl.load.offsetarray.dx10.frag", "main"}, |         {"hlsl.load.offsetarray.dx10.frag", "main"}, | ||||||
|         {"hlsl.logical.unary.frag", "main"}, |  | ||||||
|         {"hlsl.logical.binary.frag", "main"}, |         {"hlsl.logical.binary.frag", "main"}, | ||||||
|         {"hlsl.logical.binary.vec.frag", "main"}, |         {"hlsl.logical.binary.vec.frag", "main"}, | ||||||
|  |         {"hlsl.logicalConvert.frag", "main"}, | ||||||
|  |         {"hlsl.logical.unary.frag", "main"}, | ||||||
|         {"hlsl.namespace.frag", "main"}, |         {"hlsl.namespace.frag", "main"}, | ||||||
|         {"hlsl.matNx1.frag", "main"}, |         {"hlsl.matNx1.frag", "main"}, | ||||||
|         {"hlsl.matrixSwizzle.vert", "ShaderFunction"}, |         {"hlsl.matrixSwizzle.vert", "ShaderFunction"}, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 John Kessenich
						John Kessenich