mirror of
				https://gitlab.winehq.org/wine/vkd3d.git
				synced 2025-09-12 18:50:22 -07:00 
			
		
		
		
	vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_min().
This commit is contained in:
		
				
					committed by
					
						 Alexandre Julliard
						Alexandre Julliard
					
				
			
			
				
	
			
			
			
						parent
						
							aa82f61ef3
						
					
				
				
					commit
					c805eb1191
				
			
				
				Notes:
				
					Alexandre Julliard
				
				2023-05-26 22:17:06 +02:00 
			
			Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/210
| @@ -434,29 +434,29 @@ static bool fold_max(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
|  |  | ||||||
| static bool fold_min(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, | static bool fold_min(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, | ||||||
|         struct hlsl_ir_constant *src1, struct hlsl_ir_constant *src2) |         const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) | ||||||
| { | { | ||||||
|     enum hlsl_base_type type = dst->node.data_type->base_type; |     enum hlsl_base_type type = dst_type->base_type; | ||||||
|     unsigned int k; |     unsigned int k; | ||||||
|  |  | ||||||
|     assert(type == src1->node.data_type->base_type); |     assert(type == src1->node.data_type->base_type); | ||||||
|     assert(type == src2->node.data_type->base_type); |     assert(type == src2->node.data_type->base_type); | ||||||
|  |  | ||||||
|     for (k = 0; k < dst->node.data_type->dimx; ++k) |     for (k = 0; k < dst_type->dimx; ++k) | ||||||
|     { |     { | ||||||
|         switch (type) |         switch (type) | ||||||
|         { |         { | ||||||
|             case HLSL_TYPE_INT: |             case HLSL_TYPE_INT: | ||||||
|                 dst->value.u[k].i = min(src1->value.u[k].i, src2->value.u[k].i); |                 dst->u[k].i = min(src1->value.u[k].i, src2->value.u[k].i); | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|             case HLSL_TYPE_UINT: |             case HLSL_TYPE_UINT: | ||||||
|                 dst->value.u[k].u = min(src1->value.u[k].u, src2->value.u[k].u); |                 dst->u[k].u = min(src1->value.u[k].u, src2->value.u[k].u); | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|             default: |             default: | ||||||
|                 FIXME("Fold min for type %s.\n", debug_hlsl_type(ctx, dst->node.data_type)); |                 FIXME("Fold min for type %s.\n", debug_hlsl_type(ctx, dst_type)); | ||||||
|                 return false; |                 return false; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -612,7 +612,7 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, | |||||||
|             break; |             break; | ||||||
|  |  | ||||||
|         case HLSL_OP2_MIN: |         case HLSL_OP2_MIN: | ||||||
|             success = fold_min(ctx, res, arg1, arg2); |             success = fold_min(ctx, &res->value, instr->data_type, arg1, arg2); | ||||||
|             break; |             break; | ||||||
|  |  | ||||||
|         case HLSL_OP2_BIT_XOR: |         case HLSL_OP2_BIT_XOR: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user