mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-14 06:58:56 +02:00
fuck you 2 times
This commit is contained in:
parent
bf559148b9
commit
271695f020
2 changed files with 17 additions and 6 deletions
|
|
@ -200,12 +200,13 @@ Id GetAttributeType(EmitContext& ctx, AttributeType type) {
|
|||
case AttributeType::Float:
|
||||
return ctx.F32[4];
|
||||
case AttributeType::SignedInt:
|
||||
case AttributeType::SignedNorm:
|
||||
return ctx.TypeVector(ctx.TypeInt(32, true), 4);
|
||||
case AttributeType::UnsignedInt:
|
||||
case AttributeType::UnsignedNorm:
|
||||
return ctx.U32[4];
|
||||
case AttributeType::SignedScaled:
|
||||
return ctx.profile.support_scaled_attributes ? ctx.F32[4]
|
||||
: ctx.TypeVector(ctx.TypeInt(32, true), 4);
|
||||
return ctx.profile.support_scaled_attributes ? ctx.F32[4] : ctx.TypeVector(ctx.TypeInt(32, true), 4);
|
||||
case AttributeType::UnsignedScaled:
|
||||
return ctx.profile.support_scaled_attributes ? ctx.F32[4] : ctx.U32[4];
|
||||
case AttributeType::Disabled:
|
||||
|
|
@ -218,12 +219,10 @@ InputGenericInfo GetAttributeInfo(EmitContext& ctx, AttributeType type, Id id) {
|
|||
switch (type) {
|
||||
case AttributeType::Float:
|
||||
return InputGenericInfo{id, ctx.input_f32, ctx.F32[1], InputGenericLoadOp::None};
|
||||
// TODO: properly impl this?
|
||||
case AttributeType::UnsignedNorm:
|
||||
return InputGenericInfo{id, ctx.input_u32, ctx.U32[1], InputGenericLoadOp::Bitcast};
|
||||
return InputGenericInfo{id, ctx.input_u32, ctx.U32[1], InputGenericLoadOp::UNorm};
|
||||
case AttributeType::SignedNorm:
|
||||
return InputGenericInfo{id, ctx.input_s32, ctx.TypeInt(32, true), InputGenericLoadOp::Bitcast};
|
||||
//
|
||||
return InputGenericInfo{id, ctx.input_s32, ctx.TypeInt(32, true), InputGenericLoadOp::SNorm};
|
||||
case AttributeType::UnsignedInt:
|
||||
return InputGenericInfo{id, ctx.input_u32, ctx.U32[1], InputGenericLoadOp::Bitcast};
|
||||
case AttributeType::SignedInt:
|
||||
|
|
@ -781,6 +780,16 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
|
|||
return OpConvertSToF(F32[1], value);
|
||||
case InputGenericLoadOp::UToF:
|
||||
return OpConvertUToF(F32[1], value);
|
||||
case InputGenericLoadOp::SNorm: {
|
||||
Id const fp16_value = OpShiftRightArithmetic(U32[1], value, Const(16U));
|
||||
Id const max_value = Const(unsigned(std::numeric_limits<s16>::max()));
|
||||
return OpFDiv(F32[1], OpConvertSToF(F32[1], fp16_value), max_value);
|
||||
}
|
||||
case InputGenericLoadOp::UNorm: {
|
||||
Id const fp16_value = OpShiftRightLogical(U32[1], value, Const(16U));
|
||||
Id const max_value = Const(unsigned(std::numeric_limits<u16>::max()));
|
||||
return OpFDiv(F32[1], OpConvertSToF(F32[1], fp16_value), max_value);
|
||||
}
|
||||
default:
|
||||
return value;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -143,6 +143,8 @@ enum class InputGenericLoadOp {
|
|||
Bitcast,
|
||||
SToF,
|
||||
UToF,
|
||||
SNorm,
|
||||
UNorm,
|
||||
};
|
||||
|
||||
struct InputGenericInfo {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue