<p dir="ltr"><br>
On Mar 3, 2016 10:22 PM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
><br>
> sample_c is backwards from what GL and Vulkan expect.<br>
><br>
> See intel_state.c in i965.<br>
> ---<br>
>  src/intel/vulkan/genX_state.c | 24 +++++++++++++++++++++++-<br>
>  1 file changed, 23 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c<br>
> index 63ea269..e2bd95d 100644<br>
> --- a/src/intel/vulkan/genX_state.c<br>
> +++ b/src/intel/vulkan/genX_state.c<br>
> @@ -184,6 +184,28 @@ static const uint32_t vk_to_gen_compare_op[] = {<br>
>     [VK_COMPARE_OP_ALWAYS]                    = PREFILTEROPALWAYS,<br>
>  };</p>
<p dir="ltr">I believe vk_to_gen_compare_op above is unused after this. Please delete it.  Other than that,</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></p>
<p dir="ltr">><br>
> +/* Vulkan specifies the result of shadow comparisons as:<br>
> + *     1     if   ref <op> texel,<br>
> + *     0     otherwise.<br>
> + *<br>
> + * The hardware does:<br>
> + *     0     if texel <op> ref,<br>
> + *     1     otherwise.<br>
> + *<br>
> + * So, these look a bit strange because there's both a negation<br>
> + * and swapping of the arguments involved.<br>
> + */<br>
> +static const uint32_t vk_to_gen_shadow_compare_op[] = {<br>
> +   [VK_COMPARE_OP_NEVER]                        = PREFILTEROPALWAYS,<br>
> +   [VK_COMPARE_OP_LESS]                         = PREFILTEROPLEQUAL,<br>
> +   [VK_COMPARE_OP_EQUAL]                        = PREFILTEROPNOTEQUAL,<br>
> +   [VK_COMPARE_OP_LESS_OR_EQUAL]                = PREFILTEROPLESS,<br>
> +   [VK_COMPARE_OP_GREATER]                      = PREFILTEROPGEQUAL,<br>
> +   [VK_COMPARE_OP_NOT_EQUAL]                    = PREFILTEROPEQUAL,<br>
> +   [VK_COMPARE_OP_GREATER_OR_EQUAL]             = PREFILTEROPGREATER,<br>
> +   [VK_COMPARE_OP_ALWAYS]                       = PREFILTEROPNEVER,<br>
> +};<br>
> +<br>
>  VkResult genX(CreateSampler)(<br>
>      VkDevice                                    _device,<br>
>      const VkSamplerCreateInfo*                  pCreateInfo,<br>
> @@ -228,7 +250,7 @@ VkResult genX(CreateSampler)(<br>
>        .ChromaKeyEnable = 0,<br>
>        .ChromaKeyIndex = 0,<br>
>        .ChromaKeyMode = 0,<br>
> -      .ShadowFunction = vk_to_gen_compare_op[pCreateInfo->compareOp],<br>
> +      .ShadowFunction = vk_to_gen_shadow_compare_op[pCreateInfo->compareOp],<br>
>        .CubeSurfaceControlMode = OVERRIDE,<br>
><br>
>        .BorderColorPointer = border_color_offset,<br>
> --<br>
> 2.7.2<br>
><br>
</p>