diff options
| author | 2019-07-05 13:39:13 -0400 | |
|---|---|---|
| committer | 2019-07-05 13:39:13 -0400 | |
| commit | 772c86a260eb446b0fe4232b0a50666511bef25c (patch) | |
| tree | 013d92268c06454c93565c83eff2b79b56a00839 /src/video_core/shader/node.h | |
| parent | Merge pull request #2669 from FearlessTobi/move-cpujit-setting (diff) | |
| parent | texture_cache: Address Feedback (diff) | |
| download | yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.tar.gz yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.tar.xz yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.zip | |
Merge pull request #2601 from FernandoS27/texture_cache
Implement a new Texture Cache
Diffstat (limited to 'src/video_core/shader/node.h')
| -rw-r--r-- | src/video_core/shader/node.h | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h index 3cfb911bb..0ac83fcf0 100644 --- a/src/video_core/shader/node.h +++ b/src/video_core/shader/node.h | |||
| @@ -146,6 +146,8 @@ enum class OperationCode { | |||
| 146 | TextureQueryLod, /// (MetaTexture, float[N] coords) -> float4 | 146 | TextureQueryLod, /// (MetaTexture, float[N] coords) -> float4 |
| 147 | TexelFetch, /// (MetaTexture, int[N], int) -> float4 | 147 | TexelFetch, /// (MetaTexture, int[N], int) -> float4 |
| 148 | 148 | ||
| 149 | ImageStore, /// (MetaImage, float[N] coords) -> void | ||
| 150 | |||
| 149 | Branch, /// (uint branch_target) -> void | 151 | Branch, /// (uint branch_target) -> void |
| 150 | PushFlowStack, /// (uint branch_target) -> void | 152 | PushFlowStack, /// (uint branch_target) -> void |
| 151 | PopFlowStack, /// () -> void | 153 | PopFlowStack, /// () -> void |
| @@ -263,6 +265,48 @@ private: | |||
| 263 | bool is_bindless{}; ///< Whether this sampler belongs to a bindless texture or not. | 265 | bool is_bindless{}; ///< Whether this sampler belongs to a bindless texture or not. |
| 264 | }; | 266 | }; |
| 265 | 267 | ||
| 268 | class Image { | ||
| 269 | public: | ||
| 270 | explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type) | ||
| 271 | : offset{offset}, index{index}, type{type}, is_bindless{false} {} | ||
| 272 | |||
| 273 | explicit Image(u32 cbuf_index, u32 cbuf_offset, std::size_t index, | ||
| 274 | Tegra::Shader::ImageType type) | ||
| 275 | : offset{(static_cast<u64>(cbuf_index) << 32) | cbuf_offset}, index{index}, type{type}, | ||
| 276 | is_bindless{true} {} | ||
| 277 | |||
| 278 | explicit Image(std::size_t offset, std::size_t index, Tegra::Shader::ImageType type, | ||
| 279 | bool is_bindless) | ||
| 280 | : offset{offset}, index{index}, type{type}, is_bindless{is_bindless} {} | ||
| 281 | |||
| 282 | std::size_t GetOffset() const { | ||
| 283 | return offset; | ||
| 284 | } | ||
| 285 | |||
| 286 | std::size_t GetIndex() const { | ||
| 287 | return index; | ||
| 288 | } | ||
| 289 | |||
| 290 | Tegra::Shader::ImageType GetType() const { | ||
| 291 | return type; | ||
| 292 | } | ||
| 293 | |||
| 294 | bool IsBindless() const { | ||
| 295 | return is_bindless; | ||
| 296 | } | ||
| 297 | |||
| 298 | bool operator<(const Image& rhs) const { | ||
| 299 | return std::tie(offset, index, type, is_bindless) < | ||
| 300 | std::tie(rhs.offset, rhs.index, rhs.type, rhs.is_bindless); | ||
| 301 | } | ||
| 302 | |||
| 303 | private: | ||
| 304 | std::size_t offset{}; | ||
| 305 | std::size_t index{}; | ||
| 306 | Tegra::Shader::ImageType type{}; | ||
| 307 | bool is_bindless{}; | ||
| 308 | }; | ||
| 309 | |||
| 266 | struct GlobalMemoryBase { | 310 | struct GlobalMemoryBase { |
| 267 | u32 cbuf_index{}; | 311 | u32 cbuf_index{}; |
| 268 | u32 cbuf_offset{}; | 312 | u32 cbuf_offset{}; |
| @@ -289,8 +333,14 @@ struct MetaTexture { | |||
| 289 | u32 element{}; | 333 | u32 element{}; |
| 290 | }; | 334 | }; |
| 291 | 335 | ||
| 336 | struct MetaImage { | ||
| 337 | const Image& image; | ||
| 338 | std::vector<Node> values; | ||
| 339 | }; | ||
| 340 | |||
| 292 | /// Parameters that modify an operation but are not part of any particular operand | 341 | /// Parameters that modify an operation but are not part of any particular operand |
| 293 | using Meta = std::variant<MetaArithmetic, MetaTexture, MetaStackClass, Tegra::Shader::HalfType>; | 342 | using Meta = |
| 343 | std::variant<MetaArithmetic, MetaTexture, MetaImage, MetaStackClass, Tegra::Shader::HalfType>; | ||
| 294 | 344 | ||
| 295 | /// Holds any kind of operation that can be done in the IR | 345 | /// Holds any kind of operation that can be done in the IR |
| 296 | class OperationNode final { | 346 | class OperationNode final { |