From 0d89b3a922c86c9f3598729a4526a1a508020b19 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 9 Feb 2017 15:29:59 -0800 Subject: [PATCH] Better sampler handling --- libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp | 10 ++-------- .../gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp | 6 ------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp index 21c211ca20..23ab9b203c 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp @@ -171,14 +171,8 @@ void GL45Texture::syncSampler() const { glTextureParameteri(_id, GL_TEXTURE_WRAP_R, WRAP_MODES[sampler.getWrapModeW()]); glTextureParameterf(_id, GL_TEXTURE_MAX_ANISOTROPY_EXT, sampler.getMaxAnisotropy()); glTextureParameterfv(_id, GL_TEXTURE_BORDER_COLOR, (const float*)&sampler.getBorderColor()); - -#if 0 - // FIXME account for mip offsets here - auto baseMip = std::max(sampler.getMipOffset(), _minMip); - glTextureParameteri(_id, GL_TEXTURE_BASE_LEVEL, baseMip); - glTextureParameterf(_id, GL_TEXTURE_MIN_LOD, (float)sampler.getMinMip()); - glTextureParameterf(_id, GL_TEXTURE_MAX_LOD, (sampler.getMaxMip() == Sampler::MAX_MIP_LEVEL ? 1000.f : sampler.getMaxMip() - _mipOffset)); -#endif + glTextureParameterf(_id, GL_TEXTURE_MIN_LOD, sampler.getMinMip()); + glTextureParameterf(_id, GL_TEXTURE_MAX_LOD, (sampler.getMaxMip() == Sampler::MAX_MIP_LEVEL ? 1000.f : sampler.getMaxMip())); } using GL45FixedAllocationTexture = GL45Backend::GL45FixedAllocationTexture; diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp index 67ab1b5bb5..b6c72aab77 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp @@ -370,13 +370,7 @@ void GL45ResourceTexture::copyMipsFromTexture() { void GL45ResourceTexture::syncSampler() const { Parent::syncSampler(); - const Sampler& sampler = _gpuObject.getSampler(); - uint16_t maxMip = _gpuObject.evalNumMips() - _allocatedMip; - auto minMip = std::max(sampler.getMipOffset(), sampler.getMinMip()); - minMip = std::min(minMip, maxMip); glTextureParameteri(_id, GL_TEXTURE_BASE_LEVEL, _populatedMip - _allocatedMip); - glTextureParameterf(_id, GL_TEXTURE_MIN_LOD, (float)minMip); - glTextureParameterf(_id, GL_TEXTURE_MAX_LOD, (float)maxMip); } void GL45ResourceTexture::promote() {