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

Method PrintCallInstr

Source/SpireCore/SpirVCodeGen.cpp:3451–3681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3449 Dictionary<String, int> GLSLstd450InstructionSet = GenGLSLstd450InstructionSet();
3450
3451 void PrintCallInstr(CallInstruction * instr)
3452 // return ID of this instruction
3453 {
3454 String callName = GetFuncOriginalName(instr->Function);
3455
3456 //------------------------- texture instructions -------------------------
3457 if (callName == "texture")
3458 {
3459 if (instr->Arguments[0]->Type->IsNonShadowTexture())
3460 {
3461 if (instr->Arguments[0]->Type->ToString() == "sampler2D")
3462 {
3463 //*** no bias!!!
3464 //__intrinsic vec4 texture(sampler2D tex, vec2 coord);
3465 ctx.AddInstrTexture(
3466 (ILOperand*)instr,
3467 GetOperandValue(instr->Arguments[0].Ptr()),
3468 GetOperandValue(instr->Arguments[1].Ptr()),
3469 currentExecutionModel
3470 );
3471 return;
3472 }
3473 else if (instr->Arguments[0]->Type->ToString() == "samplerCube")
3474 {
3475 if (instr->Arguments.Count() == 2)
3476 {
3477 //__intrinsic vec4 texture(samplerCube tex, vec3 coord);
3478 ctx.AddInstrTexture(
3479 (ILOperand*)instr,
3480 GetOperandValue(instr->Arguments[0].Ptr()),
3481 GetOperandValue(instr->Arguments[1].Ptr()),
3482 currentExecutionModel
3483 );
3484 return;
3485 }
3486 else
3487 {
3488 //__intrinsic vec4 texture(samplerCube tex, vec3 coord, float bias);
3489 ctx.AddInstrTexture(
3490 (ILOperand*)instr,
3491 GetOperandValue(instr->Arguments[0].Ptr()),
3492 GetOperandValue(instr->Arguments[1].Ptr()),
3493 currentExecutionModel,
3494 GetOperandValue(instr->Arguments[2].Ptr())
3495 );
3496 return;
3497 }
3498 }
3499 }
3500 else
3501 {
3502 //instr->Arguments[0]->Type->IsShadowTexture
3503
3504 //__intrinsic float texture(sampler2DShadow tex, vec3 coord);
3505 //__intrinsic float texture(samplerCubeShadow tex, vec4 coord);
3506 ctx.AddInstrTextureShadow(
3507 (ILOperand*)instr,
3508 GetOperandValue(instr->Arguments[0].Ptr()),

Callers

nothing calls this directly

Calls 15

GetFuncOriginalNameFunction · 0.85
GetTypeFromStringFunction · 0.85
ILBaseTypeEnum · 0.85
IsNonShadowTextureMethod · 0.80
AddInstrTextureMethod · 0.80
AddInstrTextureShadowMethod · 0.80
IsFloatVectorMethod · 0.80
IsFloatMatrixMethod · 0.80
AddInstrDotMethod · 0.80
AddInstrTransposeMethod · 0.80

Tested by

no test coverage detected