SamplerVk.h#

The PVRVk Sampler class.

Includes#

  • PVRVk/DeviceVk.h

Included By#

Namespaces#

Classes#

Source Code#

#pragma once
#include "PVRVk/DeviceVk.h"

namespace pvrvk {
struct SamplerCreateInfo
{
    SamplerCreateInfo()
        : magFilter(pvrvk::Filter::e_LINEAR), minFilter(pvrvk::Filter::e_NEAREST), mipMapMode(pvrvk::SamplerMipmapMode::e_LINEAR), wrapModeU(pvrvk::SamplerAddressMode::e_REPEAT),
          wrapModeV(pvrvk::SamplerAddressMode::e_REPEAT), wrapModeW(pvrvk::SamplerAddressMode::e_REPEAT), compareOp(pvrvk::CompareOp::e_NEVER), compareOpEnable(false),
          enableAnisotropy(false), anisotropyMaximum(1.0f), lodBias(0.0f), lodMinimum(0.0f), lodMaximum(100.0f), unnormalizedCoordinates(false),
          borderColor(pvrvk::BorderColor::e_FLOAT_TRANSPARENT_BLACK), pNext(nullptr)
    {}

    SamplerCreateInfo(pvrvk::Filter magniFilter, pvrvk::Filter miniFilter, pvrvk::SamplerMipmapMode mipMapFilter = pvrvk::SamplerMipmapMode::e_LINEAR,
        pvrvk::SamplerAddressMode wrapModeU = pvrvk::SamplerAddressMode::e_REPEAT, pvrvk::SamplerAddressMode wrapModeV = pvrvk::SamplerAddressMode::e_REPEAT,
        pvrvk::SamplerAddressMode wrapModeW = pvrvk::SamplerAddressMode::e_REPEAT)
        : magFilter(magniFilter), minFilter(miniFilter), mipMapMode(mipMapFilter), wrapModeU(wrapModeU), wrapModeV(wrapModeV), wrapModeW(wrapModeW),
          compareOp(pvrvk::CompareOp::e_NEVER), compareOpEnable(false), enableAnisotropy(false), anisotropyMaximum(1.0f), lodBias(0.0f), lodMinimum(0.0f), lodMaximum(100.0f),
          unnormalizedCoordinates(false), borderColor(pvrvk::BorderColor::e_FLOAT_TRANSPARENT_BLACK), pNext(nullptr)
    {}

    pvrvk::Filter magFilter;
    pvrvk::Filter minFilter;
    pvrvk::SamplerMipmapMode mipMapMode;
    pvrvk::SamplerAddressMode wrapModeU;
    pvrvk::SamplerAddressMode wrapModeV;
    pvrvk::SamplerAddressMode wrapModeW;
    pvrvk::CompareOp compareOp;
    bool compareOpEnable;
    bool enableAnisotropy;
    float anisotropyMaximum;
    float lodBias;
    float lodMinimum;
    float lodMaximum;
    bool unnormalizedCoordinates;
    pvrvk::BorderColor borderColor;
    const void* pNext;
};

namespace impl {
class Sampler_ : public PVRVkDeviceObjectBase<VkSampler, ObjectType::e_SAMPLER>, public DeviceObjectDebugUtils<Sampler_>
{
private:
    friend class Device_;

    class make_shared_enabler
    {
    protected:
        make_shared_enabler() {}
        friend class Sampler_;
    };

    static Sampler constructShared(const DeviceWeakPtr& device, const SamplerCreateInfo& createInfo)
    {
        return std::make_shared<Sampler_>(make_shared_enabler{}, device, createInfo);
    }

    SamplerCreateInfo _createInfo;

public:
    DECLARE_NO_COPY_SEMANTICS(Sampler_)
    Sampler_(make_shared_enabler, const DeviceWeakPtr& device, const pvrvk::SamplerCreateInfo& desc);

    ~Sampler_();

    const SamplerCreateInfo& getCreateInfo() const { return _createInfo; }
};
} // namespace impl
} // namespace pvrvk