summaryrefslogtreecommitdiff
path: root/src/video_core/shader/node.h
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-01-05 15:23:24 -0400
committerGravatar FernandoS272020-01-24 16:43:30 -0400
commit603c861532ed1a89254556ff84bbe121bd700765 (patch)
tree8bf8f67ff6393ce7b00b04a3b4b2d596cd8eb5bc /src/video_core/shader/node.h
parentShader_IR: Address Feedback (diff)
downloadyuzu-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.h48
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>;
230using Node4 = std::array<Node, 4>; 230using Node4 = std::array<Node, 4>;
231using NodeBlock = std::vector<Node>; 231using NodeBlock = std::vector<Node>;
232 232
233class BindlessSamplerNode;
234class ArraySamplerNode;
235
236using TrackSamplerData = std::variant<BindlessSamplerNode, ArraySamplerNode>;
237using TrackSampler = std::shared_ptr<TrackSamplerData>;
238
233class Sampler { 239class Sampler {
234public: 240public:
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
298class ArraySamplerNode final {
299public:
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
315private:
316 u32 index;
317 u32 base_offset;
318 u32 bindless_var;
319};
320
321/// Represents a tracked bindless sampler into a direct const buffer
322class BindlessSamplerNode final {
323public:
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
334private:
335 u32 index;
336 u32 offset;
337};
338
291class Image final { 339class Image final {
292public: 340public:
293 /// This constructor is for bound images 341 /// This constructor is for bound images