From 31bb95f11f96aec4ce87cfcf62611611cf05ec95 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 21 Jun 2019 15:07:39 -0400 Subject: [PATCH] direct3d: Use D3DPOOL_DEFAULT for vertex buffers after all, release correctly. Fixes Bugzilla #4679. Fixes Bugzilla #4537. --- src/render/direct3d/SDL_render_d3d.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index c1e1231ee..9fb009f7c 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -1223,7 +1223,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti IDirect3DVertexBuffer9_Release(vbo); } - if (FAILED(IDirect3DDevice9_CreateVertexBuffer(data->device, (UINT) vertsize, usage, fvf, D3DPOOL_MANAGED, &vbo, NULL))) { + if (FAILED(IDirect3DDevice9_CreateVertexBuffer(data->device, (UINT) vertsize, usage, fvf, D3DPOOL_DEFAULT, &vbo, NULL))) { vbo = NULL; } data->vertexBuffers[vboidx] = vbo; @@ -1550,6 +1550,13 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) data->shaders[i] = NULL; } } + /* Release all vertex buffers */ + for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) { + if (data->vertexBuffers[i]) { + IDirect3DVertexBuffer9_Release(data->vertexBuffers[i]); + } + data->vertexBuffers[i] = NULL; + } if (data->device) { IDirect3DDevice9_Release(data->device); data->device = NULL; @@ -1591,7 +1598,7 @@ D3D_Reset(SDL_Renderer * renderer) } } - /* Release all vertex buffers */ + /* Release all vertex buffers */ for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) { if (data->vertexBuffers[i]) { IDirect3DVertexBuffer9_Release(data->vertexBuffers[i]);