Fixing the by region update of the compressed texture to match the 4 x 4 tiles alignment

This commit is contained in:
samcake 2017-05-02 17:30:31 -07:00
parent ef628eaec6
commit 84305c2049
2 changed files with 10 additions and 4 deletions

View file

@ -429,9 +429,13 @@ void GL41VariableAllocationTexture::populateTransferQueue() {
// consuming more than X bandwidth
auto mipSize = _gpuObject.getStoredMipFaceSize(sourceMip, face);
const auto lines = mipDimensions.y;
auto bytesPerLine = mipSize / lines;
const uint32_t CHUNK_NUM_LINES { 4 };
const auto numChunks = (lines + (CHUNK_NUM_LINES - 1)) / CHUNK_NUM_LINES;
auto bytesPerChunk = mipSize / numChunks;
//auto bytesPerLine = mipSize / lines;
Q_ASSERT(0 == (mipSize % lines));
uint32_t linesPerTransfer = (uint32_t)(MAX_TRANSFER_SIZE / bytesPerLine);
// uint32_t linesPerTransfer = (uint32_t)(MAX_TRANSFER_SIZE / bytesPerLine);
uint32_t linesPerTransfer = CHUNK_NUM_LINES * (uint32_t)(MAX_TRANSFER_SIZE / bytesPerChunk);
uint32_t lineOffset = 0;
while (lineOffset < lines) {
uint32_t linesToCopy = std::min<uint32_t>(lines - lineOffset, linesPerTransfer);

View file

@ -197,9 +197,11 @@ void GL45ResourceTexture::populateTransferQueue() {
// consuming more than X bandwidth
auto mipSize = _gpuObject.getStoredMipFaceSize(sourceMip, face);
const auto lines = mipDimensions.y;
auto bytesPerLine = mipSize / lines;
const uint32_t CHUNK_NUM_LINES { 4 };
const auto numChunks = (lines + (CHUNK_NUM_LINES - 1)) / CHUNK_NUM_LINES;
auto bytesPerChunk = mipSize / numChunks;
Q_ASSERT(0 == (mipSize % lines));
uint32_t linesPerTransfer = (uint32_t)(MAX_TRANSFER_SIZE / bytesPerLine);
uint32_t linesPerTransfer = CHUNK_NUM_LINES * (uint32_t)(MAX_TRANSFER_SIZE / bytesPerChunk);
uint32_t lineOffset = 0;
while (lineOffset < lines) {
uint32_t linesToCopy = std::min<uint32_t>(lines - lineOffset, linesPerTransfer);