-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfeature.cpp
51 lines (43 loc) · 2.09 KB
/
feature.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "feature_detect.h"
#include "util.h"
#pragma GCC diagnostic ignored "-Wunused-variable"
int main()
{
feature_detection detect;
VkPhysicalDeviceFeatures feat10 = {};
assert(feat10.logicOp == VK_FALSE); // not used
VkPipelineColorBlendStateCreateInfo pipeinfo = {};
detect.check_VkPipelineColorBlendStateCreateInfo(&pipeinfo);
detect.adjust_VkPhysicalDeviceFeatures(feat10);
assert(feat10.logicOp == VK_FALSE); // still not used
feat10.logicOp = VK_TRUE; // set to used, but not actually used
detect.adjust_VkPhysicalDeviceFeatures(feat10);
assert(feat10.logicOp == VK_FALSE); // corretly corrected to not used
feat10.logicOp = VK_TRUE; // set to used
pipeinfo.logicOpEnable = VK_TRUE; // used here
detect.check_VkPipelineColorBlendStateCreateInfo(&pipeinfo);
detect.adjust_VkPhysicalDeviceFeatures(feat10);
assert(feat10.logicOp == VK_TRUE); // not changed, still used
VkPhysicalDeviceVulkan12Features feat12 = {};
detect.adjust_VkPhysicalDeviceVulkan12Features(feat12);
assert(feat12.drawIndirectCount == VK_FALSE);
assert(feat12.hostQueryReset == VK_FALSE);
feat12.drawIndirectCount = VK_TRUE;
detect.adjust_VkPhysicalDeviceVulkan12Features(feat12);
assert(feat12.drawIndirectCount == VK_FALSE); // was adjusted
feat12.drawIndirectCount = VK_TRUE;
detect.check_vkCmdDrawIndirectCount(0, 0, 0, 0, 0, 0, 0); // actually use feature
detect.adjust_VkPhysicalDeviceVulkan12Features(feat12);
assert(feat12.drawIndirectCount == VK_TRUE); // now unchanged
assert(feat12.hostQueryReset == VK_FALSE); // also unchanged
VkBaseOutStructure second = { (VkStructureType)2, nullptr };
VkBaseOutStructure first = { (VkStructureType)1, &second };
VkBaseOutStructure root = { (VkStructureType)0, &first };
assert(find_extension_parent(&root, (VkStructureType)0) == nullptr);
assert(find_extension_parent(&root, (VkStructureType)1) == &root);
assert(find_extension_parent(&root, (VkStructureType)2) == &first);
assert(find_extension(&root, (VkStructureType)0) == &root);
assert(find_extension(&root, (VkStructureType)1) == &first);
assert(find_extension(&root, (VkStructureType)2) == &second);
return 0;
}