<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 17, 2016 at 8:46 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:llandwerlin@gmail.com" target="_blank">llandwerlin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Up to this point we were using the gen8+ structures. Altough this commit<br>
doesn't fixes the border color CTS tests, this is a step in the right<br>
direction to fix the following tests :<br></blockquote><div><br></div><div>It's not entirely clear where you're headed but I'm afraid the approach may ultimately be doomed to failure.  The fundamental problem is that Vulkan allows complete mix-and-match of images and samplers in the shader.  We cannot know, until the shader *executes* which sampler will be associated with a particular texture.  This leaves us with two possible solutions:<br><br></div><div> 1) Emit a sampler for every possible sampler+image combination.<br></div><div> 2) Piles of shader hacks.<br></div><div><br></div><div>Both approaches are highly annoying.  While the first option is probably the less annoying of the two, there is one format (R32_UINT maybe?  I don't remember for sure) for which integer border color just doesn't work at all on Haswell.  On Ivy Bridge, integer border color is so broken we probably shouldn't be using it at all.  This leaves us with shader hacks.  Ken wrote a bunch of code for this so that we could get the ES 3.1 CTS passing on Haswell and Ivy Bridge.  Maybe that could be ported?  Maybe we can find some magic Ivy Bridge "make border color work" bit?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
dEQP-VK.pipeline.sampler.view_<wbr>type.2d.format.*.address_<wbr>modes.all_mode_clamp_to_<wbr>border_*<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
 src/intel/vulkan/anv_cmd_<wbr>buffer.c |  10 ++<br>
 src/intel/vulkan/anv_device.c     |  42 +-------<br>
 src/intel/vulkan/anv_genX.h       |   3 +-<br>
 src/intel/vulkan/anv_private.h    |   7 ++<br>
 src/intel/vulkan/genX_state.c     | 220 ++++++++++++++++++++++++++++++<wbr>++------<br>
 5 files changed, 208 insertions(+), 74 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_cmd_<wbr>buffer.c b/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
index b051489..a63f3d9 100644<br>
--- a/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
@@ -931,6 +931,16 @@ anv_cmd_buffer_emit_samplers(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
       if (sampler == NULL)<br>
          continue;<br>
<br>
+      /* On Haswell, although the border color structures are 20 dwords long<br>
+       * and must be aligned at 512 bytes, the position of the 8/16/32bits<br>
+       * colors overlap, meaning we can't have a single color structure<br>
+       * configured for all formats. We therefore need to reemit the sampler<br>
+       * structure for the used format. */<br>
+      if (cmd_buffer->device->info.is_<wbr>haswell) {<br>
+         gen75_pack_sampler_state(cmd_<wbr>buffer->device, sampler,<br>
+                                  desc->image_view->vk_format);<br>
+      }<br>
+<br>
       memcpy(state->map + (s * 16),<br>
              sampler->state, sizeof(sampler->state));<br>
    }<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index ce1b9c1..4e69307 100644<br>
--- a/src/intel/vulkan/anv_device.<wbr>c<br>
+++ b/src/intel/vulkan/anv_device.<wbr>c<br>
@@ -724,46 +724,6 @@ anv_queue_finish(struct anv_queue *queue)<br>
 {<br>
 }<br>
<br>
-static struct anv_state<br>
-anv_state_pool_emit_data(<wbr>struct anv_state_pool *pool, size_t size, size_t align, const void *p)<br>
-{<br>
-   struct anv_state state;<br>
-<br>
-   state = anv_state_pool_alloc(pool, size, align);<br>
-   memcpy(state.map, p, size);<br>
-<br>
-   if (!pool->block_pool->device-><wbr>info.has_llc)<br>
-      anv_state_clflush(state);<br>
-<br>
-   return state;<br>
-}<br>
-<br>
-struct gen8_border_color {<br>
-   union {<br>
-      float float32[4];<br>
-      uint32_t uint32[4];<br>
-   };<br>
-   /* Pad out to 64 bytes */<br>
-   uint32_t _pad[12];<br>
-};<br>
-<br>
-static void<br>
-anv_device_init_border_<wbr>colors(struct anv_device *device)<br>
-{<br>
-   static const struct gen8_border_color border_colors[] = {<br>
-      [VK_BORDER_COLOR_FLOAT_<wbr>TRANSPARENT_BLACK] =  { .float32 = { 0.0, 0.0, 0.0, 0.0 } },<br>
-      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>BLACK] =       { .float32 = { 0.0, 0.0, 0.0, 1.0 } },<br>
-      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>WHITE] =       { .float32 = { 1.0, 1.0, 1.0, 1.0 } },<br>
-      [VK_BORDER_COLOR_INT_<wbr>TRANSPARENT_BLACK] =    { .uint32 = { 0, 0, 0, 0 } },<br>
-      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>BLACK] =         { .uint32 = { 0, 0, 0, 1 } },<br>
-      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>WHITE] =         { .uint32 = { 1, 1, 1, 1 } },<br>
-   };<br>
-<br>
-   device->border_colors = anv_state_pool_emit_data(&<wbr>device->dynamic_state_pool,<br>
-                                                    sizeof(border_colors), 64,<br>
-                                                    border_colors);<br>
-}<br>
-<br>
 VkResult<br>
 anv_device_submit_simple_<wbr>batch(struct anv_device *device,<br>
                                struct anv_batch *batch)<br>
@@ -926,7 +886,7 @@ VkResult anv_CreateDevice(<br>
<br>
    anv_device_init_blorp(device);<br>
<br>
-   anv_device_init_border_colors(<wbr>device);<br>
+   ANV_GEN_DISPATCH(device, border_colors_setup, device);<br>
<br>
    *pDevice = anv_device_to_handle(device);<br>
<br>
diff --git a/src/intel/vulkan/anv_genX.h b/src/intel/vulkan/anv_genX.h<br>
index 27c55b9..a4a39e1 100644<br>
--- a/src/intel/vulkan/anv_genX.h<br>
+++ b/src/intel/vulkan/anv_genX.h<br>
@@ -28,7 +28,7 @@<br>
 /*<br>
  * Gen-specific function declarations.  This header must *not* be included<br>
  * directly.  Instead, it is included multiple times by anv_private.h.<br>
- *<br>
+ *<br>
  * In this header file, the usual genx() macro is available.<br>
  */<br>
<br>
@@ -37,6 +37,7 @@<br>
 #endif<br>
<br>
 VkResult genX(init_device_state)(struct anv_device *device);<br>
+void genX(border_colors_setup)(<wbr>struct anv_device *device);<br>
<br>
 void genX(cmd_buffer_emit_state_<wbr>base_address)(struct anv_cmd_buffer *cmd_buffer);<br>
<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index 69e6aac..faebbb2 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -643,6 +643,7 @@ struct anv_device {<br>
     struct blorp_context                        blorp;<br>
<br>
     struct anv_state                            border_colors;<br>
+    uint32_t                                    border_color_align;<br>
<br>
     struct anv_queue                            queue;<br>
<br>
@@ -1732,6 +1733,8 @@ void anv_buffer_view_fill_image_<wbr>param(struct anv_device *device,<br>
<br>
 struct anv_sampler {<br>
    uint32_t state[4];<br>
+<br>
+   VkSamplerCreateInfo info;<br>
 };<br>
<br>
 struct anv_framebuffer {<br>
@@ -1783,6 +1786,10 @@ struct anv_query_pool {<br>
    struct anv_bo                                bo;<br>
 };<br>
<br>
+void gen75_pack_sampler_state(<wbr>struct anv_device *device,<br>
+                              struct anv_sampler *sampler,<br>
+                              VkFormat format);<br>
+<br>
 void *anv_lookup_entrypoint(const struct gen_device_info *devinfo,<br>
                             const char *name);<br>
<br>
diff --git a/src/intel/vulkan/genX_state.<wbr>c b/src/intel/vulkan/genX_state.<wbr>c<br>
index a6d405d..cbf7df2 100644<br>
--- a/src/intel/vulkan/genX_state.<wbr>c<br>
+++ b/src/intel/vulkan/genX_state.<wbr>c<br>
@@ -28,11 +28,144 @@<br>
 #include <fcntl.h><br>
<br>
 #include "anv_private.h"<br>
+#include "vk_format_info.h"<br>
<br>
 #include "common/gen_sample_positions.<wbr>h"<br>
 #include "genxml/gen_macros.h"<br>
 #include "genxml/genX_pack.h"<br>
<br>
+static uint32_t<br>
+border_color_index(<wbr>VkBorderColor border_color, VkFormat format)<br>
+{<br>
+#if GEN_IS_HASWELL<br>
+   if (!vk_format_is_integer(format)<wbr>)<br>
+      return border_color;<br>
+<br>
+   uint32_t max_bpc = vk_format_max_bpc(format);<br>
+   uint32_t index = 0;<br>
+<br>
+   if (max_bpc <= 8)<br>
+      return border_color;<br>
+<br>
+   if (max_bpc <= 16)<br>
+      index = VK_BORDER_COLOR_END_RANGE + 1;<br>
+   else<br>
+      index = VK_BORDER_COLOR_END_RANGE + 4;<br>
+<br>
+   switch (border_color) {<br>
+   case VK_BORDER_COLOR_FLOAT_<wbr>TRANSPARENT_BLACK:<br>
+   case VK_BORDER_COLOR_INT_<wbr>TRANSPARENT_BLACK:<br>
+      index += 0;<br>
+      break;<br>
+<br>
+   case VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>BLACK:<br>
+   case VK_BORDER_COLOR_INT_OPAQUE_<wbr>BLACK:<br>
+      index += 1;<br>
+      break;<br>
+<br>
+   case VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>WHITE:<br>
+   case VK_BORDER_COLOR_INT_OPAQUE_<wbr>WHITE:<br>
+      index += 2;<br>
+      break;<br>
+<br>
+   default:<br>
+      unreachable("invalid border color");<br>
+   }<br>
+<br>
+   return index;<br>
+#else<br>
+   return border_color;<br>
+#endif<br>
+}<br>
+<br>
+#define BORDER_COLOR(name, r, g, b, a) {           \<br>
+      .BorderColor##name##Red   = r,               \<br>
+      .BorderColor##name##Green = g,               \<br>
+      .BorderColor##name##Blue  = b,               \<br>
+      .BorderColor##name##Alpha = a,               \<br>
+   }<br>
+<br>
+void<br>
+genX(border_colors_setup)(<wbr>struct anv_device *device)<br>
+{<br>
+#if GEN_IS_HASWELL<br>
+   static const struct GENX(SAMPLER_BORDER_COLOR_<wbr>STATE) border_colors[] = {<br>
+      [VK_BORDER_COLOR_FLOAT_<wbr>TRANSPARENT_BLACK] =<br>
+         BORDER_COLOR(Float, 0.0, 0.0, 0.0, 0.0),<br>
+      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>BLACK] =<br>
+         BORDER_COLOR(Float, 0.0, 0.0, 0.0, 1.0),<br>
+      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>WHITE] =<br>
+         BORDER_COLOR(Float, 1.0, 1.0, 1.0, 1.0),<br>
+      [VK_BORDER_COLOR_INT_<wbr>TRANSPARENT_BLACK] =<br>
+         BORDER_COLOR(8bit, 0, 0, 0, 0),<br>
+      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>BLACK] =<br>
+         BORDER_COLOR(8bit, 0, 0, 0, 1),<br>
+      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>WHITE] =<br>
+         BORDER_COLOR(8bit, 1, 1, 1, 1),<br>
+      [VK_BORDER_COLOR_END_RANGE + 1] =<br>
+         BORDER_COLOR(16bit, 0, 0, 0, 0),<br>
+      [VK_BORDER_COLOR_END_RANGE + 2] =<br>
+         BORDER_COLOR(16bit, 0, 0, 0, 1),<br>
+      [VK_BORDER_COLOR_END_RANGE + 3] =<br>
+         BORDER_COLOR(16bit, 1, 1, 1, 1),<br>
+      [VK_BORDER_COLOR_END_RANGE + 4] =<br>
+         BORDER_COLOR(32bit, 0, 0, 0, 0),<br>
+      [VK_BORDER_COLOR_END_RANGE + 5] =<br>
+         BORDER_COLOR(32bit, 0, 0, 0, 1),<br>
+      [VK_BORDER_COLOR_END_RANGE + 6] =<br>
+         BORDER_COLOR(32bit, 1, 1, 1, 1)<br>
+   };<br>
+   device->border_color_align = 512;<br>
+#elif GEN_GEN == 7<br>
+   static const struct GENX(SAMPLER_BORDER_COLOR_<wbr>STATE) border_colors[] = {<br>
+      [VK_BORDER_COLOR_FLOAT_<wbr>TRANSPARENT_BLACK] =<br>
+         BORDER_COLOR(Float, 0.0, 0.0, 0.0, 0.0),<br>
+      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>BLACK] =<br>
+         BORDER_COLOR(Float, 0.0, 0.0, 0.0, 1.0),<br>
+      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>WHITE] =<br>
+         BORDER_COLOR(Float, 1.0, 1.0, 1.0, 1.0),<br>
+      [VK_BORDER_COLOR_INT_<wbr>TRANSPARENT_BLACK] =<br>
+         BORDER_COLOR(Float, 0.0, 0.0, 0.0, 0.0),<br>
+      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>BLACK] =<br>
+         BORDER_COLOR(Float, 0.0, 0.0, 0.0, 1.0),<br>
+      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>WHITE] =<br>
+         BORDER_COLOR(Float, 1.0, 1.0, 1.0, 1.0)<br>
+   };<br>
+   device->border_color_align = 64;<br>
+#else /* GEN_GEN >= 8 */<br>
+   static const struct GENX(SAMPLER_BORDER_COLOR_<wbr>STATE) border_colors[] = {<br>
+      [VK_BORDER_COLOR_FLOAT_<wbr>TRANSPARENT_BLACK] =<br>
+         BORDER_COLOR(Float, 0.0, 0.0, 0.0, 0.0),<br>
+      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>BLACK] =<br>
+         BORDER_COLOR(Float, 0.0, 0.0, 0.0, 1.0),<br>
+      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>WHITE] =<br>
+         BORDER_COLOR(Float, 1.0, 1.0, 1.0, 1.0),<br>
+      [VK_BORDER_COLOR_INT_<wbr>TRANSPARENT_BLACK] =<br>
+         BORDER_COLOR(32bit, 0, 0, 0, 0),<br>
+      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>BLACK] =<br>
+         BORDER_COLOR(32bit, 0, 0, 0, 1),<br>
+      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>WHITE] =<br>
+         BORDER_COLOR(32bit, 1, 1, 1, 1)<br>
+   };<br>
+   device->border_color_align = 64;<br>
+#endif<br>
+<br>
+   device->border_colors =<br>
+      anv_state_pool_alloc(&device-><wbr>dynamic_state_pool,<br>
+                           ARRAY_SIZE(border_colors) * device->border_color_align,<br>
+                           device->border_color_align);<br>
+<br>
+   for (uint32_t i = 0; i < ARRAY_SIZE(border_colors); i++) {<br>
+      GENX(SAMPLER_BORDER_COLOR_<wbr>STATE_pack)(<br>
+         NULL,<br>
+         device->border_colors.map + i * device->border_color_align,<br>
+         &border_colors[i]);<br>
+   }<br>
+<br>
+   if (!device->info.has_llc)<br>
+      anv_state_clflush(device-><wbr>border_colors);<br>
+}<br>
+<br>
 VkResult<br>
 genX(init_device_state)(struct anv_device *device)<br>
 {<br>
@@ -148,24 +281,21 @@ static const uint32_t vk_to_gen_shadow_compare_op[] = {<br>
    [VK_COMPARE_OP_ALWAYS]                       = PREFILTEROPNEVER,<br>
 };<br>
<br>
-VkResult genX(CreateSampler)(<br>
-    VkDevice                                    _device,<br>
-    const VkSamplerCreateInfo*                  pCreateInfo,<br>
-    const VkAllocationCallbacks*                pAllocator,<br>
-    VkSampler*                                  pSampler)<br>
+#if GEN_IS_HASWELL<br>
+void<br>
+#else<br>
+static void<br>
+#endif<br>
+genX(pack_sampler_state)(<br>
+   struct anv_device *                          device,<br>
+   struct anv_sampler *                         sampler,<br>
+   VkFormat                                     format)<br>
 {<br>
-   ANV_FROM_HANDLE(anv_device, device, _device);<br>
-   struct anv_sampler *sampler;<br>
-<br>
-   assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_<wbr>CREATE_INFO);<br>
-<br>
-   sampler = anv_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,<br>
-                        VK_SYSTEM_ALLOCATION_SCOPE_<wbr>OBJECT);<br>
-   if (!sampler)<br>
-      return vk_error(VK_ERROR_OUT_OF_HOST_<wbr>MEMORY);<br>
-<br>
-   uint32_t border_color_offset = device->border_colors.offset +<br>
-                                  pCreateInfo->borderColor * 64;<br>
+   uint32_t color_index =<br>
+      border_color_index(sampler-><wbr>info.borderColor, format);<br>
+   uint32_t color_offset =<br>
+      device->border_colors.offset +<br>
+      color_index * device->border_color_align;<br>
<br>
    struct GENX(SAMPLER_STATE) sampler_state = {<br>
       .SamplerDisable = false,<br>
@@ -180,28 +310,28 @@ VkResult genX(CreateSampler)(<br>
 #if GEN_GEN == 8<br>
       .BaseMipLevel = 0.0,<br>
 #endif<br>
-      .MipModeFilter = vk_to_gen_mipmap_mode[<wbr>pCreateInfo->mipmapMode],<br>
-      .MagModeFilter = vk_to_gen_tex_filter(<wbr>pCreateInfo->magFilter,<br>
-                                            pCreateInfo->anisotropyEnable)<wbr>,<br>
-      .MinModeFilter = vk_to_gen_tex_filter(<wbr>pCreateInfo->minFilter,<br>
-                                            pCreateInfo->anisotropyEnable)<wbr>,<br>
-      .TextureLODBias = anv_clamp_f(pCreateInfo-><wbr>mipLodBias, -16, 15.996),<br>
+      .MipModeFilter = vk_to_gen_mipmap_mode[sampler-<wbr>>info.mipmapMode],<br>
+      .MagModeFilter = vk_to_gen_tex_filter(sampler-><wbr>info.magFilter,<br>
+                                            sampler->info.<wbr>anisotropyEnable),<br>
+      .MinModeFilter = vk_to_gen_tex_filter(sampler-><wbr>info.minFilter,<br>
+                                            sampler->info.<wbr>anisotropyEnable),<br>
+      .TextureLODBias = anv_clamp_f(sampler->info.<wbr>mipLodBias, -16, 15.996),<br>
       .AnisotropicAlgorithm = EWAApproximation,<br>
-      .MinLOD = anv_clamp_f(pCreateInfo-><wbr>minLod, 0, 14),<br>
-      .MaxLOD = anv_clamp_f(pCreateInfo-><wbr>maxLod, 0, 14),<br>
+      .MinLOD = anv_clamp_f(sampler->info.<wbr>minLod, 0, 14),<br>
+      .MaxLOD = anv_clamp_f(sampler->info.<wbr>maxLod, 0, 14),<br>
       .ChromaKeyEnable = 0,<br>
       .ChromaKeyIndex = 0,<br>
       .ChromaKeyMode = 0,<br>
-      .ShadowFunction = vk_to_gen_shadow_compare_op[<wbr>pCreateInfo->compareOp],<br>
+      .ShadowFunction = vk_to_gen_shadow_compare_op[<wbr>sampler->info.compareOp],<br>
       .CubeSurfaceControlMode = OVERRIDE,<br>
<br>
-      .BorderColorPointer = border_color_offset,<br>
+      .BorderColorPointer = color_offset,<br>
<br>
 #if GEN_GEN >= 8<br>
       .LODClampMagnificationMode = MIPNONE,<br>
 #endif<br>
<br>
-      .MaximumAnisotropy = vk_to_gen_max_anisotropy(<wbr>pCreateInfo->maxAnisotropy),<br>
+      .MaximumAnisotropy = vk_to_gen_max_anisotropy(<wbr>sampler->info.maxAnisotropy),<br>
       .<wbr>RAddressMinFilterRoundingEnabl<wbr>e = 0,<br>
       .<wbr>RAddressMagFilterRoundingEnabl<wbr>e = 0,<br>
       .<wbr>VAddressMinFilterRoundingEnabl<wbr>e = 0,<br>
@@ -209,13 +339,39 @@ VkResult genX(CreateSampler)(<br>
       .<wbr>UAddressMinFilterRoundingEnabl<wbr>e = 0,<br>
       .<wbr>UAddressMagFilterRoundingEnabl<wbr>e = 0,<br>
       .TrilinearFilterQuality = 0,<br>
-      .NonnormalizedCoordinateEnable = pCreateInfo-><wbr>unnormalizedCoordinates,<br>
-      .TCXAddressControlMode = vk_to_gen_tex_address[<wbr>pCreateInfo->addressModeU],<br>
-      .TCYAddressControlMode = vk_to_gen_tex_address[<wbr>pCreateInfo->addressModeV],<br>
-      .TCZAddressControlMode = vk_to_gen_tex_address[<wbr>pCreateInfo->addressModeW],<br>
+      .NonnormalizedCoordinateEnable = sampler->info.<wbr>unnormalizedCoordinates,<br>
+      .TCXAddressControlMode = vk_to_gen_tex_address[sampler-<wbr>>info.addressModeU],<br>
+      .TCYAddressControlMode = vk_to_gen_tex_address[sampler-<wbr>>info.addressModeV],<br>
+      .TCZAddressControlMode = vk_to_gen_tex_address[sampler-<wbr>>info.addressModeW],<br>
    };<br>
<br>
    GENX(SAMPLER_STATE_pack)(NULL, sampler->state, &sampler_state);<br>
+}<br>
+<br>
+<br>
+VkResult genX(CreateSampler)(<br>
+    VkDevice                                    _device,<br>
+    const VkSamplerCreateInfo*                  pCreateInfo,<br>
+    const VkAllocationCallbacks*                pAllocator,<br>
+    VkSampler*                                  pSampler)<br>
+{<br>
+   ANV_FROM_HANDLE(anv_device, device, _device);<br>
+   struct anv_sampler *sampler;<br>
+<br>
+   assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_<wbr>CREATE_INFO);<br>
+<br>
+   sampler = anv_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,<br>
+                        VK_SYSTEM_ALLOCATION_SCOPE_<wbr>OBJECT);<br>
+   if (!sampler)<br>
+      return vk_error(VK_ERROR_OUT_OF_HOST_<wbr>MEMORY);<br>
+<br>
+   sampler->info = *pCreateInfo;<br>
+<br>
+   /* No need to pack the sampler state on HSW, as the packing will depend on<br>
+    * the format of the associated texture. */<br>
+#if ! GEN_IS_HASWELL<br>
+   genX(pack_sampler_state)(<wbr>device, sampler, VK_FORMAT_UNDEFINED);<br>
+#endif<br>
<br>
    *pSampler = anv_sampler_to_handle(sampler)<wbr>;<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>