@@ -110,6 +110,28 @@ static bool IsFloatingPointType(VarType type)
110110 }
111111}
112112
113+ static bool IsSignedIntegerType (VarType type)
114+ {
115+ switch (type)
116+ {
117+ case VarType::SLong:
118+ case VarType::SInt:
119+ case VarType::SShort: return true ;
120+ default : return false ;
121+ }
122+ }
123+
124+ static bool IsUnsignedIntegerType (VarType type)
125+ {
126+ switch (type)
127+ {
128+ case VarType::ULong:
129+ case VarType::UInt:
130+ case VarType::UShort: return true ;
131+ default : return false ;
132+ }
133+ }
134+
113135static bool IsEncodedPointer (const ShaderVariable &var)
114136{
115137 if (var.type != VarType::GPUPointer)
@@ -3002,13 +3024,24 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
30023024 ShaderVariable b;
30033025 RDCASSERT (GetShaderVariable (inst.args [1 ], opCode, dxOpCode, a));
30043026 RDCASSERT (GetShaderVariable (inst.args [2 ], opCode, dxOpCode, b));
3005- RDCASSERTEQUAL (a.type , VarType::SInt);
3006- RDCASSERTEQUAL (b.type , VarType::SInt);
3007- RDCASSERTEQUAL (result.type , VarType::SInt);
3027+ RDCASSERT (IsSignedIntegerType (a.type ));
3028+ RDCASSERTEQUAL (a.type , b.type );
3029+ RDCASSERTEQUAL (result.type , a.type );
3030+ const uint32_t c = 0 ;
30083031 if (dxOpCode == DXOp::IMin)
3009- result.value .s32v [0 ] = RDCMIN (a.value .s32v [0 ], b.value .s32v [0 ]);
3032+ {
3033+ #undef _IMPL
3034+ #define _IMPL (I, S, U ) comp<S>(result, c) = RDCMIN(comp<S>(a, c), comp<S>(b, c));
3035+
3036+ IMPL_FOR_INT_TYPES_FOR_TYPE (_IMPL, result.type );
3037+ }
30103038 else if (dxOpCode == DXOp::IMax)
3011- result.value .s32v [0 ] = RDCMAX (a.value .s32v [0 ], b.value .s32v [0 ]);
3039+ {
3040+ #undef _IMPL
3041+ #define _IMPL (I, S, U ) comp<S>(result, c) = RDCMAX(comp<S>(a, c), comp<S>(b, c));
3042+ IMPL_FOR_INT_TYPES_FOR_TYPE (_IMPL, result.type );
3043+ }
3044+ break ;
30123045 }
30133046 case DXOp::UMin:
30143047 case DXOp::UMax:
@@ -3019,13 +3052,23 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
30193052 ShaderVariable b;
30203053 RDCASSERT (GetShaderVariable (inst.args [1 ], opCode, dxOpCode, a));
30213054 RDCASSERT (GetShaderVariable (inst.args [2 ], opCode, dxOpCode, b));
3022- RDCASSERTEQUAL (a.type , VarType::SInt);
3023- RDCASSERTEQUAL (b.type , VarType::SInt);
3024- RDCASSERTEQUAL (result.type , VarType::SInt);
3055+ RDCASSERT (IsUnsignedIntegerType (a.type ));
3056+ RDCASSERTEQUAL (a.type , b.type );
3057+ RDCASSERTEQUAL (result.type , a.type );
3058+ const uint32_t c = 0 ;
30253059 if (dxOpCode == DXOp::UMin)
3026- result.value .u32v [0 ] = RDCMIN (a.value .u32v [0 ], b.value .u32v [0 ]);
3060+ {
3061+ #undef _IMPL
3062+ #define _IMPL (I, S, U ) comp<U>(result, c) = RDCMIN(comp<U>(a, c), comp<U>(b, c));
3063+
3064+ IMPL_FOR_INT_TYPES_FOR_TYPE (_IMPL, result.type );
3065+ }
30273066 else if (dxOpCode == DXOp::UMax)
3028- result.value .u32v [0 ] = RDCMAX (a.value .u32v [0 ], b.value .u32v [0 ]);
3067+ {
3068+ #undef _IMPL
3069+ #define _IMPL (I, S, U ) comp<U>(result, c) = RDCMAX(comp<U>(a, c), comp<U>(b, c));
3070+ IMPL_FOR_INT_TYPES_FOR_TYPE (_IMPL, result.type );
3071+ }
30293072 break ;
30303073 }
30313074 case DXOp::FMin:
0 commit comments