X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fgraphicsbuffer.h;h=fd897712c7d4c00a3dda86475bad1f05b2508bf7;hp=47534c9b3cbb244f15f419fa0798d4abccbc4efc;hb=255065a607d82846c4a8b730000d547b3f080d0c;hpb=eff96d65bd1101083e04cb3ff2468b3feea3ff9e diff --git a/src/graphicsbuffer.h b/src/graphicsbuffer.h index 47534c9..fd89771 100644 --- a/src/graphicsbuffer.h +++ b/src/graphicsbuffer.h @@ -1,14 +1,13 @@ #ifndef _GRAPHICSBUFFER_H #define _GRAPHICSBUFFER_H -#include -#define GL_GLEXT_PROTOTYPES -#include +#include "SDL.h" +#include "gl_core44.h" namespace IPDF { - /* + /** * Implementation of an OpenGL buffer, with some extra cleverness. */ class GraphicsBuffer @@ -21,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 @@ -55,10 +55,16 @@ 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(); + void Bind() const; private: - void RecreateBuffer(); + bool RecreateBuffer(const void *data = NULL); GLuint m_buffer_handle; BufferType m_buffer_type; BufferUsage m_buffer_usage; @@ -66,6 +72,7 @@ namespace IPDF size_t m_buffer_size; bool m_invalidated; bool m_buffer_shape_dirty; + bool m_faking_map; }; }