X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fgraphicsbuffer.h;h=b102c5195e94abe197d81d233403e0621dd48808;hb=33d1adb60806e13863aa3b6c5e1dee9836cd3d04;hp=9513cb74a1842faa7a14eb1c241d0c96a503128e;hpb=f8ef964f021d1d6da6ea46bbb1fe8f0250a5be8c;p=ipdf%2Fcode.git diff --git a/src/graphicsbuffer.h b/src/graphicsbuffer.h index 9513cb7..b102c51 100644 --- a/src/graphicsbuffer.h +++ b/src/graphicsbuffer.h @@ -1,7 +1,7 @@ #ifndef _GRAPHICSBUFFER_H #define _GRAPHICSBUFFER_H -#include +#include "SDL.h" #include "gl_core44.h" @@ -20,7 +20,8 @@ namespace IPDF BufferTypePixelPack, // Pixel Pack buffer BufferTypePixelUnpack, BufferTypeUniform, // Uniform/Constant buffer - BufferTypeDrawIndirect, + BufferTypeTexture, // I was hoping to avoid this one. + BufferTypeDrawIndirect }; enum BufferUsage @@ -54,10 +55,17 @@ namespace IPDF const size_t GetSize() const { return m_buffer_size; } void Invalidate(); + + // WARNING: The buffer handle can change for (almost) no reason. + // If you do _anything_ to the buffer, you'll need to call this + // again to see if we've recreated it in a vain attempt to outsmart + // the driver. + GLuint GetHandle() const { return m_buffer_handle; } void Bind() const; + void BindRange(size_t start, size_t size) const; private: - bool RecreateBuffer(const void *data = nullptr); + bool RecreateBuffer(const void *data = NULL); GLuint m_buffer_handle; BufferType m_buffer_type; BufferUsage m_buffer_usage;