mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 15:24:34 +00:00
Refactor GenericFeaturesPNextNode
This commit is contained in:
parent
c607a65755
commit
75db58ae8b
@ -37,6 +37,18 @@ namespace vkb {
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
GenericFeaturesPNextNode::GenericFeaturesPNextNode()
|
||||||
|
: fields() {} // zero initializes the array of fields
|
||||||
|
|
||||||
|
bool GenericFeaturesPNextNode::match(
|
||||||
|
GenericFeaturesPNextNode const& requested, GenericFeaturesPNextNode const& supported) {
|
||||||
|
assert(requested.sType == supported.sType && "Non-matching sTypes in features nodes!");
|
||||||
|
for (uint32_t i = 0; i < field_capacity; i++) {
|
||||||
|
if (requested.fields[i] && !supported.fields[i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
class VulkanFunctions {
|
class VulkanFunctions {
|
||||||
private:
|
private:
|
||||||
std::mutex init_mutex;
|
std::mutex init_mutex;
|
||||||
|
@ -117,26 +117,16 @@ template <typename T> class Result {
|
|||||||
|
|
||||||
struct GenericFeaturesPNextNode {
|
struct GenericFeaturesPNextNode {
|
||||||
|
|
||||||
GenericFeaturesPNextNode() : sType(static_cast<VkStructureType>(0)), pNext(nullptr) {
|
GenericFeaturesPNextNode();
|
||||||
for (auto& field : fields) {
|
|
||||||
field = 0;
|
template <typename T> void set(T const& features) { *reinterpret_cast<T*>(this) = features; }
|
||||||
}
|
|
||||||
}
|
static bool match(GenericFeaturesPNextNode const& requested, GenericFeaturesPNextNode const& supported);
|
||||||
|
|
||||||
VkStructureType sType = static_cast<VkStructureType>(0);
|
VkStructureType sType = static_cast<VkStructureType>(0);
|
||||||
void* pNext = nullptr;
|
void* pNext = nullptr;
|
||||||
static const uint32_t field_capacity = 256;
|
static const uint32_t field_capacity = 256;
|
||||||
VkBool32 fields[field_capacity];
|
VkBool32 fields[field_capacity];
|
||||||
|
|
||||||
template <typename T> void set(T const& features) { *reinterpret_cast<T*>(this) = features; }
|
|
||||||
|
|
||||||
static bool match(GenericFeaturesPNextNode const& requested, GenericFeaturesPNextNode const& supported) {
|
|
||||||
assert(requested.sType == supported.sType && "Non-matching sTypes in features nodes!");
|
|
||||||
for (uint32_t i = 0; i < field_capacity; i++) {
|
|
||||||
if (requested.fields[i] && !supported.fields[i]) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
Loading…
Reference in New Issue
Block a user