replaced alloca by temp arena
This commit is contained in:
@@ -85,8 +85,9 @@ namespace Juliet::D3D12
|
|||||||
{
|
{
|
||||||
auto d3d12driver = static_cast<D3D12Driver*>(driver.Get());
|
auto d3d12driver = static_cast<D3D12Driver*>(driver.Get());
|
||||||
|
|
||||||
// TODO: use scratch allocator for alloca (stack alloc)
|
TempArena tempArena = ArenaTempBegin(d3d12driver->DriverArena);
|
||||||
HANDLE* events = static_cast<HANDLE*>(alloca(sizeof(HANDLE) * numFences));
|
|
||||||
|
HANDLE* events = ArenaPushArray<HANDLE>(tempArena.Arena, numFences, "JUST IN CASE");
|
||||||
MemoryZero(events, sizeof(HANDLE) * numFences);
|
MemoryZero(events, sizeof(HANDLE) * numFences);
|
||||||
|
|
||||||
for (uint32 i = 0; i < numFences; ++i)
|
for (uint32 i = 0; i < numFences; ++i)
|
||||||
@@ -97,6 +98,7 @@ namespace Juliet::D3D12
|
|||||||
if (FAILED(res))
|
if (FAILED(res))
|
||||||
{
|
{
|
||||||
LogError(d3d12driver->D3D12Device, "Setting fence event failed!", res);
|
LogError(d3d12driver->D3D12Device, "Setting fence event failed!", res);
|
||||||
|
ArenaTempEnd(tempArena);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +115,9 @@ namespace Juliet::D3D12
|
|||||||
}
|
}
|
||||||
|
|
||||||
DWORD waitResult = WaitForMultipleObjects(numFences, events, waitForAll, INFINITE);
|
DWORD waitResult = WaitForMultipleObjects(numFences, events, waitForAll, INFINITE);
|
||||||
|
|
||||||
|
ArenaTempEnd(tempArena);
|
||||||
|
|
||||||
if (waitResult == WAIT_FAILED)
|
if (waitResult == WAIT_FAILED)
|
||||||
{
|
{
|
||||||
LogError(LogCategory::Graphics, "Wait failed");
|
LogError(LogCategory::Graphics, "Wait failed");
|
||||||
@@ -155,8 +160,8 @@ namespace Juliet::D3D12
|
|||||||
auto d3d12Fence = reinterpret_cast<D3D12Fence*>(fence.Get());
|
auto d3d12Fence = reinterpret_cast<D3D12Fence*>(fence.Get());
|
||||||
|
|
||||||
#if JULIET_DEBUG
|
#if JULIET_DEBUG
|
||||||
LogDebug(LogCategory::Graphics, "ReleaseFence | %x fence. Handle %x | Event %x | Refcount %d | Querier %s", d3d12Fence,
|
LogDebug(LogCategory::Graphics, "ReleaseFence | %x fence. Handle %x | Event %x | Refcount %d | Querier %s",
|
||||||
d3d12Fence->Handle, d3d12Fence->Event, d3d12Fence->ReferenceCount, CStr(querier));
|
d3d12Fence, d3d12Fence->Handle, d3d12Fence->Event, d3d12Fence->ReferenceCount, CStr(querier));
|
||||||
#endif
|
#endif
|
||||||
if (--d3d12Fence->ReferenceCount == 0)
|
if (--d3d12Fence->ReferenceCount == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user