summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorRodrigo Locatti <reinuseslisp@airmail.cc>2020-03-31 05:56:28 +0200
committerGitHub <noreply@github.com>2020-03-31 05:56:28 +0200
commitc19425ed69589dc4577b660cfb50c2f25a42582e (patch)
treef5888dc8ce3e6e65a5c7c061d099ea8473b71a38 /src/video_core/renderer_vulkan
parentMerge pull request #3566 from ReinUsesLisp/vk-wrapper-part1 (diff)
parentclang-format (diff)
downloadyuzu-c19425ed69589dc4577b660cfb50c2f25a42582e.tar
yuzu-c19425ed69589dc4577b660cfb50c2f25a42582e.tar.gz
yuzu-c19425ed69589dc4577b660cfb50c2f25a42582e.tar.bz2
yuzu-c19425ed69589dc4577b660cfb50c2f25a42582e.tar.lz
yuzu-c19425ed69589dc4577b660cfb50c2f25a42582e.tar.xz
yuzu-c19425ed69589dc4577b660cfb50c2f25a42582e.tar.zst
yuzu-c19425ed69589dc4577b660cfb50c2f25a42582e.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 51ecb5567..d67f08cf9 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -1941,7 +1941,11 @@ private:
return {};
}
- Expression AtomicAdd(Operation operation) {
+ template <Id (Module::*func)(Id, Id, Id, Id, Id), Type result_type,
+ Type value_type = result_type>
+ Expression Atomic(Operation operation) {
+ const Id type_def = GetTypeDefinition(result_type);
+
Id pointer;
if (const auto smem = std::get_if<SmemNode>(&*operation[0])) {
pointer = GetSharedMemoryPointer(*smem);
@@ -1949,14 +1953,15 @@ private:
pointer = GetGlobalMemoryPointer(*gmem);
} else {
UNREACHABLE();
- return {Constant(t_uint, 0), Type::Uint};
+ return {Constant(type_def, 0), result_type};
}
+ const Id value = As(Visit(operation[1]), value_type);
+
const Id scope = Constant(t_uint, static_cast<u32>(spv::Scope::Device));
- const Id semantics = Constant(t_uint, 0U);
+ const Id semantics = Constant(type_def, 0);
- const Id value = AsUint(Visit(operation[1]));
- return {OpAtomicIAdd(t_uint, pointer, scope, semantics, value), Type::Uint};
+ return {(this->*func)(type_def, pointer, scope, semantics, value), result_type};
}
Expression Branch(Operation operation) {
@@ -2545,7 +2550,21 @@ private:
&SPIRVDecompiler::AtomicImageXor,
&SPIRVDecompiler::AtomicImageExchange,
- &SPIRVDecompiler::AtomicAdd,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicExchange, Type::Uint>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicIAdd, Type::Uint>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicUMin, Type::Uint>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicUMax, Type::Uint>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicAnd, Type::Uint>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicOr, Type::Uint>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicXor, Type::Uint>,
+
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicExchange, Type::Int>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicIAdd, Type::Int>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicSMin, Type::Int>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicSMax, Type::Int>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicAnd, Type::Int>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicOr, Type::Int>,
+ &SPIRVDecompiler::Atomic<&Module::OpAtomicXor, Type::Int>,
&SPIRVDecompiler::Branch,
&SPIRVDecompiler::BranchIndirect,