MCPcopy Create free account
hub / github.com/csyonghe/Spire / PrintProjectInstrExpr

Method PrintProjectInstrExpr

Source/SpireCore/GLSLCodeGen.cpp:95–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93 }
94
95 void PrintProjectInstrExpr(CodeGenContext & ctx, ProjectInstruction * proj)
96 {
97 if (auto memberLoadInstr = dynamic_cast<MemberLoadInstruction*>(proj->Operand.Ptr()))
98 {
99 bool overrideBaseMemberLoad = false;
100 auto genType = dynamic_cast<ILGenericType*>(memberLoadInstr->Operands[0]->Type.Ptr());
101 if (genType && genType->GenericTypeName == "PackedBuffer")
102 {
103 // load record type from packed buffer
104 String conversionFunction;
105 int size = 0;
106 if (memberLoadInstr->Type->ToString() == "int")
107 {
108 conversionFunction = "floatBitsToInt";
109 size = 1;
110 }
111 else if (memberLoadInstr->Type->ToString() == "ivec2")
112 {
113 conversionFunction = "floatBitsToInt";
114 size = 2;
115 }
116 else if (memberLoadInstr->Type->ToString() == "ivec3")
117 {
118 conversionFunction = "floatBitsToInt";
119 size = 3;
120 }
121 else if (memberLoadInstr->Type->ToString() == "ivec4")
122 {
123 conversionFunction = "floatBitsToInt";
124 size = 4;
125 }
126 else if (memberLoadInstr->Type->ToString() == "uint")
127 {
128 conversionFunction = "floatBitsToUint";
129 size = 1;
130 }
131 else if (memberLoadInstr->Type->ToString() == "uvec2")
132 {
133 conversionFunction = "floatBitsToUint";
134 size = 2;
135 }
136 else if (memberLoadInstr->Type->ToString() == "uvec3")
137 {
138 conversionFunction = "floatBitsToUint";
139 size = 3;
140 }
141 else if (memberLoadInstr->Type->ToString() == "uvec4")
142 {
143 conversionFunction = "floatBitsToUint";
144 size = 4;
145 }
146 else if (memberLoadInstr->Type->ToString() == "float")
147 {
148 conversionFunction = "";
149 size = 1;
150 }
151 else if (memberLoadInstr->Type->ToString() == "vec2")
152 {

Callers

nothing calls this directly

Calls 5

CodePositionClass · 0.85
diagnoseMethod · 0.80
GetVectorSizeMethod · 0.80
PtrMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected