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

Method run

tutorials/verify/verify.cpp:3480–3548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3478 }
3479
3480 VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent)
3481 {
3482 std::string cfg = state->rtcore + ",isa="+stringOfISA(isa);
3483 RTCDeviceRef device = rtcNewDevice(cfg.c_str());
3484 errorHandler(nullptr,rtcGetDeviceError(device));
3485
3486 Ref<SceneGraph::Node> sphere = SceneGraph::createQuadSphere(Vec3fa(0.f), 1.f, 32);
3487
3488 sflags.sflags = sflags.sflags | RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS;
3489
3490 VerifyScene bl_scene(device, sflags);
3491 bl_scene.addGeometry(quality, sphere);
3492 rtcCommitScene(bl_scene);
3493 AssertNoError(device);
3494
3495 bool passed = true;
3496 {
3497 // test 4x4 column major
3498 std::vector<AffineSpace3fa> matrices(10);
3499 for (uint32_t i = 0; i < matrices.size(); ++i) {
3500 matrices[i].l.vx.x = random_float(); matrices[i].l.vy.x = random_float(); matrices[i].l.vz.x = random_float(); matrices[i].p.x = random_float();
3501 matrices[i].l.vx.y = random_float(); matrices[i].l.vy.y = random_float(); matrices[i].l.vz.y = random_float(); matrices[i].p.y = random_float();
3502 matrices[i].l.vx.z = random_float(); matrices[i].l.vy.z = random_float(); matrices[i].l.vz.z = random_float(); matrices[i].p.z = random_float();
3503 }
3504
3505 RTCScene tl_scene = rtcNewScene(device);
3506 RTCGeometry instance_array = rtcNewGeometry (device, RTC_GEOMETRY_TYPE_INSTANCE_ARRAY);
3507 rtcSetSharedGeometryBuffer(instance_array, RTC_BUFFER_TYPE_TRANSFORM, 0, RTC_FORMAT_FLOAT4X4_COLUMN_MAJOR, (void*)matrices.data(), 0, sizeof(AffineSpace3fa), matrices.size());
3508 rtcSetGeometryInstancedScene(instance_array, bl_scene);
3509 rtcAttachGeometry(tl_scene,instance_array);
3510 rtcReleaseGeometry(instance_array);
3511 rtcCommitGeometry(instance_array);
3512 rtcCommitScene(tl_scene);
3513 AssertNoError(device);
3514
3515 // do test
3516 for (uint32_t i = 0; i < matrices.size(); ++i)
3517 {
3518 const AffineSpace3fa& ref = matrices[i];
3519 {
3520 float mat[16];
3521 rtcGetGeometryTransformEx(instance_array, i, 0.f, RTC_FORMAT_FLOAT4X4_COLUMN_MAJOR, mat);
3522 passed &= (ref.l.vx.x == mat[0]); passed &= (ref.l.vy.x == mat[4]); passed &= (ref.l.vz.x == mat[ 8]); passed &= (ref.p.x == mat[12]);
3523 passed &= (ref.l.vx.y == mat[1]); passed &= (ref.l.vy.y == mat[5]); passed &= (ref.l.vz.y == mat[ 9]); passed &= (ref.p.y == mat[13]);
3524 passed &= (ref.l.vx.z == mat[2]); passed &= (ref.l.vy.z == mat[6]); passed &= (ref.l.vz.z == mat[10]); passed &= (ref.p.z == mat[14]);
3525 passed &= (0.f == mat[3]); passed &= (0.f == mat[7]); passed &= (0.f == mat[11]); passed &= (1.f == mat[15]);
3526 }
3527 {
3528 float mat[12];
3529 rtcGetGeometryTransformEx(instance_array, i, 0.f, RTC_FORMAT_FLOAT3X4_COLUMN_MAJOR, mat);
3530 passed &= (ref.l.vx.x == mat[0]); passed &= (ref.l.vy.x == mat[3]); passed &= (ref.l.vz.x == mat[6]); passed &= (ref.p.x == mat[ 9]);
3531 passed &= (ref.l.vx.y == mat[1]); passed &= (ref.l.vy.y == mat[4]); passed &= (ref.l.vz.y == mat[7]); passed &= (ref.p.y == mat[10]);
3532 passed &= (ref.l.vx.z == mat[2]); passed &= (ref.l.vy.z == mat[5]); passed &= (ref.l.vz.z == mat[8]); passed &= (ref.p.z == mat[11]);
3533 }
3534 {
3535 float mat[12];
3536 rtcGetGeometryTransformEx(instance_array, i, 0.f, RTC_FORMAT_FLOAT3X4_ROW_MAJOR, mat);
3537 passed &= (ref.l.vx.x == mat[0]); passed &= (ref.l.vy.x == mat[1]); passed &= (ref.l.vz.x == mat[ 2]); passed &= (ref.p.x == mat[ 3]);

Callers

nothing calls this directly

Calls 15

stringOfISAFunction · 0.85
rtcNewDeviceFunction · 0.85
errorHandlerFunction · 0.85
rtcGetDeviceErrorFunction · 0.85
rtcCommitSceneFunction · 0.85
AssertNoErrorFunction · 0.85
rtcNewSceneFunction · 0.85
rtcAttachGeometryFunction · 0.85
rtcReleaseGeometryFunction · 0.85
rtcCommitGeometryFunction · 0.85

Tested by

no test coverage detected