@ -109,12 +109,13 @@ enum class OperationCode {
UBitfieldExtract , / / / ( MetaArithmetic , uint value , int offset , int offset ) - > uint
UBitfieldExtract , / / / ( MetaArithmetic , uint value , int offset , int offset ) - > uint
UBitCount , / / / ( MetaArithmetic , uint ) - > uint
UBitCount , / / / ( MetaArithmetic , uint ) - > uint
HAdd , / / / ( MetaHalf Arithmetic , f16vec2 a , f16vec2 b ) - > f16vec2
HMul , / / / ( MetaHalf Arithmetic , f16vec2 a , f16vec2 b ) - > f16vec2
HFma , / / / ( MetaHalf Arithmetic , f16vec2 a , f16vec2 b , f16vec2 c ) - > f16vec2
HAdd , / / / ( MetaArithmetic , f16vec2 a , f16vec2 b ) - > f16vec2
HMul , / / / ( MetaArithmetic , f16vec2 a , f16vec2 b ) - > f16vec2
HFma , / / / ( MetaArithmetic , f16vec2 a , f16vec2 b , f16vec2 c ) - > f16vec2
HAbsolute , / / / ( f16vec2 a ) - > f16vec2
HAbsolute , / / / ( f16vec2 a ) - > f16vec2
HNegate , / / / ( f16vec2 a , bool first , bool second ) - > f16vec2
HNegate , / / / ( f16vec2 a , bool first , bool second ) - > f16vec2
HClamp , / / / ( f16vec2 src , float min , float max ) - > f16vec2
HClamp , / / / ( f16vec2 src , float min , float max ) - > f16vec2
HUnpack , / / / ( Tegra : : Shader : : HalfType , T value ) - > f16vec2
HMergeF32 , / / / ( f16vec2 src ) - > float
HMergeF32 , / / / ( f16vec2 src ) - > float
HMergeH0 , / / / ( f16vec2 dest , f16vec2 src ) - > f16vec2
HMergeH0 , / / / ( f16vec2 dest , f16vec2 src ) - > f16vec2
HMergeH1 , / / / ( f16vec2 dest , f16vec2 src ) - > f16vec2
HMergeH1 , / / / ( f16vec2 dest , f16vec2 src ) - > f16vec2
@ -287,13 +288,6 @@ struct MetaArithmetic {
bool precise { } ;
bool precise { } ;
} ;
} ;
struct MetaHalfArithmetic {
bool precise { } ;
std : : array < Tegra : : Shader : : HalfType , 3 > types = { Tegra : : Shader : : HalfType : : H0_H1 ,
Tegra : : Shader : : HalfType : : H0_H1 ,
Tegra : : Shader : : HalfType : : H0_H1 } ;
} ;
struct MetaTexture {
struct MetaTexture {
const Sampler & sampler ;
const Sampler & sampler ;
Node array { } ;
Node array { } ;
@ -305,11 +299,10 @@ struct MetaTexture {
u32 element { } ;
u32 element { } ;
} ;
} ;
constexpr MetaArithmetic PRECISE = { true } ;
constexpr MetaArithmetic NO_PRECISE = { false } ;
constexpr MetaHalfArithmetic HALF_NO_PRECISE = { false } ;
inline constexpr MetaArithmetic PRECISE = { true } ;
inline constexpr MetaArithmetic NO_PRECISE = { false } ;
using Meta = std : : variant < MetaArithmetic , MetaHalfArithmetic , MetaTextur e > ;
using Meta = std : : variant < MetaArithmetic , MetaTexture , Tegra : : Shader : : HalfTyp e > ;
/ / / Holds any kind of operation that can be done in the IR
/ / / Holds any kind of operation that can be done in the IR
class OperationNode final {
class OperationNode final {
@ -713,6 +706,8 @@ private:
/ / / Unpacks a half immediate from an instruction
/ / / Unpacks a half immediate from an instruction
Node UnpackHalfImmediate ( Tegra : : Shader : : Instruction instr , bool has_negation ) ;
Node UnpackHalfImmediate ( Tegra : : Shader : : Instruction instr , bool has_negation ) ;
/ / / Unpacks a binary value into a half float pair with a type format
Node UnpackHalfFloat ( Node value , Tegra : : Shader : : HalfType type ) ;
/ / / Merges a half pair into another value
/ / / Merges a half pair into another value
Node HalfMerge ( Node dest , Node src , Tegra : : Shader : : HalfMerge merge ) ;
Node HalfMerge ( Node dest , Node src , Tegra : : Shader : : HalfMerge merge ) ;
/ / / Conditionally absolute / negated half float pair . Absolute is applied first
/ / / Conditionally absolute / negated half float pair . Absolute is applied first
@ -726,8 +721,7 @@ private:
Node GetPredicateComparisonInteger ( Tegra : : Shader : : PredCondition condition , bool is_signed ,
Node GetPredicateComparisonInteger ( Tegra : : Shader : : PredCondition condition , bool is_signed ,
Node op_a , Node op_b ) ;
Node op_a , Node op_b ) ;
/ / / Returns a predicate comparing two half floats . meta consumes how both pairs will be compared
/ / / Returns a predicate comparing two half floats . meta consumes how both pairs will be compared
Node GetPredicateComparisonHalf ( Tegra : : Shader : : PredCondition condition ,
const MetaHalfArithmetic & meta , Node op_a , Node op_b ) ;
Node GetPredicateComparisonHalf ( Tegra : : Shader : : PredCondition condition , Node op_a , Node op_b ) ;
/ / / Returns a predicate combiner operation
/ / / Returns a predicate combiner operation
OperationCode GetPredicateCombiner ( Tegra : : Shader : : PredOperation operation ) ;
OperationCode GetPredicateCombiner ( Tegra : : Shader : : PredOperation operation ) ;