MCPcopy Create free account
hub / github.com/RenderKit/embree / run

Method run

tutorials/verify/verify.cpp:1530–1588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1528 : VerifyApplication::Test(name,isa,VerifyApplication::TEST_SHOULD_PASS), sflags(sflags) {}
1529
1530 VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent)
1531 {
1532 std::string cfg = state->rtcore + ",isa="+stringOfISA(isa);
1533 RTCDeviceRef device = rtcNewDevice(cfg.c_str());
1534 errorHandler(nullptr,rtcGetDeviceError(device));
1535 VerifyScene scene(device,sflags);
1536 AssertNoError(device);
1537 unsigned int geom[128];
1538 for (size_t i=0; i<128; i++) geom[i] = -1;
1539 Sphere spheres[128];
1540 memset(spheres,0,sizeof(spheres));
1541
1542 for (size_t i=0; i<size_t(50*state->intensity); i++)
1543 {
1544 for (size_t j=0; j<10; j++) {
1545 int index = random_int()%128;
1546 Vec3fa pos = 100.0f*random_Vec3fa();
1547 if (geom[index] == -1) {
1548 switch (random_int()%11) {
1549 case 0: geom[index] = scene.addSphere(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,2.0f,10).first; break;
1550 case 1: geom[index] = scene.addSphere(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,2.0f,10,-1,random_motion_vector(1.0f)).first; break;
1551 case 2: geom[index] = scene.addQuadSphere(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,2.0f,10).first; break;
1552 case 3: geom[index] = scene.addQuadSphere(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,2.0f,10,-1,random_motion_vector(1.0f)).first; break;
1553 case 4: geom[index] = scene.addGridSphere(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,2.0f,10).first; break;
1554 case 5: geom[index] = scene.addGridSphere(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,2.0f,10,-1,random_motion_vector(1.0f)).first; break;
1555 case 6: geom[index] = scene.addHair(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,1.0f,2.0f,10).first; break;
1556 case 7: geom[index] = scene.addHair(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,1.0f,2.0f,10,random_motion_vector(1.0f)).first; break;
1557 case 8: geom[index] = scene.addSubdivSphere(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,2.0f,4,4).first; break;
1558 case 9: geom[index] = scene.addSubdivSphere(sampler,RTC_BUILD_QUALITY_MEDIUM,pos,2.0f,4,4,-1,random_motion_vector(1.0f)).first; break;
1559 case 10:
1560 spheres[index] = Sphere(pos,2.0f);
1561 geom[index] = scene.addUserGeometryEmpty(sampler,RTC_BUILD_QUALITY_MEDIUM,&spheres[index]).first; break;
1562 }
1563 AssertNoError(device);
1564 }
1565 else {
1566 rtcDetachGeometry(scene,geom[index]);
1567 AssertNoError(device);
1568 geom[index] = -1;
1569 }
1570 }
1571 rtcCommitScene(scene);
1572 AssertNoError(device);
1573 rtcCommitScene(scene);
1574 AssertNoError(device);
1575 if (i%2 == 0) std::cout << "." << std::flush;
1576 }
1577
1578 /* now delete all geometries */
1579 for (size_t i=0; i<128; i++)
1580 if (geom[i] != -1) rtcDetachGeometry(scene,geom[i]);
1581 rtcCommitScene(scene);
1582 AssertNoError(device);
1583
1584 rtcCommitScene (scene);
1585 AssertNoError(device);
1586
1587 return VerifyApplication::PASSED;

Callers

nothing calls this directly

Calls 15

stringOfISAFunction · 0.85
rtcNewDeviceFunction · 0.85
errorHandlerFunction · 0.85
rtcGetDeviceErrorFunction · 0.85
AssertNoErrorFunction · 0.85
rtcDetachGeometryFunction · 0.85
rtcCommitSceneFunction · 0.85
addSphereMethod · 0.80
addQuadSphereMethod · 0.80
addGridSphereMethod · 0.80
addHairMethod · 0.80
addSubdivSphereMethod · 0.80

Tested by

no test coverage detected