You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param data The data to put in the new allocated buffer
152
153
*/
153
154
funallocate(data:ByteBuffer): Throwable? {
154
-
// FixMe: If access contains any of GL_MAP_PERSISTENT_BIT or GL_MAP_COHERENT_BIT and the buffer was not initialized using glBufferStorage, glMapBufferRange will fail
155
155
if (!bufferValid(target))
156
156
returnIllegalArgumentException("Target is not valid. Refer to the table in the documentation")
157
157
@@ -172,17 +172,54 @@ interface IBuffer {
172
172
* @param size The size of the new buffer
173
173
*/
174
174
funallocate(size:Long): Throwable? {
175
-
if (size <0) returnIllegalArgumentException("Invalid size parameter: $size")
175
+
if (!bufferValid(target))
176
+
returnIllegalArgumentException("Target is not valid. Refer to the table in the documentation")
177
+
178
+
if (!bufferUsageValid(usage))
179
+
returnIllegalArgumentException("Buffer usage is invalid")
* This function cannot be called twice for the same buffer
191
+
* This function handles the buffer binding
192
+
*/
193
+
funstorage(data:ByteBuffer): Throwable? {
194
+
if (!bufferValid(target))
195
+
returnIllegalArgumentException("Target is not valid. Refer to the table in the documentation")
196
+
197
+
if (!bufferUsageValid(usage))
198
+
returnIllegalArgumentException("Buffer usage is invalid")
199
+
200
+
bind()
201
+
glBufferStorage(target, data, usage)
202
+
bind(0)
176
203
177
-
// FixMe: If access contains any of GL_MAP_PERSISTENT_BIT or GL_MAP_COHERENT_BIT and the buffer was not initialized using glBufferStorage, glMapBufferRange will fail
204
+
returnnull
205
+
}
206
+
207
+
/**
208
+
* Create a new buffer storage
209
+
* This function cannot be called twice for the same buffer
210
+
* This function handles the buffer binding
211
+
*
212
+
* @param size The size of the storage buffer
213
+
*/
214
+
funstorage(size:Long): Throwable? {
178
215
if (!bufferValid(target))
179
216
returnIllegalArgumentException("Target is not valid. Refer to the table in the documentation")
180
217
181
218
if (!bufferUsageValid(usage))
182
219
returnIllegalArgumentException("Buffer usage is invalid")
0 commit comments