1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "BsGLIndexBuffer.h"
4#include "BsGLHardwareBufferManager.h"
5#include "Profiling/BsRenderStats.h"
6#include "Error/BsException.h"
7#include "BsGLCommandBuffer.h"
8
9namespace bs { namespace ct
10{
11 static void deleteBuffer(HardwareBuffer* buffer)
12 {
13 bs_pool_delete(static_cast<GLHardwareBuffer*>(buffer));
14 }
15
16 GLIndexBuffer::GLIndexBuffer(const INDEX_BUFFER_DESC& desc, GpuDeviceFlags deviceMask)
17 :IndexBuffer(desc, deviceMask)
18 {
19 assert((deviceMask == GDF_DEFAULT || deviceMask == GDF_PRIMARY) && "Multiple GPUs not supported natively on OpenGL.");
20 }
21
22 void GLIndexBuffer::initialize()
23 {
24 mBuffer = bs_pool_new<GLHardwareBuffer>(GL_ELEMENT_ARRAY_BUFFER, mSize, mUsage);
25 mBufferDeleter = &deleteBuffer;
26
27 IndexBuffer::initialize();
28 }
29}}
30