<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 15, 2017 at 10:09 AM, Juan A. Suarez Romero <span dir="ltr"><<a href="mailto:jasuarez@igalia.com" target="_blank">jasuarez@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">According to Ivybridge PRM, Volume 4 Part 1 p73, signed integer formats<br>
cannot be multisampled.<br>
<br>
Also in the same PRM p63, any format with greater than 64 bits per<br>
element cannot be multisampled.<br>
<br>
This fixes the following Vulkan CTS tests in Haswell:<br>
<br>
dEQP-VK.memory.requirements.<wbr>image.regular_tiling_optimal<br>
dEQP-VK.memory.requirements.<wbr>image.transient_tiling_optimal<br>
<br>
It also fixes crashes in the following Vulkan CTS tests in Haswell (becoming now<br>
skip):<br>
<br>
dEQP-VK.glsl.texture_<wbr>functions.query.<wbr>texturesamples.isampler2dms_<wbr>fragment<br>
dEQP-VK.glsl.texture_<wbr>functions.query.<wbr>texturesamples.isampler2dms_<wbr>vertex<br>
dEQP-VK.glsl.texture_<wbr>functions.query.<wbr>texturesamples.<wbr>isampler2dmsarray_fragment<br>
dEQP-VK.glsl.texture_<wbr>functions.query.<wbr>texturesamples.<wbr>isampler2dmsarray_vertex<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.64x64_1.r16g16_<wbr>sint.samples_4<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.64x64_1.r16g16_<wbr>sint.samples_8<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.64x64_1.<wbr>r32g32b32a32_sfloat.samples_4<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.64x64_1.<wbr>r32g32b32a32_sfloat.samples_8<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.64x64_4.r16g16_<wbr>sint.samples_4<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.64x64_4.r16g16_<wbr>sint.samples_8<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.64x64_4.<wbr>r32g32b32a32_sfloat.samples_4<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.64x64_4.<wbr>r32g32b32a32_sfloat.samples_8<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.79x31_1.r16g16_<wbr>sint.samples_4<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.79x31_1.r16g16_<wbr>sint.samples_8<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.79x31_1.<wbr>r32g32b32a32_sfloat.samples_4<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.79x31_1.<wbr>r32g32b32a32_sfloat.samples_8<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.79x31_4.r16g16_<wbr>sint.samples_4<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.79x31_4.r16g16_<wbr>sint.samples_8<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.79x31_4.<wbr>r32g32b32a32_sfloat.samples_4<br>
dEQP-VK.pipeline.multisample.<wbr>sampled_image.79x31_4.<wbr>r32g32b32a32_sfloat.samples_8<br>
<br>
Signed-off-by: Juan A. Suarez Romero <<a href="mailto:jasuarez@igalia.com">jasuarez@igalia.com</a>><br>
---<br>
 src/intel/vulkan/anv_device.c  |  4 ++--<br>
 src/intel/vulkan/anv_formats.c | 32 ++++++++++++++++++++++++++++++<wbr>++<br>
 2 files changed, 34 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index d1a6cc8..a8ab8c3 100644<br>
--- a/src/intel/vulkan/anv_device.<wbr>c<br>
+++ b/src/intel/vulkan/anv_device.<wbr>c<br>
@@ -622,12 +622,12 @@ void anv_<wbr>GetPhysicalDeviceProperties(<br>
       .maxFramebufferWidth                      = (1 << 14),<br>
       .maxFramebufferHeight                     = (1 << 14),<br>
       .maxFramebufferLayers                     = (1 << 11),<br>
-      .framebufferColorSampleCounts             = sample_counts,<br>
+      .framebufferColorSampleCounts             = devinfo->gen == 7 ? VK_SAMPLE_COUNT_1_BIT : sample_counts,<br>
       .framebufferDepthSampleCounts             = sample_counts,<br>
       .<wbr>framebufferStencilSampleCounts           = sample_counts,<br>
       .<wbr>framebufferNoAttachmentsSample<wbr>Counts     = sample_counts,<br>
       .maxColorAttachments                      = MAX_RTS,<br>
-      .sampledImageColorSampleCounts            = sample_counts,<br>
+      .sampledImageColorSampleCounts            = devinfo->gen == 7 ? VK_SAMPLE_COUNT_1_BIT : sample_counts,<br></blockquote><div><br></div><div>The Vulkan spec says we're supposed to support at least 1x and 4x on both of these.<br><br></div><div>So I guess the real question is what's the best choice that will let apps run.  My feeling is that setting these fields to 1x and 4x and then just dying horribly if they use an integer format is probably actually the better choice.  That said, we should definitely make sure we're dying horribly if they use an integer format!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       .<wbr>sampledImageIntegerSampleCount<wbr>s          = VK_SAMPLE_COUNT_1_BIT,<br>
       .sampledImageDepthSampleCounts            = sample_counts,<br>
       .<wbr>sampledImageStencilSampleCount<wbr>s          = sample_counts,<br>
diff --git a/src/intel/vulkan/anv_<wbr>formats.c b/src/intel/vulkan/anv_<wbr>formats.c<br>
index 6005791..3eac931 100644<br>
--- a/src/intel/vulkan/anv_<wbr>formats.c<br>
+++ b/src/intel/vulkan/anv_<wbr>formats.c<br>
@@ -561,6 +561,38 @@ anv_get_image_format_<wbr>properties(<br>
       sampleCounts = isl_device_get_sample_counts(&<wbr>physical_device->isl_dev);<br>
    }<br>
<br>
+   /*<br>
+    * From the Ivybridge PRM, Volume 4 Part 1 p73, SURFACE_STATE, Number of<br>
+    * Multisamples:<br>
+    *<br>
+    *    - This field must be set to MULTISAMPLECOUNT_1 for SINT MSRTs when<br>
+    *      all RT channels are not written.<br>
+    *<br>
+    * And errata from the Ivybridge PRM, Volume 4 Part 1 p77,<br>
+    * RENDER_SURFACE_STATE, MCS Enable:<br>
+    *<br>
+    *   This field must be set to 0 [MULTISAMPLECOUNT_1] for all SINT MSRTs<br>
+    *   when all RT channels are not written.<br>
+    *<br>
+    * Note that the above SINT restrictions apply only to *MSRTs* (that is,<br>
+    * *multisampled* render targets). The restrictions seem to permit an MCS<br>
+    * if the render target is singlesampled.<br>
+    *<br>
+    * From the IvyBridge PRM, Volume 4 Part 1 p63, SURFACE_STATE, Surface<br>
+    * Format:<br>
+    *<br>
+    *    If Number of Multisamples is set to a value other than<br>
+    *    MULTISAMPLECOUNT_1, this field cannot be set to the following<br>
+    *    formats: any format with greater than 64 bits per element, if Number<br>
+    *    of Multisamples is MULTISAMPLECOUNT_8, any compressed texture format<br>
+    *    (BC*), and any YCRCB* format.<br>
+    */<br>
+   if (physical_device->info.gen < 8 &&<br>
+       (isl_format_has_sint_channel(<wbr>anv_formats[info->format].isl_<wbr>format) ||<br>
+        isl_format_get_layout(anv_<wbr>formats[info->format].isl_<wbr>format)->bpb > 64)) {<br>
+      sampleCounts = VK_SAMPLE_COUNT_1_BIT;<br></blockquote><div><br></div><div>We have this very helpful function in isl called isl_format_supports_multisampling which I don't believe has the SINT restriction yet.  I think the better thing to do would be to add the SINT restriction to that helper and use it rather than hand-coding it here.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   }<br>
+<br>
    if (info->usage & (VK_IMAGE_USAGE_TRANSFER_SRC_<wbr>BIT |<br>
                       VK_IMAGE_USAGE_TRANSFER_DST_<wbr>BIT)) {<br>
       /* Accept transfers on anything we can sample from or renderer to. */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.3<br>
<br>
</font></span></blockquote></div><br></div></div>