Skip to content
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

Vulkan Backend - incorrect mipmap generation for cubemap frame buffers. #3236

Open
volcoma opened this issue Jan 1, 2024 · 4 comments
Open
Labels

Comments

@volcoma
Copy link
Contributor

volcoma commented Jan 1, 2024

Hi, i've found a bug with the implementation of the mipmap generation in

void TextureVK::resolve function.

Currently it only generates mipmap for one of the faces of the cubemap as seen here. This works fine for dx11 and opengl backends
I have a frame buffer which is filled properly

for(int i = 0; i < 6; ++i)
{
gfx::frame_buffer::ptr output ...  per face

gfx::blit(pass.id,
             cubemap_fbo->get_texture()->native_handle(),
             0,
             0,
             0,
             uint16_t(face),
             output->get_texture()->native_handle());
} 

after that i use a pass to resolve the texture so it can force generate the mipmaps

            gfx::render_pass pass("cubemap_generate_mips");
            pass.bind(cubemap_fbo.get());
            pass.touch();

Screenshot 2024-01-01 154044

if i change the function a bit

            auto numLayers = _numLayers;
            if(m_type == VK_IMAGE_VIEW_TYPE_CUBE || VK_IMAGE_VIEW_TYPE_CUBE_ARRAY)
            {
                numLayers = 6;
            }

and use numLayers instead of _numLayers it fixes it.

Screenshot 2024-01-01 154001

I am not sure if it is the same for both VK_IMAGE_VIEW_TYPE_CUBE and VK_IMAGE_VIEW_TYPE_CUBE_ARRAY but i think it is.
Could not find much info about it.

@bkaradzic bkaradzic added the bug label Jan 1, 2024
@bkaradzic
Copy link
Owner

cc @pezcode

@pezcode
Copy link
Contributor

pezcode commented Jan 4, 2024

The easiest fix would be to use the existing m_numSides, that would also work for layered cube maps, i.e. 6*N

@volcoma
Copy link
Contributor Author

volcoma commented May 9, 2024

Hi. Any idea when this fix would hit master? Seemed like a trivial fix, but like 5 months passed.

@bkaradzic
Copy link
Owner

@volcoma You can test fix, and send PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants