Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion attachments/29_mipmapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,9 @@ class HelloTriangleApplication
.anisotropyEnable = vk::True,
.maxAnisotropy = properties.limits.maxSamplerAnisotropy,
.compareEnable = vk::False,
.compareOp = vk::CompareOp::eAlways};
.compareOp = vk::CompareOp::eAlways,
.minLod = 0.0f,
.maxLod = vk::LodClampNone};
textureSampler = vk::raii::Sampler(device, samplerInfo);
}

Expand Down
6 changes: 4 additions & 2 deletions en/09_Generating_Mipmaps.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,17 @@ void createTextureSampler() {
.anisotropyEnable = vk::True,
.maxAnisotropy = properties.limits.maxSamplerAnisotropy,
.compareEnable = vk::False,
.compareOp = vk::CompareOp::eAlways
.compareOp = vk::CompareOp::eAlways,
.minLod = 0.0f,
.maxLod = vk::LodClampNone
};
...
}
----

In the code above, we've set up the sampler with linear filtering for both minification and magnification, and linear interpolation between mip levels. We've also set the mip level bias to 0.0f.

By default, the full range of mip levels will be used. The default `minLod` is 0.0f, and the default `maxLod` is `VK_LOD_CLAMP_NONE` (which equals 1000.0f), meaning all available mipmap levels in the texture will be sampled.
The `minLod` and `maxLod` are used to effectively set the range of mip levels to be used by clamping the minimum and maximum LOD values. By setting `minLod` to `0.0f` and `maxLod` to `VK_LOD_CLAMP_NONE` we ensure the full range of mip levels will be used.

Now run your program, and you should see the following:

Expand Down
Loading