// Copyright 2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "common/OSPCommon.ih"

OSPRAY_BEGIN_ISPC_NAMESPACE

struct PixelFilter;

/* Samples a relative pixel position proportional to the kernel of a
   pixel filter.

   The sampled position is relative to the center of a pixel. It converts a
   uniform 2D random variable s with values of the range [0..1) into a
   non-uniform 2D position in the range of [-w/2 .. w/2], where w =
   self->width. The center of the pixel filter kernel is [0,0], which
   represents a position at the center of the pixel.

   Returns a 2D position in the domain [-w/2 .. w/2] distributed proportionally
   to the filter kernel.
*/
SYCL_EXTERNAL vec2f PixelFilter_dispatch_sample(
    const PixelFilter *uniform self, const vec2f &x);

OSPRAY_END_ISPC_NAMESPACE
