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

Method run

tutorials/verify/verify.cpp:2122–2178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2120 }
2121
2122 VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent)
2123 {
2124 std::string cfg = state->rtcore + ",isa="+stringOfISA(isa);
2125 RTCDeviceRef device = rtcNewDevice(cfg.c_str());
2126 errorHandler(nullptr,rtcGetDeviceError(device));
2127 size_t M = num_interpolation_vertices*N+16; // pads the arrays with some valid data
2128
2129 RTCGeometry geom = rtcNewGeometry(device, RTC_GEOMETRY_TYPE_SUBDIVISION);
2130 AssertNoError(device);
2131 rtcSetGeometryVertexAttributeCount(geom,2);
2132
2133 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT, interpolation_quad_indices, 0, sizeof(unsigned int), num_interpolation_quad_faces*4);
2134 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_FACE, 0, RTC_FORMAT_UINT, interpolation_quad_faces, 0, sizeof(unsigned int), num_interpolation_quad_faces);
2135 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_EDGE_CREASE_INDEX, 0, RTC_FORMAT_UINT2, interpolation_edge_crease_indices, 0, 2*sizeof(unsigned int), 3);
2136 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT, 0, RTC_FORMAT_FLOAT, interpolation_edge_crease_weights, 0, sizeof(float), 3);
2137 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX, 0, RTC_FORMAT_UINT, interpolation_vertex_crease_indices, 0, sizeof(unsigned int), 2);
2138 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT, 0, RTC_FORMAT_FLOAT, interpolation_vertex_crease_weights, 0, sizeof(float), 2);
2139 AssertNoError(device);
2140
2141 std::vector<float> vertices0(M);
2142 for (size_t i=0; i<M; i++) vertices0[i] = random_float();
2143 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT3, vertices0.data(), 0, N*sizeof(float), num_interpolation_vertices);
2144 AssertNoError(device);
2145
2146 /*std::vector<float> vertices1(M);
2147 for (size_t i=0; i<M; i++) vertices1[i] = random_float();
2148 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX, 1, RTC_FORMAT_FLOAT3, vertices1.data(), 0, N*sizeof(float), num_interpolation_vertices);
2149 AssertNoError(device);*/
2150
2151 std::vector<float> user_vertices0(M);
2152 for (size_t i=0; i<M; i++) user_vertices0[i] = random_float();
2153 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, RTCFormat(RTC_FORMAT_FLOAT+N), user_vertices0.data(), 0, N*sizeof(float), num_interpolation_vertices);
2154 AssertNoError(device);
2155
2156 std::vector<float> user_vertices1(M);
2157 for (size_t i=0; i<M; i++) user_vertices1[i] = random_float();
2158 rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 1, RTCFormat(RTC_FORMAT_FLOAT+N), user_vertices1.data(), 0, N*sizeof(float), num_interpolation_vertices);
2159 AssertNoError(device);
2160
2161 bool passed = true;
2162 if (N >= 3) {
2163 passed &= checkSubdivInterpolation(device,geom,RTC_BUFFER_TYPE_VERTEX,0,vertices0.data(),3,N);
2164 //passed &= checkSubdivInterpolation(device,geom,RTC_BUFFER_TYPE_VERTEX,1,vertices1.data(),3,N);
2165 }
2166 passed &= checkSubdivInterpolation(device,geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,0,user_vertices0.data(),N,N);
2167 passed &= checkSubdivInterpolation(device,geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,1,user_vertices1.data(),N,N);
2168
2169 passed &= checkSubdivInterpolation(device,geom,RTC_BUFFER_TYPE_VERTEX,0,vertices0.data(),1,N);
2170 //passed &= checkSubdivInterpolation(device,geom,RTC_BUFFER_TYPE_VERTEX,1,vertices1.data(),1,N);
2171 passed &= checkSubdivInterpolation(device,geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,0,user_vertices0.data(),1,N);
2172 passed &= checkSubdivInterpolation(device,geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,1,user_vertices1.data(),1,N);
2173
2174 rtcReleaseGeometry(geom);
2175 AssertNoError(device);
2176
2177 return (VerifyApplication::TestReturnValue) passed;
2178 }
2179 };

Callers

nothing calls this directly

Calls 11

stringOfISAFunction · 0.85
rtcNewDeviceFunction · 0.85
errorHandlerFunction · 0.85
rtcGetDeviceErrorFunction · 0.85
AssertNoErrorFunction · 0.85
rtcReleaseGeometryFunction · 0.85
RTCFormatEnum · 0.50
c_strMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected