2021-05-21 03:38:38 +00:00
|
|
|
// Copyright 2021 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
#include "shader_recompiler/backend/glsl/emit_context.h"
|
|
|
|
#include "shader_recompiler/backend/glsl/emit_glsl_instructions.h"
|
|
|
|
#include "shader_recompiler/frontend/ir/value.h"
|
|
|
|
#include "shader_recompiler/profile.h"
|
|
|
|
|
|
|
|
namespace Shader::Backend::GLSL {
|
|
|
|
void EmitLoadStorageU8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset) {
|
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmitLoadStorageS8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset) {
|
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmitLoadStorageU16([[maybe_unused]] EmitContext& ctx,
|
|
|
|
[[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset) {
|
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmitLoadStorageS16([[maybe_unused]] EmitContext& ctx,
|
|
|
|
[[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset) {
|
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
2021-05-24 22:35:37 +00:00
|
|
|
void EmitLoadStorage32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
|
|
|
|
const IR::Value& offset) {
|
2021-05-25 05:35:30 +00:00
|
|
|
ctx.AddU32("{}=ssbo{}[{}];", inst, binding.U32(), offset.U32());
|
2021-05-21 03:38:38 +00:00
|
|
|
}
|
|
|
|
|
2021-05-25 05:35:30 +00:00
|
|
|
void EmitLoadStorage64(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
|
|
|
|
const IR::Value& offset) {
|
|
|
|
ctx.AddU32x2("{}=uvec2(ssbo{}[{}],ssbo{}[{}]);", inst, binding.U32(), offset.U32(),
|
|
|
|
binding.U32(), offset.U32() + 1);
|
2021-05-21 03:38:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EmitLoadStorage128([[maybe_unused]] EmitContext& ctx,
|
|
|
|
[[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset) {
|
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmitWriteStorageU8([[maybe_unused]] EmitContext& ctx,
|
|
|
|
[[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset,
|
2021-05-21 23:55:58 +00:00
|
|
|
[[maybe_unused]] std::string_view value) {
|
2021-05-21 03:38:38 +00:00
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmitWriteStorageS8([[maybe_unused]] EmitContext& ctx,
|
|
|
|
[[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset,
|
2021-05-21 23:55:58 +00:00
|
|
|
[[maybe_unused]] std::string_view value) {
|
2021-05-21 03:38:38 +00:00
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmitWriteStorageU16([[maybe_unused]] EmitContext& ctx,
|
|
|
|
[[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset,
|
2021-05-21 23:55:58 +00:00
|
|
|
[[maybe_unused]] std::string_view value) {
|
2021-05-21 03:38:38 +00:00
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmitWriteStorageS16([[maybe_unused]] EmitContext& ctx,
|
|
|
|
[[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset,
|
2021-05-21 23:55:58 +00:00
|
|
|
[[maybe_unused]] std::string_view value) {
|
2021-05-21 03:38:38 +00:00
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
|
2021-05-22 05:52:03 +00:00
|
|
|
void EmitWriteStorage32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
|
|
|
|
std::string_view value) {
|
2021-05-25 05:35:30 +00:00
|
|
|
ctx.Add("ssbo{}[{}]={};", binding.U32(), offset.U32(), value);
|
2021-05-21 03:38:38 +00:00
|
|
|
}
|
|
|
|
|
2021-05-22 05:52:03 +00:00
|
|
|
void EmitWriteStorage64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
|
|
|
|
std::string_view value) {
|
2021-05-25 05:35:30 +00:00
|
|
|
ctx.Add("ssbo{}[{}]={}.x;", binding.U32(), offset.U32(), value);
|
|
|
|
ctx.Add("ssbo{}[{}]={}.y;", binding.U32(), offset.U32() + 1, value);
|
2021-05-21 03:38:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EmitWriteStorage128([[maybe_unused]] EmitContext& ctx,
|
|
|
|
[[maybe_unused]] const IR::Value& binding,
|
|
|
|
[[maybe_unused]] const IR::Value& offset,
|
2021-05-21 23:55:58 +00:00
|
|
|
[[maybe_unused]] std::string_view value) {
|
2021-05-21 03:38:38 +00:00
|
|
|
throw NotImplementedException("GLSL Instrucion");
|
|
|
|
}
|
|
|
|
} // namespace Shader::Backend::GLSL
|