| 4227 | } |
| 4228 | |
| 4229 | void PrintImportInstr(ImportInstruction * instr) |
| 4230 | { |
| 4231 | auto block = instr->SourceWorld->WorldOutput; |
| 4232 | |
| 4233 | if (instr->ImportOperator->Name.Content == "standardImport") |
| 4234 | { |
| 4235 | ctx.AddInstrAccessChain_StructMember(instr, ctx.InterfaceNameToID["blk" + block->Name], instr->ComponentName); |
| 4236 | } |
| 4237 | |
| 4238 | else if (instr->ImportOperator->Name.Content == "vertexImport") |
| 4239 | { |
| 4240 | int componentID = ctx.InterfaceNameToID[instr->ComponentName]; |
| 4241 | if (componentID == -1) |
| 4242 | throw InvalidOperationException("can not find import component for vertexImport in PrintImportInstr(): " + instr->ComponentName); |
| 4243 | ctx.UpdateVariable(instr, componentID); |
| 4244 | } |
| 4245 | |
| 4246 | else if (instr->ImportOperator->Name.Content == "uniformImport") |
| 4247 | { |
| 4248 | if (instr->Type->IsTexture()) |
| 4249 | { |
| 4250 | int pointerID = ctx.InterfaceNameToID[instr->ComponentName]; |
| 4251 | if (pointerID == -1) |
| 4252 | throw InvalidOperationException("can not find import component for uniformImport in PrintImportInstr(): " + instr->ComponentName); |
| 4253 | ctx.UpdateVariable(instr, pointerID); |
| 4254 | } |
| 4255 | else |
| 4256 | { |
| 4257 | ctx.AddInstrAccessChain_StructMember(instr, ctx.InterfaceNameToID["blk" + block->Name], instr->ComponentName); |
| 4258 | } |
| 4259 | } |
| 4260 | |
| 4261 | else if (instr->ImportOperator->Name.Content == "textureImport") |
| 4262 | { |
| 4263 | int textureStorageID = ctx.InterfaceNameToID[instr->ComponentName]; |
| 4264 | int textureValueID = ctx.AddInstrLoad(textureStorageID, MemoryAccess::None); |
| 4265 | |
| 4266 | int operandID = -1; |
| 4267 | operandID = ctx.AddInstrTexture( |
| 4268 | 0, |
| 4269 | textureValueID, |
| 4270 | GetOperandValue(instr->Arguments[0].Ptr()), |
| 4271 | currentExecutionModel |
| 4272 | ); |
| 4273 | |
| 4274 | operandID = ctx.ConvertBasicType( |
| 4275 | operandID, |
| 4276 | ctx.IDInfos[operandID]().GetILType(), |
| 4277 | instr->Type); |
| 4278 | CompiledComponent ccomp; |
| 4279 | if (instr->SourceWorld->LocalComponents.TryGetValue(instr->ComponentName, ccomp)) |
| 4280 | { |
| 4281 | if (ccomp.Attributes.ContainsKey("Norma")) |
| 4282 | operandID = ctx.AddInstrMulAdd(operandID, 2.0, -1.0); |
| 4283 | } |
| 4284 | |
| 4285 | int storeID = ctx.AddInstrVariableDeclaration((ILOperand*)instr, instr->Type, StorageClass::Function); |
| 4286 | ctx.AddInstrStore((ILOperand*)instr, storeID, operandID); |
nothing calls this directly
no test coverage detected