summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-04-15 15:03:49 -0400
committerGravatar GitHub2020-04-15 15:03:49 -0400
commite33196d4e7687dd29636decd4b52e01b10fe8984 (patch)
treeb20b84dc47b9ef48c8701951ead117f52252e6e5 /src/video_core/renderer_vulkan
parentMerge pull request #3670 from lioncash/reorder (diff)
parentshader/memory: Implement RED.E.ADD (diff)
downloadyuzu-e33196d4e7687dd29636decd4b52e01b10fe8984.tar.gz
yuzu-e33196d4e7687dd29636decd4b52e01b10fe8984.tar.xz
yuzu-e33196d4e7687dd29636decd4b52e01b10fe8984.zip
Merge pull request #3612 from ReinUsesLisp/red
shader/memory: Implement RED.E.ADD and minor changes to ATOM
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp65
1 files changed, 40 insertions, 25 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 62e4ca488..aaa138f52 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -1938,11 +1938,8 @@ private:
1938 return {}; 1938 return {};
1939 } 1939 }
1940 1940
1941 template <Id (Module::*func)(Id, Id, Id, Id, Id), Type result_type, 1941 template <Id (Module::*func)(Id, Id, Id, Id, Id)>
1942 Type value_type = result_type>
1943 Expression Atomic(Operation operation) { 1942 Expression Atomic(Operation operation) {
1944 const Id type_def = GetTypeDefinition(result_type);
1945
1946 Id pointer; 1943 Id pointer;
1947 if (const auto smem = std::get_if<SmemNode>(&*operation[0])) { 1944 if (const auto smem = std::get_if<SmemNode>(&*operation[0])) {
1948 pointer = GetSharedMemoryPointer(*smem); 1945 pointer = GetSharedMemoryPointer(*smem);
@@ -1950,15 +1947,19 @@ private:
1950 pointer = GetGlobalMemoryPointer(*gmem); 1947 pointer = GetGlobalMemoryPointer(*gmem);
1951 } else { 1948 } else {
1952 UNREACHABLE(); 1949 UNREACHABLE();
1953 return {Constant(type_def, 0), result_type}; 1950 return {v_float_zero, Type::Float};
1954 } 1951 }
1955
1956 const Id value = As(Visit(operation[1]), value_type);
1957
1958 const Id scope = Constant(t_uint, static_cast<u32>(spv::Scope::Device)); 1952 const Id scope = Constant(t_uint, static_cast<u32>(spv::Scope::Device));
1959 const Id semantics = Constant(type_def, 0); 1953 const Id semantics = Constant(t_uint, 0);
1954 const Id value = AsUint(Visit(operation[1]));
1955
1956 return {(this->*func)(t_uint, pointer, scope, semantics, value), Type::Uint};
1957 }
1960 1958
1961 return {(this->*func)(type_def, pointer, scope, semantics, value), result_type}; 1959 template <Id (Module::*func)(Id, Id, Id, Id, Id)>
1960 Expression Reduce(Operation operation) {
1961 Atomic<func>(operation);
1962 return {};
1962 } 1963 }
1963 1964
1964 Expression Branch(Operation operation) { 1965 Expression Branch(Operation operation) {
@@ -2547,21 +2548,35 @@ private:
2547 &SPIRVDecompiler::AtomicImageXor, 2548 &SPIRVDecompiler::AtomicImageXor,
2548 &SPIRVDecompiler::AtomicImageExchange, 2549 &SPIRVDecompiler::AtomicImageExchange,
2549 2550
2550 &SPIRVDecompiler::Atomic<&Module::OpAtomicExchange, Type::Uint>, 2551 &SPIRVDecompiler::Atomic<&Module::OpAtomicExchange>,
2551 &SPIRVDecompiler::Atomic<&Module::OpAtomicIAdd, Type::Uint>, 2552 &SPIRVDecompiler::Atomic<&Module::OpAtomicIAdd>,
2552 &SPIRVDecompiler::Atomic<&Module::OpAtomicUMin, Type::Uint>, 2553 &SPIRVDecompiler::Atomic<&Module::OpAtomicUMin>,
2553 &SPIRVDecompiler::Atomic<&Module::OpAtomicUMax, Type::Uint>, 2554 &SPIRVDecompiler::Atomic<&Module::OpAtomicUMax>,
2554 &SPIRVDecompiler::Atomic<&Module::OpAtomicAnd, Type::Uint>, 2555 &SPIRVDecompiler::Atomic<&Module::OpAtomicAnd>,
2555 &SPIRVDecompiler::Atomic<&Module::OpAtomicOr, Type::Uint>, 2556 &SPIRVDecompiler::Atomic<&Module::OpAtomicOr>,
2556 &SPIRVDecompiler::Atomic<&Module::OpAtomicXor, Type::Uint>, 2557 &SPIRVDecompiler::Atomic<&Module::OpAtomicXor>,
2557 2558
2558 &SPIRVDecompiler::Atomic<&Module::OpAtomicExchange, Type::Int>, 2559 &SPIRVDecompiler::Atomic<&Module::OpAtomicExchange>,
2559 &SPIRVDecompiler::Atomic<&Module::OpAtomicIAdd, Type::Int>, 2560 &SPIRVDecompiler::Atomic<&Module::OpAtomicIAdd>,
2560 &SPIRVDecompiler::Atomic<&Module::OpAtomicSMin, Type::Int>, 2561 &SPIRVDecompiler::Atomic<&Module::OpAtomicSMin>,
2561 &SPIRVDecompiler::Atomic<&Module::OpAtomicSMax, Type::Int>, 2562 &SPIRVDecompiler::Atomic<&Module::OpAtomicSMax>,
2562 &SPIRVDecompiler::Atomic<&Module::OpAtomicAnd, Type::Int>, 2563 &SPIRVDecompiler::Atomic<&Module::OpAtomicAnd>,
2563 &SPIRVDecompiler::Atomic<&Module::OpAtomicOr, Type::Int>, 2564 &SPIRVDecompiler::Atomic<&Module::OpAtomicOr>,
2564 &SPIRVDecompiler::Atomic<&Module::OpAtomicXor, Type::Int>, 2565 &SPIRVDecompiler::Atomic<&Module::OpAtomicXor>,
2566
2567 &SPIRVDecompiler::Reduce<&Module::OpAtomicIAdd>,
2568 &SPIRVDecompiler::Reduce<&Module::OpAtomicUMin>,
2569 &SPIRVDecompiler::Reduce<&Module::OpAtomicUMax>,
2570 &SPIRVDecompiler::Reduce<&Module::OpAtomicAnd>,
2571 &SPIRVDecompiler::Reduce<&Module::OpAtomicOr>,
2572 &SPIRVDecompiler::Reduce<&Module::OpAtomicXor>,
2573
2574 &SPIRVDecompiler::Reduce<&Module::OpAtomicIAdd>,
2575 &SPIRVDecompiler::Reduce<&Module::OpAtomicSMin>,
2576 &SPIRVDecompiler::Reduce<&Module::OpAtomicSMax>,
2577 &SPIRVDecompiler::Reduce<&Module::OpAtomicAnd>,
2578 &SPIRVDecompiler::Reduce<&Module::OpAtomicOr>,
2579 &SPIRVDecompiler::Reduce<&Module::OpAtomicXor>,
2565 2580
2566 &SPIRVDecompiler::Branch, 2581 &SPIRVDecompiler::Branch,
2567 &SPIRVDecompiler::BranchIndirect, 2582 &SPIRVDecompiler::BranchIndirect,