mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-01 22:58:38 -04:00
render/vulkan: vkMapMemory stage spans up front
We always need these mapped for CPU access, so map it up front instead of duplicating lazy mapping at each site of use.
This commit is contained in:
parent
bf0246e50c
commit
bf67eb342b
3 changed files with 6 additions and 18 deletions
|
|
@ -41,9 +41,7 @@ static bool write_pixels(struct wlr_vk_texture *texture,
|
|||
uint32_t stride, const pixman_region32_t *region, const void *vdata,
|
||||
VkImageLayout old_layout, VkPipelineStageFlags src_stage,
|
||||
VkAccessFlags src_access) {
|
||||
VkResult res;
|
||||
struct wlr_vk_renderer *renderer = texture->renderer;
|
||||
VkDevice dev = texture->renderer->dev->dev;
|
||||
|
||||
const struct wlr_pixel_format_info *format_info = drm_get_pixel_format_info(texture->format->drm);
|
||||
assert(format_info);
|
||||
|
|
@ -79,15 +77,6 @@ static bool write_pixels(struct wlr_vk_texture *texture,
|
|||
free(copies);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!span.buffer->cpu_mapping) {
|
||||
res = vkMapMemory(dev, span.buffer->memory, 0, VK_WHOLE_SIZE, 0, &span.buffer->cpu_mapping);
|
||||
if (res != VK_SUCCESS) {
|
||||
wlr_vk_error("vkMapMemory", res);
|
||||
free(copies);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
char *map = (char*)span.buffer->cpu_mapping + span.alloc.start;
|
||||
|
||||
// upload data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue