diff options
| author | 2020-01-05 15:23:24 -0400 | |
|---|---|---|
| committer | 2020-01-24 16:43:30 -0400 | |
| commit | 603c861532ed1a89254556ff84bbe121bd700765 (patch) | |
| tree | 8bf8f67ff6393ce7b00b04a3b4b2d596cd8eb5bc /src/video_core/shader/node.h | |
| parent | Shader_IR: Address Feedback (diff) | |
| download | yuzu-603c861532ed1a89254556ff84bbe121bd700765.tar.gz yuzu-603c861532ed1a89254556ff84bbe121bd700765.tar.xz yuzu-603c861532ed1a89254556ff84bbe121bd700765.zip | |
Shader_IR: Implement initial code for tracking indexed samplers.
Diffstat (limited to 'src/video_core/shader/node.h')
| -rw-r--r-- | src/video_core/shader/node.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h index 075c7d07c..b370df8f9 100644 --- a/src/video_core/shader/node.h +++ b/src/video_core/shader/node.h | |||
| @@ -230,6 +230,12 @@ using Node = std::shared_ptr<NodeData>; | |||
| 230 | using Node4 = std::array<Node, 4>; | 230 | using Node4 = std::array<Node, 4>; |
| 231 | using NodeBlock = std::vector<Node>; | 231 | using NodeBlock = std::vector<Node>; |
| 232 | 232 | ||
| 233 | class BindlessSamplerNode; | ||
| 234 | class ArraySamplerNode; | ||
| 235 | |||
| 236 | using TrackSamplerData = std::variant<BindlessSamplerNode, ArraySamplerNode>; | ||
| 237 | using TrackSampler = std::shared_ptr<TrackSamplerData>; | ||
| 238 | |||
| 233 | class Sampler { | 239 | class Sampler { |
| 234 | public: | 240 | public: |
| 235 | /// This constructor is for bound samplers | 241 | /// This constructor is for bound samplers |
| @@ -288,6 +294,48 @@ private: | |||
| 288 | bool is_bindless{}; ///< Whether this sampler belongs to a bindless texture or not. | 294 | bool is_bindless{}; ///< Whether this sampler belongs to a bindless texture or not. |
| 289 | }; | 295 | }; |
| 290 | 296 | ||
| 297 | /// Represents a tracked bindless sampler into a direct const buffer | ||
| 298 | class ArraySamplerNode final { | ||
| 299 | public: | ||
| 300 | explicit ArraySamplerNode(u32 index, u32 base_offset, u32 bindless_var) | ||
| 301 | : index{index}, base_offset{base_offset}, bindless_var{bindless_var} {} | ||
| 302 | |||
| 303 | u32 GetIndex() const { | ||
| 304 | return index; | ||
| 305 | } | ||
| 306 | |||
| 307 | u32 GetBaseOffset() const { | ||
| 308 | return base_offset; | ||
| 309 | } | ||
| 310 | |||
| 311 | u32 GetIndexVar() const { | ||
| 312 | return bindless_var; | ||
| 313 | } | ||
| 314 | |||
| 315 | private: | ||
| 316 | u32 index; | ||
| 317 | u32 base_offset; | ||
| 318 | u32 bindless_var; | ||
| 319 | }; | ||
| 320 | |||
| 321 | /// Represents a tracked bindless sampler into a direct const buffer | ||
| 322 | class BindlessSamplerNode final { | ||
| 323 | public: | ||
| 324 | explicit BindlessSamplerNode(u32 index, u32 offset) : index{index}, offset{offset} {} | ||
| 325 | |||
| 326 | u32 GetIndex() const { | ||
| 327 | return index; | ||
| 328 | } | ||
| 329 | |||
| 330 | u32 GetOffset() const { | ||
| 331 | return offset; | ||
| 332 | } | ||
| 333 | |||
| 334 | private: | ||
| 335 | u32 index; | ||
| 336 | u32 offset; | ||
| 337 | }; | ||
| 338 | |||
| 291 | class Image final { | 339 | class Image final { |
| 292 | public: | 340 | public: |
| 293 | /// This constructor is for bound images | 341 | /// This constructor is for bound images |