Solving the size evaluation for compressed format

This commit is contained in:
samcake 2017-05-22 16:51:54 -07:00
parent e4f9f2935e
commit e0487f7e04
4 changed files with 12 additions and 10 deletions

View file

@ -270,17 +270,17 @@ Item {
StatText {
text: "GPU Textures: ";
}
StatText {
text: " Pressure State: " + root.gpuTextureMemoryPressureState;
}
StatText {
text: " Count: " + root.gpuTextures;
}
StatText {
text: " Pending Transfer: " + root.texturePendingTransfers + " MB";
text: " Pressure State: " + root.gpuTextureMemoryPressureState;
}
StatText {
text: " Resource Allocated/Populated: " + root.gpuTextureResourceMemory + " / " + root.gpuTextureResourcePopulatedMemory + " MB";
text: " Resource Allocated / Populated / Pending: ";
}
StatText {
text: " " + root.gpuTextureResourceMemory + " / " + root.gpuTextureResourcePopulatedMemory + " / " + root.texturePendingTransfers + " MB";
}
StatText {
text: " Resident Memory: " + root.gpuTextureResidentMemory + " MB";

View file

@ -42,7 +42,6 @@ GL45VariableAllocationTexture::~GL45VariableAllocationTexture() {
void GL45VariableAllocationTexture::incrementPopulatedSize(Size delta) const {
_populatedSize += delta;
if (_size < _populatedSize) {
Backend::textureResourcePopulatedGPUMemSize.update(0, delta);
} else {
Backend::textureResourcePopulatedGPUMemSize.update(0, delta);
@ -101,6 +100,9 @@ void GL45ResourceTexture::allocateStorage(uint16 allocatedMip) {
_size = 0;
bool wtf = false;
for (uint16_t mip = _allocatedMip; mip < mipLevels; ++mip) {
if (_gpuObject.evalMipSize(mip) == 0) {
wtf = true;
}
_size += _gpuObject.evalMipSize(mip);
}
Backend::textureResourceGPUMemSize.update(0, _size);
@ -198,7 +200,6 @@ void GL45ResourceTexture::demote() {
auto numPopulatedDemoted = _populatedMip - oldPopulatedMip;
Size amountUnpopulated = 0;
for (int i = 0; i < numPopulatedDemoted; i++) {
//amountUnpopulated += _gpuObject.getStoredMipSize(oldPopulatedMip + i);
amountUnpopulated += _gpuObject.evalMipSize(oldPopulatedMip + i);
}
decrementPopulatedSize(amountUnpopulated);

View file

@ -429,7 +429,8 @@ public:
//
// Here are the static function to compute the different sizes from parametered dimensions and format
// Tile size must be a power of 2
static uint16 evalTiledLength(uint16 length, int tile) { return length / tile + ((~length & tile) != 0); }
static uint16 evalTiledPadding(uint16 length, int tile) { int tileMinusOne = (tile - 1); return (tileMinusOne - (length + tileMinusOne) % tile); }
static uint16 evalTiledLength(uint16 length, int tile) { return length / tile + (evalTiledPadding(length, tile) != 0); }
static uint16 evalTiledWidth(uint16 width, int tileX) { return evalTiledLength(width, tileX); }
static uint16 evalTiledHeight(uint16 height, int tileY) { return evalTiledLength(height, tileY); }
static Size evalLineSize(uint16 width, const Element& format) { return evalPaddedSize(evalTiledWidth(width, format.getTile().x) * format.getSize()); }

View file

@ -49,7 +49,7 @@ Item {
{
prop: "textureResidentGPUMemSize",
label: "Resident",
color: "#FF6309"
color: "#A2277C"
},
{
prop: "textureFramebufferGPUMemSize",
@ -69,7 +69,7 @@ Item {
{
prop: "texturePendingGPUTransferSize",
label: "Transfer",
color: "#A2277C"
color: "#FF6309"
}
]
}