Mipmapping in vulkan

Hey guys,
i read the specification about the whole mipmapping thing and took a look at the example from Sascha Willems (https://github.com/SaschaWillems/Vulkan/blob/master/texture/texture.cpp), but there are still one thing unclear to me.
I am a little bit confused because my professor says that OpenGL does mipmapping automatically (if enabled of course). (I dont know OpenGL)

So what i am confused about is, if i have to manually load the different mip-levels? Or can vulkan generate the different mip-levels for me automatically?

Thanks in advance :slight_smile:

[QUOTE=Twanks123;40340]Hey guys,
i read the specification about the whole mipmapping thing and took a look at the example from Sascha Willems (https://github.com/SaschaWillems/Vulkan/blob/master/texture/texture.cpp), but there are still one thing unclear to me.
I am a little bit confused because my professor says that OpenGL does mipmapping automatically (if enabled of course). (I dont know OpenGL)[/quote]
Yes, you can do glGenerateMipmap to generate mip maps from a texture. But in reality you don’t want to do that, you want to generate your mip maps offline and store them inside of your image file so you have better control over downsampling and stuff. Besides this, having the API generate the mip maps can also take a significant amount of time everytime you run your application, so if it’s about textures generate and store them with your texture.

Yes, Vulkan has no functionality like glGenerateMipmap so you have to generate mip maps by yourself.

Thanks for the answer Sascha!
I used FreeImage to load images, but i will move to gli as you in your examples.
Can you tell me which program do you use to generate / view “.ktx” files? And what do you use to generate the mipmaps offline?

I’m using the PowerVR TexTool (https://community.imgtec.com/developers/powervr/tools/pvrtextool/) from their SDK. It also has a function to generate mip maps for your textures, can create texture arrays, cube maps, and has lots of convenient feature like copying a channel from another texture into the current one and an extensive list of formats that map onto the Vulkan formats.

Awesome! After mipmapping i will implement cubemaps into my engine :slight_smile: One step closer to become a professional graphics programmer! Thanks!

Okay i have to ask you one last question. I know this is offtopic, but there is no tutorial how to do this. :frowning:
Can you explain me how to integrate “gli” in my project?

What i did so far was using CMake and integrate “…\Libs\gli” in “Include Directories”.
But the compiler says "cannot open source file “glm/gtc/packing.hpp” (and some other files)

[QUOTE=Twanks123;40345]What i did so far was using CMake and integrate “…\Libs\gli” in “Include Directories”.
But the compiler says "cannot open source file “glm/gtc/packing.hpp” (and some other files)[/QUOTE]

The error complains about glm and not gli (though both are from the same author). Are you using glm?

Oh i am dumb, no i wrote my own math-library. Is it possible to use gli without glm?

I using glm now aswell. Everything works fine! :slight_smile:

Afaik you cant’ use gli without glm, but glm is awesome anyway :wink: