Hi,
I need help because my profiler indicates that there are huge leaks on some instructions, and I don't understand why.
Could you help me ?
struct VS_CONSTANT_BUFFER_G_BUFFER
{
XMFLOAT4X4A viewWorld ;
XMFLOAT4X4A projViewWorld;
bool normalMappingEnabled;
//bool padding[15];
};
{
VS_CONSTANT_BUFFER_G_BUFFER dataVSconstantBufferGBufferPass;
HRESULT hr;
//memory leak indicated here
hr = deferredContext->Map(GbufferVsPassConstants, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
// Get a pointer to the data in the constant buffer.
//auto dataVSconstantBufferGBufferPass = reinterpret_cast <VS_CONSTANT_BUFFER_G_BUFFER *>(mappedResource.pData);
//memcpy(mappedResource.pData, dataVSconstantBufferGBufferPass, sizeof(dataVSconstantBufferGBufferPass));
// Copy the matrices into the constant buffer.
dataVSconstantBufferGBufferPass.viewWorld = viewWorld;
dataVSconstantBufferGBufferPass.projViewWorld = projViewWorld;
dataVSconstantBufferGBufferPass.normalMappingEnabled = D3D11Rendering::normalMappingEnabled;
memcpy(mappedResource.pData, &dataVSconstantBufferGBufferPass, sizeof(dataVSconstantBufferGBufferPass));
// Unlock the constant buffer.
deferredContext->Unmap(GbufferVsPassConstants, 0);
//memory leak indicated here too
deferredContext->VSSetConstantBuffers(0, 1, (ID3D11Buffer* const*)&GbufferVsPassConstants);
GbufferVsPassConstants->Release();
deferredContext->Flush();
}