<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 27/11/2018 10:53, Tapani Pälli
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20181127105321.4267-12-tapani.palli@intel.com">
<pre class="moz-quote-pre" wrap="">If external format is used, we store the external format identifier in
conversion to be used later when creating VkImageView.
v2: rebase to b43f955037c changes
Signed-off-by: Tapani Pälli <a class="moz-txt-link-rfc2396E" href="mailto:tapani.palli@intel.com"><tapani.palli@intel.com></a>
---
src/intel/vulkan/anv_formats.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 972a6f98620..6e7807579df 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -1170,6 +1170,15 @@ VkResult anv_CreateSamplerYcbcrConversion(
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_ycbcr_conversion *conversion;
+ /* Search for VkExternalFormatANDROID and resolve the format. */
+ struct anv_format *ext_format = NULL;
+ const struct VkExternalFormatANDROID *ext_info =
+ vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_FORMAT_ANDROID);
+
+ uint64_t format = ext_info ? ext_info->externalFormat : 0;
+ if (format)
+ ext_format = (struct anv_format *) (uintptr_t) format;</pre>
</blockquote>
<p><br>
</p>
<p>In that if I would add assert(pCreateInfo->format == <span
style="color: rgb(38, 67, 87); font-family: Consolas,
"Liberation Mono", Courier, monospace; font-size:
16px; font-style: normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 400; letter-spacing:
normal; orphans: 2; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;">VK_FORMAT_UNDEFINED);</span></p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:20181127105321.4267-12-tapani.palli@intel.com">
<pre class="moz-quote-pre" wrap="">
+
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO);
conversion = vk_alloc2(&device->alloc, pAllocator, sizeof(*conversion), 8,</pre>
</blockquote>
<p><br>
</p>
<p>Spec says that we should ignore the value of
pCreateInfo->components :</p>
<p style="box-sizing: border-box; margin: 0px 0px 0.75em; padding:
0px; direction: ltr; font-family: Noto, sans-serif; font-weight:
normal; font-size: 1em; line-height: 1.6; text-rendering:
optimizelegibility;">"When creating an external format conversion,
the value of<span> </span><code style="box-sizing: border-box;
font-family: Consolas, "Liberation Mono", Courier,
monospace; font-size: inherit; font-weight: normal; color:
rgb(38, 67, 87); border-radius: 0px; letter-spacing: 0px;
padding: 0px; background-color: transparent; line-height:
inherit; overflow-wrap: break-word; font-style: normal
!important;">components</code><span> </span>is ignored"</p>
<p><br>
</p>
<br>
<blockquote type="cite"
cite="mid:20181127105321.4267-12-tapani.palli@intel.com">
<pre class="moz-quote-pre" wrap="">
@@ -1190,6 +1199,10 @@ VkResult anv_CreateSamplerYcbcrConversion(
conversion->chroma_offsets[1] = pCreateInfo->yChromaOffset;
conversion->chroma_filter = pCreateInfo->chromaFilter;
+ /* Setup external format. */
+ if (ext_format)
+ conversion->format = ext_format;
+
bool has_chroma_subsampled = false;
for (uint32_t p = 0; p < conversion->format->n_planes; p++) {
if (conversion->format->planes[p].has_chroma &&
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>