mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
render/vulkan: don't use UNDEFINED layout for imported DMA-BUFs
UNDEFINED when used as source layout means that the contents of the underlying memory becomes undefined. This isn't what we want here: we don't want to mutate the imported pixel data. The Vulkan spec isn't really clear what the proper value should be here, but after discussing with driver developers [1] it seems like UNDEFINED isn't the right one. The recommendation is to use GENERAL instead. [1]: https://github.com/ValveSoftware/gamescope/issues/356
This commit is contained in:
parent
56ebfde540
commit
2c4d3ad12d
2 changed files with 2 additions and 4 deletions
|
|
@ -187,9 +187,7 @@ static bool render_pass_submit(struct wlr_render_pass *wlr_pass) {
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
uint32_t render_wait_len = 0;
|
uint32_t render_wait_len = 0;
|
||||||
wl_list_for_each_safe(texture, tmp_tex, &renderer->foreign_textures, foreign_link) {
|
wl_list_for_each_safe(texture, tmp_tex, &renderer->foreign_textures, foreign_link) {
|
||||||
VkImageLayout src_layout = VK_IMAGE_LAYOUT_GENERAL;
|
|
||||||
if (!texture->transitioned) {
|
if (!texture->transitioned) {
|
||||||
src_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
|
||||||
texture->transitioned = true;
|
texture->transitioned = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,7 +197,7 @@ static bool render_pass_submit(struct wlr_render_pass *wlr_pass) {
|
||||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT,
|
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT,
|
||||||
.dstQueueFamilyIndex = renderer->dev->queue_family,
|
.dstQueueFamilyIndex = renderer->dev->queue_family,
|
||||||
.image = texture->image,
|
.image = texture->image,
|
||||||
.oldLayout = src_layout,
|
.oldLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||||
.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||||
.srcAccessMask = 0, // ignored anyways
|
.srcAccessMask = 0, // ignored anyways
|
||||||
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
||||||
|
|
|
||||||
|
|
@ -842,7 +842,7 @@ void wlr_vk_texture_get_image_attribs(struct wlr_texture *texture,
|
||||||
attribs->image = vk_texture->image;
|
attribs->image = vk_texture->image;
|
||||||
attribs->format = vk_texture->format->vk;
|
attribs->format = vk_texture->format->vk;
|
||||||
attribs->layout = vk_texture->transitioned ?
|
attribs->layout = vk_texture->transitioned ?
|
||||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : VK_IMAGE_LAYOUT_UNDEFINED;
|
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wlr_vk_texture_has_alpha(struct wlr_texture *texture) {
|
bool wlr_vk_texture_has_alpha(struct wlr_texture *texture) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue