New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Purge calls of GL.GenerateMipmap from Texture constructors #5599
Comments
I'm actually fairly certain that B is the right path. We need to be calling |
Yes, that is correct. B is the right path.
|
I think the code to upload mipmaps as you say in 'B' is already working, and all that is needed is removing the Gl.GenerateMipmap call. A few days ago when I was investigating the issue, removing the call made the mipmaps work, but I was out of time and I couldn't investigate further. |
No it isn't. There is no loop in the This is required to correctly construct a texture with mips. |
I just checked it... the code to read the mipmaps is not in the PlatformConstructor but in the Texture2DReader.cs file. I'm talking about the assets read with the Content object. If you're talking about creating a new Texture2D() then you may be right, I haven't explored that path. |
Sure... I am not speaking of the code to read the data for a mip map from disk and copy it to the texture.
Yes I am speaking of that. Specifically...
|
Continuing a discussion with @Jjagg from #5557 (comment).
From what I have found you need to call Although @KonajuGames has suggested that maybe he did something else to fix this? |
#5614 fixed this for Texture2D. Texture3D has no support for mipmaps at this stage. TextureCube still uses glGenerateMipmaps. These could be added as separate issues. |
In
Texture2D
in particular it callsGL.GenerateMipmap
in some form to fill out the mip map chain.This is wrong.
GL.GenerateMipmap
literally means "generate mip maps from the level 0 data now". It reads each pixel of the level 0 data and filters it down to generate mips. Depending on the target platform on the CPU or the GPU.It should be painfully obvious that doing this on a empty texture is a waste of time.
Also you cannot call
GL.GenerateMipmap
on compressed textures as GL will not auto generate mips for compressed formats. It would require GL to compress the texture at runtime which it does not do. So currently this fails for compressed formats.Versions of MonoGame from just 6 months ago didn't call
GL.GenerateMipmap
at all:MonoGame/MonoGame.Framework/Graphics/Texture2D.OpenGL.cs
Line 109 in 5e387fd
So either A:We stop callingGL.GenerateMipmap
and do nothing for mipmaps on construction (which I don't know is correct).Or B:
GL.CompressedTexImage2D
orGL.TexImage2D
for each level.The text was updated successfully, but these errors were encountered: