summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-15 23:15:13 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:31 +0200
commit31d402ee74d7f7045aec7e748fdee489a434db6b (patch)
tree2cc89d8b24d856e2af92be0a1a1948329b92dd01 /src/shader_recompiler/backend
parentglasm: Add graphics specific shader declarations to GLASM (diff)
downloadyuzu-31d402ee74d7f7045aec7e748fdee489a434db6b.tar
yuzu-31d402ee74d7f7045aec7e748fdee489a434db6b.tar.gz
yuzu-31d402ee74d7f7045aec7e748fdee489a434db6b.tar.bz2
yuzu-31d402ee74d7f7045aec7e748fdee489a434db6b.tar.lz
yuzu-31d402ee74d7f7045aec7e748fdee489a434db6b.tar.xz
yuzu-31d402ee74d7f7045aec7e748fdee489a434db6b.tar.zst
yuzu-31d402ee74d7f7045aec7e748fdee489a434db6b.zip
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp1
-rw-r--r--src/shader_recompiler/backend/glasm/reg_alloc.cpp3
-rw-r--r--src/shader_recompiler/backend/glasm/reg_alloc.h11
3 files changed, 15 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index ab6790ce8..e5c96eb7f 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -54,6 +54,7 @@ public:
}
switch (value.type) {
case Type::Register:
+ case Type::Void:
break;
case Type::U32:
ctx.Add("MOV.U {}.x,{};", reg, value.imm_u32);
diff --git a/src/shader_recompiler/backend/glasm/reg_alloc.cpp b/src/shader_recompiler/backend/glasm/reg_alloc.cpp
index f556f3aee..0e38f467f 100644
--- a/src/shader_recompiler/backend/glasm/reg_alloc.cpp
+++ b/src/shader_recompiler/backend/glasm/reg_alloc.cpp
@@ -57,6 +57,9 @@ void RegAlloc::FreeReg(Register reg) {
Value RegAlloc::MakeImm(const IR::Value& value) {
Value ret;
switch (value.Type()) {
+ case IR::Type::Void:
+ ret.type = Type::Void;
+ break;
case IR::Type::U1:
ret.type = Type::U32;
ret.imm_u32 = value.U1() ? 0xffffffff : 0;
diff --git a/src/shader_recompiler/backend/glasm/reg_alloc.h b/src/shader_recompiler/backend/glasm/reg_alloc.h
index 5742436cf..ede6edd1f 100644
--- a/src/shader_recompiler/backend/glasm/reg_alloc.h
+++ b/src/shader_recompiler/backend/glasm/reg_alloc.h
@@ -23,6 +23,7 @@ namespace Shader::Backend::GLASM {
class EmitContext;
enum class Type : u32 {
+ Void,
Register,
U32,
S32,
@@ -65,6 +66,8 @@ struct Value {
return false;
}
switch (type) {
+ case Type::Void:
+ return true;
case Type::Register:
return id == rhs.id;
case Type::U32:
@@ -218,6 +221,8 @@ struct fmt::formatter<Shader::Backend::GLASM::ScalarU32> {
template <typename FormatContext>
auto format(const Shader::Backend::GLASM::ScalarU32& value, FormatContext& ctx) {
switch (value.type) {
+ case Shader::Backend::GLASM::Type::Void:
+ break;
case Shader::Backend::GLASM::Type::Register:
return Shader::Backend::GLASM::FormatTo<true>(ctx, value.id);
case Shader::Backend::GLASM::Type::U32:
@@ -242,6 +247,8 @@ struct fmt::formatter<Shader::Backend::GLASM::ScalarS32> {
template <typename FormatContext>
auto format(const Shader::Backend::GLASM::ScalarS32& value, FormatContext& ctx) {
switch (value.type) {
+ case Shader::Backend::GLASM::Type::Void:
+ break;
case Shader::Backend::GLASM::Type::Register:
return Shader::Backend::GLASM::FormatTo<true>(ctx, value.id);
case Shader::Backend::GLASM::Type::U32:
@@ -266,6 +273,8 @@ struct fmt::formatter<Shader::Backend::GLASM::ScalarF32> {
template <typename FormatContext>
auto format(const Shader::Backend::GLASM::ScalarF32& value, FormatContext& ctx) {
switch (value.type) {
+ case Shader::Backend::GLASM::Type::Void:
+ break;
case Shader::Backend::GLASM::Type::Register:
return Shader::Backend::GLASM::FormatTo<true>(ctx, value.id);
case Shader::Backend::GLASM::Type::U32:
@@ -290,6 +299,8 @@ struct fmt::formatter<Shader::Backend::GLASM::ScalarF64> {
template <typename FormatContext>
auto format(const Shader::Backend::GLASM::ScalarF64& value, FormatContext& ctx) {
switch (value.type) {
+ case Shader::Backend::GLASM::Type::Void:
+ break;
case Shader::Backend::GLASM::Type::Register:
return Shader::Backend::GLASM::FormatTo<true>(ctx, value.id);
case Shader::Backend::GLASM::Type::U32: