Add GPUResourceUsage.Staging for both CPU read/write access
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -294,10 +294,7 @@ public:
|
||||
/// <summary>
|
||||
/// Checks if texture is a staging buffer (supports direct CPU access).
|
||||
/// </summary>
|
||||
FORCE_INLINE bool IsStaging() const
|
||||
{
|
||||
return _desc.Usage == GPUResourceUsage::StagingUpload || _desc.Usage == GPUResourceUsage::StagingReadback;
|
||||
}
|
||||
bool IsStaging() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether this <see cref="GPUTexture"/> is a using a block compress format (BC1, BC2, BC3, BC4, BC5, BC6H, BC7, etc.).
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace FlaxEngine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the staging description for this instance.
|
||||
/// Gets the staging upload (CPU write) description for this instance.
|
||||
/// </summary>
|
||||
/// <returns>A staging texture description</returns>
|
||||
public GPUTextureDescription ToStagingUpload()
|
||||
@@ -312,7 +312,7 @@ namespace FlaxEngine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the staging description for this instance.
|
||||
/// Gets the staging readback (CPU read) description for this instance.
|
||||
/// </summary>
|
||||
/// <returns>A staging texture description</returns>
|
||||
public GPUTextureDescription ToStagingReadback()
|
||||
@@ -323,6 +323,18 @@ namespace FlaxEngine
|
||||
return desc;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the staging (CPU read/write) description for this instance.
|
||||
/// </summary>
|
||||
/// <returns>A staging texture description</returns>
|
||||
public GPUTextureDescription ToStaging()
|
||||
{
|
||||
var desc = this;
|
||||
desc.Flags = GPUTextureFlags.None;
|
||||
desc.Usage = GPUResourceUsage.Staging;
|
||||
return desc;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -397,6 +397,7 @@ public:
|
||||
void Clear();
|
||||
GPUTextureDescription ToStagingUpload() const;
|
||||
GPUTextureDescription ToStagingReadback() const;
|
||||
GPUTextureDescription ToStaging() const;
|
||||
bool Equals(const GPUTextureDescription& other) const;
|
||||
String ToString() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user