Skip to content

Commit

Permalink
Fix memory leak for vertex buffers in dx103DFluidGrid.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Feb 13, 2018
1 parent 10efe46 commit 2dff3de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Layers/xrRenderDX10/3DFluid/dx103DFluidGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inline void ComputeRowColsForFlat3DTexture(int depth, int* outCols, int* outRows
dx103DFluidGrid::dx103DFluidGrid() {}
dx103DFluidGrid::~dx103DFluidGrid()
{
// TODO: implement init/deinit functionality and guards
DestroyVertexBuffers();
}

void dx103DFluidGrid::Initialize(int gridWidth, int gridHeight, int gridDepth)
Expand Down Expand Up @@ -145,6 +145,14 @@ void dx103DFluidGrid::CreateVertexBuffers()
boundaryLines = NULL;
}

void dx103DFluidGrid::DestroyVertexBuffers()
{
_RELEASE(m_pRenderQuadBuffer);
_RELEASE(m_pSlicesBuffer);
_RELEASE(m_pBoundarySlicesBuffer);
_RELEASE(m_pBoundaryLinesBuffer);
}

void dx103DFluidGrid::InitScreenSlice(VS_INPUT_FLUIDSIM_STRUCT** vertices, int z, int& index)
{
VS_INPUT_FLUIDSIM_STRUCT tempVertex1;
Expand Down
1 change: 1 addition & 0 deletions src/Layers/xrRenderDX10/3DFluid/dx103DFluidGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class dx103DFluidGrid

private:
void CreateVertexBuffers();
void DestroyVertexBuffers();

void InitScreenSlice(VS_INPUT_FLUIDSIM_STRUCT** vertices, int z, int& index);
void InitSlice(int z, VS_INPUT_FLUIDSIM_STRUCT** vertices, int& index);
Expand Down

0 comments on commit 2dff3de

Please sign in to comment.