Skip to content

Commit 4ade6ff

Browse files
authored
Merge branch 'master' into sw/ci-compiler-version
2 parents 4c58fb6 + c9e873d commit 4ade6ff

3 files changed

Lines changed: 76 additions & 1 deletion

File tree

‎common/simd/vboolf4_sse2.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ namespace embree
5858
#if !defined(__EMSCRIPTEN__)
5959
__forceinline operator const __m128i() const { return _mm_castps_si128(v); }
6060
__forceinline operator const __m128d() const { return _mm_castps_pd(v); }
61+
#endif
6162
/* kept for source compatibility with code that calls .m128i()/.m128d() explicitly */
6263
__forceinline const __m128i m128i() const { return _mm_castps_si128(v); }
6364
__forceinline const __m128d m128d() const { return _mm_castps_pd(v); }
64-
#endif
6565
#endif
6666

6767
__forceinline vboolf(bool a)

‎kernels/common/scene_subdiv_mesh.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,11 @@ namespace embree
531531
{
532532
for (size_t f=r.begin(); f<r.end(); f++)
533533
{
534+
/* Skip faces with zero vertices. */
535+
if (mesh->faceVertices[f] == 0) {
536+
continue;
537+
}
538+
534539
HalfEdge* edge = &halfEdges[mesh->faceStartEdge[f]];
535540

536541
/* for vertex topology we also test if vertices are valid */

‎tutorials/verify/verify.cpp‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,75 @@ namespace embree
11731173
BBox<Vec4<double>> bbv4d;
11741174
};
11751175

1176+
struct SubdivZeroValenceTest : public VerifyApplication::Test
1177+
{
1178+
SubdivZeroValenceTest(std::string name, int64_t isa)
1179+
: VerifyApplication::Test(std::move(name),isa,VerifyApplication::TEST_SHOULD_PASS)
1180+
{}
1181+
1182+
VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent)
1183+
{
1184+
std::string cfg = state->rtcore + ",isa="+stringOfISA(isa);
1185+
RTCDeviceRef device = rtcNewDevice(cfg.c_str());
1186+
errorHandler(nullptr,rtcGetDeviceError(device));
1187+
1188+
auto createGeometry = [&](bool zeroValenceFace)
1189+
{
1190+
RTCGeometry geometry = rtcNewGeometry(device,RTC_GEOMETRY_TYPE_SUBDIVISION);
1191+
float* vertices = static_cast<float*>(rtcSetNewGeometryBuffer(
1192+
geometry,RTC_BUFFER_TYPE_VERTEX,0,RTC_FORMAT_FLOAT3,3*sizeof(float),4));
1193+
unsigned int* faces = static_cast<unsigned int*>(rtcSetNewGeometryBuffer(
1194+
geometry,RTC_BUFFER_TYPE_FACE,0,RTC_FORMAT_UINT,sizeof(unsigned int),
1195+
zeroValenceFace ? 2 : 1));
1196+
unsigned int* indices = static_cast<unsigned int*>(rtcSetNewGeometryBuffer(
1197+
geometry,RTC_BUFFER_TYPE_INDEX,0,RTC_FORMAT_UINT,sizeof(unsigned int),4));
1198+
if (!vertices || !faces || !indices)
1199+
throw std::runtime_error("failed to allocate subdivision geometry buffers");
1200+
1201+
vertices[0] = 0.0f;
1202+
vertices[1] = 0.0f;
1203+
vertices[2] = 0.0f;
1204+
vertices[3] = 1.0f;
1205+
vertices[4] = 0.0f;
1206+
vertices[5] = 0.0f;
1207+
vertices[6] = 1.0f;
1208+
vertices[7] = 1.0f;
1209+
vertices[8] = 0.0f;
1210+
vertices[9] = 0.0f;
1211+
vertices[10] = 1.0f;
1212+
vertices[11] = 0.0f;
1213+
faces[0] = 4;
1214+
if (zeroValenceFace) faces[1] = 0;
1215+
indices[0] = 0;
1216+
indices[1] = 1;
1217+
indices[2] = 2;
1218+
indices[3] = 3;
1219+
AssertNoError(device);
1220+
return geometry;
1221+
};
1222+
1223+
RTCScene scene = rtcNewScene(device);
1224+
RTCGeometry geometry = createGeometry(false);
1225+
rtcCommitGeometry(geometry);
1226+
AssertNoError(device);
1227+
rtcAttachGeometry(scene,geometry);
1228+
AssertNoError(device);
1229+
rtcReleaseGeometry(geometry);
1230+
rtcCommitScene(scene);
1231+
AssertNoError(device);
1232+
rtcReleaseScene(scene);
1233+
1234+
scene = rtcNewScene(device);
1235+
geometry = createGeometry(true);
1236+
rtcCommitGeometry(geometry);
1237+
AssertNoError(device);
1238+
rtcReleaseGeometry(geometry);
1239+
rtcReleaseScene(scene);
1240+
1241+
return VerifyApplication::PASSED;
1242+
}
1243+
};
1244+
11761245
/////////////////////////////////////////////////////////////////////////////////
11771246
/////////////////////////////////////////////////////////////////////////////////
11781247
/////////////////////////////////////////////////////////////////////////////////
@@ -6444,6 +6513,7 @@ namespace embree
64446513

64456514
groups.top()->add(new MultipleDevicesTest("multiple_devices",isa));
64466515
groups.top()->add(new TypesTest("types_test",isa));
6516+
groups.top()->add(new SubdivZeroValenceTest("subdiv_zero_valence",isa));
64476517

64486518
push(new TestGroup("get_bounds",true,true));
64496519
for (auto gtype : gtypes_all)

0 commit comments

Comments
 (0)