suyu/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp

67 lines
1.7 KiB
C++
Raw Normal View History

2021-02-08 05:54:35 +00:00
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "shader_recompiler/backend/spirv/emit_spirv.h"
#include "shader_recompiler/backend/spirv/emit_spirv_instructions.h"
2021-02-08 05:54:35 +00:00
namespace Shader::Backend::SPIRV {
2021-02-17 03:59:28 +00:00
void EmitBitCastU16F16(EmitContext&) {
2021-02-08 05:54:35 +00:00
throw NotImplementedException("SPIR-V Instruction");
}
2021-02-17 03:59:28 +00:00
Id EmitBitCastU32F32(EmitContext& ctx, Id value) {
2021-02-16 07:10:22 +00:00
return ctx.OpBitcast(ctx.U32[1], value);
2021-02-08 05:54:35 +00:00
}
2021-02-17 03:59:28 +00:00
void EmitBitCastU64F64(EmitContext&) {
2021-02-08 05:54:35 +00:00
throw NotImplementedException("SPIR-V Instruction");
}
2021-02-17 03:59:28 +00:00
void EmitBitCastF16U16(EmitContext&) {
2021-02-08 05:54:35 +00:00
throw NotImplementedException("SPIR-V Instruction");
}
2021-02-17 03:59:28 +00:00
Id EmitBitCastF32U32(EmitContext& ctx, Id value) {
2021-02-16 07:10:22 +00:00
return ctx.OpBitcast(ctx.F32[1], value);
2021-02-08 05:54:35 +00:00
}
2021-02-17 03:59:28 +00:00
void EmitBitCastF64U64(EmitContext&) {
2021-02-08 05:54:35 +00:00
throw NotImplementedException("SPIR-V Instruction");
}
2021-03-05 06:15:16 +00:00
Id EmitPackUint2x32(EmitContext& ctx, Id value) {
return ctx.OpBitcast(ctx.U64, value);
2021-02-08 05:54:35 +00:00
}
2021-02-19 21:10:18 +00:00
Id EmitUnpackUint2x32(EmitContext& ctx, Id value) {
return ctx.OpBitcast(ctx.U32[2], value);
2021-02-08 05:54:35 +00:00
}
2021-02-19 21:10:18 +00:00
Id EmitPackFloat2x16(EmitContext& ctx, Id value) {
return ctx.OpBitcast(ctx.U32[1], value);
2021-02-08 05:54:35 +00:00
}
2021-02-19 21:10:18 +00:00
Id EmitUnpackFloat2x16(EmitContext& ctx, Id value) {
return ctx.OpBitcast(ctx.F16[2], value);
2021-02-08 05:54:35 +00:00
}
2021-02-19 21:10:18 +00:00
Id EmitPackHalf2x16(EmitContext& ctx, Id value) {
return ctx.OpPackHalf2x16(ctx.U32[1], value);
2021-02-08 05:54:35 +00:00
}
2021-02-19 21:10:18 +00:00
Id EmitUnpackHalf2x16(EmitContext& ctx, Id value) {
return ctx.OpUnpackHalf2x16(ctx.F32[2], value);
}
Id EmitPackDouble2x32(EmitContext& ctx, Id value) {
return ctx.OpBitcast(ctx.F64[1], value);
}
Id EmitUnpackDouble2x32(EmitContext& ctx, Id value) {
return ctx.OpBitcast(ctx.U32[2], value);
2021-02-08 05:54:35 +00:00
}
} // namespace Shader::Backend::SPIRV