Vulkan forces mipmapping on resized console fonts
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Disable applying texture resize to console font
What did you do to make it look that bad? For me the font looks really nice with upscaling on
Re: Disable applying texture resize to console font
It seems like this might only happen with Vulkan. The sizes, at least for my setup, that causes issues is 3x, 5x, and 6x.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Disable applying texture resize to console font
It may be because Vulkan unconditionally creates mipmaps and this font doesn't like that. The problem here seems to be that these sizes are not powers of two so that it renders some trilinearly filtered version of the character. For fonts, mipmapping should be disabled, especially for these factors.
Re: Disable applying texture resize to console font
Here is my attempt to fix it.
However, I'm not quite sure that the given condition should be applied to VulkanSampler objects.
Clamp mode can be passed to VkHardwareTexture as well.
However, I'm not quite sure that the given condition should be applied to VulkanSampler objects.
Clamp mode can be passed to VkHardwareTexture as well.
Re: Disable applying texture resize to console font
Hopefully Graf knows the answer to this one. What does the OpenGL backend do here?
Re: Disable applying texture resize to console font
OpenGL backend passes clamp mode to hardware texture, and decision about mipmap generation is made there. I thought Vulkan is different in this regard.
Re: Disable applying texture resize to console font
There's two possible ways mipmapping can be disabled (for both backends).
Either the texture can be generated with no mipmaps to begin with. In this case the current vulkan samplers will suffice because their mipmap sampling rules say they clamp to the available mipmap levels. This is different from OpenGL where the sampling rules say if mipmap sampling is enabled and it doesn't have mipmaps then it must behave like sampling from a white texture.
Or the texture is generated with mipmaps always and it is the selected sampler that chooses not to use it. In this case the vulkan backend will have to create a descriptor set with a sampler with no mipmapping. My general understanding of the hwrenderer level isn't strong enough to say if the mipmap rule applies to a full set of clamp modes. If it does, then your PR is correct. If not, then logic for picking a different sampler needs to be handled in VkHardwareTexture::GetDescriptorSet.
If the texture shouldn't have mipmaps to begin with, then that decision is handled in VkHardwareTexture::CreateTexture. The third parameter to imgbuilder.setSize and the call to mImage.GenerateMipmaps needs to be made conditional in that case.
Either the texture can be generated with no mipmaps to begin with. In this case the current vulkan samplers will suffice because their mipmap sampling rules say they clamp to the available mipmap levels. This is different from OpenGL where the sampling rules say if mipmap sampling is enabled and it doesn't have mipmaps then it must behave like sampling from a white texture.
Or the texture is generated with mipmaps always and it is the selected sampler that chooses not to use it. In this case the vulkan backend will have to create a descriptor set with a sampler with no mipmapping. My general understanding of the hwrenderer level isn't strong enough to say if the mipmap rule applies to a full set of clamp modes. If it does, then your PR is correct. If not, then logic for picking a different sampler needs to be handled in VkHardwareTexture::GetDescriptorSet.
If the texture shouldn't have mipmaps to begin with, then that decision is handled in VkHardwareTexture::CreateTexture. The third parameter to imgbuilder.setSize and the call to mImage.GenerateMipmaps needs to be made conditional in that case.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Disable applying texture resize to console font
TBH, I think the 3x, 5x and 6x scaling modes should be disabled because they tend to generate very shitty lower mipmap levels, i.e. they first do an upscale of the texture and then a downscale with a different factor. That will inevitably create bad looking textures where small detail is involved.
Re: Disable applying texture resize to console font
I was using 3x and 5x with old xBRZ for a while. Textures were pretty good to me, so I disagree with you here.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Disable applying texture resize to console font
Read my last 5 words. With normal textures it won't be so obvious but it kills the fonts.
Re: Disable applying texture resize to console font
Honestly I believe that's a bit overkill and perhaps too constricting for the end-user for a simple problem like this. It's like using a hammer to kill a mosquito on your grandma's shoulder - sure, you'll get the mosquito, but imagine how your grandma feels afterward... this is not a very practical solution.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Disable applying texture resize to console font
I'll never understand what the obsession with those scaling modes is. 5x and 6x barely give an advantage, for any normal use 4x with texture filtering is enough. The same is true for 3x, it barely makes a difference to 2x or 4x. Fact is that those odd factors have a degrading effect on the mipmaps which isn't present in 2x and 4x which makes these look better in most cases than the supposedly higher ones - except for extreme closeups.
Re: Disable applying texture resize to console font
Mipmaps are not created for font textures because of their clamping mode. This works correctly in OpenGL backend but not in Vulkan one.
In fact, this topic should be moved to Vulkan render bugs with its title changed accordingly.
No need to remove any scaling factors. Let’s fix ignored clamping mode in Vulkan backend.
I think my PR is wrong. We need to pass clamp value to VkHardwareTexture like in OpenGL backend.
In fact, this topic should be moved to Vulkan render bugs with its title changed accordingly.
No need to remove any scaling factors. Let’s fix ignored clamping mode in Vulkan backend.
I think my PR is wrong. We need to pass clamp value to VkHardwareTexture like in OpenGL backend.
Re: Disable applying texture resize to console font
Done._mental_ wrote: In fact, this topic should be moved to Vulkan render bugs with its title changed accordingly.