-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndexBuffer.cpp
More file actions
33 lines (25 loc) · 821 Bytes
/
IndexBuffer.cpp
File metadata and controls
33 lines (25 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "IndexBuffer.h"
IndexBuffer::IndexBuffer(void* list_indices, UINT size_list, RenderSystem* system)
{
mRenderSystem = system;
if (mBuffer) mBuffer->Release();
D3D11_BUFFER_DESC buff_desc = {};
buff_desc.Usage = D3D11_USAGE_DEFAULT;
buff_desc.ByteWidth = 4 * size_list;
buff_desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
buff_desc.CPUAccessFlags = 0;
buff_desc.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA init_data = {};
init_data.pSysMem = list_indices;
mSizeList = size_list;
if (FAILED(mRenderSystem->mD3DDevice->CreateBuffer(&buff_desc, &init_data, &mBuffer)))
throw std::exception("IndexBuffer not created successfully");
}
IndexBuffer::~IndexBuffer()
{
mBuffer->Release();
}
UINT IndexBuffer::getSizeIndexList() const
{
return this->mSizeList;
}