Implement GL_MAX_PROGRAM_TEXEL_OFFSET and GL_MAX_TEXTURE_LOD_BIAS
- GL_MAX_PROGRAM_TEXEL_OFFSET and GL_MIN_PROGRAM_TEXEL_OFFSET were
technically already properly implemented, since the spec mentions
that the behavior outside of these limits is undefined, and
SwiftShader has no actual hard limit for these parameters.
- GL_MAX_TEXTURE_LOD_BIAS also has no hard limit in SwiftShader,
other than the limit imposed on LOD itself, so that limit was
used for GL_MAX_TEXTURE_LOD_BIAS.
Change-Id: I60b15b7f7a0febbc3e6582caff6c6a414a5d4964
Reviewed-on: https://swiftshader-review.googlesource.com/11709
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Renderer/Sampler.cpp b/src/Renderer/Sampler.cpp
index 24734da..60f5e35 100644
--- a/src/Renderer/Sampler.cpp
+++ b/src/Renderer/Sampler.cpp
@@ -72,7 +72,7 @@
texture.baseLevel = 0;
texture.maxLevel = 1000;
- texture.maxLod = MIPMAP_LEVELS - 2; // Trilinear accesses lod+1
+ texture.maxLod = MAX_TEXTURE_LOD;
texture.minLod = 0;
}
@@ -344,12 +344,12 @@
void Sampler::setMinLod(float minLod)
{
- texture.minLod = clamp(minLod, 0.0f, (float)(MIPMAP_LEVELS - 2));
+ texture.minLod = clamp(minLod, 0.0f, (float)(MAX_TEXTURE_LOD));
}
void Sampler::setMaxLod(float maxLod)
{
- texture.maxLod = clamp(maxLod, 0.0f, (float)(MIPMAP_LEVELS - 2));
+ texture.maxLod = clamp(maxLod, 0.0f, (float)(MAX_TEXTURE_LOD));
}
void Sampler::setFilterQuality(FilterType maximumFilterQuality)