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

@@ -39,26 +39,19 @@ int main(int /*argc*/, char ** /*argv*/)
assert(!physicalDevices.empty());
vk::PhysicalDeviceMemoryProperties memoryProperties = physicalDevices[0].getMemoryProperties();
uint32_t width = 500;
uint32_t height = 500;
#if defined(VK_USE_PLATFORM_WIN32_KHR)
HWND window = vk::su::initializeWindow(AppName, AppName, width, height);
vk::UniqueSurfaceKHR surface = instance->createWin32SurfaceKHRUnique(vk::Win32SurfaceCreateInfoKHR({}, GetModuleHandle(nullptr), window));
#else
#pragma error "unhandled platform"
#endif
vk::su::SurfaceData surfaceData(instance, AppName, AppName, vk::Extent2D(500, 500));
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex(physicalDevices[0], surface);
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());
vk::UniqueRenderPass renderPass = vk::su::createRenderPass(device, vk::su::pickColorFormat(physicalDevices[0].getSurfaceFormatsKHR(surface.get())), vk::Format::eD16Unorm);
vk::UniqueRenderPass renderPass = vk::su::createRenderPass(device, vk::su::pickColorFormat(physicalDevices[0].getSurfaceFormatsKHR(surfaceData.surface.get())), vk::Format::eD16Unorm);
vk::UniqueDescriptorSetLayout descriptorSetLayout = vk::su::createDescriptorSetLayout(device);
vk::UniquePipelineLayout pipelineLayout = device->createPipelineLayoutUnique(vk::PipelineLayoutCreateInfo(vk::PipelineLayoutCreateFlags(), 1, &descriptorSetLayout.get()));
glslang::InitializeProcess();
vk::UniqueShaderModule vertexShaderModule = vk::su::createShaderModule(device, vk::ShaderStageFlagBits::eVertex, vertexShaderText);
vk::UniqueShaderModule fragmentShaderModule = vk::su::createShaderModule(device, vk::ShaderStageFlagBits::eFragment, fragmentShaderText);
vk::UniqueShaderModule vertexShaderModule = vk::su::createShaderModule(device, vk::ShaderStageFlagBits::eVertex, vertexShaderText_PC_C);
vk::UniqueShaderModule fragmentShaderModule = vk::su::createShaderModule(device, vk::ShaderStageFlagBits::eFragment, fragmentShaderText_C_C);
glslang::FinalizeProcess();
/* VULKAN_KEY_START */
@@ -166,7 +159,7 @@ int main(int /*argc*/, char ** /*argv*/)
/* VULKAN_KEY_END */
#if defined(VK_USE_PLATFORM_WIN32_KHR)
DestroyWindow(window);
DestroyWindow(surfaceData.window);
#else
#pragma error "unhandled platform"
#endif