diff --git a/android/examples/parallaxmapping/build.gradle b/android/examples/parallaxmapping/build.gradle index 93251bfd..84b6e682 100644 --- a/android/examples/parallaxmapping/build.gradle +++ b/android/examples/parallaxmapping/build.gradle @@ -63,7 +63,7 @@ task copyTask { copy { from '../../../data/textures' into 'assets/textures' - include 'rocks_normal_height_rgba.dds' + include 'rocks_normal_height_rgba.ktx' } copy { diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 97dbcae3..e695a910 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -250,7 +250,7 @@ void VulkanExampleBase::renderFrame() timer -= 1.0f; } } - float fpsTimer = std::chrono::duration(tEnd - lastTimestamp).count(); + float fpsTimer = (float)(std::chrono::duration(tEnd - lastTimestamp).count()); if (fpsTimer > 1000.0f) { lastFPS = static_cast((float)frameCounter * (1000.0f / fpsTimer)); @@ -621,26 +621,26 @@ void VulkanExampleBase::drawUI(const VkCommandBuffer commandBuffer) void VulkanExampleBase::prepareFrame() { // Acquire the next image from the swap chain - VkResult err = swapChain.acquireNextImage(semaphores.presentComplete, ¤tBuffer); + VkResult result = swapChain.acquireNextImage(semaphores.presentComplete, ¤tBuffer); // Recreate the swapchain if it's no longer compatible with the surface (OUT_OF_DATE) or no longer optimal for presentation (SUBOPTIMAL) - if ((err == VK_ERROR_OUT_OF_DATE_KHR) || (err == VK_SUBOPTIMAL_KHR)) { + if ((result == VK_ERROR_OUT_OF_DATE_KHR) || (result == VK_SUBOPTIMAL_KHR)) { windowResize(); } else { - VK_CHECK_RESULT(err); + VK_CHECK_RESULT(result); } } void VulkanExampleBase::submitFrame() { - VkResult res = swapChain.queuePresent(queue, currentBuffer, semaphores.renderComplete); - if (!((res == VK_SUCCESS) || (res == VK_SUBOPTIMAL_KHR))) { - if (res == VK_ERROR_OUT_OF_DATE_KHR) { + VkResult result = swapChain.queuePresent(queue, currentBuffer, semaphores.renderComplete); + if (!((result == VK_SUCCESS) || (result == VK_SUBOPTIMAL_KHR))) { + if (result == VK_ERROR_OUT_OF_DATE_KHR) { // Swap chain is no longer compatible with the surface and needs to be recreated windowResize(); return; } else { - VK_CHECK_RESULT(res); + VK_CHECK_RESULT(result); } } VK_CHECK_RESULT(vkQueueWaitIdle(queue)); diff --git a/data/textures/hdr_uffizi_bc6uf.DDS b/data/textures/hdr_uffizi_bc6uf.DDS deleted file mode 100644 index 8b5115a6..00000000 Binary files a/data/textures/hdr_uffizi_bc6uf.DDS and /dev/null differ diff --git a/data/textures/rocks_color_bc3_unorm.dds b/data/textures/rocks_color_bc3_unorm.dds deleted file mode 100644 index 2ac4ea08..00000000 Binary files a/data/textures/rocks_color_bc3_unorm.dds and /dev/null differ diff --git a/data/textures/rocks_normal_height_rgba.dds b/data/textures/rocks_normal_height_rgba.dds deleted file mode 100644 index 72fff176..00000000 Binary files a/data/textures/rocks_normal_height_rgba.dds and /dev/null differ diff --git a/data/textures/stonewall_colormap_bc3.dds b/data/textures/stonewall_colormap_bc3.dds deleted file mode 100644 index 1bd79c65..00000000 Binary files a/data/textures/stonewall_colormap_bc3.dds and /dev/null differ diff --git a/data/textures/stonewall_heightmap_rgba.dds b/data/textures/stonewall_heightmap_rgba.dds deleted file mode 100644 index 5408546a..00000000 Binary files a/data/textures/stonewall_heightmap_rgba.dds and /dev/null differ diff --git a/examples/multisampling/multisampling.cpp b/examples/multisampling/multisampling.cpp index 476a3680..a7655f2f 100644 --- a/examples/multisampling/multisampling.cpp +++ b/examples/multisampling/multisampling.cpp @@ -577,13 +577,17 @@ public: VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.MSAA)); - // MSAA with sample shading pipeline - // Sample shading enables per-sample shading to avoid shader aliasing and smooth out e.g. high frequency texture maps - // Note: This will trade performance for are more stable image - multisampleState.sampleShadingEnable = VK_TRUE; // Enable per-sample shading (instead of per-fragment) - multisampleState.minSampleShading = 0.25f; // Minimum fraction for sample shading - - VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.MSAASampleShading)); + + if (vulkanDevice->features.sampleRateShading) + { + // MSAA with sample shading pipeline + // Sample shading enables per-sample shading to avoid shader aliasing and smooth out e.g. high frequency texture maps + // Note: This will trade performance for are more stable image + multisampleState.sampleShadingEnable = VK_TRUE; // Enable per-sample shading (instead of per-fragment) + multisampleState.minSampleShading = 0.25f; // Minimum fraction for sample shading + + VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.MSAASampleShading)); + } } // Prepare and initialize uniform buffer containing shader uniforms diff --git a/examples/parallaxmapping/parallaxmapping.cpp b/examples/parallaxmapping/parallaxmapping.cpp index e11e7c31..7aaaac0c 100644 --- a/examples/parallaxmapping/parallaxmapping.cpp +++ b/examples/parallaxmapping/parallaxmapping.cpp @@ -121,9 +121,9 @@ public: models.quad.loadFromFile(getAssetPath() + "models/plane_z.obj", vertexLayout, 0.1f, vulkanDevice, queue); // Textures - textures.normalHeightMap.loadFromFile(getAssetPath() + "textures/rocks_normal_height_rgba.dds", VK_FORMAT_R8G8B8A8_UNORM, vulkanDevice, queue); + textures.normalHeightMap.loadFromFile(getAssetPath() + "textures/rocks_normal_height_rgba.ktx", VK_FORMAT_R8G8B8A8_UNORM, vulkanDevice, queue); if (vulkanDevice->features.textureCompressionBC) { - textures.colorMap.loadFromFile(getAssetPath() + "textures/rocks_color_bc3_unorm.dds", VK_FORMAT_BC3_UNORM_BLOCK, vulkanDevice, queue); + textures.colorMap.loadFromFile(getAssetPath() + "textures/rocks_color_bc3_unorm.ktx", VK_FORMAT_BC3_UNORM_BLOCK, vulkanDevice, queue); } else if (vulkanDevice->features.textureCompressionASTC_LDR) { textures.colorMap.loadFromFile(getAssetPath() + "textures/rocks_color_astc_8x8_unorm.ktx", VK_FORMAT_ASTC_8x8_UNORM_BLOCK, vulkanDevice, queue); diff --git a/examples/particlefire/particlefire.cpp b/examples/particlefire/particlefire.cpp index 94c48141..385de4f6 100644 --- a/examples/particlefire/particlefire.cpp +++ b/examples/particlefire/particlefire.cpp @@ -374,9 +374,14 @@ public: samplerCreateInfo.minLod = 0.0f; // Both particle textures have the same number of mip maps samplerCreateInfo.maxLod = float(textures.particles.fire.mipLevels); - // Enable anisotropic filtering - samplerCreateInfo.maxAnisotropy = 8.0f; - samplerCreateInfo.anisotropyEnable = VK_TRUE; + + if (vulkanDevice->features.samplerAnisotropy) + { + // Enable anisotropic filtering + samplerCreateInfo.maxAnisotropy = 8.0f; + samplerCreateInfo.anisotropyEnable = VK_TRUE; + } + // Use a different border color (than the normal texture loader) for additive blending samplerCreateInfo.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; VK_CHECK_RESULT(vkCreateSampler(device, &samplerCreateInfo, nullptr, &textures.particles.sampler));