now with fewer midnight-isms
[ipdf/code.git] / src / graphicsbuffer.h
index 7cec235..3dbb6fb 100644 (file)
@@ -7,7 +7,7 @@
 
 namespace IPDF
 {
-       /*
+       /**
         * Implementation of an OpenGL buffer, with some extra cleverness.
         */
        class GraphicsBuffer
@@ -20,6 +20,7 @@ namespace IPDF
                        BufferTypePixelPack,            // Pixel Pack buffer
                        BufferTypePixelUnpack,
                        BufferTypeUniform,              // Uniform/Constant buffer
+                       BufferTypeTexture,              // I was hoping to avoid this one.
                        BufferTypeDrawIndirect,
                };
                
@@ -54,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() const;
        private:
-               void RecreateBuffer();
+               bool RecreateBuffer(const void *data = nullptr);
                GLuint m_buffer_handle;
                BufferType m_buffer_type;
                BufferUsage m_buffer_usage;
@@ -65,6 +72,7 @@ namespace IPDF
                size_t m_buffer_size;
                bool m_invalidated;
                bool m_buffer_shape_dirty;
+               bool m_faking_map;
        };
 
 }

UCC git Repository :: git.ucc.asn.au