File: device_feature_property_positive.cpp

package info (click to toggle)
vulkan-validationlayers 1.4.321.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,412 kB
  • sloc: cpp: 594,175; python: 11,321; sh: 24; makefile: 20; xml: 14
file content (58 lines) | stat: -rw-r--r-- 2,281 bytes parent folder | download | duplicates (9)
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
52
53
54
55
56
57
58
/*
 * Copyright (c) 2025 The Khronos Group Inc.
 * Copyright (c) 2025 Valve Corporation
 * Copyright (c) 2025 LunarG, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 */

#include <gtest/gtest.h>
#include <vulkan/vulkan_core.h>
#include "../framework/layer_validation_tests.h"

class PositiveDeviceFeatureProperty : public VkLayerTest {
  public:
    VkDeviceCreateInfo m_second_device_ci = vku::InitStructHelper();
    vkt::QueueCreateInfoArray *m_queue_info = nullptr;
    void InitDeviceFeatureProperty();

    ~PositiveDeviceFeatureProperty() {
        if (m_queue_info) {
            delete m_queue_info;
        }
    }
};

void PositiveDeviceFeatureProperty::InitDeviceFeatureProperty() {
    RETURN_IF_SKIP(Init());
    m_queue_info = new vkt::QueueCreateInfoArray(m_device->Physical().queue_properties_);
    m_second_device_ci.queueCreateInfoCount = m_queue_info->Size();
    m_second_device_ci.pQueueCreateInfos = m_queue_info->Data();
    m_second_device_ci.enabledExtensionCount = static_cast<uint32_t>(m_device_extension_names.size());
    m_second_device_ci.ppEnabledExtensionNames = m_device_extension_names.data();
}

TEST_F(PositiveDeviceFeatureProperty, VertexAttributeDivisor) {
    AddRequiredExtensions(VK_KHR_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME);
    RETURN_IF_SKIP(InitDeviceFeatureProperty());
    VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR vadf = vku::InitStructHelper();
    m_second_device_ci.pNext = &vadf;
    VkDevice second_device = VK_NULL_HANDLE;
    vk::CreateDevice(Gpu(), &m_second_device_ci, nullptr, &second_device);
    vk::DestroyDevice(second_device, nullptr);
}

TEST_F(PositiveDeviceFeatureProperty, PropertyWithoutExtension) {
    SetTargetApiVersion(VK_API_VERSION_1_1);
    RETURN_IF_SKIP(InitFramework());

    // query several properties which are unlikely to all be supported by the same physical device
    VkPhysicalDeviceDrmPropertiesEXT drm_props = vku::InitStructHelper();
    VkPhysicalDeviceLayeredDriverPropertiesMSFT layered_props = vku::InitStructHelper(&drm_props);

    GetPhysicalDeviceProperties2(layered_props);
}