forked from ShuriZma/suyu
1
0
Fork 0

glsl: Implement BF*

This commit is contained in:
ameerj 2021-05-21 21:31:41 -04:00
parent 0f40b0e61c
commit 266a3d60e3
3 changed files with 10 additions and 9 deletions

View File

@ -204,8 +204,8 @@ void EmitSelectU8(EmitContext& ctx, std::string_view cond, std::string_view true
std::string_view false_value); std::string_view false_value);
void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value, void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value); std::string_view false_value);
void EmitSelectU32(EmitContext& ctx, std::string_view cond, std::string_view true_value, void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
std::string_view false_value); std::string_view true_value, std::string_view false_value);
void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value, void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value); std::string_view false_value);
void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value, void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value,

View File

@ -22,7 +22,7 @@ void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& in
void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLSL Instruction"); ctx.AddU32("{}={}-{};", inst, a, b);
} }
void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@ -111,26 +111,26 @@ void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::
[[maybe_unused]] std::string_view insert, [[maybe_unused]] std::string_view insert,
[[maybe_unused]] std::string_view offset, [[maybe_unused]] std::string_view offset,
[[maybe_unused]] std::string_view count) { [[maybe_unused]] std::string_view count) {
throw NotImplementedException("GLSL Instruction"); ctx.AddU32("{}=bitfieldInsert({}, {}, int({}), int({}));", inst, base, insert, offset, count);
} }
void EmitBitFieldSExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitBitFieldSExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view base, [[maybe_unused]] std::string_view base,
[[maybe_unused]] std::string_view offset, [[maybe_unused]] std::string_view offset,
[[maybe_unused]] std::string_view count) { [[maybe_unused]] std::string_view count) {
throw NotImplementedException("GLSL Instruction"); ctx.AddU32("{}=bitfieldExtract(int({}), int({}), int({}));", inst, base, offset, count);
} }
void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view base, [[maybe_unused]] std::string_view base,
[[maybe_unused]] std::string_view offset, [[maybe_unused]] std::string_view offset,
[[maybe_unused]] std::string_view count) { [[maybe_unused]] std::string_view count) {
throw NotImplementedException("GLSL Instruction"); ctx.AddU32("{}=bitfieldExtract({}, int({}), int({}));", inst, base, offset, count);
} }
void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) { [[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLSL Instruction"); ctx.AddU32("{}=bitfieldReverse({});", inst, value);
} }
void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,

View File

@ -28,10 +28,11 @@ void EmitSelectU16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::stri
throw NotImplementedException("GLSL Instruction"); throw NotImplementedException("GLSL Instruction");
} }
void EmitSelectU32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, void EmitSelectU32([[maybe_unused]] EmitContext& ctx, IR::Inst& inst,
[[maybe_unused]] std::string_view cond,
[[maybe_unused]] std::string_view true_value, [[maybe_unused]] std::string_view true_value,
[[maybe_unused]] std::string_view false_value) { [[maybe_unused]] std::string_view false_value) {
throw NotImplementedException("GLSL Instruction"); ctx.AddU32("{}={}?{}:{};", inst, cond, true_value, false_value);
} }
void EmitSelectU64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, void EmitSelectU64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond,