Add sample Template; some generalization in utils; some minor improvements in some samples. (#349)
* Add samples SecondaryCommandBuffer and SeparateImageSampler. + made some helper functions more explicit. * Add sample Template, some generalizations in utils, some minor improvements in various samples.
This commit is contained in:
committed by
Markus Tavenrath
parent
89a56017a8
commit
d811c3a7e2
@@ -31,18 +31,17 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
vk::UniqueDebugReportCallbackEXT debugReportCallback = vk::su::createDebugReportCallback(instance);
|
||||
#endif
|
||||
|
||||
std::vector<vk::PhysicalDevice> physicalDevices = instance->enumeratePhysicalDevices();
|
||||
assert(!physicalDevices.empty());
|
||||
vk::PhysicalDevice physicalDevice = instance->enumeratePhysicalDevices().front();
|
||||
|
||||
vk::su::SurfaceData surfaceData(instance, AppName, AppName, vk::Extent2D(500, 500));
|
||||
|
||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex(physicalDevices[0], *surfaceData.surface);
|
||||
vk::UniqueDevice device = vk::su::createDevice(physicalDevices[0], graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions());
|
||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex(physicalDevice, *surfaceData.surface);
|
||||
vk::UniqueDevice device = vk::su::createDevice(physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions());
|
||||
|
||||
/* VULKAN_HPP_KEY_START */
|
||||
|
||||
const vk::Format depthFormat = vk::Format::eD16Unorm;
|
||||
vk::FormatProperties formatProperties = physicalDevices[0].getFormatProperties(depthFormat);
|
||||
vk::FormatProperties formatProperties = physicalDevice.getFormatProperties(depthFormat);
|
||||
|
||||
vk::ImageTiling tiling;
|
||||
if (formatProperties.linearTilingFeatures & vk::FormatFeatureFlagBits::eDepthStencilAttachment)
|
||||
@@ -60,7 +59,7 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
vk::ImageCreateInfo imageCreateInfo(vk::ImageCreateFlags(), vk::ImageType::e2D, depthFormat, vk::Extent3D(surfaceData.extent, 1), 1, 1, vk::SampleCountFlagBits::e1, tiling, vk::ImageUsageFlagBits::eDepthStencilAttachment);
|
||||
vk::UniqueImage depthImage = device->createImageUnique(imageCreateInfo);
|
||||
|
||||
vk::PhysicalDeviceMemoryProperties memoryProperties = physicalDevices[0].getMemoryProperties();
|
||||
vk::PhysicalDeviceMemoryProperties memoryProperties = physicalDevice.getMemoryProperties();
|
||||
vk::MemoryRequirements memoryRequirements = device->getImageMemoryRequirements(depthImage.get());
|
||||
uint32_t typeBits = memoryRequirements.memoryTypeBits;
|
||||
uint32_t typeIndex = uint32_t(~0);
|
||||
|
||||
Reference in New Issue
Block a user