diff --git a/README.md b/README.md
index f3556b62..44f549a8 100644
--- a/README.md
+++ b/README.md
@@ -99,10 +99,10 @@ Uses [assimp](https://github.com/assimp/assimp) to load and a mesh from a common
Shows the use of instancing for rendering the same mesh with differing uniforms with one single draw command. This saves performance if the same mesh has to be rendered multiple times.
-## [Skeletal animation](skeletalanimation/)
-
+## [Multi sampling](multisampling/)
+
-Based on the mesh loading example, this example loads and displays a rigged COLLADA model including animations. Bone weights are extracted for each vertex and are passed to the vertex shader together with the final bone transformation matrices for vertex position calculations.
+Demonstrates the use of resolve attachments for doing multisampling. Instead of doing an explicit resolve from a multisampled image this example creates multisampled attachments for the color and depth buffer and sets up the render pass to use these as resolve attachments that will get resolved to the visible frame buffer at the end of this render pass. To highlight MSAA the example renders a mesh with fine details against a bright background. Here is a [screenshot without MSAA](./screenshots/multisampling_nomsaa.png) to compare.
## [Particle system](particlefire/)
@@ -110,8 +110,6 @@ Based on the mesh loading example, this example loads and displays a rigged COLL
Point sprite based particle system simulating a fire. Particles and their attributes are stored in a host visible vertex buffer that's updated on the CPU on each frame. Also makes use of pre-multiplied alpha for rendering particles with different blending modes (smoke and fire) in one single pass.
-
-
## [Push constants](pushconstants/)
@@ -178,6 +176,12 @@ Uses a (spherical) material capture texture containing environment lighting and
Like normal mapping, parallax mapping simulates geometry on a flat surface. In addition to normal mapping a heightmap is used to offset texture coordinates depending on the viewing angle giving the illusion of added depth.
+## [Skeletal animation](skeletalanimation/)
+
+
+Based on the mesh loading example, this example loads and displays a rigged COLLADA model including animations. Bone weights are extracted for each vertex and are passed to the vertex shader together with the final bone transformation matrices for vertex position calculations.
+
+
## [(Tessellation shader) PN-Triangles](tessellation/)
diff --git a/multisampling/multisampling.cpp b/multisampling/multisampling.cpp
index 5ca29740..10af446e 100644
--- a/multisampling/multisampling.cpp
+++ b/multisampling/multisampling.cpp
@@ -1,8 +1,6 @@
/*
* Vulkan Example - Multisampling using resolve attachments
*
-* todo : add second renderpass without msaa and allow toggle
-*
* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
@@ -238,8 +236,7 @@ public:
attachments[1].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
attachments[1].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
- // Depth attachment
- // This needs to use the same number of samples as the msaa attachment
+ // Multisampled depth attachment we render to
attachments[2].format = depthFormat;
attachments[2].samples = SAMPLE_COUNT;
attachments[2].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
@@ -249,7 +246,7 @@ public:
attachments[2].initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
attachments[2].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
- // Depth resolve
+ // Depth resolve attachment
attachments[3].format = depthFormat;
attachments[3].samples = VK_SAMPLE_COUNT_1_BIT;
attachments[3].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
@@ -263,20 +260,22 @@ public:
colorReference.attachment = 0;
colorReference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
+ VkAttachmentReference depthReference = {};
+ depthReference.attachment = 2;
+ depthReference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+
+ // Two resolve attachment references for color and depth
std::array resolveReferences = {};
resolveReferences[0].attachment = 1;
resolveReferences[0].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
resolveReferences[1].attachment = 3;
resolveReferences[1].layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
- VkAttachmentReference depthReference = {};
- depthReference.attachment = 2;
- depthReference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
-
VkSubpassDescription subpass = {};
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpass.colorAttachmentCount = 1;
subpass.pColorAttachments = &colorReference;
+ // Pass our resolve attachments to the sub pass
subpass.pResolveAttachments = resolveReferences.data();
subpass.pDepthStencilAttachment = &depthReference;
@@ -353,6 +352,7 @@ public:
VkCommandBufferBeginInfo cmdBufInfo = vkTools::initializers::commandBufferBeginInfo();
VkClearValue clearValues[3];
+ // Clear to a white background for higher contrast
clearValues[0].color = { { 1.0f, 1.0f, 1.0f, 1.0f } };
clearValues[1].color = { { 1.0f, 1.0f, 1.0f, 1.0f } };
clearValues[2].depthStencil = { 1.0f, 0 };
diff --git a/screenshots/multisampling.png b/screenshots/multisampling.png
new file mode 100644
index 00000000..f1ce28b9
Binary files /dev/null and b/screenshots/multisampling.png differ
diff --git a/screenshots/multisampling_nomsaa.png b/screenshots/multisampling_nomsaa.png
new file mode 100644
index 00000000..87640471
Binary files /dev/null and b/screenshots/multisampling_nomsaa.png differ