summaryrefslogtreecommitdiff
path: root/Runtime/GfxDevice/GLDataBufferCommon.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/GfxDevice/GLDataBufferCommon.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/GfxDevice/GLDataBufferCommon.h')
-rw-r--r--Runtime/GfxDevice/GLDataBufferCommon.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/Runtime/GfxDevice/GLDataBufferCommon.h b/Runtime/GfxDevice/GLDataBufferCommon.h
new file mode 100644
index 0000000..7e7a9b9
--- /dev/null
+++ b/Runtime/GfxDevice/GLDataBufferCommon.h
@@ -0,0 +1,24 @@
+#ifndef GL_DATABUFFER_COMMON_H
+#define GL_DATABUFFER_COMMON_H
+
+#if GFX_SUPPORTS_OPENGL || GFX_SUPPORTS_OPENGLES || GFX_SUPPORTS_OPENGLES20 || GFX_SUPPORTS_OPENGLES30
+
+#define DATA_BUFFER_ID_MASK 0xC0000000
+#define MAKE_DATA_BUFFER_ID(id) (id|DATA_BUFFER_ID_MASK)
+
+inline void glRegisterBufferData(UInt32 bufferID, GLsizeiptr size, void* related)
+{
+ REGISTER_EXTERNAL_GFX_DEALLOCATION(MAKE_DATA_BUFFER_ID(bufferID) );
+ REGISTER_EXTERNAL_GFX_ALLOCATION_REF(MAKE_DATA_BUFFER_ID(bufferID),size,related);
+}
+
+inline void glDeregisterBufferData(int count, GLuint* buffferIds)
+{
+ for (size_t q = 0; q < count; ++q)
+ REGISTER_EXTERNAL_GFX_DEALLOCATION(MAKE_DATA_BUFFER_ID(buffferIds[q]) );
+}
+
+#endif
+
+#endif // GL_DATABUFFER_COMMON_H
+