diff options
Diffstat (limited to 'src/video_core/shader/node.h')
| -rw-r--r-- | src/video_core/shader/node.h | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h index 0397f4c6e..b29aedce8 100644 --- a/src/video_core/shader/node.h +++ b/src/video_core/shader/node.h | |||
| @@ -273,50 +273,64 @@ private: | |||
| 273 | bool is_bindless{}; ///< Whether this sampler belongs to a bindless texture or not. | 273 | bool is_bindless{}; ///< Whether this sampler belongs to a bindless texture or not. |
| 274 | }; | 274 | }; |
| 275 | 275 | ||
| 276 | class Image { | 276 | class Image final { |
| 277 | public: | 277 | public: |
| 278 | explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type) | 278 | constexpr explicit Image(u64 offset, std::size_t index, Tegra::Shader::ImageType type) |
| 279 | : offset{offset}, index{index}, type{type}, is_bindless{false} {} | 279 | : offset{offset}, index{index}, type{type}, is_bindless{false} {} |
| 280 | 280 | ||
| 281 | explicit Image(u32 cbuf_index, u32 cbuf_offset, std::size_t index, | 281 | constexpr explicit Image(u32 cbuf_index, u32 cbuf_offset, std::size_t index, |
| 282 | Tegra::Shader::ImageType type) | 282 | Tegra::Shader::ImageType type) |
| 283 | : offset{(static_cast<u64>(cbuf_index) << 32) | cbuf_offset}, index{index}, type{type}, | 283 | : offset{(static_cast<u64>(cbuf_index) << 32) | cbuf_offset}, index{index}, type{type}, |
| 284 | is_bindless{true} {} | 284 | is_bindless{true} {} |
| 285 | 285 | ||
| 286 | explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type, | 286 | constexpr explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type, |
| 287 | bool is_bindless) | 287 | bool is_bindless, bool is_written, bool is_read) |
| 288 | : offset{offset}, index{index}, type{type}, is_bindless{is_bindless} {} | 288 | : offset{offset}, index{index}, type{type}, is_bindless{is_bindless}, |
| 289 | is_written{is_written}, is_read{is_read} {} | ||
| 289 | 290 | ||
| 290 | std::size_t GetOffset() const { | 291 | void MarkRead() { |
| 292 | is_read = true; | ||
| 293 | } | ||
| 294 | |||
| 295 | void MarkWrite() { | ||
| 296 | is_written = true; | ||
| 297 | } | ||
| 298 | |||
| 299 | constexpr std::size_t GetOffset() const { | ||
| 291 | return offset; | 300 | return offset; |
| 292 | } | 301 | } |
| 293 | 302 | ||
| 294 | std::size_t GetIndex() const { | 303 | constexpr std::size_t GetIndex() const { |
| 295 | return index; | 304 | return index; |
| 296 | } | 305 | } |
| 297 | 306 | ||
| 298 | Tegra::Shader::ImageType GetType() const { | 307 | constexpr Tegra::Shader::ImageType GetType() const { |
| 299 | return type; | 308 | return type; |
| 300 | } | 309 | } |
| 301 | 310 | ||
| 302 | bool IsBindless() const { | 311 | constexpr bool IsBindless() const { |
| 303 | return is_bindless; | 312 | return is_bindless; |
| 304 | } | 313 | } |
| 305 | 314 | ||
| 306 | std::pair<u32, u32> GetBindlessCBuf() const { | 315 | constexpr bool IsRead() const { |
| 307 | return {static_cast<u32>(offset >> 32), static_cast<u32>(offset)}; | 316 | return is_read; |
| 317 | } | ||
| 318 | |||
| 319 | constexpr bool IsWritten() const { | ||
| 320 | return is_written; | ||
| 308 | } | 321 | } |
| 309 | 322 | ||
| 310 | bool operator<(const Image& rhs) const { | 323 | constexpr std::pair<u32, u32> GetBindlessCBuf() const { |
| 311 | return std::tie(offset, index, type, is_bindless) < | 324 | return {static_cast<u32>(offset >> 32), static_cast<u32>(offset)}; |
| 312 | std::tie(rhs.offset, rhs.index, rhs.type, rhs.is_bindless); | ||
| 313 | } | 325 | } |
| 314 | 326 | ||
| 315 | private: | 327 | private: |
| 316 | std::size_t offset{}; | 328 | u64 offset{}; |
| 317 | std::size_t index{}; | 329 | std::size_t index{}; |
| 318 | Tegra::Shader::ImageType type{}; | 330 | Tegra::Shader::ImageType type{}; |
| 319 | bool is_bindless{}; | 331 | bool is_bindless{}; |
| 332 | bool is_read{}; | ||
| 333 | bool is_written{}; | ||
| 320 | }; | 334 | }; |
| 321 | 335 | ||
| 322 | struct GlobalMemoryBase { | 336 | struct GlobalMemoryBase { |