vulkan: Handle generating mipmaps for 1x1 images

Testcase included.
This commit is contained in:
Benjamin Otte 2024-03-19 01:33:32 +01:00
parent f36f1b9829
commit 9fe9ea34fd
5 changed files with 12 additions and 2 deletions

View File

@ -245,7 +245,9 @@ gsk_gpu_render_pass_end_op_vk_command (GskGpuOp *op,
vkCmdEndRenderPass (state->vk_command_buffer);
if (gsk_gpu_image_get_flags (self->target) & GSK_GPU_IMAGE_CAN_MIPMAP)
if ((gsk_gpu_image_get_flags (self->target) & GSK_GPU_IMAGE_CAN_MIPMAP) &&
(gsk_gpu_image_get_width (self->target) > 1 ||
gsk_gpu_image_get_height (self->target) > 1))
{
vkCmdPipelineBarrier (state->vk_command_buffer,
gsk_vulkan_image_get_vk_pipeline_stage (GSK_VULKAN_IMAGE (self->target)),

View File

@ -71,7 +71,7 @@ static inline guint
gsk_vulkan_mipmap_levels (gsize width,
gsize height)
{
return g_bit_nth_msf (MAX (width, height) - 1, -1) + 1;
return g_bit_nth_msf (MAX (MAX (width, height) - 1, 1), -1) + 1;
}
G_END_DECLS

View File

@ -0,0 +1,7 @@
texture-scale {
bounds: 0 0 10 10;
filter: trilinear;
texture: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWP4z8DwHwAFAAH/q842\
iQAAAABJRU5ErkJggg==\
");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 B

View File

@ -104,6 +104,7 @@ compare_render_tests = [
'mask-modes-with-alpha',
'mask-texture-color-alpha',
'mipmap-generation-later',
'mipmap-with-1x1',
'nested-rounded-clips',
'offscreen-forced-downscale',
'offscreen-fractional-translate-nogl',