<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 17, 2016 at 11:51 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"><span class="">On Mon, 2016-10-17 at 11:09 -0700, Jason Ekstrand wrote:<br>
> On Mon, Oct 17, 2016 at 8:46 AM, Lionel Landwerlin <llandwerlin@gmail<br>
> .com> wrote:<br>
> > Up to this point we were using the gen8+ structures. Altough this<br>
> > commit<br>
> > doesn't fixes the border color CTS tests, this is a step in the<br>
> > right<br>
> > direction to fix the following tests :<br>
><br>
> It's not entirely clear where you're headed but I'm afraid the<br>
> approach may ultimately be doomed to failure. The fundamental<br>
> problem is that Vulkan allows complete mix-and-match of images and<br>
> samplers in the shader. We cannot know, until the shader *executes*<br>
> which sampler will be associated with a particular texture.<br>
<br>
</span>Maybe I'm missing something, but essentially the approach here is to<br>
SAMPLER_STATE_pack() when we bind the descriptors set. That's when we<br>
know for sure what couples of (sampler, texture) are going to be used,<br>
at least that's my understanding.<span class=""><br></span></blockquote><div><br></div><div>That's where we know all possible (sampler, texture) tuples but we don't know exactly which combinations will get used by the shader. This is in contrast to GL where sampler and texture are sort-of separate but by the time you get into the shader, they're tied together.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> This leaves us with two possible solutions:<br>
><br>
> 1) Emit a sampler for every possible sampler+image combination.<br>
<br>
</span>Actually that may not be a bad idea.<br>
<div class="HOEnZb"><div class="h5"><br>
> 2) Piles of shader hacks.<br>
><br>
> Both approaches are highly annoying. While the first option is<br>
> probably the less annoying of the two, there is one format (R32_UINT<br>
> maybe? I don't remember for sure) for which integer border color<br>
> just doesn't work at all on Haswell. On Ivy Bridge, integer border<br>
> color is so broken we probably shouldn't be using it at all. This<br>
> leaves us with shader hacks. Ken wrote a bunch of code for this so<br>
> that we could get the ES 3.1 CTS passing on Haswell and Ivy Bridge. <br>
> Maybe that could be ported? Maybe we can find some magic Ivy Bridge<br>
> "make border color work" bit?<br>
> <br>
> > dEQP-<br>
> > VK.pipeline.sampler.view_type.<wbr>2d.format.*.address_modes.all_<wbr>mode_cl<br>
> > amp_to_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.<wbr>c | 42 +-------<br>
> > src/intel/vulkan/anv_genX.h | 3 +-<br>
> > src/intel/vulkan/anv_private.<wbr>h | 7 ++<br>
> > src/intel/vulkan/genX_state.<wbr>c | 220<br>
> > ++++++++++++++++++++++++++++++<wbr>++------<br>
> > 5 files changed, 208 insertions(+), 74 deletions(-)<br>
> ><br>
> > diff --git a/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
> > 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<br>
> > anv_cmd_buffer *cmd_buffer,<br>
> > if (sampler == NULL)<br>
> > continue;<br>
> ><br>
> > + /* On Haswell, although the border color structures are 20<br>
> > dwords long<br>
> > + * and must be aligned at 512 bytes, the position of the<br>
> > 8/16/32bits<br>
> > + * colors overlap, meaning we can't have a single color<br>
> > structure<br>
> > + * configured for all formats. We therefore need to reemit<br>
> > 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<br>
> > 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,<br>
> > 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 = {<br>
> > 0.0, 0.0, 0.0, 0.0 } },<br>
> > - [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>BLACK] = { .float32 = {<br>
> > 0.0, 0.0, 0.0, 1.0 } },<br>
> > - [VK_BORDER_COLOR_FLOAT_OPAQUE_<wbr>WHITE] = { .float32 = {<br>
> > 1.0, 1.0, 1.0, 1.0 } },<br>
> > - [VK_BORDER_COLOR_INT_<wbr>TRANSPARENT_BLACK] = { .uint32 = {<br>
> > 0, 0, 0, 0 } },<br>
> > - [VK_BORDER_COLOR_INT_OPAQUE_<wbr>BLACK] = { .uint32 = {<br>
> > 0, 0, 0, 1 } },<br>
> > - [VK_BORDER_COLOR_INT_OPAQUE_<wbr>WHITE] = { .uint32 = {<br>
> > 1, 1, 1, 1 } },<br>
> > - };<br>
> > -<br>
> > - device->border_colors = anv_state_pool_emit_data(&<wbr>device-<br>
> > >dynamic_state_pool,<br>
> > - <br>
> > sizeof(border_colors), 64,<br>
> > - <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_<wbr>colors(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<br>
> > 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<br>
> > included<br>
> > * directly. Instead, it is included multiple times by<br>
> > 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<br>
> > anv_cmd_buffer *cmd_buffer);<br>
> ><br>
> > diff --git a/src/intel/vulkan/anv_<wbr>private.h<br>
> > 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 <br>
> > border_color_align;<br>
> ><br>
> > struct anv_queue queue;<br>
> ><br>
> > @@ -1732,6 +1733,8 @@ void anv_buffer_view_fill_image_<wbr>param(struct<br>
> > 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<br>
> > 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)<br>
> > 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)<br>
> > 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)<br>
> > 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-<br>
> > >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-<br>
> > >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)(<wbr>struct anv_device *device)<br>
> > {<br>
> > @@ -148,24 +281,21 @@ static const uint32_t<br>
> > vk_to_gen_shadow_compare_op[] = {<br>
> > [VK_COMPARE_OP_ALWAYS] =<br>
> > 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 ==<br>
> > VK_STRUCTURE_TYPE_SAMPLER_<wbr>CREATE_INFO);<br>
> > -<br>
> > - sampler = anv_alloc2(&device->alloc, pAllocator,<br>
> > 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-<br>
> > >mipmapMode],<br>
> > - .MagModeFilter = vk_to_gen_tex_filter(<wbr>pCreateInfo-<br>
> > >magFilter,<br>
> > - pCreateInfo-<br>
> > >anisotropyEnable),<br>
> > - .MinModeFilter = vk_to_gen_tex_filter(<wbr>pCreateInfo-<br>
> > >minFilter,<br>
> > - pCreateInfo-<br>
> > >anisotropyEnable),<br>
> > - .TextureLODBias = anv_clamp_f(pCreateInfo-><wbr>mipLodBias, -16,<br>
> > 15.996),<br>
> > + .MipModeFilter = vk_to_gen_mipmap_mode[sampler-<br>
> > >info.mipmapMode],<br>
> > + .MagModeFilter = vk_to_gen_tex_filter(sampler-<br>
> > >info.magFilter,<br>
> > + sampler-<br>
> > >info.anisotropyEnable),<br>
> > + .MinModeFilter = vk_to_gen_tex_filter(sampler-<br>
> > >info.minFilter,<br>
> > + sampler-<br>
> > >info.anisotropyEnable),<br>
> > + .TextureLODBias = anv_clamp_f(sampler->info.<wbr>mipLodBias, -16,<br>
> > 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-<br>
> > >compareOp],<br>
> > + .ShadowFunction = vk_to_gen_shadow_compare_op[<wbr>sampler-<br>
> > >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-<br>
> > >maxAnisotropy),<br>
> > + .MaximumAnisotropy = vk_to_gen_max_anisotropy(<wbr>sampler-<br>
> > >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-<br>
> > >unnormalizedCoordinates,<br>
> > - .TCXAddressControlMode = vk_to_gen_tex_address[<wbr>pCreateInfo-<br>
> > >addressModeU],<br>
> > - .TCYAddressControlMode = vk_to_gen_tex_address[<wbr>pCreateInfo-<br>
> > >addressModeV],<br>
> > - .TCZAddressControlMode = vk_to_gen_tex_address[<wbr>pCreateInfo-<br>
> > >addressModeW],<br>
> > + .NonnormalizedCoordinateEnable = sampler-<br>
> > >info.unnormalizedCoordinates,<br>
> > + .TCXAddressControlMode = vk_to_gen_tex_address[sampler-<br>
> > >info.addressModeU],<br>
> > + .TCYAddressControlMode = vk_to_gen_tex_address[sampler-<br>
> > >info.addressModeV],<br>
> > + .TCZAddressControlMode = vk_to_gen_tex_address[sampler-<br>
> > >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 ==<br>
> > VK_STRUCTURE_TYPE_SAMPLER_<wbr>CREATE_INFO);<br>
> > +<br>
> > + sampler = anv_alloc2(&device->alloc, pAllocator,<br>
> > 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<br>
> > 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>
> ><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>
> ><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>