Add a couple of new samples, improved some others: (#414)
new: - InstanceVersion: print out the instance version - PhysicalDeviceExtensions: print out the device specific extensions - PhysicalDeviceFeatures: print out the device specific features - PhysicalDeviceGroups: print out the device groups (interesting with SLI) - PhysicalDeviceMemoryProperties: print out the device specific memory properties - PhysicalDeviceQueueFamilyProperties: print out the device specific queue family properties - SurfaceCapabilities: print out the surface specific capabilities - SurfaceFormats: print out the supported surface specific formats improved: - InstanceExtensionProperties: print out the instance extensions alphabetically - InstanceLayerProperties: removed an unused local function - RayTracing: improved fence usage
This commit is contained in:
committed by
Markus Tavenrath
parent
178bf4ded7
commit
c06a3300f6
@@ -47,6 +47,11 @@ namespace vk
|
||||
return device->allocateMemoryUnique(vk::MemoryAllocateInfo(memoryRequirements.size, memoryTypeIndex));
|
||||
}
|
||||
|
||||
bool contains(std::vector<vk::ExtensionProperties> const& extensionProperties, std::string const& extensionName)
|
||||
{
|
||||
return std::find_if(extensionProperties.begin(), extensionProperties.end(), [&extensionName](vk::ExtensionProperties const& ep) { return extensionName == ep.extensionName; }) != extensionProperties.end();
|
||||
}
|
||||
|
||||
vk::UniqueCommandPool createCommandPool(vk::UniqueDevice &device, uint32_t queueFamilyIndex)
|
||||
{
|
||||
vk::CommandPoolCreateInfo commandPoolCreateInfo(vk::CommandPoolCreateFlagBits::eResetCommandBuffer, queueFamilyIndex);
|
||||
@@ -195,6 +200,10 @@ namespace vk
|
||||
{
|
||||
enabledLayers.push_back("VK_LAYER_KHRONOS_validation");
|
||||
}
|
||||
if (std::find(layers.begin(), layers.end(), "VK_LAYER_LUNARG_assistant_layer") == layers.end())
|
||||
{
|
||||
enabledLayers.push_back("VK_LAYER_LUNARG_assistant_layer");
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<char const*> enabledExtensions;
|
||||
@@ -212,8 +221,8 @@ namespace vk
|
||||
|
||||
// create a UniqueInstance
|
||||
vk::ApplicationInfo applicationInfo(appName.c_str(), 1, engineName.c_str(), 1, apiVersion);
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &applicationInfo, checked_cast<uint32_t>(enabledLayers.size()), enabledLayers.data(),
|
||||
checked_cast<uint32_t>(enabledExtensions.size()), enabledExtensions.data()));
|
||||
vk::InstanceCreateInfo instanceCreateInfo({}, &applicationInfo, checked_cast<uint32_t>(enabledLayers.size()), enabledLayers.data(), checked_cast<uint32_t>(enabledExtensions.size()), enabledExtensions.data());
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique(instanceCreateInfo);
|
||||
|
||||
#if (VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1)
|
||||
// initialize function pointers for instance
|
||||
@@ -807,7 +816,7 @@ namespace vk
|
||||
16.0f, false, vk::CompareOp::eNever, 0.0f, 0.0f, vk::BorderColor::eFloatOpaqueBlack));
|
||||
}
|
||||
|
||||
UUID::UUID(uint8_t data[VK_UUID_SIZE])
|
||||
UUID::UUID(uint8_t const data[VK_UUID_SIZE])
|
||||
{
|
||||
memcpy(m_data, data, VK_UUID_SIZE * sizeof(uint8_t));
|
||||
}
|
||||
|
||||
@@ -103,7 +103,9 @@ namespace vk
|
||||
SurfaceData(vk::UniqueInstance &instance, std::string const& className, std::string const& windowName, vk::Extent2D const& extent);
|
||||
|
||||
vk::Extent2D extent;
|
||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
HWND window;
|
||||
#endif
|
||||
vk::UniqueSurfaceKHR surface;
|
||||
};
|
||||
|
||||
@@ -196,7 +198,7 @@ namespace vk
|
||||
struct UUID
|
||||
{
|
||||
public:
|
||||
UUID(uint8_t data[VK_UUID_SIZE]);
|
||||
UUID(uint8_t const data[VK_UUID_SIZE]);
|
||||
|
||||
uint8_t m_data[VK_UUID_SIZE];
|
||||
};
|
||||
@@ -263,6 +265,7 @@ namespace vk
|
||||
|
||||
vk::UniqueDeviceMemory allocateMemory(vk::UniqueDevice const& device, vk::PhysicalDeviceMemoryProperties const& memoryProperties, vk::MemoryRequirements const& memoryRequirements,
|
||||
vk::MemoryPropertyFlags memoryPropertyFlags);
|
||||
bool contains(std::vector<vk::ExtensionProperties> const& extensionProperties, std::string const& extensionName);
|
||||
vk::UniqueCommandPool createCommandPool(vk::UniqueDevice &device, uint32_t queueFamilyIndex);
|
||||
vk::UniqueDebugUtilsMessengerEXT createDebugUtilsMessenger(vk::UniqueInstance &instance);
|
||||
vk::UniqueDescriptorPool createDescriptorPool(vk::UniqueDevice &device, std::vector<vk::DescriptorPoolSize> const& poolSizes);
|
||||
@@ -299,7 +302,7 @@ namespace vk
|
||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
HWND initializeWindow(std::string const& className, std::string const& windowName, LONG width, LONG height);
|
||||
#else
|
||||
#pragma error "unhandled platform"
|
||||
# error "unhandled platform"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user