set TEXTURE_MAX_LEVEL if we can't generate mipmaps
This prevents "mipmap incomplete textures" when mipmaps are used for
sampling, but there are not enough mipmaps (down to 1x1 size) available
in the texture. This caused meshes to be rendered with a black texture
instead of the mimap incomplete texture.
@@ -925,6 +925,8 @@ impl GpuTexture {
&& mip_count == 1
{
state.gl.generate_mipmap(target);
+ } else {
+ state.gl.tex_parameter_i32(target, glow::TEXTURE_MAX_LEVEL, mip_count as i32 - 1);
}
state.set_texture(0, target, Default::default());
