Search found 1125 matches

by robmar
Sun Apr 15, 2018 10:06 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

Reallocate it first, then memcpy, that's what my code does.
by robmar
Sun Apr 15, 2018 9:48 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

So how would you do it, with greater efficiency?
by robmar
Sun Apr 15, 2018 7:23 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

This change reduces memory allocations afterwards from 2.4GB to 1.2GB and everything works well after cycle testing during hours.
I also free the keeptriangles using clear after the memcpy to protect system memory from running out on big meshes.
The mesh alone used in testing takes 380 MB.
by robmar
Sun Apr 15, 2018 7:17 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

I do this:

Code: Select all

 
node->Triangles.clear();
node->Triangles.set-used(keepTriangles.size());
 
memcpy(... Same line
 
KeepTriangles.clear();      // Keep memory use tighter
 
If (node->Child... Same as before
 
by robmar
Sun Apr 15, 2018 4:50 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

The bug is the memcpy, it copies the triangles over existing data, that was much larger, then reduces the size variable, but this does not free the overwritten larger data. I'm not sure how two allocation of different sizes sharing the same start address can get freed later. This results in the smal...
by robmar
Sat Apr 14, 2018 9:57 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

But the array is memcpied over without deallocating first, then the size is reset, but that doesn't deallocate the memory. Take a look at those array functions.
by robmar
Sat Apr 14, 2018 7:46 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

Bingo! That was a massive memory leak in constructOctree, the use of memcpy to nodes->Triangles then after using .set_used(0) doesn't free the memory.

On my big model, it's causing 1.2GB excess memory.
by robmar
Sat Apr 14, 2018 7:03 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

Sorry, I meant octants, and yes, each triangle should be only in one node specified for it's bounding box. This seems, sorry, a bit of a disaster, a fairly simple mesh with 12,522 triangles, like the little dragon, ends up with a whopping 395 nodes! Its looking like it really needs memory optimising...
by robmar
Sat Apr 14, 2018 10:32 am
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

I'd thought octree just split the mesh into octants, so just check which octant using it's bounding box, then check the triangles. Is the current method faster than that method would be?
by robmar
Sat Apr 14, 2018 10:28 am
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

I saw in iarray.h it adds 30 bytes or something extra for each allocation, but didn't imagine that there wasn't a method to tighten that down for each of the triangle allocations. With 440,000 triangles, any excess padding would hurt!
by robmar
Fri Apr 13, 2018 4:11 pm
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

I have that clear, but what I'm uncertain about is the selector, because for a mesh that has 6 million primitives, it is using a triangle array that is consuming about 2 gigabytes of memory. The coctetnode is 80 bytes in size, with one for each primitive, and the buffer of kept triangles during a hi...
by robmar
Fri Apr 13, 2018 9:59 am
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

I'm finding that with large models, if I load the triangle selector, it uses twice the amount of memory as taken by the mesh itself!
I'm wondering why, as the overhead to sort the triangles into 8 groups shouldn't be more than a few %
by robmar
Fri Apr 13, 2018 9:09 am
Forum: Advanced Help
Topic: Updated COctreeSceneNode class for Irrlicht 1.7.3
Replies: 45
Views: 7116

Re: Updated COctreeSceneNode class for Irrlicht 1.7.3

Thinking about removing the time overhead to load octree sorted triangle lists, as larger meshes tend to have many meshes, couldn't we just scan the mesh buffers for a hit, checking the boundary box for each submesh?
by robmar
Thu Jan 11, 2018 1:00 pm
Forum: Open Discussion and Dev Announcements
Topic: Implementing BGFX as a driver...
Replies: 42
Views: 19687

Re: Implementing BGFX as a driver...

Thanks, will sort it and post an HLSL version
by robmar
Thu Jan 11, 2018 12:59 pm
Forum: Everything 2d/3d Graphics
Topic: The Vulkan API
Replies: 71
Views: 31113

Re: The Vulkan API

Be nice to give Vulkan a test with Irrlich