1 #ifndef VVGL_GLBuffer_hpp 2 #define VVGL_GLBuffer_hpp 4 #include "VVGL_Defines.hpp" 8 #include "GLContext.hpp" 60 #if defined(VVGL_SDK_MAC) 61 #include "GLBuffer_Enums_Mac.h" 62 #elif defined(VVGL_SDK_RPI) 63 #include "GLBuffer_Enums_RPI.h" 64 #elif defined(VVGL_SDK_IOS) 65 #include "GLBuffer_Enums_IOS.h" 66 #elif defined(VVGL_SDK_GLFW) 67 #include "GLBuffer_Enums_GLFW.h" 68 #elif defined(VVGL_SDK_QT) 69 #include "GLBuffer_Enums_Qt.h" 119 Target target = Target_2D;
121 #if defined(VVGL_SDK_MAC) 126 PixelFormat pixelFormat = PF_RGBA;
129 PixelType pixelType = PT_UByte;
135 bool texRangeFlag =
false;
137 bool texClientStorageFlag =
false;
138 uint32_t msAmount = 0;
140 uint32_t localSurfaceID = 0;
143 uint32_t bytesPerRowForWidth(
const uint32_t & w)
const;
145 uint32_t backingLengthForSize(
const Size & s)
const;
156 bool preferDeletion =
false;
162 bool flipped =
false;
166 Timestamp contentTimestamp = {
static_cast<uint64_t
>(0), static_cast<uint32_t>(0) };
168 bool pboMapped =
false;
174 void *backingContext =
nullptr;
178 void *cpuBackingPtr =
nullptr;
181 #if defined(VVGL_SDK_MAC) 184 IOSurfaceRef _localSurfaceRef =
nullptr;
186 IOSurfaceRef _remoteSurfaceRef =
nullptr;
191 GLBufferPoolRef parentBufferPool =
nullptr;
201 GLBuffer(GLBufferPoolRef inParentPool);
219 #if defined(VVGL_SDK_MAC) 223 IOSurfaceRef localSurfaceRef()
const;
224 void setLocalSurfaceRef(
const IOSurfaceRef & n);
225 IOSurfaceRef remoteSurfaceRef()
const;
226 void setRemoteSurfaceRef(
const IOSurfaceRef & n);
231 uint32_t backingLengthForSize(
Size s)
const;
233 Rect glReadySrcRect()
const;
238 bool isFullFrame()
const;
240 bool isNPOT2DTex()
const;
242 bool isPOT2DTex()
const;
243 #if defined(VVGL_SDK_MAC) 244 bool safeToPublishToSyphon()
const;
248 #if !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3) 254 void mapPBO(
const uint32_t & inAccess,
const bool & inUseCurrentContext=
false);
259 void unmapPBO(
const bool & inUseCurrentContext=
false);
260 #endif // !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3) 261 bool isContentMatch(
GLBuffer & n)
const;
265 string getDescriptionString()
const;
276 VVGL_EXPORT GLBufferRef GLBufferCopy(
const GLBufferRef & n);
Vertex Attribute Object
Definition: GLBuffer.hpp:55
The GLBuffer was created from an external, CPU-based source.
Definition: GLBuffer.hpp:103
Type
Describes the several different kinds of GLBuffers.
Definition: GLBuffer.hpp:39
Definition: GLBuffer.hpp:13
The CPU backing was a QImage, which will be deleted when the buffer's resources are no longer needed...
Definition: GLBuffer.hpp:105
The CPU backing is a GWorld, and must be freed appropriately.
Definition: GLBuffer.hpp:91
Texture.
Definition: GLBuffer.hpp:47
uint32_t backingLengthForSize(const Size &s) const
Returns the amount of memory in bytes required to accommodate a buffer of the passed size with the re...
Basic struct for 2D size.
Definition: VVGL_Geom.hpp:46
There is no resource.
Definition: GLBuffer.hpp:77
The GPU backing was a CVOpenGLTextureRef allocated by CoreVideo- this GLBuffer maintains a strong ref...
Definition: GLBuffer.hpp:97
shared_ptr< GLBuffer > GLBufferRef
Very common- GLBufferRef is a shared pointer around a GLBuffer.
Definition: VVGL_Base.hpp:44
Descriptor desc
Describes basic properties of the underlying resources.
Definition: GLBuffer.hpp:151
BackingID
The "BackingID" is an arbitrary enum that isn't used functionally by this lib.
Definition: GLBuffer.hpp:87
Representation of a GL resource of some sort- most commonly an OpenGL texture, but can also be other ...
Definition: GLBuffer.hpp:31
Pixel Buffer Object.
Definition: GLBuffer.hpp:49
CPU-only buffer.
Definition: GLBuffer.hpp:41
The Descriptor struct describes the hardware attributes of the GLBuffer.
Definition: GLBuffer.hpp:115
uint32_t calculateBackingLength()
Calculates the total number of bytes that are required to contain this GLBuffer's image data in syste...
Definition: GLBuffer.hpp:214
uint32_t bytesPerRowForWidth(const uint32_t &w) const
Returns the amount of memory in bytes that a single row of the provided width requires with the recei...
The CPU backing was a QVideoFrame, which will be deleted when the buffer's resources are no longer ne...
Definition: GLBuffer.hpp:107
The GLBuffer was created from an IOSurface (Mac SDK only) that was generated by another process...
Definition: GLBuffer.hpp:101
function< void(GLBuffer &, void *)> BackingReleaseCallback
This defines a callback that is used to release the backing of a GLBuffer, where appropriate. The GLBuffer being released is the first var, and the GLBuffer's backingContext is the second var. The backingContext is probably a pointer to an object from another SDK that has been retained, and needs to be released/freed using the appropriate means.
Definition: GLBuffer.hpp:35
Basic struct for a rectangle using VVGL::Point and VVGL::Size.
Definition: VVGL_Geom.hpp:65
The CPU backing was allocated by this library, and will be freed when the buffer's resources are no l...
Definition: GLBuffer.hpp:93
FBO.
Definition: GLBuffer.hpp:45
The resource was created by this framework (and should be deleted by this framework) ...
Definition: GLBuffer.hpp:78
uint32_t calculateBackingBytesPerRow()
Calculates the number of bytes that are required to display one row's worth of image data from this G...
Definition: GLBuffer.hpp:212
No backing ID or unknown backing ID.
Definition: GLBuffer.hpp:89
InternalFormat
Definition: GLBuffer.hpp:12
The CPU backing was a CVPixelBufferRef allocated by CoreVideo- this GLBuffer maintains a strong refer...
Definition: GLBuffer.hpp:95
The CPU backing was an NSBitmapImageRep, which will be freed when the buffer's resources are no longe...
Definition: GLBuffer.hpp:99
Element Buffer Object.
Definition: GLBuffer.hpp:53
string getDescriptionString() const
Returns a std::string that describes some basic properties of the GLBuffer instance.
Backing
Indicates the relationship this buffer has with its backing.
Definition: GLBuffer.hpp:76
Vertex Buffer Object
Definition: GLBuffer.hpp:51
Renderbuffer.
Definition: GLBuffer.hpp:43