mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +02:00
Debuging the bad transfers...
This commit is contained in:
parent
bb0bdac864
commit
d0fa8fe887
1 changed files with 9 additions and 7 deletions
|
@ -386,7 +386,9 @@ void GL41VariableAllocationTexture::promote() {
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||||
|
|
||||||
withPreservedTexture([&] {
|
glActiveTexture(GL_TEXTURE0 + GL41Backend::RESOURCE_TRANSFER_TEX_UNIT);
|
||||||
|
glBindTexture(_target, _texture);
|
||||||
|
|
||||||
// Transfer from pbo to new texture
|
// Transfer from pbo to new texture
|
||||||
for (uint16_t mip = _populatedMip; mip < numMips; ++mip) {
|
for (uint16_t mip = _populatedMip; mip < numMips; ++mip) {
|
||||||
auto& sourceMip = sourceMips[mip];
|
auto& sourceMip = sourceMips[mip];
|
||||||
|
@ -394,12 +396,13 @@ void GL41VariableAllocationTexture::promote() {
|
||||||
uint16_t destLevel = mip - _allocatedMip;
|
uint16_t destLevel = mip - _allocatedMip;
|
||||||
|
|
||||||
for (GLint f = 0; f < faceTargets.size(); f++) {
|
for (GLint f = 0; f < faceTargets.size(); f++) {
|
||||||
glCompressedTexSubImage2D(faceTargets[f], destLevel, 0, 0, sourceMip._dims.x, sourceMip._dims.y, internalFormat,
|
glCompressedTexImage2D(faceTargets[f], destLevel, internalFormat, sourceMip._dims.x, sourceMip._dims.y, 0,
|
||||||
sourceMip._faceSize, (void*)(sourceMip._offset + f * sourceMip._faceSize));
|
sourceMip._faceSize, (void*)(sourceMip._offset + f * sourceMip._faceSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
syncSampler();
|
syncSampler();
|
||||||
});
|
|
||||||
|
glBindTexture(_target, 0);
|
||||||
|
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
glDeleteBuffers(1, &pbo);
|
glDeleteBuffers(1, &pbo);
|
||||||
|
@ -445,7 +448,6 @@ void GL41VariableAllocationTexture::demote() {
|
||||||
auto oldSize = _size;
|
auto oldSize = _size;
|
||||||
const_cast<GLuint&>(_id) = allocate(_gpuObject);
|
const_cast<GLuint&>(_id) = allocate(_gpuObject);
|
||||||
uint16_t oldAllocatedMip = _allocatedMip;
|
uint16_t oldAllocatedMip = _allocatedMip;
|
||||||
uint16_t oldPopulatedMip = _populatedMip;
|
|
||||||
allocateStorage(_allocatedMip + 1);
|
allocateStorage(_allocatedMip + 1);
|
||||||
_populatedMip = std::max(_populatedMip, _allocatedMip);
|
_populatedMip = std::max(_populatedMip, _allocatedMip);
|
||||||
|
|
||||||
|
@ -469,7 +471,7 @@ void GL41VariableAllocationTexture::demote() {
|
||||||
|
|
||||||
// Collect the mip description from the source texture
|
// Collect the mip description from the source texture
|
||||||
GLint bufferOffset { 0 };
|
GLint bufferOffset { 0 };
|
||||||
for (uint16_t mip = oldPopulatedMip; mip < numMips; ++mip) {
|
for (uint16_t mip = _populatedMip; mip < numMips; ++mip) {
|
||||||
auto& sourceMip = sourceMips[mip];
|
auto& sourceMip = sourceMips[mip];
|
||||||
sourceMip._dims = _gpuObject.evalMipDimensions(mip);
|
sourceMip._dims = _gpuObject.evalMipDimensions(mip);
|
||||||
|
|
||||||
|
@ -493,7 +495,7 @@ void GL41VariableAllocationTexture::demote() {
|
||||||
(void)CHECK_GL_ERROR();
|
(void)CHECK_GL_ERROR();
|
||||||
|
|
||||||
// Transfer from source texture to pbo
|
// Transfer from source texture to pbo
|
||||||
for (uint16_t mip = oldPopulatedMip; mip < numMips; ++mip) {
|
for (uint16_t mip = _populatedMip; mip < numMips; ++mip) {
|
||||||
auto& sourceMip = sourceMips[mip];
|
auto& sourceMip = sourceMips[mip];
|
||||||
|
|
||||||
uint16_t sourceLevel = mip - oldAllocatedMip;
|
uint16_t sourceLevel = mip - oldAllocatedMip;
|
||||||
|
@ -517,7 +519,7 @@ void GL41VariableAllocationTexture::demote() {
|
||||||
uint16_t destLevel = mip - _allocatedMip;
|
uint16_t destLevel = mip - _allocatedMip;
|
||||||
|
|
||||||
for (GLint f = 0; f < faceTargets.size(); f++) {
|
for (GLint f = 0; f < faceTargets.size(); f++) {
|
||||||
glCompressedTexSubImage2D(faceTargets[f], destLevel, 0, 0, sourceMip._dims.x, sourceMip._dims.y, internalFormat,
|
glCompressedTexImage2D(faceTargets[f], destLevel, internalFormat, sourceMip._dims.x, sourceMip._dims.y, 0,
|
||||||
sourceMip._faceSize, (void*)(sourceMip._offset + f * sourceMip._faceSize));
|
sourceMip._faceSize, (void*)(sourceMip._offset + f * sourceMip._faceSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue