[Mesa-dev] [PATCH] anv: Fix backwards shadow comparisons

Jason Ekstrand jason at jlekstrand.net
Fri Mar 4 06:35:30 UTC 2016


On Mar 3, 2016 10:22 PM, "Kenneth Graunke" <kenneth at whitecape.org> wrote:
>
> sample_c is backwards from what GL and Vulkan expect.
>
> See intel_state.c in i965.
> ---
>  src/intel/vulkan/genX_state.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
> index 63ea269..e2bd95d 100644
> --- a/src/intel/vulkan/genX_state.c
> +++ b/src/intel/vulkan/genX_state.c
> @@ -184,6 +184,28 @@ static const uint32_t vk_to_gen_compare_op[] = {
>     [VK_COMPARE_OP_ALWAYS]                    = PREFILTEROPALWAYS,
>  };

I believe vk_to_gen_compare_op above is unused after this. Please delete
it.  Other than that,

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

>
> +/* Vulkan specifies the result of shadow comparisons as:
> + *     1     if   ref <op> texel,
> + *     0     otherwise.
> + *
> + * The hardware does:
> + *     0     if texel <op> ref,
> + *     1     otherwise.
> + *
> + * So, these look a bit strange because there's both a negation
> + * and swapping of the arguments involved.
> + */
> +static const uint32_t vk_to_gen_shadow_compare_op[] = {
> +   [VK_COMPARE_OP_NEVER]                        = PREFILTEROPALWAYS,
> +   [VK_COMPARE_OP_LESS]                         = PREFILTEROPLEQUAL,
> +   [VK_COMPARE_OP_EQUAL]                        = PREFILTEROPNOTEQUAL,
> +   [VK_COMPARE_OP_LESS_OR_EQUAL]                = PREFILTEROPLESS,
> +   [VK_COMPARE_OP_GREATER]                      = PREFILTEROPGEQUAL,
> +   [VK_COMPARE_OP_NOT_EQUAL]                    = PREFILTEROPEQUAL,
> +   [VK_COMPARE_OP_GREATER_OR_EQUAL]             = PREFILTEROPGREATER,
> +   [VK_COMPARE_OP_ALWAYS]                       = PREFILTEROPNEVER,
> +};
> +
>  VkResult genX(CreateSampler)(
>      VkDevice                                    _device,
>      const VkSamplerCreateInfo*                  pCreateInfo,
> @@ -228,7 +250,7 @@ VkResult genX(CreateSampler)(
>        .ChromaKeyEnable = 0,
>        .ChromaKeyIndex = 0,
>        .ChromaKeyMode = 0,
> -      .ShadowFunction = vk_to_gen_compare_op[pCreateInfo->compareOp],
> +      .ShadowFunction =
vk_to_gen_shadow_compare_op[pCreateInfo->compareOp],
>        .CubeSurfaceControlMode = OVERRIDE,
>
>        .BorderColorPointer = border_color_offset,
> --
> 2.7.2
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160303/cd49eae0/attachment-0001.html>


More information about the mesa-dev mailing list