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

Method OpImageSampleExplicitLod

Source/SpireCore/SpirVCodeGen.cpp:1445–1499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1443 streamFunctionBody.Add(Bias);
1444 }
1445 void OpImageSampleExplicitLod(
1446 const int ID,
1447 const int typeID,
1448 const int textureID,
1449 const int coordinateID,
1450 const int LodID,
1451 const int Bias = -1,
1452 const int GradX = -1,
1453 const int GradY = -1)
1454 {
1455 sbTextFunctionBody << LR"(%)" << ID << LR"( = OpImageSampleExplicitLod %)"
1456 << typeID << LR"( %)" << textureID << LR"( %)" << coordinateID;
1457 if (Bias != -1)
1458 sbTextFunctionBody << LR"( Bias %)" << Bias;
1459 if (GradX != -1)
1460 sbTextFunctionBody << LR"( Grad %)" << GradX << LR"( %)" << GradY;
1461 else
1462 sbTextFunctionBody << LR"( Lod %)" << LodID;
1463 sbTextFunctionBody << EndLine;
1464
1465 int IO = 0;
1466 int len = 5;
1467 if (Bias != -1)
1468 {
1469 IO |= (int)ImageOperands::Bias;
1470 len++;
1471 }
1472 if (GradX != -1) {
1473 IO |= (int)ImageOperands::Grad;
1474 len += 2;
1475 }
1476 else
1477 {
1478 IO |= (int)ImageOperands::Lod;
1479 len++;
1480 }
1481 if (IO)
1482 len++;
1483 streamFunctionBody.Add(88 + (len << 16));
1484 streamFunctionBody.Add(typeID);
1485 streamFunctionBody.Add(ID);
1486 streamFunctionBody.Add(textureID);
1487 streamFunctionBody.Add(coordinateID);
1488 if (IO)
1489 streamFunctionBody.Add(IO);
1490 if (Bias != -1)
1491 streamFunctionBody.Add(Bias);
1492 if (GradX != -1)
1493 {
1494 streamFunctionBody.Add(GradX);
1495 streamFunctionBody.Add(GradY);
1496 }
1497 else
1498 streamFunctionBody.Add(LodID);
1499 }
1500 void OpImageSampleDrefImplicitLod(
1501 const int ID,
1502 const int typeID,

Callers 1

AddInstrTextureMethod · 0.80

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected