Mark font textures as something that shouldn't be downscaled

This commit is contained in:
Dale Glass 2020-10-27 01:19:22 +01:00
parent 7a186bba34
commit 3284313399
3 changed files with 7 additions and 2 deletions

View file

@ -223,7 +223,7 @@ void GLTextureTransferEngineDefault::updateMemoryPressure() {
idealMemoryAllocation += texture->evalTotalSize();
// Track how much we're actually using
totalVariableMemoryAllocation += gltexture->size();
if (vartexture->canDemote()) {
if (!gltexture->_gpuObject.getImportant() && vartexture->canDemote()) {
canDemote |= true;
}
if (vartexture->canPromote()) {
@ -503,7 +503,7 @@ void GLTextureTransferEngineDefault::processDemotes(size_t reliefRequired, const
for (const auto& texture : strongTextures) {
GLTexture* gltexture = Backend::getGPUObject<GLTexture>(*texture);
GLVariableAllocationSupport* vargltexture = dynamic_cast<GLVariableAllocationSupport*>(gltexture);
if (vargltexture->canDemote()) {
if (!gltexture->_gpuObject.getImportant() && vargltexture->canDemote()) {
demoteQueue.push({ texture, (float)gltexture->size() });
}
}

View file

@ -571,6 +571,9 @@ public:
void setExternalRecycler(const ExternalRecycler& recycler);
ExternalRecycler getExternalRecycler() const;
bool getImportant() const { return _important; }
void setImportant(bool important) { _important = important; }
const GPUObjectPointer gpuObject {};
ExternalUpdates getUpdates() const;
@ -632,6 +635,7 @@ protected:
bool _autoGenerateMips = false;
bool _isIrradianceValid = false;
bool _defined = false;
bool _important = false;
static TexturePointer create(TextureUsageType usageType, Type type, const Element& texelFormat, uint16 width, uint16 height, uint16 depth, uint16 numSamples, uint16 numSlices, uint16 numMips, const Sampler& sampler);

View file

@ -260,6 +260,7 @@ void Font::read(QIODevice& in) {
gpu::Sampler(gpu::Sampler::FILTER_MIN_POINT_MAG_LINEAR));
_texture->setStoredMipFormat(formatMip);
_texture->assignStoredMip(0, image.sizeInBytes(), image.constBits());
_texture->setImportant(true);
}
void Font::setupGPU() {