mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-11-01 12:57:52 +00:00
shader: SULD.D bits32 implement more complexer method.
This commit is contained in:
parent
ed1d8beb13
commit
08db60392d
1 changed files with 28 additions and 4 deletions
|
@ -80,10 +80,34 @@ u32 ShaderIR::DecodeImage(NodeBlock& bb, u32 pc) {
|
||||||
|
|
||||||
switch (instr.suldst.GetStoreDataLayout()) {
|
switch (instr.suldst.GetStoreDataLayout()) {
|
||||||
case StoreType::Bits32: {
|
case StoreType::Bits32: {
|
||||||
MetaImage meta{image, {}, {}};
|
Node value{};
|
||||||
Node value = Operation(OperationCode::ImageLoad, meta, GetCoordinates(type));
|
for (s32 i = 3; i >= 0; i--) {
|
||||||
SetTemporary(bb, 0, std::move(value));
|
MetaImage meta{image, {}, i};
|
||||||
SetRegister(bb, instr.gpr0.Value(), GetTemporary(0));
|
Node element_value =
|
||||||
|
Operation(OperationCode::ImageLoad, meta, GetCoordinates(type));
|
||||||
|
|
||||||
|
const Node comp = GetPredicateComparisonFloat(PredCondition::GreaterEqual,
|
||||||
|
element_value, Immediate(1.0f));
|
||||||
|
const Node mul =
|
||||||
|
Operation(OperationCode::Select, comp, Immediate(1.f), Immediate(255.f));
|
||||||
|
|
||||||
|
Node element = Operation(OperationCode::FMul, NO_PRECISE, element_value, mul);
|
||||||
|
element = SignedOperation(OperationCode::ICastFloat, true, NO_PRECISE,
|
||||||
|
std::move(element));
|
||||||
|
element = Operation(OperationCode::ULogicalShiftLeft, std::move(element),
|
||||||
|
Immediate(8 * i));
|
||||||
|
if (i == 3) {
|
||||||
|
//(namkazt) for now i'm force it to 0 at alpha component if color is in
|
||||||
|
// range (0-255)
|
||||||
|
value = Operation(OperationCode::Select, comp, Immediate(0),
|
||||||
|
std::move(element));
|
||||||
|
} else {
|
||||||
|
value = Operation(OperationCode::UBitwiseOr, value,
|
||||||
|
Operation(OperationCode::Select, comp,
|
||||||
|
std::move(element_value), std::move(element)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetRegister(bb, instr.gpr0.Value(), std::move(value));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue