]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/texture_backend.cpp
Set debug names for pipeline and descriptor set layouts on Vulkan
[libs/gl.git] / source / backends / vulkan / texture_backend.cpp
index 237b984558bf1dd3fd484009a1b06cd5b2bc24c9..bf2692172c922295c835012ccc0637ab2d909aa8 100644 (file)
@@ -134,43 +134,6 @@ void VulkanTexture::create_mip_views() const
        }
 }
 
-void VulkanTexture::stage_pixels(void *staging, const void *data, size_t count)
-{
-       const Texture &self = *static_cast<const Texture *>(this);
-
-       if(self.swizzle==RGBA_TO_RGB)
-       {
-               const uint32_t *src = static_cast<const uint32_t *>(data);
-               uint32_t *dst = static_cast<uint32_t *>(staging);
-               size_t i = 0;
-               for(; i+3<count; i+=4)
-               {
-                       dst[0] = src[0]|0xFF000000;
-                       dst[1] = (src[0]>>24)|(src[1]<<8)|0xFF000000;
-                       dst[2] = (src[1]>>16)|(src[2]<<16)|0xFF000000;
-                       dst[3] = (src[2]>>8)|0xFF000000;
-                       src += 3;
-                       dst += 4;
-               }
-
-               if(i<count)
-               {
-                       const uint8_t *src_bytes = reinterpret_cast<const uint8_t *>(src);
-                       for(; i<count; ++i)
-                       {
-                               *dst++ = src_bytes[0]|(src_bytes[1]<<8)|(src_bytes[2]<<16)|0xFF000000;
-                               src_bytes += 3;
-                       }
-               }
-       }
-       else
-       {
-               const char *src = static_cast<const char *>(data);
-               size_t data_size = count*get_pixel_size(self.storage_fmt);
-               copy(src, src+data_size, static_cast<char *>(staging));
-       }
-}
-
 void VulkanTexture::generate_mipmap()
 {
        unsigned n_levels = static_cast<const Texture *>(this)->n_levels;
@@ -178,16 +141,17 @@ void VulkanTexture::generate_mipmap()
        TransferQueue &tq = device.get_transfer_queue();
        for(unsigned i=0; i+1<n_levels; ++i)
        {
-               tq.prepare_transfer(this, true, 0,
+               tq.prepare_transfer(this, true,
                        [this, i](){
                                change_layout(i, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, false);
                                change_layout(i+1, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true);
                        },
                        [this, i](VkCommandBuffer cmd_buf, VkBuffer, size_t){
+                               const Texture &self = *static_cast<const Texture *>(this);
                                const VulkanFunctions &vk = device.get_functions();
 
                                VkImageBlit region = { };
-                               region.srcSubresource.aspectMask = get_vulkan_aspect(get_components(static_cast<const Texture *>(this)->storage_fmt));
+                               region.srcSubresource.aspectMask = get_vulkan_aspect(get_components(self.storage_fmt));
                                region.srcSubresource.mipLevel = i;
                                region.srcSubresource.baseArrayLayer = 0;
                                region.srcSubresource.layerCount = 1;