mirror of
https://github.com/minetest/minetest.git
synced 2025-01-09 14:57:29 +01:00
OpenGL: allow uploads of buffers to hardware ahead-of-time
This commit is contained in:
parent
bb550158fc
commit
33b8307119
@ -310,6 +310,18 @@ public:
|
|||||||
0 or another texture first. */
|
0 or another texture first. */
|
||||||
virtual void removeAllTextures() = 0;
|
virtual void removeAllTextures() = 0;
|
||||||
|
|
||||||
|
//! Eagerly upload buffer to hardware
|
||||||
|
/** This can be a good idea if you have a newly created or modified buffer,
|
||||||
|
which you know you will draw in the near future (e.g. end of same frame,
|
||||||
|
or next frame), because it gives the GPU driver to copy the contents. */
|
||||||
|
virtual void updateHardwareBuffer(const scene::IVertexBuffer *vb) = 0;
|
||||||
|
|
||||||
|
//! Eagerly upload buffer to hardware
|
||||||
|
/** This can be a good idea if you have a newly created or modified buffer,
|
||||||
|
which you know you will draw in the near future (e.g. end of same frame,
|
||||||
|
or next frame), because it gives the GPU driver to copy the contents. */
|
||||||
|
virtual void updateHardwareBuffer(const scene::IIndexBuffer *ib) = 0;
|
||||||
|
|
||||||
//! Remove hardware buffer
|
//! Remove hardware buffer
|
||||||
virtual void removeHardwareBuffer(const scene::IVertexBuffer *vb) = 0;
|
virtual void removeHardwareBuffer(const scene::IVertexBuffer *vb) = 0;
|
||||||
|
|
||||||
|
@ -1167,6 +1167,24 @@ void CNullDriver::deleteHardwareBuffer(SHWBufferLink *HWBuffer)
|
|||||||
delete HWBuffer;
|
delete HWBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CNullDriver::updateHardwareBuffer(const scene::IVertexBuffer *vb)
|
||||||
|
{
|
||||||
|
if (!vb)
|
||||||
|
return;
|
||||||
|
auto *link = getBufferLink(vb);
|
||||||
|
if (link)
|
||||||
|
updateHardwareBuffer(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDriver::updateHardwareBuffer(const scene::IIndexBuffer *ib)
|
||||||
|
{
|
||||||
|
if (!ib)
|
||||||
|
return;
|
||||||
|
auto *link = getBufferLink(ib);
|
||||||
|
if (link)
|
||||||
|
updateHardwareBuffer(link);
|
||||||
|
}
|
||||||
|
|
||||||
void CNullDriver::removeHardwareBuffer(const scene::IVertexBuffer *vb)
|
void CNullDriver::removeHardwareBuffer(const scene::IVertexBuffer *vb)
|
||||||
{
|
{
|
||||||
if (!vb)
|
if (!vb)
|
||||||
|
@ -348,6 +348,10 @@ protected:
|
|||||||
virtual SHWBufferLink *createHardwareBuffer(const scene::IIndexBuffer *ib) { return 0; }
|
virtual SHWBufferLink *createHardwareBuffer(const scene::IIndexBuffer *ib) { return 0; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual void updateHardwareBuffer(const scene::IVertexBuffer *vb) override;
|
||||||
|
|
||||||
|
virtual void updateHardwareBuffer(const scene::IIndexBuffer *ib) override;
|
||||||
|
|
||||||
//! Remove hardware buffer
|
//! Remove hardware buffer
|
||||||
void removeHardwareBuffer(const scene::IVertexBuffer *vb) override;
|
void removeHardwareBuffer(const scene::IVertexBuffer *vb) override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user