mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
fixing the gl41 bug
This commit is contained in:
parent
542ec3dc46
commit
2be1e36c47
2 changed files with 18 additions and 9 deletions
|
@ -221,7 +221,13 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
||||||
case gpu::SRGBA:
|
case gpu::SRGBA:
|
||||||
result = GL_SRGB8_ALPHA8; // standard 2.2 gamma correction color
|
result = GL_SRGB8_ALPHA8; // standard 2.2 gamma correction color
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case gpu::TILE4x4: {
|
||||||
|
switch (dstFormat.getSemantic()) {
|
||||||
case gpu::COMPRESSED_BC4_RED:
|
case gpu::COMPRESSED_BC4_RED:
|
||||||
result = GL_COMPRESSED_RED_RGTC1;
|
result = GL_COMPRESSED_RED_RGTC1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -78,13 +78,6 @@ GL41Texture::GL41Texture(const std::weak_ptr<GLBackend>& backend, const Texture&
|
||||||
: GLTexture(backend, texture, allocate(texture)) {
|
: GLTexture(backend, texture, allocate(texture)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint GL41Texture::allocate(const Texture& texture) {
|
|
||||||
GLuint result;
|
|
||||||
glGenTextures(1, &result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GL41Texture::withPreservedTexture(std::function<void()> f) const {
|
void GL41Texture::withPreservedTexture(std::function<void()> f) const {
|
||||||
glActiveTexture(GL_TEXTURE0 + GL41Backend::RESOURCE_TRANSFER_TEX_UNIT);
|
glActiveTexture(GL_TEXTURE0 + GL41Backend::RESOURCE_TRANSFER_TEX_UNIT);
|
||||||
glBindTexture(_target, _texture);
|
glBindTexture(_target, _texture);
|
||||||
|
@ -96,6 +89,14 @@ void GL41Texture::withPreservedTexture(std::function<void()> f) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GLuint GL41Texture::allocate(const Texture& texture) {
|
||||||
|
GLuint result;
|
||||||
|
glGenTextures(1, &result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GL41Texture::generateMips() const {
|
void GL41Texture::generateMips() const {
|
||||||
withPreservedTexture([&] {
|
withPreservedTexture([&] {
|
||||||
glGenerateMipmap(_target);
|
glGenerateMipmap(_target);
|
||||||
|
@ -279,6 +280,7 @@ GL41VariableAllocationTexture::GL41VariableAllocationTexture(const std::weak_ptr
|
||||||
allocateStorage(allocatedMip);
|
allocateStorage(allocatedMip);
|
||||||
_memoryPressureStateStale = true;
|
_memoryPressureStateStale = true;
|
||||||
copyMipsFromTexture();
|
copyMipsFromTexture();
|
||||||
|
|
||||||
syncSampler();
|
syncSampler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,6 +320,8 @@ Size GL41VariableAllocationTexture::copyMipsFromTexture() {
|
||||||
amount += copyMipFaceFromTexture(sourceMip, targetMip, face);
|
amount += copyMipFaceFromTexture(sourceMip, targetMip, face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +472,6 @@ void GL41VariableAllocationTexture::copyTextureMipsInGPUMem(GLuint srcId, GLuint
|
||||||
} else {
|
} else {
|
||||||
copyUncompressedTexGPUMem(_gpuObject, _target, srcId, destId, numMips, srcMipOffset, destMipOffset, populatedMips);
|
copyUncompressedTexGPUMem(_gpuObject, _target, srcId, destId, numMips, srcMipOffset, destMipOffset, populatedMips);
|
||||||
}
|
}
|
||||||
syncSampler();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue