mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git
synced 2024-11-21 19:50:05 +00:00
Fix for not applying debug margin in Generic algorithm.
Ported test for linear algorithm from VMA. Code by @medranSolus
This commit is contained in:
parent
80cd0026a1
commit
ae519f2521
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
build/
|
||||
bin/
|
@ -349,6 +349,8 @@ struct MyUniformRandomNumberGenerator
|
||||
{
|
||||
typedef uint32_t result_type;
|
||||
MyUniformRandomNumberGenerator(RandomNumberGenerator& gen) : m_Gen(gen) { }
|
||||
static uint32_t min() { return 0; }
|
||||
static uint32_t max() { return UINT32_MAX; }
|
||||
uint32_t operator()() { return m_Gen.Generate(); }
|
||||
|
||||
private:
|
||||
|
@ -4009,8 +4009,8 @@ bool BlockMetadata_Generic::CheckAllocation(
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start from offset equal to beginning of this suballocation.
|
||||
UINT64 offset = suballoc.offset;
|
||||
// Start from offset equal to beginning of this suballocation and debug margin of previous allocation if present.
|
||||
UINT64 offset = suballoc.offset + (suballocItem == m_Suballocations.cbegin() ? 0 : GetDebugMargin());
|
||||
|
||||
// Apply alignment.
|
||||
offset = AlignUp(offset, allocAlignment);
|
||||
@ -4018,7 +4018,7 @@ bool BlockMetadata_Generic::CheckAllocation(
|
||||
// Calculate padding at the beginning based on current offset.
|
||||
const UINT64 paddingBegin = offset - suballoc.offset;
|
||||
|
||||
// Fail if requested size plus margin before and after is bigger than size of this suballocation.
|
||||
// Fail if requested size plus margin after is bigger than size of this suballocation.
|
||||
if(paddingBegin + allocSize + GetDebugMargin() > suballoc.size)
|
||||
{
|
||||
return false;
|
||||
|
@ -20,8 +20,8 @@
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "D3D12MemAlloc.h"
|
||||
#include "Common.h"
|
||||
#include "D3D12MemAlloc.h"
|
||||
#include "Tests.h"
|
||||
#include <atomic>
|
||||
#include <Shlwapi.h> // For StrStrI
|
||||
|
1255
src/Tests.cpp
1255
src/Tests.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user