Refactored Graphics #297

Merged
Xenosas1337 merged 13 commits from SP3-1-Rendering into main 2023-01-01 12:35:09 +08:00
3 changed files with 81 additions and 66 deletions
Showing only changes of commit 118ad33109 - Show all commits

View File

@ -198,12 +198,13 @@ namespace SHADE
InitDummyPipelineLayouts (logicalDevice); InitDummyPipelineLayouts (logicalDevice);
} }
std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHEnumWrapper<SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes> types) noexcept std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes types) noexcept
{ {
std::vector<Handle<SHVkDescriptorSetLayout>> layoutsFound; std::vector<Handle<SHVkDescriptorSetLayout>> layoutsFound;
for (uint8_t i = 0; i < numPredefinedDescSetLayoutTypes; ++i) for (uint8_t i = 0; i < numPredefinedDescSetLayoutTypes; ++i)
{ {
if (types & (static_cast<uint64_t>(1) << i)) auto result = types & static_cast<SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes>(static_cast<uint64_t>(1) << i);
if (static_cast<uint64_t>(result))
layoutsFound.push_back(predefinedLayouts[i]); layoutsFound.push_back(predefinedLayouts[i]);
} }
@ -226,6 +227,17 @@ namespace SHADE
return perSystemData[static_cast<uint32_t>(systemType)].descMappings.GetMappings(); return perSystemData[static_cast<uint32_t>(systemType)].descMappings.GetMappings();
} }
SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes operator|(SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes lhs, SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes rhs) noexcept
{
return static_cast<SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes>(static_cast<uint64_t>(lhs) | static_cast<uint64_t>(rhs));
}
SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes operator&(SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes lhs, SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes rhs) noexcept
{
return static_cast<SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes>(static_cast<uint64_t>(lhs) & static_cast<uint64_t>(rhs));
}
//SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetBatchingSystemData(void) noexcept //SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetBatchingSystemData(void) noexcept
//{ //{
// return batchingSystemData; // return batchingSystemData;

View File

@ -88,12 +88,15 @@ namespace SHADE
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* SETTERS AND GETTERS */ /* SETTERS AND GETTERS */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static std::vector<Handle<SHVkDescriptorSetLayout>> GetPredefinedDescSetLayouts (SHEnumWrapper<SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes> types) noexcept; static std::vector<Handle<SHVkDescriptorSetLayout>> GetPredefinedDescSetLayouts (SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes types) noexcept;
static SHVertexInputState const& GetDefaultViState (void) noexcept; static SHVertexInputState const& GetDefaultViState (void) noexcept;
static PerSystem const& GetSystemData (SystemType systemType) noexcept; static PerSystem const& GetSystemData (SystemType systemType) noexcept;
static SHDescriptorMappings::MapType const& GetMappings (SystemType systemType) noexcept; static SHDescriptorMappings::MapType const& GetMappings (SystemType systemType) noexcept;
//static PerSystem const& GetBatchingSystemData(void) noexcept; //static PerSystem const& GetBatchingSystemData(void) noexcept;
//static PerSystem const& GetTextSystemData(void) noexcept; //static PerSystem const& GetTextSystemData(void) noexcept;
//static PerSystem const& GetRenderGraphNodeComputeData(void) noexcept; //static PerSystem const& GetRenderGraphNodeComputeData(void) noexcept;
}; };
SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes operator| (SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes lhs, SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes rhs) noexcept;
SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes operator& (SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes lhs, SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes rhs) noexcept;
} }

View File

@ -2,66 +2,66 @@
#include <iostream> #include <iostream>
namespace SHADE //namespace SHADE
{ //{
template<typename BitType> // template<typename BitType>
class SHEnumWrapper // class SHEnumWrapper
{ // {
public: // public:
using UnderlyingType = typename std::underlying_type_t<BitType>; // using UnderlyingType = typename std::underlying_type_t<BitType>;
//
private: // private:
UnderlyingType mask; // UnderlyingType mask;
//
public: // public:
//
constexpr SHEnumWrapper(void) noexcept // constexpr SHEnumWrapper(void) noexcept
: mask{ 0 } // : mask{ 0 }
{ // {
//
}; // };
//
constexpr SHEnumWrapper(BitType bit) noexcept // constexpr SHEnumWrapper(BitType bit) noexcept
: mask{ static_cast<UnderlyingType>(bit) } // : mask{ static_cast<UnderlyingType>(bit) }
{ // {
//
}; // };
//
constexpr SHEnumWrapper(SHEnumWrapper<BitType> const& rhs) noexcept = default; // constexpr SHEnumWrapper(SHEnumWrapper<BitType> const& rhs) noexcept = default;
constexpr SHEnumWrapper& operator= (SHEnumWrapper<BitType> const& rhs) noexcept = default; // constexpr SHEnumWrapper& operator= (SHEnumWrapper<BitType> const& rhs) noexcept = default;
//
constexpr explicit SHEnumWrapper(UnderlyingType flags) noexcept // constexpr explicit SHEnumWrapper(UnderlyingType flags) noexcept
: mask{ flags } // : mask{ flags }
{ // {
//
}; // };
//
constexpr SHEnumWrapper<BitType> operator| (SHEnumWrapper<BitType> const& rhs) const noexcept // constexpr SHEnumWrapper<BitType> operator| (SHEnumWrapper<BitType> const& rhs) const noexcept
{ // {
return static_cast<SHEnumWrapper<BitType>> (mask | rhs.mask); // return static_cast<SHEnumWrapper<BitType>> (mask | rhs.mask);
}; // };
//
constexpr SHEnumWrapper<BitType> operator& (SHEnumWrapper<BitType> const& rhs) const noexcept // constexpr SHEnumWrapper<BitType> operator& (SHEnumWrapper<BitType> const& rhs) const noexcept
{ // {
return static_cast<SHEnumWrapper<BitType>> (mask & rhs.mask); // return static_cast<SHEnumWrapper<BitType>> (mask & rhs.mask);
}; // };
//
constexpr operator UnderlyingType() const noexcept // constexpr operator UnderlyingType() const noexcept
{ // {
return mask; // return mask;
}; // };
}; // };
//
template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>> // template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>>
inline BitType operator|(const BitType& left, const BitType& right) // inline BitType operator|(const BitType& left, const BitType& right)
{ // {
return static_cast<BitType>(static_cast<int>(left) | static_cast<int>(right)); // return static_cast<BitType>(static_cast<int>(left) | static_cast<int>(right));
} // }
//
template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>> // template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>>
inline BitType operator&(const BitType& left, const BitType& right) // inline BitType operator&(const BitType& left, const BitType& right)
{ // {
return static_cast<BitType>(static_cast<int>(left) & static_cast<int>(right)); // return static_cast<BitType>(static_cast<int>(left) & static_cast<int>(right));
} // }
//
} //}