-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,39 @@ | ||
diff --git a/src/vulkan/formats.c b/src/vulkan/formats.c | ||
index f0eb0fb7..7d1c6478 100644 | ||
--- a/src/vulkan/formats.c | ||
+++ b/src/vulkan/formats.c | ||
@@ -415,7 +415,12 @@ void vk_setup_formats(struct pl_gpu_t *gpu) | ||
.pNext = has_drm_mods ? &drm_props : NULL, | ||
}; | ||
|
||
- vk->GetPhysicalDeviceFormatProperties2KHR(vk->physd, vk_fmt->tfmt, &prop2); | ||
+ VkFormat tfmt = vk_fmt->tfmt; | ||
+ if (tfmt == VK_FORMAT_R10X6_UNORM_PACK16) | ||
+ tfmt = VK_FORMAT_R16_UNORM; | ||
+ else if (tfmt == VK_FORMAT_R10X6G10X6_UNORM_2PACK16) | ||
+ tfmt = VK_FORMAT_R16G16_UNORM; | ||
+ vk->GetPhysicalDeviceFormatProperties2KHR(vk->physd, tfmt, &prop2); | ||
|
||
// If wholly unsupported, try falling back to the emulation formats | ||
// for texture operations | ||
diff --git a/src/vulkan/gpu_tex.c b/src/vulkan/gpu_tex.c | ||
index a419ffdc..ec32c546 100644 | ||
index a419ffdc..19249e19 100644 | ||
--- a/src/vulkan/gpu_tex.c | ||
+++ b/src/vulkan/gpu_tex.c | ||
@@ -371,6 +371,11 @@ pl_tex vk_tex_create(pl_gpu gpu, const struct pl_tex_params *params) | ||
.pQueueFamilyIndices = qfs, | ||
}; | ||
|
||
+ if (tex_vk->img_fmt == VK_FORMAT_R10X6_UNORM_PACK16) | ||
+ iinfo.format = VK_FORMAT_R16_UNORM; | ||
+ else if (tex_vk->img_fmt == VK_FORMAT_R10X6G10X6_UNORM_2PACK16) | ||
+ iinfo.format = VK_FORMAT_R16G16_UNORM; | ||
+ | ||
struct vk_malloc_params mparams = { | ||
.optimal = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, | ||
.export_handle = params->export_handle, | ||
@@ -1215,7 +1220,12 @@ pl_tex pl_vulkan_wrap(pl_gpu gpu, const struct pl_vulkan_wrap_params *params) | ||
@@ -1144,10 +1144,15 @@ skip_blocking: | ||
|
||
pl_tex pl_vulkan_wrap(pl_gpu gpu, const struct pl_vulkan_wrap_params *params) | ||
{ | ||
+ VkFormat desired_fmt = params->format; | ||
+ if (desired_fmt == VK_FORMAT_R10X6_UNORM_PACK16) | ||
+ desired_fmt = VK_FORMAT_R16_UNORM; | ||
+ else if (desired_fmt == VK_FORMAT_R10X6G10X6_UNORM_2PACK16) | ||
+ desired_fmt = VK_FORMAT_R16G16_UNORM; | ||
pl_fmt fmt = NULL; | ||
for (int i = 0; i < gpu->num_formats; i++) { | ||
const struct vk_format **vkfmt = PL_PRIV(gpu->formats[i]); | ||
- if ((*vkfmt)->tfmt == params->format) { | ||
+ if ((*vkfmt)->tfmt == desired_fmt) { | ||
fmt = gpu->formats[i]; | ||
break; | ||
} | ||
@@ -1155,7 +1160,7 @@ pl_tex pl_vulkan_wrap(pl_gpu gpu, const struct pl_vulkan_wrap_params *params) | ||
|
||
if (!fmt) { | ||
PL_ERR(gpu, "Could not find pl_fmt suitable for wrapped image " | ||
- "with format %s", vk_fmt_name(params->format)); | ||
+ "with format %s", vk_fmt_name(desired_fmt)); | ||
return NULL; | ||
} | ||
|
||
@@ -1215,7 +1220,7 @@ pl_tex pl_vulkan_wrap(pl_gpu gpu, const struct pl_vulkan_wrap_params *params) | ||
tex_vk->external_img = true; | ||
tex_vk->held = !fmt->num_planes; | ||
tex_vk->img = params->image; | ||
- tex_vk->img_fmt = params->format; | ||
+ if (params->format == VK_FORMAT_R10X6_UNORM_PACK16) | ||
+ tex_vk->img_fmt = VK_FORMAT_R16_UNORM; | ||
+ else if (params->format == VK_FORMAT_R10X6G10X6_UNORM_2PACK16) | ||
+ tex_vk->img_fmt = VK_FORMAT_R16G16_UNORM; | ||
+ else | ||
+ tex_vk->img_fmt = params->format; | ||
+ tex_vk->img_fmt = desired_fmt; | ||
tex_vk->num_planes = fmt->num_planes; | ||
tex_vk->usage_flags = usage; | ||
tex_vk->aspect = params->aspect; |