Add samples 16_Vulkan_1_1, CopyBlitImage, CreateDebugReportCallback, DrawTexturedCube (#304)

+ slightly adjust some other samples.
This commit is contained in:
Andreas Süßenbach
2019-03-26 12:24:36 +01:00
committed by Markus Tavenrath
parent 7905145361
commit 2d8483e06f
22 changed files with 1209 additions and 237 deletions

View File

@@ -15,6 +15,7 @@
// VulkanHpp Samples : 09_InitDescriptorSet
// Initialize a descriptor set
#include "../utils/math.hpp"
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iostream>
@@ -40,10 +41,8 @@ int main(int /*argc*/, char ** /*argv*/)
vk::UniqueDevice device = vk::su::createDevice(physicalDevices[0], vk::su::findGraphicsQueueFamilyIndex(physicalDevices[0].getQueueFamilyProperties()));
vk::UniqueBuffer buffer = device->createBufferUnique(vk::BufferCreateInfo(vk::BufferCreateFlags(), sizeof(glm::mat4x4), vk::BufferUsageFlagBits::eUniformBuffer));
vk::UniqueDeviceMemory deviceMemory = vk::su::allocateMemory(device, physicalDevices[0].getMemoryProperties(), device->getBufferMemoryRequirements(buffer.get()), vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent);
device->bindBufferMemory(buffer.get(), deviceMemory.get(), 0);
vk::su::BufferData uniformBufferData(physicalDevices[0], device, sizeof(glm::mat4x4), vk::BufferUsageFlagBits::eUniformBuffer);
vk::su::copyToDevice(device, uniformBufferData.deviceMemory, vk::su::createModelViewProjectionClipMatrix());
vk::UniqueDescriptorSetLayout descriptorSetLayout = vk::su::createDescriptorSetLayout(device);
@@ -56,7 +55,7 @@ int main(int /*argc*/, char ** /*argv*/)
// allocate a descriptor set
std::vector<vk::UniqueDescriptorSet> descriptorSets = device->allocateDescriptorSetsUnique(vk::DescriptorSetAllocateInfo(descriptorPool.get(), 1, &descriptorSetLayout.get()));
vk::DescriptorBufferInfo descriptorBufferInfo(buffer.get(), 0, sizeof(glm::mat4x4));
vk::DescriptorBufferInfo descriptorBufferInfo(uniformBufferData.buffer.get(), 0, sizeof(glm::mat4x4));
device->updateDescriptorSets(vk::WriteDescriptorSet(descriptorSets[0].get(), 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &descriptorBufferInfo), {});
/* VULKAN_HPP_KEY_END */

View File

@@ -17,11 +17,13 @@ cmake_minimum_required(VERSION 3.2)
project(09_InitDescriptorSet)
set(HEADERS
../utils/math.hpp
../utils/utils.hpp
)
set(SOURCES
09_InitDescriptorSet.cpp
../utils/math.cpp
../utils/utils.cpp
)