diff --git a/gsk/gpu/gskgpurenderpassop.c b/gsk/gpu/gskgpurenderpassop.c index c9f7ee2615..4dbfea7aef 100644 --- a/gsk/gpu/gskgpurenderpassop.c +++ b/gsk/gpu/gskgpurenderpassop.c @@ -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)), diff --git a/gsk/gpu/gskvulkanimageprivate.h b/gsk/gpu/gskvulkanimageprivate.h index 54f2754326..77df1e23b3 100644 --- a/gsk/gpu/gskvulkanimageprivate.h +++ b/gsk/gpu/gskvulkanimageprivate.h @@ -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 diff --git a/testsuite/gsk/compare/mipmap-with-1x1.node b/testsuite/gsk/compare/mipmap-with-1x1.node new file mode 100644 index 0000000000..c52ed08bf9 --- /dev/null +++ b/testsuite/gsk/compare/mipmap-with-1x1.node @@ -0,0 +1,7 @@ +texture-scale { + bounds: 0 0 10 10; + filter: trilinear; + texture: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWP4z8DwHwAFAAH/q842\ +iQAAAABJRU5ErkJggg==\ +"); +} diff --git a/testsuite/gsk/compare/mipmap-with-1x1.png b/testsuite/gsk/compare/mipmap-with-1x1.png new file mode 100644 index 0000000000..6c5b2a45af Binary files /dev/null and b/testsuite/gsk/compare/mipmap-with-1x1.png differ diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build index a1c3e9cd6d..28ffe5c286 100644 --- a/testsuite/gsk/meson.build +++ b/testsuite/gsk/meson.build @@ -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',