Merge pull request #160 from gm-matthew/textureNP

Texture mipmaps must be at least 2x2
This commit is contained in:
dukeeeey 2024-07-06 18:47:05 +01:00 committed by GitHub
commit 40bb7acbf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -210,7 +210,7 @@ vec4 texBiLinear(usampler2D texSampler, ivec2 wrapMode, vec2 texSize, ivec2 texP
vec4 GetTextureValue() vec4 GetTextureValue()
{ {
float lod = mip_map_level(fsViewVertex); float lod = mip_map_level(fsViewVertex);
float numLevels = floor(log2(min(float(baseTexInfo.z), float(baseTexInfo.w)))); // r3d only generates down to 1:1 for square textures, otherwise its the min dimension float numLevels = floor(log2(min(float(baseTexInfo.z), float(baseTexInfo.w)))) - 1.0; // r3d only generates down to 2:2 for square textures, otherwise its the min dimension
float fLevel = clamp(lod, 0.0, numLevels); float fLevel = clamp(lod, 0.0, numLevels);
int iLevel = int(fLevel); int iLevel = int(fLevel);