MCPcopy Create free account
hub / github.com/comaps/comaps / Bind

Method Bind

libs/drape/vulkan/vulkan_texture.cpp:176–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void VulkanTexture::Bind(ref_ptr<dp::GraphicsContext> context) const
177{
178 ref_ptr<dp::vulkan::VulkanBaseContext> vulkanContext = context;
179 VkCommandBuffer commandBuffer = vulkanContext->GetCurrentMemoryCommandBuffer();
180 CHECK(commandBuffer != nullptr, ());
181
182 // Fill texture on the first bind.
183 if (m_creationStagingBuffer != nullptr)
184 {
185 // Here we use VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, because we also read textures
186 // in vertex shaders.
187 MakeImageLayoutTransition(
188 commandBuffer, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
189 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT,
190 VK_PIPELINE_STAGE_TRANSFER_BIT);
191
192 auto staging = m_creationStagingBuffer->GetReservationById(m_reservationId);
193 auto bufferCopyRegion = BufferCopyRegion(0, 0, GetWidth(), GetHeight(), staging.m_offset);
194 vkCmdCopyBufferToImage(commandBuffer, staging.m_stagingBuffer, m_textureObject.m_image,
195 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &bufferCopyRegion);
196
197 MakeImageLayoutTransition(commandBuffer, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_PIPELINE_STAGE_TRANSFER_BIT,
198 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
199
200 m_creationStagingBuffer.reset();
201 }
202}
203
204void VulkanTexture::SetFilter(TextureFilter filter)
205{

Callers 1

UNIT_TESTFunction · 0.45

Calls 3

BufferCopyRegionFunction · 0.85
resetMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.36