EnsureBufferAndCopy utility functions now avoid resizes if new size is smaller or equal
This commit is contained in:
parent
29b4465dfd
commit
f0c09817ce
|
@ -115,6 +115,7 @@ namespace Sandbox
|
||||||
SHSystemManager::RegisterRoutine<SHDebugDrawSystem, SHDebugDrawSystem::ProcessPointsRoutine>();
|
SHSystemManager::RegisterRoutine<SHDebugDrawSystem, SHDebugDrawSystem::ProcessPointsRoutine>();
|
||||||
|
|
||||||
SHSystemManager::RegisterRoutine<SHScriptEngine, SHScriptEngine::GizmosDrawRoutine>();
|
SHSystemManager::RegisterRoutine<SHScriptEngine, SHScriptEngine::GizmosDrawRoutine>();
|
||||||
|
SHSystemManager::RegisterRoutine<SHGraphicsSystem, SHGraphicsSystem::PrepareRenderRoutine>();
|
||||||
SHSystemManager::RegisterRoutine<SHGraphicsSystem, SHGraphicsSystem::BatcherDispatcherRoutine>();
|
SHSystemManager::RegisterRoutine<SHGraphicsSystem, SHGraphicsSystem::BatcherDispatcherRoutine>();
|
||||||
SHSystemManager::RegisterRoutine<SHGraphicsSystem, SHGraphicsSystem::BeginRoutine>();
|
SHSystemManager::RegisterRoutine<SHGraphicsSystem, SHGraphicsSystem::BeginRoutine>();
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,16 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (bufferHandle)
|
if (bufferHandle)
|
||||||
{
|
{
|
||||||
// Resize
|
// Resize if we need to resize
|
||||||
bufferHandle->ResizeReplace(size, src, size);
|
if (bufferHandle->GetSizeStored() < size)
|
||||||
|
{
|
||||||
|
bufferHandle->ResizeReplace(size, src, size);
|
||||||
|
}
|
||||||
|
// Otherwise just copy the data over
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bufferHandle->MapWriteUnmap(src, size, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -113,8 +121,16 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (bufferHandle)
|
if (bufferHandle)
|
||||||
{
|
{
|
||||||
// Resize
|
// Resize if we need to resize
|
||||||
bufferHandle->ResizeReplace(size, src, size); // TODO: Set to host visible method?
|
if (bufferHandle->GetSizeStored() < size)
|
||||||
|
{
|
||||||
|
bufferHandle->ResizeReplace(size, src, size);
|
||||||
|
}
|
||||||
|
// Otherwise just copy the data over
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bufferHandle->MapWriteUnmap(src, size, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue