From 4aaa2192b993411f63d46a57b93e9e787b6a836d Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 20 Dec 2018 22:36:17 -0300 Subject: shader_ir: Add immediate node constructors --- src/video_core/shader/shader_ir.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/video_core/shader/shader_ir.h') diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index 300cf1083..db06d51ca 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h @@ -598,9 +598,26 @@ private: Node Conditional(Node condition, std::vector&& code); /// Creates a commentary Node Comment(const std::string& text); - + /// Creates an u32 immediate + Node Immediate(u32 value); + /// Creates a s32 immediate + Node Immediate(s32 value) { + return Immediate(static_cast(value)); + } + /// Creates a f32 immediate + Node Immediate(f32 value) { + // TODO(Rodrigo): Replace this with bit_cast when C++20 releases + return Immediate(*reinterpret_cast(&value)); + } + + /// Generates a node representing a 19-bit immediate value + Node GetImmediate19(Tegra::Shader::Instruction instr); + /// Generates a node representing a 32-bit immediate value + Node GetImmediate32(Tegra::Shader::Instruction instr); /// Generates a node for a passed predicate. It can be optionally negated Node GetPredicate(u64 pred, bool negated = false); + /// Generates a predicate node for an immediate true or false value + Node GetPredicate(bool immediate); template inline Node Operation(OperationCode code, const T*... operands) { -- cgit v1.2.3