mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +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:
|
||||
result = GL_SRGB8_ALPHA8; // standard 2.2 gamma correction color
|
||||
break;
|
||||
|
||||
default:
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case gpu::TILE4x4: {
|
||||
switch (dstFormat.getSemantic()) {
|
||||
case gpu::COMPRESSED_BC4_RED:
|
||||
result = GL_COMPRESSED_RED_RGTC1;
|
||||
break;
|
||||
|
|
|
@ -78,13 +78,6 @@ GL41Texture::GL41Texture(const std::weak_ptr<GLBackend>& backend, const 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 {
|
||||
glActiveTexture(GL_TEXTURE0 + GL41Backend::RESOURCE_TRANSFER_TEX_UNIT);
|
||||
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 {
|
||||
withPreservedTexture([&] {
|
||||
glGenerateMipmap(_target);
|
||||
|
@ -279,6 +280,7 @@ GL41VariableAllocationTexture::GL41VariableAllocationTexture(const std::weak_ptr
|
|||
allocateStorage(allocatedMip);
|
||||
_memoryPressureStateStale = true;
|
||||
copyMipsFromTexture();
|
||||
|
||||
syncSampler();
|
||||
}
|
||||
|
||||
|
@ -318,6 +320,8 @@ Size GL41VariableAllocationTexture::copyMipsFromTexture() {
|
|||
amount += copyMipFaceFromTexture(sourceMip, targetMip, face);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
|
@ -468,7 +472,6 @@ void GL41VariableAllocationTexture::copyTextureMipsInGPUMem(GLuint srcId, GLuint
|
|||
} else {
|
||||
copyUncompressedTexGPUMem(_gpuObject, _target, srcId, destId, numMips, srcMipOffset, destMipOffset, populatedMips);
|
||||
}
|
||||
syncSampler();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue