mirror of
https://github.com/Drezil/imgui.git
synced 2025-01-05 14:06:35 +00:00
Examples: DirectX11: increasing vertex buffer size (would really need a dynamic buffer size)
+ Delete unused code
This commit is contained in:
parent
381c7428c1
commit
5834297928
@ -46,12 +46,6 @@ struct VERTEX_CONSTANT_BUFFER
|
|||||||
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
||||||
static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count)
|
static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count)
|
||||||
{
|
{
|
||||||
size_t total_vtx_count = 0;
|
|
||||||
for (int n = 0; n < cmd_lists_count; n++)
|
|
||||||
total_vtx_count += cmd_lists[n]->vtx_buffer.size();
|
|
||||||
if (total_vtx_count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Copy and convert all vertices into a single contiguous buffer
|
// Copy and convert all vertices into a single contiguous buffer
|
||||||
D3D11_MAPPED_SUBRESOURCE mappedResource;
|
D3D11_MAPPED_SUBRESOURCE mappedResource;
|
||||||
if (g_pd3dDeviceImmediateContext->Map(g_pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource) != S_OK)
|
if (g_pd3dDeviceImmediateContext->Map(g_pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource) != S_OK)
|
||||||
@ -461,7 +455,7 @@ void InitImGui()
|
|||||||
D3D11_BUFFER_DESC bufferDesc;
|
D3D11_BUFFER_DESC bufferDesc;
|
||||||
memset(&bufferDesc, 0, sizeof(D3D11_BUFFER_DESC));
|
memset(&bufferDesc, 0, sizeof(D3D11_BUFFER_DESC));
|
||||||
bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
|
bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||||
bufferDesc.ByteWidth = 10000 * sizeof(CUSTOMVERTEX);
|
bufferDesc.ByteWidth = 100000 * sizeof(CUSTOMVERTEX); // Maybe we should handle that more dynamically?
|
||||||
bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||||
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||||
bufferDesc.MiscFlags = 0;
|
bufferDesc.MiscFlags = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user