mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
Better sampler handling
This commit is contained in:
parent
fe5c511eeb
commit
0d89b3a922
2 changed files with 2 additions and 14 deletions
|
@ -171,14 +171,8 @@ void GL45Texture::syncSampler() const {
|
||||||
glTextureParameteri(_id, GL_TEXTURE_WRAP_R, WRAP_MODES[sampler.getWrapModeW()]);
|
glTextureParameteri(_id, GL_TEXTURE_WRAP_R, WRAP_MODES[sampler.getWrapModeW()]);
|
||||||
glTextureParameterf(_id, GL_TEXTURE_MAX_ANISOTROPY_EXT, sampler.getMaxAnisotropy());
|
glTextureParameterf(_id, GL_TEXTURE_MAX_ANISOTROPY_EXT, sampler.getMaxAnisotropy());
|
||||||
glTextureParameterfv(_id, GL_TEXTURE_BORDER_COLOR, (const float*)&sampler.getBorderColor());
|
glTextureParameterfv(_id, GL_TEXTURE_BORDER_COLOR, (const float*)&sampler.getBorderColor());
|
||||||
|
glTextureParameterf(_id, GL_TEXTURE_MIN_LOD, sampler.getMinMip());
|
||||||
#if 0
|
glTextureParameterf(_id, GL_TEXTURE_MAX_LOD, (sampler.getMaxMip() == Sampler::MAX_MIP_LEVEL ? 1000.f : sampler.getMaxMip()));
|
||||||
// FIXME account for mip offsets here
|
|
||||||
auto baseMip = std::max<uint16_t>(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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using GL45FixedAllocationTexture = GL45Backend::GL45FixedAllocationTexture;
|
using GL45FixedAllocationTexture = GL45Backend::GL45FixedAllocationTexture;
|
||||||
|
|
|
@ -370,13 +370,7 @@ void GL45ResourceTexture::copyMipsFromTexture() {
|
||||||
|
|
||||||
void GL45ResourceTexture::syncSampler() const {
|
void GL45ResourceTexture::syncSampler() const {
|
||||||
Parent::syncSampler();
|
Parent::syncSampler();
|
||||||
const Sampler& sampler = _gpuObject.getSampler();
|
|
||||||
uint16_t maxMip = _gpuObject.evalNumMips() - _allocatedMip;
|
|
||||||
auto minMip = std::max<uint16_t>(sampler.getMipOffset(), sampler.getMinMip());
|
|
||||||
minMip = std::min<uint16_t>(minMip, maxMip);
|
|
||||||
glTextureParameteri(_id, GL_TEXTURE_BASE_LEVEL, _populatedMip - _allocatedMip);
|
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() {
|
void GL45ResourceTexture::promote() {
|
||||||
|
|
Loading…
Reference in a new issue