summaryrefslogtreecommitdiff
path: root/src/video_core/shader/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/shader/node.h')
-rw-r--r--src/video_core/shader/node.h52
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
268class Image {
269public:
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
303private:
304 std::size_t offset{};
305 std::size_t index{};
306 Tegra::Shader::ImageType type{};
307 bool is_bindless{};
308};
309
266struct GlobalMemoryBase { 310struct 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
336struct 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
293using Meta = std::variant<MetaArithmetic, MetaTexture, MetaStackClass, Tegra::Shader::HalfType>; 342using 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
296class OperationNode final { 346class OperationNode final {