summaryrefslogtreecommitdiff
path: root/src/video_core/shader/node.h
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-01-05 18:36:21 -0400
committerGravatar FernandoS272020-01-24 16:43:31 -0400
commit037ea431ceb93e93274fdcf9fb724819639d04fd (patch)
tree7357dac5799959d2dc7dbe78346cb8cbd1a5400b /src/video_core/shader/node.h
parentShader_IR: Setup Indexed Samplers on the IR (diff)
downloadyuzu-037ea431ceb93e93274fdcf9fb724819639d04fd.tar.gz
yuzu-037ea431ceb93e93274fdcf9fb724819639d04fd.tar.xz
yuzu-037ea431ceb93e93274fdcf9fb724819639d04fd.zip
Shader_IR: deduce size of indexed samplers
Diffstat (limited to 'src/video_core/shader/node.h')
-rw-r--r--src/video_core/shader/node.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h
index b370df8f9..2f29b9506 100644
--- a/src/video_core/shader/node.h
+++ b/src/video_core/shader/node.h
@@ -240,15 +240,15 @@ class Sampler {
240public: 240public:
241 /// This constructor is for bound samplers 241 /// This constructor is for bound samplers
242 constexpr explicit Sampler(u32 index, u32 offset, Tegra::Shader::TextureType type, 242 constexpr explicit Sampler(u32 index, u32 offset, Tegra::Shader::TextureType type,
243 bool is_array, bool is_shadow, bool is_buffer) 243 bool is_array, bool is_shadow, bool is_buffer, bool is_indexed)
244 : index{index}, offset{offset}, type{type}, is_array{is_array}, is_shadow{is_shadow}, 244 : index{index}, offset{offset}, type{type}, is_array{is_array}, is_shadow{is_shadow},
245 is_buffer{is_buffer} {} 245 is_buffer{is_buffer}, is_indexed{is_indexed} {}
246 246
247 /// This constructor is for bindless samplers 247 /// This constructor is for bindless samplers
248 constexpr explicit Sampler(u32 index, u32 offset, u32 buffer, Tegra::Shader::TextureType type, 248 constexpr explicit Sampler(u32 index, u32 offset, u32 buffer, Tegra::Shader::TextureType type,
249 bool is_array, bool is_shadow, bool is_buffer) 249 bool is_array, bool is_shadow, bool is_buffer, bool is_indexed)
250 : index{index}, offset{offset}, buffer{buffer}, type{type}, is_array{is_array}, 250 : index{index}, offset{offset}, buffer{buffer}, type{type}, is_array{is_array},
251 is_shadow{is_shadow}, is_buffer{is_buffer}, is_bindless{true} {} 251 is_shadow{is_shadow}, is_buffer{is_buffer}, is_bindless{true}, is_indexed{is_indexed} {}
252 252
253 constexpr u32 GetIndex() const { 253 constexpr u32 GetIndex() const {
254 return index; 254 return index;
@@ -282,16 +282,30 @@ public:
282 return is_bindless; 282 return is_bindless;
283 } 283 }
284 284
285 constexpr bool IsIndexed() const {
286 return is_indexed;
287 }
288
289 constexpr u32 Size() const {
290 return size;
291 }
292
293 void SetSize(u32 new_size) {
294 size = new_size;
295 }
296
285private: 297private:
286 u32 index{}; ///< Emulated index given for the this sampler. 298 u32 index{}; ///< Emulated index given for the this sampler.
287 u32 offset{}; ///< Offset in the const buffer from where the sampler is being read. 299 u32 offset{}; ///< Offset in the const buffer from where the sampler is being read.
288 u32 buffer{}; ///< Buffer where the bindless sampler is being read (unused on bound samplers). 300 u32 buffer{}; ///< Buffer where the bindless sampler is being read (unused on bound samplers).
301 u32 size{}; ///< Size of the sampler if indexed.
289 302
290 Tegra::Shader::TextureType type{}; ///< The type used to sample this texture (Texture2D, etc) 303 Tegra::Shader::TextureType type{}; ///< The type used to sample this texture (Texture2D, etc)
291 bool is_array{}; ///< Whether the texture is being sampled as an array texture or not. 304 bool is_array{}; ///< Whether the texture is being sampled as an array texture or not.
292 bool is_shadow{}; ///< Whether the texture is being sampled as a depth texture or not. 305 bool is_shadow{}; ///< Whether the texture is being sampled as a depth texture or not.
293 bool is_buffer{}; ///< Whether the texture is a texture buffer without sampler. 306 bool is_buffer{}; ///< Whether the texture is a texture buffer without sampler.
294 bool is_bindless{}; ///< Whether this sampler belongs to a bindless texture or not. 307 bool is_bindless{}; ///< Whether this sampler belongs to a bindless texture or not.
308 bool is_indexed{}; ///< Whether this sampler is an indexed array of textures.
295}; 309};
296 310
297/// Represents a tracked bindless sampler into a direct const buffer 311/// Represents a tracked bindless sampler into a direct const buffer