Add GPUResourceUsage.Staging for both CPU read/write access

This commit is contained in:
Wojtek Figat
2025-01-30 20:39:04 +01:00
parent f11306af24
commit 44fae3838e
12 changed files with 89 additions and 21 deletions

View File

@@ -142,6 +142,14 @@ GPUTextureDescription GPUTextureDescription::ToStagingReadback() const
return copy;
}
GPUTextureDescription GPUTextureDescription::ToStaging() const
{
auto copy = *this;
copy.Flags = GPUTextureFlags::None;
copy.Usage = GPUResourceUsage::Staging;
return copy;
}
bool GPUTextureDescription::Equals(const GPUTextureDescription& other) const
{
return Dimensions == other.Dimensions
@@ -208,6 +216,11 @@ GPUTexture::GPUTexture()
_desc.Clear();
}
bool GPUTexture::IsStaging() const
{
return _desc.Usage == GPUResourceUsage::StagingUpload || _desc.Usage == GPUResourceUsage::StagingReadback || _desc.Usage == GPUResourceUsage::Staging;
}
Float2 GPUTexture::Size() const
{
return Float2(static_cast<float>(_desc.Width), static_cast<float>(_desc.Height));