D3DStreamBuffer: Use size_t within the class interface

A few StreamBuffer instances take arguments that are actually size_t,
and this will cause truncation warnings during argument forwarding
with make_unique.
This commit is contained in:
Lioncash
2016-02-16 00:39:04 -05:00
parent 2c5fcad5f5
commit 626fcf4c15
4 changed files with 54 additions and 55 deletions

View File

@ -14,29 +14,29 @@ namespace DX12
class D3DStreamBuffer
{
public:
D3DStreamBuffer(unsigned int initial_size, unsigned int max_size, bool* buffer_reallocation_notification);
D3DStreamBuffer(size_t initial_size, size_t max_size, bool* buffer_reallocation_notification);
~D3DStreamBuffer();
bool AllocateSpaceInBuffer(unsigned int allocation_size, unsigned int alignment);
void OverrideSizeOfPreviousAllocation(unsigned int override_allocation_size);
bool AllocateSpaceInBuffer(size_t allocation_size, size_t alignment);
void OverrideSizeOfPreviousAllocation(size_t override_allocation_size);
void* GetBaseCPUAddress() const;
D3D12_GPU_VIRTUAL_ADDRESS GetBaseGPUAddress() const;
ID3D12Resource* GetBuffer() const;
void* GetCPUAddressOfCurrentAllocation() const;
D3D12_GPU_VIRTUAL_ADDRESS GetGPUAddressOfCurrentAllocation() const;
unsigned int GetOffsetOfCurrentAllocation() const;
unsigned int GetSize() const;
size_t GetOffsetOfCurrentAllocation() const;
size_t GetSize() const;
static void QueueFenceCallback(void* owning_object, UINT64 fence_value);
private:
void AllocateBuffer(unsigned int size);
bool AttemptBufferResizeOrElseStall(unsigned int new_size);
void AllocateBuffer(size_t size);
bool AttemptBufferResizeOrElseStall(size_t new_size);
bool AttemptToAllocateOutOfExistingUnusedSpaceInBuffer(unsigned int allocation_size);
bool AttemptToAllocateOutOfExistingUnusedSpaceInBuffer(size_t allocation_size);
bool AttemptToFindExistingFenceToStallOn(unsigned int allocation_size);
bool AttemptToFindExistingFenceToStallOn(size_t allocation_size);
void UpdateGPUProgress();
void QueueFence(UINT64 fence_value);
@ -44,7 +44,7 @@ private:
struct FenceTrackingInformation
{
UINT64 fence_value;
unsigned int buffer_offset;
size_t buffer_offset;
};
std::queue<FenceTrackingInformation> m_queued_fences;
@ -56,13 +56,13 @@ private:
void* m_buffer_cpu_address = nullptr;
D3D12_GPU_VIRTUAL_ADDRESS m_buffer_gpu_address = {};
unsigned int m_buffer_current_allocation_offset = 0;
unsigned int m_buffer_offset = 0;
unsigned int m_buffer_size = 0;
size_t m_buffer_current_allocation_offset = 0;
size_t m_buffer_offset = 0;
size_t m_buffer_size = 0;
const unsigned int m_buffer_max_size = 0;
const size_t m_buffer_max_size = 0;
unsigned int m_buffer_gpu_completion_offset = 0;
size_t m_buffer_gpu_completion_offset = 0;
bool* m_buffer_reallocation_notification = nullptr;
};