shader_ir: Add internal flag getters

This commit is contained in:
ReinUsesLisp 2018-12-20 22:49:59 -03:00
parent 15f431f0cb
commit 2f87fd060d
2 changed files with 10 additions and 0 deletions

View file

@ -109,6 +109,14 @@ Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buff
return StoreNode(AbufNode(index, static_cast<u32>(element), buffer)); return StoreNode(AbufNode(index, static_cast<u32>(element), buffer));
} }
Node ShaderIR::GetInternalFlag(InternalFlag flag, bool negated) {
const Node node = StoreNode(InternalFlagNode(flag));
if (negated) {
return Operation(OperationCode::LogicalNegate, node);
}
return node;
}
/*static*/ OperationCode ShaderIR::SignedToUnsignedCode(OperationCode operation_code, /*static*/ OperationCode ShaderIR::SignedToUnsignedCode(OperationCode operation_code,
bool is_signed) { bool is_signed) {
if (is_signed) { if (is_signed) {

View file

@ -629,6 +629,8 @@ private:
const Tegra::Shader::IpaMode& input_mode, Node buffer = {}); const Tegra::Shader::IpaMode& input_mode, Node buffer = {});
/// Generates a node representing an output atttribute. Keeps track of used attributes. /// Generates a node representing an output atttribute. Keeps track of used attributes.
Node GetOutputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer); Node GetOutputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer);
/// Generates a node representing an internal flag
Node GetInternalFlag(InternalFlag flag, bool negated = false);
template <typename... T> template <typename... T>
inline Node Operation(OperationCode code, const T*... operands) { inline Node Operation(OperationCode code, const T*... operands) {