MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Resize

Method Resize

Source/Engine/Graphics/Textures/GPUTexture.cpp:577–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575}
576
577bool GPUTexture::Resize(int32 width, int32 height, int32 depth, PixelFormat format)
578{
579 PROFILE_CPU();
580 if (!IsAllocated())
581 {
582 LOG(Warning, "Cannot resize not created textures.");
583 return true;
584 }
585
586 auto desc = GetDescription();
587 if (format == PixelFormat::Unknown)
588 format = desc.Format;
589
590 // Skip if size won't change
591 if (desc.Width == width && desc.Height == height && desc.Depth == depth && desc.Format == format)
592 return false;
593
594 desc.Format = format;
595 desc.Width = width;
596 desc.Height = height;
597 desc.Depth = depth;
598 if (desc.MipLevels > 1)
599 desc.MipLevels = CalculateMipMapCount(0, Math::Max(width, height));
600
601 // Recreate
602 return Init(desc);
603}
604
605uint64 GPUTexture::calculateMemoryUsage() const
606{

Callers 15

DownloadDataMethod · 0.45
GetPixelsMethod · 0.45
ClearMethod · 0.45
GetTextureDataMethod · 0.45
InitCSharpMethod · 0.45
FromTextureDataMethod · 0.45
CloneMethod · 0.45
LoadMethod · 0.45
UnloadMethod · 0.45
RunDeformersMethod · 0.45
SkeletonMappingMethod · 0.45
EnsureCapacityMethod · 0.45

Calls 4

CalculateMipMapCountFunction · 0.85
IsAllocatedFunction · 0.70
InitFunction · 0.70
MaxFunction · 0.50

Tested by

no test coverage detected