Fixed typos
This commit is contained in:
parent
fd5f50f298
commit
2898671f40
9 changed files with 17 additions and 19 deletions
|
|
@ -183,7 +183,7 @@ public:
|
||||||
|
|
||||||
// Take a screenshot from the current swapchain image
|
// Take a screenshot from the current swapchain image
|
||||||
// This is done using a blit from the swapchain image to a linear image whose memory content is then saved as a ppm image
|
// This is done using a blit from the swapchain image to a linear image whose memory content is then saved as a ppm image
|
||||||
// Getting the image date directly from a swapchain image wouldn't work as they're usually stored in an implementation dependant optimal tiling format
|
// Getting the image date directly from a swapchain image wouldn't work as they're usually stored in an implementation dependent optimal tiling format
|
||||||
// Note: This requires the swapchain images to be created with the VK_IMAGE_USAGE_TRANSFER_SRC_BIT flag (see VulkanSwapChain::create)
|
// Note: This requires the swapchain images to be created with the VK_IMAGE_USAGE_TRANSFER_SRC_BIT flag (see VulkanSwapChain::create)
|
||||||
void saveScreenshot(const char *filename)
|
void saveScreenshot(const char *filename)
|
||||||
{
|
{
|
||||||
|
|
@ -355,7 +355,7 @@ public:
|
||||||
// If source is BGR (destination is always RGB) and we can't use blit (which does automatic conversion), we'll have to manually swizzle color components
|
// If source is BGR (destination is always RGB) and we can't use blit (which does automatic conversion), we'll have to manually swizzle color components
|
||||||
bool colorSwizzle = false;
|
bool colorSwizzle = false;
|
||||||
// Check if source is BGR
|
// Check if source is BGR
|
||||||
// Note: Not complete, only contains most common and basic BGR surface formats for demonstation purposes
|
// Note: Not complete, only contains most common and basic BGR surface formats for demonstration purposes
|
||||||
if (!supportsBlit)
|
if (!supportsBlit)
|
||||||
{
|
{
|
||||||
std::vector<VkFormat> formatsBGR = { VK_FORMAT_B8G8R8A8_SRGB, VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_SNORM };
|
std::vector<VkFormat> formatsBGR = { VK_FORMAT_B8G8R8A8_SRGB, VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_SNORM };
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public:
|
||||||
float zNear = 1.0f;
|
float zNear = 1.0f;
|
||||||
float zFar = 96.0f;
|
float zFar = 96.0f;
|
||||||
|
|
||||||
// Depth bias (and slope) are used to avoid shadowing artefacts
|
// Depth bias (and slope) are used to avoid shadowing artifacts
|
||||||
// Constant depth bias factor (always applied)
|
// Constant depth bias factor (always applied)
|
||||||
float depthBiasConstant = 1.25f;
|
float depthBiasConstant = 1.25f;
|
||||||
// Slope depth bias factor, applied depending on polygon's slope
|
// Slope depth bias factor, applied depending on polygon's slope
|
||||||
|
|
@ -298,7 +298,7 @@ public:
|
||||||
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
||||||
|
|
||||||
// Set depth bias (aka "Polygon offset")
|
// Set depth bias (aka "Polygon offset")
|
||||||
// Required to avoid shadow mapping artefacts
|
// Required to avoid shadow mapping artifacts
|
||||||
vkCmdSetDepthBias(
|
vkCmdSetDepthBias(
|
||||||
drawCmdBuffers[i],
|
drawCmdBuffers[i],
|
||||||
depthBiasConstant,
|
depthBiasConstant,
|
||||||
|
|
@ -423,7 +423,7 @@ public:
|
||||||
};
|
};
|
||||||
vkUpdateDescriptorSets(device, writeDescriptorSets.size(), writeDescriptorSets.data(), 0, nullptr);
|
vkUpdateDescriptorSets(device, writeDescriptorSets.size(), writeDescriptorSets.data(), 0, nullptr);
|
||||||
|
|
||||||
// Scene rendering with shadow map appplied
|
// Scene rendering with shadow map applied
|
||||||
VK_CHECK_RESULT(vkAllocateDescriptorSets(device, &allocInfo, &descriptorSets.scene));
|
VK_CHECK_RESULT(vkAllocateDescriptorSets(device, &allocInfo, &descriptorSets.scene));
|
||||||
writeDescriptorSets = {
|
writeDescriptorSets = {
|
||||||
// Binding 0 : Vertex shader uniform buffer
|
// Binding 0 : Vertex shader uniform buffer
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Render the example scene with given command buffer, pipeline layout and dscriptor set
|
Render the example scene with given command buffer, pipeline layout and descriptor set
|
||||||
Used by the scene rendering and depth pass generation command buffer
|
Used by the scene rendering and depth pass generation command buffer
|
||||||
*/
|
*/
|
||||||
void renderScene(VkCommandBuffer commandBuffer, VkPipelineLayout pipelineLayout, VkDescriptorSet descriptorSet, uint32_t cascadeIndex = 0) {
|
void renderScene(VkCommandBuffer commandBuffer, VkPipelineLayout pipelineLayout, VkDescriptorSet descriptorSet, uint32_t cascadeIndex = 0) {
|
||||||
|
|
@ -330,7 +330,7 @@ public:
|
||||||
VK_CHECK_RESULT(vkCreateFramebuffer(device, &framebufferInfo, nullptr, &cascades[i].frameBuffer));
|
VK_CHECK_RESULT(vkCreateFramebuffer(device, &framebufferInfo, nullptr, &cascades[i].frameBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shared sampler for cascade deoth reads
|
// Shared sampler for cascade depth reads
|
||||||
VkSamplerCreateInfo sampler = vks::initializers::samplerCreateInfo();
|
VkSamplerCreateInfo sampler = vks::initializers::samplerCreateInfo();
|
||||||
sampler.magFilter = VK_FILTER_LINEAR;
|
sampler.magFilter = VK_FILTER_LINEAR;
|
||||||
sampler.minFilter = VK_FILTER_LINEAR;
|
sampler.minFilter = VK_FILTER_LINEAR;
|
||||||
|
|
@ -381,7 +381,7 @@ public:
|
||||||
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
||||||
|
|
||||||
// One pass per cascade
|
// One pass per cascade
|
||||||
// The layer that this pass renders to is defined by the cascade's image view (selected via the cascade's decsriptor set)
|
// The layer that this pass renders to is defined by the cascade's image view (selected via the cascade's descriptor set)
|
||||||
for (uint32_t j = 0; j < SHADOW_MAP_CASCADE_COUNT; j++) {
|
for (uint32_t j = 0; j < SHADOW_MAP_CASCADE_COUNT; j++) {
|
||||||
renderPassBeginInfo.framebuffer = cascades[j].frameBuffer;
|
renderPassBeginInfo.framebuffer = cascades[j].frameBuffer;
|
||||||
vkCmdBeginRenderPass(drawCmdBuffers[i], &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
|
vkCmdBeginRenderPass(drawCmdBuffers[i], &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
|
||||||
|
|
@ -649,8 +649,8 @@ public:
|
||||||
float range = maxZ - minZ;
|
float range = maxZ - minZ;
|
||||||
float ratio = maxZ / minZ;
|
float ratio = maxZ / minZ;
|
||||||
|
|
||||||
// Calculate split depths based on view camera furstum
|
// Calculate split depths based on view camera frustum
|
||||||
// Based on method presentd in https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch10.html
|
// Based on method presented in https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch10.html
|
||||||
for (uint32_t i = 0; i < SHADOW_MAP_CASCADE_COUNT; i++) {
|
for (uint32_t i = 0; i < SHADOW_MAP_CASCADE_COUNT; i++) {
|
||||||
float p = (i + 1) / static_cast<float>(SHADOW_MAP_CASCADE_COUNT);
|
float p = (i + 1) / static_cast<float>(SHADOW_MAP_CASCADE_COUNT);
|
||||||
float log = minZ * std::pow(ratio, p);
|
float log = minZ * std::pow(ratio, p);
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ public:
|
||||||
|
|
||||||
vkDestroyRenderPass(device, offscreenPass.renderPass, nullptr);
|
vkDestroyRenderPass(device, offscreenPass.renderPass, nullptr);
|
||||||
|
|
||||||
// Pipelibes
|
// Pipelines
|
||||||
vkDestroyPipeline(device, pipelines.scene, nullptr);
|
vkDestroyPipeline(device, pipelines.scene, nullptr);
|
||||||
vkDestroyPipeline(device, pipelines.offscreen, nullptr);
|
vkDestroyPipeline(device, pipelines.offscreen, nullptr);
|
||||||
vkDestroyPipeline(device, pipelines.cubemapDisplay, nullptr);
|
vkDestroyPipeline(device, pipelines.cubemapDisplay, nullptr);
|
||||||
|
|
|
||||||
|
|
@ -500,7 +500,7 @@ public:
|
||||||
Offscreen SSAO generation
|
Offscreen SSAO generation
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
// Clear values for all attachments written in the fragment sahder
|
// Clear values for all attachments written in the fragment shader
|
||||||
std::vector<VkClearValue> clearValues(4);
|
std::vector<VkClearValue> clearValues(4);
|
||||||
clearValues[0].color = { { 0.0f, 0.0f, 0.0f, 1.0f } };
|
clearValues[0].color = { { 0.0f, 0.0f, 0.0f, 1.0f } };
|
||||||
clearValues[1].color = { { 0.0f, 0.0f, 0.0f, 1.0f } };
|
clearValues[1].color = { { 0.0f, 0.0f, 0.0f, 1.0f } };
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
* the same pixel position.
|
* the same pixel position.
|
||||||
*
|
*
|
||||||
* This is a feature that was especially designed for tile-based-renderers
|
* This is a feature that was especially designed for tile-based-renderers
|
||||||
* (mostly mobile GPUs) and is a new optomization feature in Vulkan for those GPU types.
|
* (mostly mobile GPUs) and is a new optimization feature in Vulkan for those GPU types.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -466,7 +466,7 @@ public:
|
||||||
VkDeviceSize offsets[1] = { 0 };
|
VkDeviceSize offsets[1] = { 0 };
|
||||||
|
|
||||||
// First sub pass
|
// First sub pass
|
||||||
// Renders the components of the scene to the G-Buffer atttachments
|
// Renders the components of the scene to the G-Buffer attachments
|
||||||
{
|
{
|
||||||
vks::debugmarker::beginRegion(drawCmdBuffers[i], "Subpass 0: Deferred G-Buffer creation", glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
vks::debugmarker::beginRegion(drawCmdBuffers[i], "Subpass 0: Deferred G-Buffer creation", glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
|
|
||||||
|
|
@ -492,7 +492,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third subpass
|
// Third subpass
|
||||||
// Render transparent geometry using a forward pass that compares against depth generted during G-Buffer fill
|
// Render transparent geometry using a forward pass that compares against depth generated during G-Buffer fill
|
||||||
{
|
{
|
||||||
vks::debugmarker::beginRegion(drawCmdBuffers[i], "Subpass 2: Forward transparency", glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
vks::debugmarker::beginRegion(drawCmdBuffers[i], "Subpass 2: Forward transparency", glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ public:
|
||||||
} textures;
|
} textures;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
//vks::Model terrain;
|
|
||||||
vkglTF::Model skysphere;
|
vkglTF::Model skysphere;
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ public:
|
||||||
{
|
{
|
||||||
uboTessEval.projection = camera.matrices.perspective;
|
uboTessEval.projection = camera.matrices.perspective;
|
||||||
uboTessEval.modelView = camera.matrices.view;
|
uboTessEval.modelView = camera.matrices.view;
|
||||||
// Tessellation evaulation uniform block
|
// Tessellation evaluation uniform block
|
||||||
memcpy(uniformBuffers.tessEval.mapped, &uboTessEval, sizeof(uboTessEval));
|
memcpy(uniformBuffers.tessEval.mapped, &uboTessEval, sizeof(uboTessEval));
|
||||||
// Tessellation control uniform block
|
// Tessellation control uniform block
|
||||||
memcpy(uniformBuffers.tessControl.mapped, &uboTessControl, sizeof(uboTessControl));
|
memcpy(uniformBuffers.tessControl.mapped, &uboTessControl, sizeof(uboTessControl));
|
||||||
|
|
|
||||||
|
|
@ -432,7 +432,7 @@ public:
|
||||||
// Use subpass dependencies for image layout transitions
|
// Use subpass dependencies for image layout transitions
|
||||||
VkSubpassDependency subpassDependencies[2] = {};
|
VkSubpassDependency subpassDependencies[2] = {};
|
||||||
|
|
||||||
// Transition from final to initial (VK_SUBPASS_EXTERNAL refers to all commmands executed outside of the actual renderpass)
|
// Transition from final to initial (VK_SUBPASS_EXTERNAL refers to all commands executed outside of the actual renderpass)
|
||||||
subpassDependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL;
|
subpassDependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL;
|
||||||
subpassDependencies[0].dstSubpass = 0;
|
subpassDependencies[0].dstSubpass = 0;
|
||||||
subpassDependencies[0].srcStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
|
subpassDependencies[0].srcStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
|
||||||
|
|
@ -721,7 +721,6 @@ public:
|
||||||
textOverlay->addText("A cube", projected.x, projected.y, TextOverlay::alignCenter);
|
textOverlay->addText("A cube", projected.x, projected.y, TextOverlay::alignCenter);
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
// toto
|
|
||||||
#else
|
#else
|
||||||
textOverlay->addText("Press \"space\" to toggle text overlay", 5.0f, 65.0f, TextOverlay::alignLeft);
|
textOverlay->addText("Press \"space\" to toggle text overlay", 5.0f, 65.0f, TextOverlay::alignLeft);
|
||||||
textOverlay->addText("Hold middle mouse button and drag to move", 5.0f, 85.0f, TextOverlay::alignLeft);
|
textOverlay->addText("Hold middle mouse button and drag to move", 5.0f, 85.0f, TextOverlay::alignLeft);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue