| 1 | #cxx . . $ `<file>/gsk/gpu/gskgpumipmapop.c`/include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 2 | |
| 3 | #include "gskgpumipmapopprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpumipmapopprivate.h`/ |
| 4 | |
| 5 | #include "gskglimageprivate.h"cxx . . $ `<file>/gsk/gpu/gskglimageprivate.h`/ |
| 6 | #include "gskgpuframeprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpuframeprivate.h`/ |
| 7 | #include "gskgpuprintprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpuprintprivate.h`/ |
| 8 | #include "gskgpuutilsprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpuutilsprivate.h`/ |
| 9 | #ifdef GDK_RENDERING_VULKANcxx . . $ `build/gdk/gdkconfig.h:22:9`! |
| 10 | #include "gskvulkanimageprivate.h"cxx . . $ `<file>/gsk/gpu/gskvulkanimageprivate.h`/ |
| 11 | #endif |
| 12 | |
| 13 | typedef struct _GskGpuMipmapOpcxx . . $ _GskGpuMipmapOp# GskGpuMipmapOpcxx . . $ GskGpuMipmapOp#; |
| 14 | |
| 15 | struct _GskGpuMipmapOpcxx . . $ _GskGpuMipmapOp# |
| 16 | { |
| 17 | GskGpuOpcxx . . $ GskGpuOp# opcxx . . $ _GskGpuMipmapOp#op.; |
| 18 | |
| 19 | GskGpuImagecxx . . $ GskGpuImage# *imagecxx . . $ _GskGpuMipmapOp#image.; |
| 20 | }; |
| 21 | |
| 22 | static void |
| 23 | gsk_gpu_mipmap_op_finishcxx . . $ gsk_gpu_mipmap_op_finish(713144cca40e0637). (GskGpuOpcxx . . $ GskGpuOp# *op) |
| 24 | { |
| 25 | GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *self = (GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *) op; |
| 26 | |
| 27 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self->imagecxx . . $ _GskGpuMipmapOp#image.); |
| 28 | } |
| 29 | |
| 30 | static void |
| 31 | gsk_gpu_mipmap_op_printcxx . . $ gsk_gpu_mipmap_op_print(a335f695b352be9). (GskGpuOpcxx . . $ GskGpuOp# *op, |
| 32 | GskGpuFramecxx . . $ GskGpuFrame# *frame, |
| 33 | GStringcxx . . $ GString# *string, |
| 34 | guintcxx . . $ guint# indent) |
| 35 | { |
| 36 | GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *self = (GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *) op; |
| 37 | |
| 38 | gsk_gpu_print_opcxx . . $ gsk_gpu_print_op(5639a58a8b507856). (string, indent, "mipmap"); |
| 39 | gsk_gpu_print_imagecxx . . $ gsk_gpu_print_image(1835c84c6f61383c). (string, self->imagecxx . . $ _GskGpuMipmapOp#image.); |
| 40 | gsk_gpu_print_newlinecxx . . $ gsk_gpu_print_newline(d02b88442e45c4d4). (string); |
| 41 | } |
| 42 | |
| 43 | #ifdef GDK_RENDERING_VULKANcxx . . $ `build/gdk/gdkconfig.h:22:9`! |
| 44 | static GskGpuOpcxx . . $ GskGpuOp# * |
| 45 | gsk_gpu_mipmap_op_vk_commandcxx . . $ gsk_gpu_mipmap_op_vk_command(ff65bed3d1310efd). (GskGpuOpcxx . . $ GskGpuOp# *op, |
| 46 | GskGpuFramecxx . . $ GskGpuFrame# *frame, |
| 47 | GskVulkanCommandStatecxx . . $ GskVulkanCommandState# *state) |
| 48 | { |
| 49 | GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *self = (GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *) op; |
| 50 | GskVulkanImagecxx . . $ GskVulkanImage# *image; |
| 51 | VkImagecxx . . $ VkImage# vk_image; |
| 52 | gsizecxx . . $ gsize# width, height; |
| 53 | guintcxx . . $ guint# i, n_levels; |
| 54 | |
| 55 | image = GSK_VULKAN_IMAGEcxx . . $ GSK_VULKAN_IMAGE(2b1a9dca49a658fd). (self->imagecxx . . $ _GskGpuMipmapOp#image.); |
| 56 | vk_image = gsk_vulkan_image_get_vk_imagecxx . . $ gsk_vulkan_image_get_vk_image(60c9576da85bf88). (image); |
| 57 | width = gsk_gpu_image_get_widthcxx . . $ gsk_gpu_image_get_width(4bdeec44aa36e037). (self->imagecxx . . $ _GskGpuMipmapOp#image.); |
| 58 | height = gsk_gpu_image_get_heightcxx . . $ gsk_gpu_image_get_height(4bdeec44aa36e037). (self->imagecxx . . $ _GskGpuMipmapOp#image.); |
| 59 | n_levels = gsk_gpu_mipmap_levelscxx . . $ gsk_gpu_mipmap_levels(747bb0b251b16f99). (width, height); |
| 60 | |
| 61 | /* optimize me: only transition mipmap layers 1..n, but not 0 */ |
| 62 | gsk_vulkan_image_transitioncxx . . $ gsk_vulkan_image_transition(e4b8ad8b21b1fcbd). (image, |
| 63 | state->semaphorescxx . . $ _GskVulkanCommandState#semaphores., |
| 64 | state->vk_command_buffercxx . . $ _GskVulkanCommandState#vk_command_buffer., |
| 65 | VK_PIPELINE_STAGE_TRANSFER_BITcxx . . $ VK_PIPELINE_STAGE_TRANSFER_BIT., |
| 66 | VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL., |
| 67 | VK_ACCESS_TRANSFER_WRITE_BITcxx . . $ VK_ACCESS_TRANSFER_WRITE_BIT.); |
| 68 | |
| 69 | for (i = 0; /* we break after the barrier */ ; i++) |
| 70 | { |
| 71 | vkCmdPipelineBarriercxx . . $ vkCmdPipelineBarrier(ca392870b0aa0c0c). (state->vk_command_buffercxx . . $ _GskVulkanCommandState#vk_command_buffer., |
| 72 | VK_PIPELINE_STAGE_TRANSFER_BITcxx . . $ VK_PIPELINE_STAGE_TRANSFER_BIT., |
| 73 | VK_PIPELINE_STAGE_TRANSFER_BITcxx . . $ VK_PIPELINE_STAGE_TRANSFER_BIT., |
| 74 | 0, |
| 75 | 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 76 | 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 77 | 1, &(VkImageMemoryBarriercxx . . $ VkImageMemoryBarrier#) { |
| 78 | .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIERcxx . . $ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER., |
| 79 | .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BITcxx . . $ VK_ACCESS_TRANSFER_WRITE_BIT., |
| 80 | .dstAccessMask = VK_ACCESS_TRANSFER_READ_BITcxx . . $ VK_ACCESS_TRANSFER_READ_BIT., |
| 81 | .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL., |
| 82 | .newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL., |
| 83 | .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNOREDcxx . . $ `<external>/13734482859137699468/vulkan_core.h:126:9`!, |
| 84 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNOREDcxx . . $ `<external>/13734482859137699468/vulkan_core.h:126:9`!, |
| 85 | .image = vk_image, |
| 86 | .subresourceRange = { |
| 87 | .aspectMask = VK_IMAGE_ASPECT_COLOR_BITcxx . . $ VK_IMAGE_ASPECT_COLOR_BIT., |
| 88 | .baseMipLevel = i, |
| 89 | .levelCount = 1, |
| 90 | .baseArrayLayer = 0, |
| 91 | .layerCount = 1 |
| 92 | }, |
| 93 | }); |
| 94 | if (i + 1 == n_levels) |
| 95 | break; |
| 96 | vkCmdBlitImagecxx . . $ vkCmdBlitImage(4c2d6cc43a33343d). (state->vk_command_buffercxx . . $ _GskVulkanCommandState#vk_command_buffer., |
| 97 | vk_image, |
| 98 | VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL., |
| 99 | vk_image, |
| 100 | VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL., |
| 101 | 1, |
| 102 | &(VkImageBlitcxx . . $ VkImageBlit#) { |
| 103 | .srcSubresource = { |
| 104 | .aspectMask = VK_IMAGE_ASPECT_COLOR_BITcxx . . $ VK_IMAGE_ASPECT_COLOR_BIT., |
| 105 | .mipLevel = i, |
| 106 | .baseArrayLayer = 0, |
| 107 | .layerCount = 1 |
| 108 | }, |
| 109 | .srcOffsets = { |
| 110 | { |
| 111 | .x = 0, |
| 112 | .y = 0, |
| 113 | .z = 0, |
| 114 | }, |
| 115 | { |
| 116 | .x = width, |
| 117 | .y = height, |
| 118 | .z = 1 |
| 119 | } |
| 120 | }, |
| 121 | .dstSubresource = { |
| 122 | .aspectMask = VK_IMAGE_ASPECT_COLOR_BITcxx . . $ VK_IMAGE_ASPECT_COLOR_BIT., |
| 123 | .mipLevel = i + 1, |
| 124 | .baseArrayLayer = 0, |
| 125 | .layerCount = 1 |
| 126 | }, |
| 127 | .dstOffsets = { |
| 128 | { |
| 129 | .x = 0, |
| 130 | .y = 0, |
| 131 | .z = 0, |
| 132 | }, |
| 133 | { |
| 134 | .x = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (1, width / 2), |
| 135 | .y = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (1, height / 2), |
| 136 | .z = 1, |
| 137 | } |
| 138 | }, |
| 139 | }, |
| 140 | VK_FILTER_LINEARcxx . . $ VK_FILTER_LINEAR.); |
| 141 | width = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (1, width / 2); |
| 142 | height = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (1, height / 2); |
| 143 | } |
| 144 | |
| 145 | gsk_vulkan_image_set_vk_image_layoutcxx . . $ gsk_vulkan_image_set_vk_image_layout(a34424fcac50c0e3). (image, |
| 146 | VK_PIPELINE_STAGE_TRANSFER_BITcxx . . $ VK_PIPELINE_STAGE_TRANSFER_BIT., |
| 147 | VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL., |
| 148 | VK_ACCESS_TRANSFER_READ_BITcxx . . $ VK_ACCESS_TRANSFER_READ_BIT.); |
| 149 | |
| 150 | return op->nextcxx . . $ _GskGpuOp#next.; |
| 151 | } |
| 152 | #endif |
| 153 | |
| 154 | static GskGpuOpcxx . . $ GskGpuOp# * |
| 155 | gsk_gpu_mipmap_op_gl_commandcxx . . $ gsk_gpu_mipmap_op_gl_command(916980b864349f41). (GskGpuOpcxx . . $ GskGpuOp# *op, |
| 156 | GskGpuFramecxx . . $ GskGpuFrame# *frame, |
| 157 | GskGLCommandStatecxx . . $ GskGLCommandState# *state) |
| 158 | { |
| 159 | GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *self = (GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *) op; |
| 160 | |
| 161 | gsk_gl_image_bind_texturescxx . . $ gsk_gl_image_bind_textures(5b668f603b8fc23c). (GSK_GL_IMAGEcxx . . $ GSK_GL_IMAGE(fcd414d3356d7530). (self->imagecxx . . $ _GskGpuMipmapOp#image.), GL_TEXTURE0cxx . . $ `<external>/17235136775614108268/gl_generated.h:3026:9`!); |
| 162 | /* need to reset the images again */ |
| 163 | state->current_imagescxx . . $ _GskGLCommandState#current_images.[0] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 164 | |
| 165 | glGenerateMipmapcxx . . $ `<external>/17235136775614108268/gl_generated.h:17508:9`! (GL_TEXTURE_2Dcxx . . $ `<external>/17235136775614108268/gl_generated.h:1535:9`!); |
| 166 | |
| 167 | return op->nextcxx . . $ _GskGpuOp#next.; |
| 168 | } |
| 169 | |
| 170 | static const GskGpuOpClasscxx . . $ GskGpuOpClass# GSK_GPU_MIPMAP_OP_CLASScxx . . $ GSK_GPU_MIPMAP_OP_CLASS. = { |
| 171 | GSK_GPU_OP_SIZEcxx . . $ `gsk/gpu/gskgpuopprivate.h:82:9`! (GskGpuMipmapOp), |
| 172 | GSK_GPU_STAGE_PASScxx . . $ GSK_GPU_STAGE_PASS., |
| 173 | gsk_gpu_mipmap_op_finishcxx . . $ gsk_gpu_mipmap_op_finish(713144cca40e0637)., |
| 174 | gsk_gpu_mipmap_op_printcxx . . $ gsk_gpu_mipmap_op_print(a335f695b352be9)., |
| 175 | #ifdef GDK_RENDERING_VULKANcxx . . $ `build/gdk/gdkconfig.h:22:9`! |
| 176 | gsk_gpu_mipmap_op_vk_commandcxx . . $ gsk_gpu_mipmap_op_vk_command(ff65bed3d1310efd)., |
| 177 | #endif |
| 178 | gsk_gpu_mipmap_op_gl_commandcxx . . $ gsk_gpu_mipmap_op_gl_command(916980b864349f41). |
| 179 | }; |
| 180 | |
| 181 | void |
| 182 | gsk_gpu_mipmap_opcxx . . $ gsk_gpu_mipmap_op(6baf52d344d0887a). (GskGpuFramecxx . . $ GskGpuFrame# *frame, |
| 183 | GskGpuImagecxx . . $ GskGpuImage# *image) |
| 184 | { |
| 185 | GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *self; |
| 186 | |
| 187 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! ((gsk_gpu_image_get_flags (image) & (GSK_GPU_IMAGE_CAN_MIPMAP | GSK_GPU_IMAGE_MIPMAP)) == GSK_GPU_IMAGE_CAN_MIPMAP); |
| 188 | |
| 189 | self = (GskGpuMipmapOpcxx . . $ GskGpuMipmapOp# *) gsk_gpu_frame_alloc_opcxx . . $ gsk_gpu_frame_alloc_op(685f6570bbf2d158). (frame, &GSK_GPU_MIPMAP_OP_CLASScxx . . $ GSK_GPU_MIPMAP_OP_CLASS.); |
| 190 | |
| 191 | self->imagecxx . . $ _GskGpuMipmapOp#image. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (image); |
| 192 | |
| 193 | gsk_gpu_image_set_flagscxx . . $ gsk_gpu_image_set_flags(88cab512b97839b5). (image, GSK_GPU_IMAGE_MIPMAPcxx . . $ GSK_GPU_IMAGE_MIPMAP.); |
| 194 | } |