1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Upgrade Embree to the latest official release.

Since Embree v3.13.0 supports AARCH64, switch back to the
official repo instead of using Embree-aarch64.

`thirdparty/embree/patches/godot-changes.patch` should now contain
an accurate diff of the changes done to the library.

(cherry picked from commit 767e374dce)
This commit is contained in:
jfons
2021-05-20 12:49:33 +02:00
committed by Rémi Verschelde
parent 2660fafcc0
commit a69cc9f13d
343 changed files with 12085 additions and 10390 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2009-2020 Intel Corporation
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#include "scene_triangle_mesh.h"
@@ -178,62 +178,13 @@ namespace embree
return true;
}
void TriangleMesh::interpolate(const RTCInterpolateArguments* const args)
{
unsigned int primID = args->primID;
float u = args->u;
float v = args->v;
RTCBufferType bufferType = args->bufferType;
unsigned int bufferSlot = args->bufferSlot;
float* P = args->P;
float* dPdu = args->dPdu;
float* dPdv = args->dPdv;
float* ddPdudu = args->ddPdudu;
float* ddPdvdv = args->ddPdvdv;
float* ddPdudv = args->ddPdudv;
unsigned int valueCount = args->valueCount;
/* calculate base pointer and stride */
assert((bufferType == RTC_BUFFER_TYPE_VERTEX && bufferSlot < numTimeSteps) ||
(bufferType == RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE && bufferSlot <= vertexAttribs.size()));
const char* src = nullptr;
size_t stride = 0;
if (bufferType == RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE) {
src = vertexAttribs[bufferSlot].getPtr();
stride = vertexAttribs[bufferSlot].getStride();
} else {
src = vertices[bufferSlot].getPtr();
stride = vertices[bufferSlot].getStride();
}
for (unsigned int i=0; i<valueCount; i+=4)
{
size_t ofs = i*sizeof(float);
const float w = 1.0f-u-v;
const Triangle& tri = triangle(primID);
const vbool4 valid = vint4((int)i)+vint4(step) < vint4(int(valueCount));
const vfloat4 p0 = vfloat4::loadu(valid,(float*)&src[tri.v[0]*stride+ofs]);
const vfloat4 p1 = vfloat4::loadu(valid,(float*)&src[tri.v[1]*stride+ofs]);
const vfloat4 p2 = vfloat4::loadu(valid,(float*)&src[tri.v[2]*stride+ofs]);
if (P) {
vfloat4::storeu(valid,P+i,madd(w,p0,madd(u,p1,v*p2)));
}
if (dPdu) {
assert(dPdu); vfloat4::storeu(valid,dPdu+i,p1-p0);
assert(dPdv); vfloat4::storeu(valid,dPdv+i,p2-p0);
}
if (ddPdudu) {
assert(ddPdudu); vfloat4::storeu(valid,ddPdudu+i,vfloat4(zero));
assert(ddPdvdv); vfloat4::storeu(valid,ddPdvdv+i,vfloat4(zero));
assert(ddPdudv); vfloat4::storeu(valid,ddPdudv+i,vfloat4(zero));
}
}
void TriangleMesh::interpolate(const RTCInterpolateArguments* const args) {
interpolate_impl<4>(args);
}
#endif
namespace isa
{
TriangleMesh* createTriangleMesh(Device* device) {