From 2be1e36c47ffa6386ec84009d3a26df990ad0ad3 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 23 May 2017 14:14:45 -0700 Subject: [PATCH] fixing the gl41 bug --- libraries/gpu-gl/src/gpu/gl/GLTexelFormat.cpp | 8 +++++++- .../src/gpu/gl41/GL41BackendTexture.cpp | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/libraries/gpu-gl/src/gpu/gl/GLTexelFormat.cpp b/libraries/gpu-gl/src/gpu/gl/GLTexelFormat.cpp index b42ffedf37..26ce56b387 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTexelFormat.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLTexelFormat.cpp @@ -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; diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp index 1f3b929ec7..5998aebb33 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp @@ -78,13 +78,6 @@ GL41Texture::GL41Texture(const std::weak_ptr& 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 f) const { glActiveTexture(GL_TEXTURE0 + GL41Backend::RESOURCE_TRANSFER_TEX_UNIT); glBindTexture(_target, _texture); @@ -96,6 +89,14 @@ void GL41Texture::withPreservedTexture(std::function 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(); }); }