diff options
| author | 2019-09-18 01:50:40 -0300 | |
|---|---|---|
| committer | 2019-09-21 17:33:52 -0300 | |
| commit | 44000971e271e350638611b0265a3fed7bcced2a (patch) | |
| tree | b224df1c5477a7e31cb0176d9299b635c6363f61 /src/video_core/shader/node.h | |
| parent | shader/image: Implement SULD and remove irrelevant code (diff) | |
| download | yuzu-44000971e271e350638611b0265a3fed7bcced2a.tar.gz yuzu-44000971e271e350638611b0265a3fed7bcced2a.tar.xz yuzu-44000971e271e350638611b0265a3fed7bcced2a.zip | |
gl_shader_decompiler: Use uint for images and fix SUATOM
In the process remove implementation of SUATOM.MIN and SUATOM.MAX as
these require a distinction between U32 and S32. These have to be
implemented with imageCompSwap loop.
Diffstat (limited to 'src/video_core/shader/node.h')
| -rw-r--r-- | src/video_core/shader/node.h | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h index e5b75783d..338bab17c 100644 --- a/src/video_core/shader/node.h +++ b/src/video_core/shader/node.h | |||
| @@ -149,11 +149,10 @@ enum class OperationCode { | |||
| 149 | TextureQueryLod, /// (MetaTexture, float[N] coords) -> float4 | 149 | TextureQueryLod, /// (MetaTexture, float[N] coords) -> float4 |
| 150 | TexelFetch, /// (MetaTexture, int[N], int) -> float4 | 150 | TexelFetch, /// (MetaTexture, int[N], int) -> float4 |
| 151 | 151 | ||
| 152 | ImageLoad, /// (MetaImage, int[N] coords) -> void | 152 | ImageLoad, /// (MetaImage, int[N] coords) -> void |
| 153 | ImageStore, /// (MetaImage, int[N] coords) -> void | 153 | ImageStore, /// (MetaImage, int[N] coords) -> void |
| 154 | |||
| 154 | AtomicImageAdd, /// (MetaImage, int[N] coords) -> void | 155 | AtomicImageAdd, /// (MetaImage, int[N] coords) -> void |
| 155 | AtomicImageMin, /// (MetaImage, int[N] coords) -> void | ||
| 156 | AtomicImageMax, /// (MetaImage, int[N] coords) -> void | ||
| 157 | AtomicImageAnd, /// (MetaImage, int[N] coords) -> void | 156 | AtomicImageAnd, /// (MetaImage, int[N] coords) -> void |
| 158 | AtomicImageOr, /// (MetaImage, int[N] coords) -> void | 157 | AtomicImageOr, /// (MetaImage, int[N] coords) -> void |
| 159 | AtomicImageXor, /// (MetaImage, int[N] coords) -> void | 158 | AtomicImageXor, /// (MetaImage, int[N] coords) -> void |
| @@ -295,21 +294,18 @@ private: | |||
| 295 | 294 | ||
| 296 | class Image final { | 295 | class Image final { |
| 297 | public: | 296 | public: |
| 298 | constexpr explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type, | 297 | constexpr explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type) |
| 299 | std::optional<Tegra::Shader::ImageAtomicSize> size) | 298 | : offset{offset}, index{index}, type{type}, is_bindless{false} {} |
| 300 | : offset{offset}, index{index}, type{type}, is_bindless{false}, size{size} {} | ||
| 301 | 299 | ||
| 302 | constexpr explicit Image(u32 cbuf_index, u32 cbuf_offset, std::size_t index, | 300 | constexpr explicit Image(u32 cbuf_index, u32 cbuf_offset, std::size_t index, |
| 303 | Tegra::Shader::ImageType type, | 301 | Tegra::Shader::ImageType type) |
| 304 | std::optional<Tegra::Shader::ImageAtomicSize> size) | ||
| 305 | : offset{(static_cast<u64>(cbuf_index) << 32) | cbuf_offset}, index{index}, type{type}, | 302 | : offset{(static_cast<u64>(cbuf_index) << 32) | cbuf_offset}, index{index}, type{type}, |
| 306 | is_bindless{true}, size{size} {} | 303 | is_bindless{true} {} |
| 307 | 304 | ||
| 308 | constexpr explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type, | 305 | constexpr explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type, |
| 309 | bool is_bindless, bool is_written, bool is_read, | 306 | bool is_bindless, bool is_written, bool is_read, bool is_atomic) |
| 310 | std::optional<Tegra::Shader::ImageAtomicSize> size) | ||
| 311 | : offset{offset}, index{index}, type{type}, is_bindless{is_bindless}, | 307 | : offset{offset}, index{index}, type{type}, is_bindless{is_bindless}, |
| 312 | is_written{is_written}, is_read{is_read}, size{size} {} | 308 | is_written{is_written}, is_read{is_read}, is_atomic{is_atomic} {} |
| 313 | 309 | ||
| 314 | void MarkWrite() { | 310 | void MarkWrite() { |
| 315 | is_written = true; | 311 | is_written = true; |
| @@ -319,8 +315,10 @@ public: | |||
| 319 | is_read = true; | 315 | is_read = true; |
| 320 | } | 316 | } |
| 321 | 317 | ||
| 322 | void SetSize(Tegra::Shader::ImageAtomicSize size_) { | 318 | void MarkAtomic() { |
| 323 | size = size_; | 319 | MarkWrite(); |
| 320 | MarkRead(); | ||
| 321 | is_atomic = true; | ||
| 324 | } | 322 | } |
| 325 | 323 | ||
| 326 | constexpr std::size_t GetOffset() const { | 324 | constexpr std::size_t GetOffset() const { |
| @@ -347,21 +345,17 @@ public: | |||
| 347 | return is_read; | 345 | return is_read; |
| 348 | } | 346 | } |
| 349 | 347 | ||
| 350 | constexpr std::pair<u32, u32> GetBindlessCBuf() const { | 348 | constexpr bool IsAtomic() const { |
| 351 | return {static_cast<u32>(offset >> 32), static_cast<u32>(offset)}; | 349 | return is_atomic; |
| 352 | } | ||
| 353 | |||
| 354 | constexpr bool IsSizeKnown() const { | ||
| 355 | return size.has_value(); | ||
| 356 | } | 350 | } |
| 357 | 351 | ||
| 358 | constexpr Tegra::Shader::ImageAtomicSize GetSize() const { | 352 | constexpr std::pair<u32, u32> GetBindlessCBuf() const { |
| 359 | return size.value(); | 353 | return {static_cast<u32>(offset >> 32), static_cast<u32>(offset)}; |
| 360 | } | 354 | } |
| 361 | 355 | ||
| 362 | constexpr bool operator<(const Image& rhs) const { | 356 | constexpr bool operator<(const Image& rhs) const { |
| 363 | return std::tie(offset, index, type, size, is_bindless) < | 357 | return std::tie(offset, index, type, is_bindless) < |
| 364 | std::tie(rhs.offset, rhs.index, rhs.type, rhs.size, rhs.is_bindless); | 358 | std::tie(rhs.offset, rhs.index, rhs.type, rhs.is_bindless); |
| 365 | } | 359 | } |
| 366 | 360 | ||
| 367 | private: | 361 | private: |
| @@ -371,7 +365,7 @@ private: | |||
| 371 | bool is_bindless{}; | 365 | bool is_bindless{}; |
| 372 | bool is_written{}; | 366 | bool is_written{}; |
| 373 | bool is_read{}; | 367 | bool is_read{}; |
| 374 | std::optional<Tegra::Shader::ImageAtomicSize> size{}; | 368 | bool is_atomic{}; |
| 375 | }; | 369 | }; |
| 376 | 370 | ||
| 377 | struct GlobalMemoryBase { | 371 | struct GlobalMemoryBase { |