mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-10 02:41:47 +00:00
Refactor GenericFeaturesPNextNode
This commit is contained in:
parent
c607a65755
commit
75db58ae8b
@ -37,6 +37,18 @@ namespace vkb {
|
||||
|
||||
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 {
|
||||
private:
|
||||
std::mutex init_mutex;
|
||||
|
@ -117,26 +117,16 @@ template <typename T> class Result {
|
||||
|
||||
struct GenericFeaturesPNextNode {
|
||||
|
||||
GenericFeaturesPNextNode() : sType(static_cast<VkStructureType>(0)), pNext(nullptr) {
|
||||
for (auto& field : fields) {
|
||||
field = 0;
|
||||
}
|
||||
}
|
||||
GenericFeaturesPNextNode();
|
||||
|
||||
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);
|
||||
void* pNext = nullptr;
|
||||
static const uint32_t field_capacity = 256;
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user