mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 09:37:14 +02:00
Don't use textures that are in the transfer pipeline
This commit is contained in:
parent
44d102d723
commit
7ffa212006
2 changed files with 19 additions and 17 deletions
|
@ -243,15 +243,8 @@ bool GLTexture::isReady() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're out of date, but the transfer is in progress, report ready
|
|
||||||
// as a special case
|
|
||||||
auto syncState = _syncState.load();
|
auto syncState = _syncState.load();
|
||||||
|
if (isOutdated() || Idle != syncState) {
|
||||||
if (isOutdated()) {
|
|
||||||
return Idle != syncState;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Idle != syncState) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ struct GLFilterMode {
|
||||||
|
|
||||||
class GLTexture : public GLObject<Texture> {
|
class GLTexture : public GLObject<Texture> {
|
||||||
public:
|
public:
|
||||||
|
static const uint16_t INVALID_MIP { (uint16_t)-1 };
|
||||||
|
static const uint8_t INVALID_FACE { (uint8_t)-1 };
|
||||||
|
|
||||||
static void initTextureTransferHelper();
|
static void initTextureTransferHelper();
|
||||||
static std::shared_ptr<GLTextureTransferHelper> _textureTransferHelper;
|
static std::shared_ptr<GLTextureTransferHelper> _textureTransferHelper;
|
||||||
|
|
||||||
|
@ -58,18 +61,24 @@ public:
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object->isReady()) {
|
if (object->isOutdated()) {
|
||||||
// Do we need to reduce texture memory usage?
|
|
||||||
if (object->isOverMaxMemory() && texturePointer->incremementMinMip()) {
|
|
||||||
// WARNING, this code path will essentially `delete this`,
|
|
||||||
// so no dereferencing of this instance should be done past this point
|
|
||||||
object = new GLTextureType(backend.shared_from_this(), texture, object);
|
|
||||||
_textureTransferHelper->transferTexture(texturePointer);
|
|
||||||
}
|
|
||||||
} else if (object->isOutdated()) {
|
|
||||||
// Object might be outdated, if so, start the transfer
|
// Object might be outdated, if so, start the transfer
|
||||||
// (outdated objects that are already in transfer will have reported 'true' for ready()
|
// (outdated objects that are already in transfer will have reported 'true' for ready()
|
||||||
_textureTransferHelper->transferTexture(texturePointer);
|
_textureTransferHelper->transferTexture(texturePointer);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!object->isReady()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do we need to reduce texture memory usage?
|
||||||
|
if (object->isOverMaxMemory() && texturePointer->incremementMinMip()) {
|
||||||
|
// WARNING, this code path will essentially `delete this`,
|
||||||
|
// so no dereferencing of this instance should be done past this point
|
||||||
|
object = new GLTextureType(backend.shared_from_this(), texture, object);
|
||||||
|
_textureTransferHelper->transferTexture(texturePointer);
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
|
|
Loading…
Reference in a new issue