Fix deadlock in asset thumbnails rendering queue when texture streaming fails
#2057
This commit is contained in:
@@ -296,6 +296,7 @@ Task* StreamingTexture::UpdateAllocation(int32 residency)
|
||||
// Setup texture
|
||||
if (texture->Init(desc))
|
||||
{
|
||||
Streaming.Error = true;
|
||||
LOG(Error, "Cannot allocate texture {0}.", ToString());
|
||||
}
|
||||
if (allocatedResidency != 0)
|
||||
|
||||
@@ -223,6 +223,11 @@ void TextureBase::SetTextureGroup(int32 textureGroup)
|
||||
}
|
||||
}
|
||||
|
||||
bool TextureBase::HasStreamingError() const
|
||||
{
|
||||
return _texture.Streaming.Error;
|
||||
}
|
||||
|
||||
BytesContainer TextureBase::GetMipData(int32 mipIndex, int32& rowPitch, int32& slicePitch)
|
||||
{
|
||||
BytesContainer result;
|
||||
|
||||
@@ -148,6 +148,11 @@ public:
|
||||
/// </summary>
|
||||
API_PROPERTY() void SetTextureGroup(int32 textureGroup);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if texture streaming failed (eg. pixel format is unsupported or texture data cannot be uploaded to GPU due to memory limit).
|
||||
/// </summary>
|
||||
API_PROPERTY() bool HasStreamingError() const;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Gets the mip data.
|
||||
|
||||
@@ -111,8 +111,9 @@ public:
|
||||
struct StreamingCache
|
||||
{
|
||||
int64 LastUpdate = 0;
|
||||
int32 TargetResidency = 0;
|
||||
int64 TargetResidencyChange = 0;
|
||||
int32 TargetResidency = 0;
|
||||
bool Error = false;
|
||||
SamplesBuffer<float, 5> QualitySamples;
|
||||
};
|
||||
|
||||
@@ -131,7 +132,8 @@ public:
|
||||
/// <summary>
|
||||
/// Stops the streaming (eg. on streaming fail).
|
||||
/// </summary>
|
||||
void ResetStreaming();
|
||||
/// <param name="error">True if streaming failed.</param>
|
||||
void ResetStreaming(bool error = true);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -84,8 +84,9 @@ void StreamableResource::RequestStreamingUpdate()
|
||||
Streaming.LastUpdate = 0;
|
||||
}
|
||||
|
||||
void StreamableResource::ResetStreaming()
|
||||
void StreamableResource::ResetStreaming(bool error)
|
||||
{
|
||||
Streaming.Error = error;
|
||||
Streaming.TargetResidency = 0;
|
||||
Streaming.LastUpdate = DateTime::MaxValue().Ticks;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user