Removed out-dated documentation

This commit is contained in:
saschawillems 2018-01-29 20:44:53 +01:00
parent d46203b890
commit 1a31d3f271
5 changed files with 1 additions and 142 deletions

View file

@ -406,4 +406,5 @@ Please note that (some) models and textures use separate licenses. Please comply
- [Official list of Vulkan resources](https://www.khronos.org/vulkan/resources) - [Official list of Vulkan resources](https://www.khronos.org/vulkan/resources)
- [Vulkan API specifications](https://www.khronos.org/registry/vulkan/specs/1.0/apispec.html) ([quick reference cards](https://www.khronos.org/registry/vulkan/specs/1.0/refguide/Vulkan-1.0-web.pdf)) - [Vulkan API specifications](https://www.khronos.org/registry/vulkan/specs/1.0/apispec.html) ([quick reference cards](https://www.khronos.org/registry/vulkan/specs/1.0/refguide/Vulkan-1.0-web.pdf))
- [SPIR-V specifications](https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html) - [SPIR-V specifications](https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html)
- [My 2016 Khronos Munich Chapter Meeting Vulkan presentation](https://www.saschawillems.de/wp-content/uploads/2018/01/Khronos_meetup_munich_fromGLtoVulkan.pdf)
- [My personal view on Vulkan (as a hobby developer)](http://www.saschawillems.de/?p=1886) - [My personal view on Vulkan (as a hobby developer)](http://www.saschawillems.de/?p=1886)

View file

@ -1,8 +0,0 @@
## Additional documentation
### Source
- [Vulkan swap chain class](./swapchain.md)
- [Vulkan example base class](./examplebaseclass.md)
### Presentations
- [From OpenGL to Vulkan (Khronos Meetup Munich, 2016-04-08)](./Khronos_meetup_munich_fromGLtoVulkan.pdf)

View file

@ -1,42 +0,0 @@
## Vulkan example base class
All examples are derived from a base class that encapsulates common used Vulkan functionality and all the setup stuff that's not necessary to repeat for each example. It also contains functions to load shaders and an easy wrapper to enable debugging via the validation layers.
If you want to create an example based on this base class, simply derive :
```cpp
#include "vulkanexamplebase.h"
...
class MyVulkanExample : public VulkanExampleBase
{
...
VulkanExample()
{
width = 1024;
height = 1024;
zoom = -15;
rotation = glm::vec3(-45.0, 22.5, 0.0);
title = "My new Vulkan Example";
}
}
```
##### Validation layers
The example base class offers a constructor overload for enabling a default set of Vulkan validation layers (for debugging purposes). If you want to use this functionality, simply use the construtor override :
```cpp
VulkanExample() : VulkanExampleBase(true)
{
...
}
```
This will cause a console window to be displayed containing all validation errors.
If you also want to display validation warnings, you need to uncomment the following line in "vulkandebug.cpp" (base directory) :
```cpp
if (flags & VK_DBG_REPORT_WARN_BIT)
{
// Uncomment to see warnings
// std::cout << "WARNING: " << "[" << pLayerPrefix << "] Code " << msgCode << " : " << pMsg << "\n";
}
```

View file

@ -1,92 +0,0 @@
## Swap chain class
```cpp
#include "base/vulkanswapchain.hpp"
```
The swap chain class connects to the platform specific surface and creates a collection of images to be presented to the windowing system.
A swap chain can hold an arbitrary number of images that can be presented to the windowing system once rendering to them is finished. At minimum it will contain two images, which is then similar to OpenGL's double buffering using a back and front buffer.
### Prerequisites
In order to use the swap chain you need to explicitly request the platform specific surface extension on at instance level :
```cpp
std::vector<const char*> enabledExtensions = { VK_KHR_SURFACE_EXTENSION_NAME };
// For windows
enabledExtensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
VkInstanceCreateInfo instanceCreateInfo = {};
...
instanceCreateInfo.enabledExtensionCount = enabledExtensions.size();
instanceCreateInfo.ppEnabledExtensionNames = enabledExtensions.data();
```
And the swap chain extension at device level :
```cpp
std::vector<const char*> enabledExtensions = { VK_KHR_SWAPCHAIN_EXTENSION_NAME };
VkDeviceCreateInfo deviceCreateInfo = {};
...
deviceCreateInfo.enabledExtensionCount = enabledExtensions.size();
deviceCreateInfo.ppEnabledExtensionNames = enabledExtensions.data();
```
### Connecting
```cpp
VulkanSwapChain::connect();
```
### Initializing the surface
```cpp
VulkanSwapChain::initSurface();
```
This will create the platform specific surface (parameters depend on OS) that's connected to your window. The function also selects a supported color format and space to be used for the swap chain images and gets indices for the graphics and presenting queue that the images will be submitted to.
### Creating the swap chain (images)
```cpp
VulkanSwapChain::create();
```
Creates the swap chain (and destroys it if it's to be recreated, e.g. for window resize) and also creates the images and image views to be used.
Note that you need to pass a valid command buffer as this also does the initial image transitions for the created images :
```cpp
//
vkTools::setImageLayout(
cmdBuffer,
buffers[i].image,
VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR);
```
### Using the swap chain
Once everything is setup, the swap chain can used in your render loop :
```cpp
...
// Get next image in the swap chain
err = swapChain.acquireNextImage(presentCompleteSemaphore, &currentBuffer);
assert(!err);
// Submit command buffers
VkSubmitInfo submitInfo = vkTools::initializers::submitInfo();
...
err = vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE);
assert(!err);
// Present current swap chain image to the (graphics) and presenting queue
err = swapChain.queuePresent(queue, currentBuffer);
assert(!err);
...
// The post present barrier is an important part of the render loop
// It adds an image barrier to the queue that transforms the currentBuffer
// swap chain image from VK_IMAGE_LAYOUT_PRESENT_SRC_KHR to VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
// so it can be used as a color attachment
submitPostPresentBarrier(swapChain.buffers[currentBuffer].image);
...
```