ExtensionsVk.h#

Functionality that helps management of Vulkan extensions, such as enumerating, enabling/disabling.

Includes#

  • PVRVk/TypesVk.h

  • PVRVk/pvrvk_vulkan_sc_minimal_wrapper.h

  • PVRVk/pvrvk_vulkan_wrapper.h

Included By#

Namespaces#

Classes#

Functions#

Source Code#

#pragma once

#include "PVRVk/TypesVk.h"
#include "PVRVk/pvrvk_vulkan_wrapper.h"
#include "PVRVk/pvrvk_vulkan_sc_minimal_wrapper.h"

namespace pvrvk {
namespace Extensions {

extern VulkanExtensionList filterExtensions(const std::vector<pvrvk::ExtensionProperties>& extensionProperties, const VulkanExtensionList& extensionsToEnable);

void enumerateInstanceExtensions(std::vector<ExtensionProperties>& outExtensions);

void enumerateInstanceExtensions(std::vector<ExtensionProperties>& outExtensions, const std::string& layerName);

bool isInstanceExtensionSupported(const std::string& extension);
} // namespace Extensions

class FragmentShadingRate : private VkPhysicalDeviceFragmentShadingRateKHR
{
public:
    FragmentShadingRate()
    {
        sampleCounts = static_cast<VkSampleCountFlags>(SampleCountFlags::e_NONE);
        fragmentSize = Extent2D().get();
    }
    FragmentShadingRate(VkPhysicalDeviceFragmentShadingRateKHR vkType) : VkPhysicalDeviceFragmentShadingRateKHR(vkType) {}
    FragmentShadingRate(SampleCountFlags sampleCounts, Extent2D fragmentSize)
    {
        this->sampleCounts = static_cast<VkSampleCountFlags>(sampleCounts);
        this->fragmentSize = fragmentSize.get();
    }

    inline VkPhysicalDeviceFragmentShadingRateKHR& get() { return *this; }

    inline const VkPhysicalDeviceFragmentShadingRateKHR& get() const { return *this; }

    inline Extent2D getFragmentSize() const { return static_cast<Extent2D>(fragmentSize); }

    inline SampleCountFlags getSampleCount() const { return static_cast<SampleCountFlags>(sampleCounts); }
};

class FragmentShadingRateProperties : public VkPhysicalDeviceFragmentShadingRatePropertiesKHR
{
public:
    FragmentShadingRateProperties(void* pNext = nullptr)
    {
        sType = static_cast<VkStructureType>(StructureType::e_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR);
        this->pNext = pNext;
        minFragmentShadingRateAttachmentTexelSize = VkExtent2D();
        maxFragmentShadingRateAttachmentTexelSize = VkExtent2D();
        maxFragmentShadingRateAttachmentTexelSizeAspectRatio = 0;
        primitiveFragmentShadingRateWithMultipleViewports = (VkBool32) false;
        layeredShadingRateAttachments = (VkBool32) false;
        fragmentShadingRateNonTrivialCombinerOps = (VkBool32) false;
        maxFragmentSize = VkExtent2D();
        maxFragmentSizeAspectRatio = 0;
        maxFragmentShadingRateCoverageSamples = 0;
        maxFragmentShadingRateRasterizationSamples = VkSampleCountFlagBits();
        fragmentShadingRateWithShaderDepthStencilWrites = (VkBool32) false;
        fragmentShadingRateWithSampleMask = (VkBool32) false;
        fragmentShadingRateWithShaderSampleMask = (VkBool32) false;
        fragmentShadingRateWithConservativeRasterization = (VkBool32) false;
        fragmentShadingRateWithFragmentShaderInterlock = (VkBool32) false;
        fragmentShadingRateWithCustomSampleLocations = (VkBool32) false;
        fragmentShadingRateStrictMultiplyCombiner = (VkBool32) false;
    }
    FragmentShadingRateProperties(VkPhysicalDeviceFragmentShadingRatePropertiesKHR vkType) : VkPhysicalDeviceFragmentShadingRatePropertiesKHR(vkType) {}

    inline VkPhysicalDeviceFragmentShadingRatePropertiesKHR* getVkPtr()
    {
        return (VkPhysicalDeviceFragmentShadingRatePropertiesKHR*)((char*)this + offsetof(FragmentShadingRateProperties, sType));
    }

    inline VkPhysicalDeviceFragmentShadingRatePropertiesKHR& get() { return *this; }

    inline const VkPhysicalDeviceFragmentShadingRatePropertiesKHR& get() const { return *this; }

    inline void* getPNext() const { return pNext; }

    FragmentShadingRateProperties& setPNext(void* pNextPointer)
    {
        this->pNext = pNextPointer;
        return *this;
    }
};

class ExtensionFeatures
{
public:
    virtual inline void* getVkPtr() = 0;

    virtual inline StructureType getSType() const = 0;

    virtual inline void* getPNext() const = 0;

    virtual ExtensionFeatures& setPNext(void* pNext) = 0;
};

class FragmentShadingRateFeatures : private VkPhysicalDeviceFragmentShadingRateFeaturesKHR, public ExtensionFeatures
{
public:
    FragmentShadingRateFeatures(void* pNext = nullptr)
    {
        sType = static_cast<VkStructureType>(StructureType::e_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR);
        this->pNext = pNext;
        pipelineFragmentShadingRate = (VkBool32) false;
        primitiveFragmentShadingRate = (VkBool32) false;
        attachmentFragmentShadingRate = (VkBool32) false;
    }

    FragmentShadingRateFeatures(VkPhysicalDeviceFragmentShadingRateFeaturesKHR vkType) : VkPhysicalDeviceFragmentShadingRateFeaturesKHR(vkType) {}

    inline void* getVkPtr() { return static_cast<void*>((char*)this + offsetof(FragmentShadingRateFeatures, sType)); }

    inline StructureType getSType() const { return static_cast<StructureType>(sType); }

    inline void* getPNext() const { return pNext; }

    ExtensionFeatures& setPNext(void* pNextPointer)
    {
        this->pNext = pNextPointer;
        return *this;
    }

    inline void setPipelineFeature(bool inPipelineFragmentShadingRate) { this->pipelineFragmentShadingRate = inPipelineFragmentShadingRate; }

    inline void setPrimitiveFeature(bool inPrimitiveFragmentShadingRate) { this->primitiveFragmentShadingRate = inPrimitiveFragmentShadingRate; }

    inline void setAttachmentFeature(bool inAttachmentFragmentShadingRate) { this->attachmentFragmentShadingRate = inAttachmentFragmentShadingRate; }

    inline VkPhysicalDeviceFragmentShadingRateFeaturesKHR& get() { return *this; }

    inline bool getPipelineFeature() const { return (bool)pipelineFragmentShadingRate; }

    inline bool getPrimitiveFeature() const { return (bool)primitiveFragmentShadingRate; }

    inline bool getAttachmentFeature() const { return (bool)attachmentFragmentShadingRate; }
};

class RayTracingPipelineFeatures : private VkPhysicalDeviceRayTracingPipelineFeaturesKHR, public ExtensionFeatures
{
public:
    RayTracingPipelineFeatures(void* pNext = nullptr)
    {
        sType = static_cast<VkStructureType>(StructureType::e_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR);
        this->pNext = pNext;
        rayTracingPipeline = (VkBool32)false;
        rayTracingPipelineShaderGroupHandleCaptureReplay = (VkBool32)false;
        rayTracingPipelineShaderGroupHandleCaptureReplayMixed = (VkBool32)false;
        rayTracingPipelineTraceRaysIndirect = (VkBool32)false;
        rayTraversalPrimitiveCulling = (VkBool32)false;
    }
    RayTracingPipelineFeatures(VkPhysicalDeviceRayTracingPipelineFeaturesKHR vkType) : VkPhysicalDeviceRayTracingPipelineFeaturesKHR(vkType) {}

    inline void* getVkPtr() { return static_cast<void*>((char*)this + offsetof(RayTracingPipelineFeatures, sType)); }

    inline StructureType getSType() const { return static_cast<StructureType>(sType); }

    inline void* getPNext() const { return pNext; }

    ExtensionFeatures& setPNext(void* pNextPointer)
    {
        this->pNext = pNextPointer;
        return *this;
    }

    inline VkPhysicalDeviceRayTracingPipelineFeaturesKHR& get() { return *this; }

    inline bool getRayTracingPipeline() { return static_cast<bool>(rayTracingPipeline); }
    inline bool getRayTracingPipelineShaderGroupHandleCaptureReplay() { return static_cast<bool>(rayTracingPipelineShaderGroupHandleCaptureReplay); }
    inline bool getRayTracingPipelineShaderGroupHandleCaptureReplayMixed() { return static_cast<bool>(rayTracingPipelineShaderGroupHandleCaptureReplayMixed); }
    inline bool getRayTracingPipelineTraceRaysIndirect() { return static_cast<bool>(rayTracingPipelineTraceRaysIndirect); }
    inline bool getRayTraversalPrimitiveCulling() { return static_cast<bool>(rayTraversalPrimitiveCulling); }
};

} // namespace pvrvk