summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/node.h
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-07-18 02:03:53 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-09-11 01:22:31 +0200
commit36abf67e79b234a361b99a342391249095ccd79c (patch)
tree3e6e0e818e952a038fbe10262bf39cf6d52eaa61 /src/video_core/shader/node.h
parentMerge pull request #2823 from ReinUsesLisp/shr-clamp (diff)
downloadyuzu-36abf67e79b234a361b99a342391249095ccd79c.tar
yuzu-36abf67e79b234a361b99a342391249095ccd79c.tar.gz
yuzu-36abf67e79b234a361b99a342391249095ccd79c.tar.bz2
yuzu-36abf67e79b234a361b99a342391249095ccd79c.tar.lz
yuzu-36abf67e79b234a361b99a342391249095ccd79c.tar.xz
yuzu-36abf67e79b234a361b99a342391249095ccd79c.tar.zst
yuzu-36abf67e79b234a361b99a342391249095ccd79c.zip
Diffstat (limited to 'src/video_core/shader/node.h')
-rw-r--r--src/video_core/shader/node.h57
1 files changed, 43 insertions, 14 deletions
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h
index b29aedce8..b47b201cf 100644
--- a/src/video_core/shader/node.h
+++ b/src/video_core/shader/node.h
@@ -7,6 +7,7 @@
#include <array>
#include <cstddef>
#include <memory>
+#include <optional>
#include <string>
#include <tuple>
#include <utility>
@@ -148,7 +149,14 @@ enum class OperationCode {
TextureQueryLod, /// (MetaTexture, float[N] coords) -> float4
TexelFetch, /// (MetaTexture, int[N], int) -> float4
- ImageStore, /// (MetaImage, float[N] coords) -> void
+ ImageStore, /// (MetaImage, int[N] values) -> void
+ AtomicImageAdd, /// (MetaImage, int[N] coords) -> void
+ AtomicImageMin, /// (MetaImage, int[N] coords) -> void
+ AtomicImageMax, /// (MetaImage, int[N] coords) -> void
+ AtomicImageAnd, /// (MetaImage, int[N] coords) -> void
+ AtomicImageOr, /// (MetaImage, int[N] coords) -> void
+ AtomicImageXor, /// (MetaImage, int[N] coords) -> void
+ AtomicImageExchange, /// (MetaImage, int[N] coords) -> void
Branch, /// (uint branch_target) -> void
BranchIndirect, /// (uint branch_target) -> void
@@ -275,25 +283,32 @@ private:
class Image final {
public:
- constexpr explicit Image(u64 offset, std::size_t index, Tegra::Shader::ImageType type)
- : offset{offset}, index{index}, type{type}, is_bindless{false} {}
+ constexpr explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type,
+ std::optional<Tegra::Shader::ImageAtomicSize> size)
+ : offset{offset}, index{index}, type{type}, is_bindless{false}, size{size} {}
constexpr explicit Image(u32 cbuf_index, u32 cbuf_offset, std::size_t index,
- Tegra::Shader::ImageType type)
+ Tegra::Shader::ImageType type,
+ std::optional<Tegra::Shader::ImageAtomicSize> size)
: offset{(static_cast<u64>(cbuf_index) << 32) | cbuf_offset}, index{index}, type{type},
- is_bindless{true} {}
+ is_bindless{true}, size{size} {}
constexpr explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type,
- bool is_bindless, bool is_written, bool is_read)
+ bool is_bindless, bool is_written, bool is_read,
+ std::optional<Tegra::Shader::ImageAtomicSize> size)
: offset{offset}, index{index}, type{type}, is_bindless{is_bindless},
- is_written{is_written}, is_read{is_read} {}
+ is_written{is_written}, is_read{is_read}, size{size} {}
+
+ void MarkWrite() {
+ is_written = true;
+ }
void MarkRead() {
is_read = true;
}
- void MarkWrite() {
- is_written = true;
+ void SetSize(Tegra::Shader::ImageAtomicSize size_) {
+ size = size_;
}
constexpr std::size_t GetOffset() const {
@@ -312,25 +327,39 @@ public:
return is_bindless;
}
- constexpr bool IsRead() const {
- return is_read;
- }
-
constexpr bool IsWritten() const {
return is_written;
}
+ constexpr bool IsRead() const {
+ return is_read;
+ }
+
constexpr std::pair<u32, u32> GetBindlessCBuf() const {
return {static_cast<u32>(offset >> 32), static_cast<u32>(offset)};
}
+ constexpr bool IsSizeKnown() const {
+ return size.has_value();
+ }
+
+ constexpr Tegra::Shader::ImageAtomicSize GetSize() const {
+ return size.value();
+ }
+
+ constexpr bool operator<(const Image& rhs) const {
+ return std::tie(offset, index, type, size, is_bindless) <
+ std::tie(rhs.offset, rhs.index, rhs.type, rhs.size, rhs.is_bindless);
+ }
+
private:
u64 offset{};
std::size_t index{};
Tegra::Shader::ImageType type{};
bool is_bindless{};
- bool is_read{};
bool is_written{};
+ bool is_read{};
+ std::optional<Tegra::Shader::ImageAtomicSize> size{};
};
struct GlobalMemoryBase {