resolve performance bug in rayintersectmeshes

This commit is contained in:
turanszkij
2017-05-02 21:51:41 +02:00
parent 8563d40505
commit ebde9af6c5
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -5236,6 +5236,7 @@ void wiRenderer::RayIntersectMeshes(const RAY& ray, const CulledList& culledObje
XMVECTOR& rayOrigin = XMLoadFloat3(&ray.origin);
XMVECTOR& rayDirection = XMVector3Normalize(XMLoadFloat3(&ray.direction));
// pre allocate helper vector array:
static size_t _arraySize = 10000;
static XMVECTOR* _vertices = (XMVECTOR*)_mm_malloc(sizeof(XMVECTOR)*_arraySize, 16);
@@ -5274,8 +5275,9 @@ void wiRenderer::RayIntersectMeshes(const RAY& ray, const CulledList& culledObje
Mesh* mesh = object->mesh;
if (mesh->vertices[VPROP_POS].size() >= _arraySize)
{
// grow preallocated vector helper array
_mm_free(_vertices);
_arraySize = mesh->vertices[VPROP_POS].size();
_arraySize = (mesh->vertices[VPROP_POS].size() + 1) * 2;
_vertices = (XMVECTOR*)_mm_malloc(sizeof(XMVECTOR)*_arraySize, 16);
}
+1 -1
View File
@@ -7,7 +7,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 11;
// minor bug fixes, alterations, refactors, updates
const int revision = 38;
const int revision = 39;
long GetVersion()