mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-30 23:33:17 +00:00
shader_recompiler: Misc shader fixes. (#2781)
* shader_recompiler: Fix frexp exponent type. * shader_recompiler: Implement V_CMP_CLASS_F32 negative class mask. * shader_recompiler: Define operands for DS_ORDERED_COUNT.
This commit is contained in:
parent
657073b9e2
commit
bec1b9056f
5 changed files with 9 additions and 7 deletions
|
@ -267,12 +267,12 @@ Id EmitFPFrexpSig64(EmitContext& ctx, Id value) {
|
||||||
|
|
||||||
Id EmitFPFrexpExp32(EmitContext& ctx, Id value) {
|
Id EmitFPFrexpExp32(EmitContext& ctx, Id value) {
|
||||||
const auto frexp = ctx.OpFrexpStruct(ctx.frexp_result_f32, value);
|
const auto frexp = ctx.OpFrexpStruct(ctx.frexp_result_f32, value);
|
||||||
return ctx.OpCompositeExtract(ctx.U32[1], frexp, 1);
|
return ctx.OpBitcast(ctx.U32[1], ctx.OpCompositeExtract(ctx.S32[1], frexp, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
Id EmitFPFrexpExp64(EmitContext& ctx, Id value) {
|
Id EmitFPFrexpExp64(EmitContext& ctx, Id value) {
|
||||||
const auto frexp = ctx.OpFrexpStruct(ctx.frexp_result_f64, value);
|
const auto frexp = ctx.OpFrexpStruct(ctx.frexp_result_f64, value);
|
||||||
return ctx.OpCompositeExtract(ctx.U32[1], frexp, 1);
|
return ctx.OpBitcast(ctx.U32[1], ctx.OpCompositeExtract(ctx.S32[1], frexp, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
Id EmitFPOrdEqual16(EmitContext& ctx, Id lhs, Id rhs) {
|
Id EmitFPOrdEqual16(EmitContext& ctx, Id lhs, Id rhs) {
|
||||||
|
|
|
@ -153,9 +153,9 @@ void EmitContext::DefineArithmeticTypes() {
|
||||||
|
|
||||||
full_result_i32x2 = Name(TypeStruct(S32[1], S32[1]), "full_result_i32x2");
|
full_result_i32x2 = Name(TypeStruct(S32[1], S32[1]), "full_result_i32x2");
|
||||||
full_result_u32x2 = Name(TypeStruct(U32[1], U32[1]), "full_result_u32x2");
|
full_result_u32x2 = Name(TypeStruct(U32[1], U32[1]), "full_result_u32x2");
|
||||||
frexp_result_f32 = Name(TypeStruct(F32[1], U32[1]), "frexp_result_f32");
|
frexp_result_f32 = Name(TypeStruct(F32[1], S32[1]), "frexp_result_f32");
|
||||||
if (info.uses_fp64) {
|
if (info.uses_fp64) {
|
||||||
frexp_result_f64 = Name(TypeStruct(F64[1], U32[1]), "frexp_result_f64");
|
frexp_result_f64 = Name(TypeStruct(F64[1], S32[1]), "frexp_result_f64");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2784,8 +2784,7 @@ constexpr std::array<InstFormat, 256> InstructionFormatDS = {{
|
||||||
// 62 = DS_APPEND
|
// 62 = DS_APPEND
|
||||||
{InstClass::DsAppendCon, InstCategory::DataShare, 3, 1, ScalarType::Uint32, ScalarType::Uint32},
|
{InstClass::DsAppendCon, InstCategory::DataShare, 3, 1, ScalarType::Uint32, ScalarType::Uint32},
|
||||||
// 63 = DS_ORDERED_COUNT
|
// 63 = DS_ORDERED_COUNT
|
||||||
{InstClass::GdsOrdCnt, InstCategory::DataShare, 3, 1, ScalarType::Undefined,
|
{InstClass::GdsOrdCnt, InstCategory::DataShare, 3, 1, ScalarType::Uint32, ScalarType::Uint32},
|
||||||
ScalarType::Undefined},
|
|
||||||
// 64 = DS_ADD_U64
|
// 64 = DS_ADD_U64
|
||||||
{InstClass::DsAtomicArith64, InstCategory::DataShare, 3, 1, ScalarType::Uint64,
|
{InstClass::DsAtomicArith64, InstCategory::DataShare, 3, 1, ScalarType::Uint64,
|
||||||
ScalarType::Uint64},
|
ScalarType::Uint64},
|
||||||
|
|
|
@ -1010,8 +1010,10 @@ void Translator::V_CMP_CLASS_F32(const GcnInst& inst) {
|
||||||
value = ir.FPIsNan(src0);
|
value = ir.FPIsNan(src0);
|
||||||
} else if ((class_mask & IR::FloatClassFunc::Infinity) == IR::FloatClassFunc::Infinity) {
|
} else if ((class_mask & IR::FloatClassFunc::Infinity) == IR::FloatClassFunc::Infinity) {
|
||||||
value = ir.FPIsInf(src0);
|
value = ir.FPIsInf(src0);
|
||||||
|
} else if ((class_mask & IR::FloatClassFunc::Negative) == IR::FloatClassFunc::Negative) {
|
||||||
|
value = ir.FPLessThanEqual(src0, ir.Imm32(-0.f));
|
||||||
} else {
|
} else {
|
||||||
UNREACHABLE();
|
UNREACHABLE_MSG("Unsupported float class mask: {:#x}", static_cast<u32>(class_mask));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We don't know the type yet, delay its resolution.
|
// We don't know the type yet, delay its resolution.
|
||||||
|
|
|
@ -25,6 +25,7 @@ enum class FloatClassFunc : u32 {
|
||||||
|
|
||||||
NaN = SignalingNan | QuietNan,
|
NaN = SignalingNan | QuietNan,
|
||||||
Infinity = PositiveInfinity | NegativeInfinity,
|
Infinity = PositiveInfinity | NegativeInfinity,
|
||||||
|
Negative = NegativeInfinity | NegativeNormal | NegativeDenorm | NegativeZero,
|
||||||
Finite = NegativeNormal | NegativeDenorm | NegativeZero | PositiveNormal | PositiveDenorm |
|
Finite = NegativeNormal | NegativeDenorm | NegativeZero | PositiveNormal | PositiveDenorm |
|
||||||
PositiveZero,
|
PositiveZero,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue