Updating the gpu buffer and how drawVertexPrimitiveList...

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
pandoragami
Posts: 226
Joined: Wed Jan 26, 2011 5:37 pm
Contact:

Updating the gpu buffer and how drawVertexPrimitiveList...

Post by pandoragami »

Hello,

This question relates to using shaders in a specific way where the vertices and indices aren't updated in every frame inside the call
for drawVertexPrimitiveList and the positions of the vertices are updated with a time variable on the gpu in the shader only (not the cpu). The question I have is this,

If the vertices and indices in drawVertexPrimitiveList are NOT changed per frame but the call is still made, does the memory
for the data inside the function still get sent over from the cpu to the gpu or does it stay in the buffer and only the shader
updates the vertices (positions, etc.)?

I also wondered about the last parameter drawVertexPrimitiveList on this page http://irrlicht.sourceforge.net/docu/cl ... b3b1e2f4fb

I tried setting the video::EIT_16BIT to 32 bit and my program crashed saying allocation wasn't possible ( not the exact quote but something
related to memory I guess), is there something else that needs to be set?

I just wondered what the differences were for the two settings, is it more memory allocation on the gpu. Mines only a gig so 32 bits would be 4 gigs?

thanks!
CuteAlien
Admin
Posts: 9629
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Updating the gpu buffer and how drawVertexPrimitiveList.

Post by CuteAlien »

video::EIT_16BIT or video::EIT_32BIT are about the size of the indexList data type. So that void* pointer can really be some 16 bit or some 32 bit type. And it affects the number of vertices you can send with a single call to the gpu. Reason the default is 16-bit is that it's usually sufficient (as you can split meshes into more meshbuffers) and it is faster because your index-array has only half the size.

drawVertexPrimitiveList does not check if anything changed compared to any previous call - each call is on it's own. If you want buffers which stay on the gpu use the IMeshBuffer interface which has a function setHardwareMappingHint.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
pandoragami
Posts: 226
Joined: Wed Jan 26, 2011 5:37 pm
Contact:

Re: Updating the gpu buffer and how drawVertexPrimitiveList.

Post by pandoragami »

CuteAlien wrote:
drawVertexPrimitiveList does not check if anything changed compared to any previous call - each call is on it's own. If you want buffers which stay on the gpu use the IMeshBuffer interface which has a function setHardwareMappingHint.
Using drawVertexPrimitiveList in conjunction with imeshbuffers wouldn't work though, right. These are two distinctly different objects, one part of the driver and the other isn't. I'm just checking the make sure what direction to take because I'll just create billboards then; but if billboards are updated on the cpu every frame then that would work either??? :(

Any suggestions.

thanks so far.
CuteAlien
Admin
Posts: 9629
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Updating the gpu buffer and how drawVertexPrimitiveList.

Post by CuteAlien »

Meshbuffers use internally drawMeshBuffer which uses some functions only available internally. It first checks if the meshbuffer is a hardwarebuffer and if so it uses the internal function drawHardwareBuffer, otherwise it calls drawVertexPrimitiveList. The hardwarebuffer functions are not available from public interfaces.

Billboards might have another problem. I think Irrlicht usually doesn't create hardware meshbuffers for objects below X polygons (I think X was 500, but can't find it right now quickly and I think the parameter could be changed somewhere).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply