<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 19, 2016 at 8:50 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Up to this point we were using the gen8+ structures to program border<br>
colors. This commit sets up the correct border colors for HSW & IVB.<br>
<br>
On HSW:<br>
   This fixes 140 failures of :<br>
     dEQP-VK.pipeline.sampler.view_<wbr>type.*.format.*.address_modes.<wbr>all_mode_clamp_to_border_*<br>
     (11 failures remain out of 840 tests)<br>
<br>
   Failures :<br>
     - dEQP-VK.pipeline.sampler.view_<wbr>type.*.format.b4g4r4a4_unorm_<wbr>pack16.address_modes.all_mode_<wbr>clamp_to_border_*<br>
<br>
       There is no equivalent of b4g4r4a4_unorm on the GLES31 test suite and<br>
       the documentation doesn't seem to list this format in any of the<br>
       8/16/32bits supported ones.<br>
<br>
     - dEQP-VK.pipeline.sampler.view_<wbr>type.2d.format.r32g32b32_uint.<wbr>address_modes.all_mode_clamp_<wbr>to_border_*<br>
<br>
       Some GLES31 equivalent tests are failing too :<br>
<br>
         dEQP-GLES31.functional.<wbr>texture.border_clamp.formats.<wbr>rgba32ui.nearest_size_pot<br>
         dEQP-GLES31.functional.<wbr>texture.border_clamp.formats.<wbr>rgba32ui.nearest_size_npot<br>
<br>
     - dEQP-VK.pipeline.sampler.view_<wbr>type.2d.format.r32_uint.<wbr>address_modes.all_mode_clamp_<wbr>to_border_*<br>
<br>
       Seems to exhibit the same issue as r32g32b32_uint (some of the<br>
       corners of the sampled texture are missing).<br>
<br>
On IVB:<br>
   This fixes 73 failures of :<br>
     dEQP-VK.pipeline.sampler.view_<wbr>type.*.format.*.address_modes.<wbr>all_mode_clamp_to_border_*<br>
     (139 failures remain out of 795 tests)<br>
<br>
     All tests using *_sfloat, *_unorm, *_snorm formats are passing.<br>
<br>
   Failures :<br>
     - dEQP-VK.pipeline.sampler.view_<wbr>type.*.format.r8g8b8_uint.<wbr>address_modes.all_mode_clamp_<wbr>to_border_*<br>
       dEQP-VK.pipeline.sampler.view_<wbr>type.*.format.r16g16b16_sint.<wbr>address_modes.all_mode_clamp_<wbr>to_border_*<br>
       dEQP-VK.pipeline.sampler.view_<wbr>type.*.format.r16g16b16_<wbr>sfloat.address_modes.all_mode_<wbr>clamp_to_border_*<br>
<br>
       These tests were triggering an assert before and remain broken. This<br>
       seems to be a hardware limitation we can't express through the Vulkan<br>
       API.<br>
<br>
     - Most of uint formats produce invalid results (some with invalid<br>
       border color, some with invalid texture data) with exception of :<br>
<br>
       dEQP-VK.pipeline.sampler.view_<wbr>type.*.format.r32_sint.<wbr>address_modes.all_mode_clamp_<wbr>to_border_*<br>
<br>
v2: Implement Jason's suggestion to have all sampler configuration ready at<br>
    sampler cration<br>
    Also fix remaining issues with 1 & 2 components texture<br>
<span class=""><br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
</span> src/intel/vulkan/anv_device.c      |  42 -------<br>
 src/intel/vulkan/anv_genX.h        |   3 +-<br>
 src/intel/vulkan/anv_private.h     |  11 +-<br>
 src/intel/vulkan/genX_cmd_<wbr>buffer.c |   5 +-<br>
 src/intel/vulkan/genX_state.c      | 229 ++++++++++++++++++++++++++++++<wbr>++++---<br>
 5 files changed, 228 insertions(+), 62 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index c995630..3ad01b9 100644<br>
<div><div class="h5">--- 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>
</div></div>-   device->border_colors = anv_state_pool_emit_data(&<wbr>device->dynamic_state_pool,<br>
<span class="">-                                                    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>
</span>@@ -943,8 +903,6 @@ VkResult anv_CreateDevice(<br>
<br>
    anv_device_init_blorp(device);<br>
<br>
-   anv_device_init_border_colors(<wbr>device);<br>
-<br>
    *pDevice = anv_device_to_handle(device);<br>
<br>
    return VK_SUCCESS;<br>
diff --git a/src/intel/vulkan/anv_genX.h b/src/intel/vulkan/anv_genX.h<br>
index d4ed325..ebd0ee7 100644<br>
<span class="">--- 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>
</span>+uint32_t genX(sampler_index)(VkFormat format);<br>
<span class=""><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>
</span>index 0e25827..2cca5c3 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -552,6 +552,7 @@ struct anv_device {<br>
<span class="">     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>
</span>@@ -1642,7 +1643,15 @@ void anv_buffer_view_fill_image_<wbr>param(struct anv_device *device,<br>
                                       struct brw_image_param *param);<br>
<br>
 struct anv_sampler {<br>
-   uint32_t state[4];<br>
+   /* On Haswell we need to have all samplers declined per number of component<br>
+    * for each possible integer format (8, 16 and 32 bits) and we also need<br>
+    * sampler configurations for normalized and floating point formats :<br>
+    *<br>
+    * 4 components * 3 integer formats + floats&normalized = 13 configurations<br>
+    *<br>
+    * On all other platforms, only state[0] is used.<br>
+    */<br>
+   uint32_t state[13][4];<br>
 };<br>
<br>
 struct anv_framebuffer {<br>
diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
index 5ea7c5f..88ed284 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -905,8 +905,9 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer,<br>
<span class="">       if (sampler == NULL)<br>
          continue;<br>
<br>
</span>-      memcpy(state->map + (s * 16),<br>
-             sampler->state, sizeof(sampler->state));<br>
+      uint32_t sampler_index = genX(sampler_index)(desc-><wbr>image_view->vk_format);<br>
+      memcpy(state->map + (s * 16), sampler->state[sampler_index],<br>
+             GENX(SAMPLER_STATE_length) * 4);<br></blockquote><div><br></div><div>Unfortunately, this only works for the case where we have a combined image and sampler.  desc->image_view could be null (just a plain sampler) or the shader could end up combining this sampler with a different image (and different format).  Sadly, I think this is probably yet another CTS coverage hole.<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 (!cmd_buffer->device->info.<wbr>has_llc)<br>
diff --git a/src/intel/vulkan/genX_state.<wbr>c b/src/intel/vulkan/genX_state.<wbr>c<br>
index be1bd78..61aeef3 100644<br>
--- a/src/intel/vulkan/genX_state.<wbr>c<br>
+++ b/src/intel/vulkan/genX_state.<wbr>c<br>
@@ -28,11 +28,172 @@<br>
<span class=""> #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>
</span>+uint32_t<br>
+genX(sampler_index)(VkFormat format)<br>
+{<br>
+#if ! GEN_IS_HASWELL<br>
+   return 0;<br>
+#else<br>
+   if (!vk_format_is_integer(format)<wbr>)<br>
+      return 0;<br>
+<br>
+   uint32_t index = 3 * (vk_format_n_channels(format) - 1);<br>
+<br>
+   switch(vk_format_max_bpc(<wbr>format)) {<br>
+   case 8:<br>
<span class="">+      index += 1;<br>
+      break;<br>
+<br>
</span>+   case 10:<br>
+   case 16:<br>
+   case 24:<br>
<span class="">+      index += 2;<br>
+      break;<br>
+<br>
</span>+   case 32:<br>
+      index += 3;<br>
+      break;<br>
+   default:<br>
+      anv_finishme("unsupported sampling format with border color");<br>
+      return 0;<br>
<span class="">+   }<br>
+<br>
+   return index;<br>
</span><span class="">+#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>
</span>+static void<br>
+border_colors_setup(struct anv_device *device)<br>
+{<br>
+#if GEN_IS_HASWELL<br>
+   /* We order things differently for Haswell and only ever care about the<br>
+    * color, not whether the color integer or float (see genX(sampler_index)).<br>
+    * This consumes 13 * 3 * 512 ~= 20kb of memory. */<br>
<span class="">+   static const struct GENX(SAMPLER_BORDER_COLOR_<wbr>STATE) border_colors[] = {<br>
</span>+      /* Transparent black: */<br>
<span class="">+      BORDER_COLOR(Float, 0.0, 0.0, 0.0, 0.0),<br>
</span>+      /*  - R textures */<br>
<span class="">+      BORDER_COLOR(8bit,  0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(32bit, 0,   0,   0,   1),<br>
</span>+      /*  - RG textures */<br>
<span class="">+      BORDER_COLOR(8bit,  0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(32bit, 0,   0,   0,   1),<br>
</span>+      /*  - RGB textures */<br>
<span class="">+      BORDER_COLOR(8bit,  0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(32bit, 0,   0,   0,   1),<br>
</span>+      /*  - RBGA textures */<br>
<span class="">+      BORDER_COLOR(8bit,  0,   0,   0,   0),<br>
</span><span class="">+      BORDER_COLOR(16bit, 0,   0,   0,   0),<br>
</span><span class="">+      BORDER_COLOR(32bit, 0,   0,   0,   0),<br>
+<br>
</span>+      /* Opaque black: */<br>
<span class="">+      BORDER_COLOR(Float, 0.0, 0.0, 0.0, 1.0),<br>
</span>+      /*  - R textures */<br>
<span class="">+      BORDER_COLOR(8bit,  0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(32bit, 0,   0,   0,   1),<br>
</span>+      /*  - RG textures */<br>
<span class="">+      BORDER_COLOR(8bit,  0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(32bit, 0,   0,   0,   1),<br>
</span>+      /*  - RGB textures */<br>
<span class="">+      BORDER_COLOR(8bit,  0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(32bit, 0,   0,   0,   1),<br>
</span>+      /*  - RGBA textures */<br>
<span class="">+      BORDER_COLOR(8bit,  0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 0,   0,   0,   1),<br>
</span><span class="">+      BORDER_COLOR(32bit, 0,   0,   0,   1),<br>
+<br>
</span>+      /* Opaque white: */<br>
<span class="">+      BORDER_COLOR(Float, 1.0, 1.0, 1.0, 1.0),<br>
</span>+      /*  - R textures */<br>
+      BORDER_COLOR(8bit,  1,   0,   0,   1),<br>
+      BORDER_COLOR(16bit, 1,   0,   0,   1),<br>
+      BORDER_COLOR(32bit, 1,   0,   0,   1),<br>
+      /*  - RG textures */<br>
+      BORDER_COLOR(8bit,  1,   1,   0,   1),<br>
+      BORDER_COLOR(16bit, 1,   1,   0,   1),<br>
+      BORDER_COLOR(32bit, 1,   1,   0,   1),<br>
+      /*  - RGB textures */<br>
<span class="">+      BORDER_COLOR(8bit,  1,   1,   1,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 1,   1,   1,   1),<br>
</span>+      BORDER_COLOR(32bit, 1,   1,   1,   1),<br>
+      /*  - RGBA textures */<br>
<span class="">+      BORDER_COLOR(8bit,  1,   1,   1,   1),<br>
</span><span class="">+      BORDER_COLOR(16bit, 1,   1,   1,   1),<br>
</span>+      BORDER_COLOR(32bit, 1,   1,   1,   1),<br>
+   };<br>
+   static_assert(sizeof(struct anv_sampler) / (4 * GENX(SAMPLER_STATE_length)) ==<br>
+                 ARRAY_SIZE(border_colors) / 3,<br>
+                 "struct anv_sampler size doesn't match border_colors");<br>
<div><div class="h5">+   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>
</div></div>@@ -91,6 +252,8 @@ genX(init_device_state)(struct anv_device *device)<br>
<br>
    assert(batch.next <= batch.end);<br>
<br>
+   border_colors_setup(device);<br>
+<br>
    return anv_device_submit_simple_<wbr>batch(device, &batch);<br>
 }<br>
<br>
@@ -148,24 +311,34 @@ static const uint32_t vk_to_gen_shadow_compare_op[] = {<br>
<span class="">    [VK_COMPARE_OP_ALWAYS]                       = PREFILTEROPNEVER,<br>
 };<br>
<br>
-VkResult genX(CreateSampler)(<br>
-    VkDevice                                    _device,<br>
</span>+static void<br>
+pack_sampler_state(<br>
<span class="">+   struct anv_device *                          device,<br>
+   struct anv_sampler *                         sampler,<br>
</span><span class="">     const VkSamplerCreateInfo*                  pCreateInfo,<br>
-    const VkAllocationCallbacks*                pAllocator,<br>
-    VkSampler*                                  pSampler)<br>
</span>+   uint32_t                                     offset,<br>
+   void *                                       dest)<br>
<span class=""> {<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>
</span>+#if GEN_IS_HASWELL<br>
+   static const uint32_t haswell_border_color_offset[] = {<br>
+      [VK_BORDER_COLOR_FLOAT_<wbr>TRANSPARENT_BLACK] = 0,<br>
+      [VK_BORDER_COLOR_INT_<wbr>TRANSPARENT_BLACK] = 0,<br>
<br>
-   sampler = vk_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,<br>
<span class="">-                        VK_SYSTEM_ALLOCATION_SCOPE_<wbr>OBJECT);<br>
-   if (!sampler)<br>
-      return vk_error(VK_ERROR_OUT_OF_HOST_<wbr>MEMORY);<br>
</span>+      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>BLACK] = 1,<br>
+      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>BLACK] = 1,<br>
<span class=""><br>
-   uint32_t border_color_offset = device->border_colors.offset +<br>
-                                  pCreateInfo->borderColor * 64;<br>
</span>+      [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>WHITE] = 2,<br>
+      [VK_BORDER_COLOR_INT_OPAQUE_<wbr>WHITE] = 2,<br>
+   };<br>
+   uint32_t color_index =<br>
+      ARRAY_SIZE(sampler->state) *<br>
+      haswell_border_color_offset[<wbr>pCreateInfo->borderColor] + offset;<br>
+#else<br>
+   uint32_t color_index = pCreateInfo->borderColor;<br>
+#endif<br>
<span class="">+   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>
</span>@@ -195,7 +368,7 @@ VkResult genX(CreateSampler)(<br>
<span class="">       .ShadowFunction = vk_to_gen_shadow_compare_op[<wbr>pCreateInfo->compareOp],<br>
</span><span class="">       .CubeSurfaceControlMode = OVERRIDE,<br>
<br>
-      .BorderColorPointer = border_color_offset,<br>
+      .BorderColorPointer = color_offset,<br>
<br>
 #if GEN_GEN >= 8<br>
       .LODClampMagnificationMode = MIPNONE,<br>
</span>@@ -215,7 +388,31 @@ VkResult genX(CreateSampler)(<br>
<span class="">       .TCZAddressControlMode = vk_to_gen_tex_address[<wbr>pCreateInfo->addressModeW],<br>
</span>    };<br>
<br>
-   GENX(SAMPLER_STATE_pack)(NULL, sampler->state, &sampler_state);<br>
+   GENX(SAMPLER_STATE_pack)(NULL, dest, &sampler_state);<br>
<span class="">+}<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>
</span>+   sampler = vk_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,<br>
<span class="">+                       VK_SYSTEM_ALLOCATION_SCOPE_<wbr>OBJECT);<br>
+   if (!sampler)<br>
+      return vk_error(VK_ERROR_OUT_OF_HOST_<wbr>MEMORY);<br>
+<br>
</span>+   pack_sampler_state(device, sampler, pCreateInfo, 0, sampler->state[0]);<br>
+#if GEN_IS_HASWELL<br>
+   for (uint32_t i = 1; i < ARRAY_SIZE(sampler->state); i++)<br>
+      pack_sampler_state(device, sampler, pCreateInfo, i, sampler->state[i]);<br>
<div class="HOEnZb"><div class="h5">+#endif<br>
<br>
    *pSampler = anv_sampler_to_handle(sampler)<wbr>;<br>
<br>
--<br>
2.9.3<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>
</div></div></blockquote></div><br></div></div>