mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 12:10:44 +02:00
clean the usage of glCopyImageSubData and provide a fall back for 4.2)
This commit is contained in:
parent
a137659a35
commit
8a40e951ac
1 changed files with 28 additions and 26 deletions
|
@ -438,7 +438,21 @@ void GL45Texture::stripToMip(uint16_t newMinMip) {
|
|||
// Copy the contents of the old texture to the new
|
||||
{
|
||||
PROFILE_RANGE(render_gpu_gl, "Blit");
|
||||
/*
|
||||
// Preferred path only available in 4.3
|
||||
if (GLEW_VERSION_4_3) {
|
||||
for (uint16 targetMip = _minMip; targetMip <= _maxMip; ++targetMip) {
|
||||
uint16 sourceMip = targetMip + mipDelta;
|
||||
Vec3u mipDimensions = _gpuObject.evalMipDimensions(targetMip + _mipOffset);
|
||||
for (GLenum target : getFaceTargets(_target)) {
|
||||
glCopyImageSubData(
|
||||
oldId, target, sourceMip, 0, 0, 0,
|
||||
_id, target, targetMip, 0, 0, 0,
|
||||
mipDimensions.x, mipDimensions.y, 1
|
||||
);
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GLuint fbo { 0 };
|
||||
glCreateFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
|
||||
|
@ -454,18 +468,6 @@ void GL45Texture::stripToMip(uint16_t newMinMip) {
|
|||
}
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
glDeleteFramebuffers(1, &fbo);
|
||||
*/
|
||||
for (uint16 targetMip = _minMip; targetMip <= _maxMip; ++targetMip) {
|
||||
uint16 sourceMip = targetMip + mipDelta;
|
||||
Vec3u mipDimensions = _gpuObject.evalMipDimensions(targetMip + _mipOffset);
|
||||
for (GLenum target : getFaceTargets(_target)) {
|
||||
glCopyImageSubData(
|
||||
oldId, target, sourceMip, 0, 0, 0,
|
||||
_id, target, targetMip, 0, 0, 0,
|
||||
mipDimensions.x, mipDimensions.y, 1
|
||||
);
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
}
|
||||
|
||||
glDeleteTextures(1, &oldId);
|
||||
|
|
Loading…
Reference in a new issue