diff --git a/base/VulkanDevice.hpp b/base/VulkanDevice.hpp index 3aec4091..4d4b0825 100644 --- a/base/VulkanDevice.hpp +++ b/base/VulkanDevice.hpp @@ -437,7 +437,7 @@ namespace vks void copyBuffer(vks::Buffer *src, vks::Buffer *dst, VkQueue queue, VkBufferCopy *copyRegion = nullptr) { assert(dst->size <= src->size); - assert(src->buffer && src->buffer); + assert(src->buffer); VkCommandBuffer copyCmd = createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy bufferCopy{}; if (copyRegion == nullptr) diff --git a/examples/computecloth/computecloth.cpp b/examples/computecloth/computecloth.cpp index 2e9516ad..da009221 100644 --- a/examples/computecloth/computecloth.cpp +++ b/examples/computecloth/computecloth.cpp @@ -1,8 +1,6 @@ /* * Vulkan Example - Compute shader sloth simulation * -* Updated compute shader by Lukas Bergdoll (https://github.com/Voultapher) -* * Copyright (C) 2016-2017 by Sascha Willems - www.saschawillems.de * * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) diff --git a/examples/computeshader/computeshader.cpp b/examples/computeshader/computeshader.cpp index ec950dbf..12526268 100644 --- a/examples/computeshader/computeshader.cpp +++ b/examples/computeshader/computeshader.cpp @@ -570,7 +570,7 @@ public: shaderNames = { "emboss", "edgedetect", "sharpen" }; for (auto& shaderName : shaderNames) { std::string fileName = getAssetPath() + "shaders/computeshader/" + shaderName + ".comp.spv"; - computePipelineCreateInfo.stage = loadShader(fileName.c_str(), VK_SHADER_STAGE_COMPUTE_BIT); + computePipelineCreateInfo.stage = loadShader(fileName, VK_SHADER_STAGE_COMPUTE_BIT); VkPipeline pipeline; VK_CHECK_RESULT(vkCreateComputePipelines(device, pipelineCache, 1, &computePipelineCreateInfo, nullptr, &pipeline)); compute.pipelines.push_back(pipeline); diff --git a/examples/deferredmultisampling/deferredmultisampling.cpp b/examples/deferredmultisampling/deferredmultisampling.cpp index f4c234ba..648b9d86 100644 --- a/examples/deferredmultisampling/deferredmultisampling.cpp +++ b/examples/deferredmultisampling/deferredmultisampling.cpp @@ -538,7 +538,6 @@ public: VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0); vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor); - VkDeviceSize offsets[1] = { 0 }; vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.deferred, 0, 1, &descriptorSet, 0, NULL); if (debugDisplay) diff --git a/examples/distancefieldfonts/distancefieldfonts.cpp b/examples/distancefieldfonts/distancefieldfonts.cpp index 1703de2a..a1a4191e 100644 --- a/examples/distancefieldfonts/distancefieldfonts.cpp +++ b/examples/distancefieldfonts/distancefieldfonts.cpp @@ -179,8 +179,6 @@ public: if (info == "char") { - std::string pair; - // char id uint32_t charid = nextValuePair(&lineStream); // Char properties diff --git a/examples/hdr/hdr.cpp b/examples/hdr/hdr.cpp index 25287b34..b1e4ce57 100644 --- a/examples/hdr/hdr.cpp +++ b/examples/hdr/hdr.cpp @@ -194,8 +194,7 @@ public: VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo(); VkClearValue clearValues[2]; - clearValues[0].color = defaultClearColor; - clearValues[0].color = { { 0.0f, 0.0f, 0.0f, 0.0f } };; + clearValues[0].color = { { 0.0f, 0.0f, 0.0f, 0.0f } }; clearValues[1].depthStencil = { 1.0f, 0 }; VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo(); @@ -207,7 +206,6 @@ public: VkViewport viewport; VkRect2D scissor; - VkDeviceSize offsets[1] = { 0 }; for (int32_t i = 0; i < drawCmdBuffers.size(); ++i) { @@ -818,8 +816,7 @@ public: shaderStages[1] = loadShader(getAssetPath() + "shaders/hdr/composition.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT); pipelineCreateInfo.layout = pipelineLayouts.composition; pipelineCreateInfo.renderPass = renderPass; - rasterizationState.cullMode = VK_CULL_MODE_BACK_BIT; - rasterizationState.cullMode = VK_CULL_MODE_NONE; + rasterizationState.cullMode = VK_CULL_MODE_FRONT_BIT; colorBlendState.attachmentCount = 1; colorBlendState.pAttachments = blendAttachmentStates.data(); VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.composition)); @@ -846,6 +843,7 @@ public: VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.bloom[0])); // Second blur pass (into separate framebuffer) + rasterizationState.cullMode = VK_CULL_MODE_BACK_BIT; pipelineCreateInfo.renderPass = filterPass.renderPass; dir = 0; VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.bloom[1])); @@ -871,7 +869,6 @@ public: vertexInputState.vertexAttributeDescriptionCount = static_cast(vertexInputAttributes.size()); vertexInputState.pVertexAttributeDescriptions = vertexInputAttributes.data(); - pipelineCreateInfo.renderPass = renderPass; pipelineCreateInfo.pVertexInputState = &vertexInputState; // Skybox pipeline (background cube) @@ -900,7 +897,7 @@ public: depthStencilState.depthWriteEnable = VK_TRUE; depthStencilState.depthTestEnable = VK_TRUE; // Flip cull mode - rasterizationState.cullMode = VK_CULL_MODE_NONE; + rasterizationState.cullMode = VK_CULL_MODE_FRONT_BIT; VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.reflect)); } diff --git a/examples/multithreading/multithreading.cpp b/examples/multithreading/multithreading.cpp index a43e8fcc..5e1d6136 100644 --- a/examples/multithreading/multithreading.cpp +++ b/examples/multithreading/multithreading.cpp @@ -350,7 +350,6 @@ public: VkClearValue clearValues[2]; clearValues[0].color = defaultClearColor; - clearValues[0].color = { {0.0f, 0.0f, 0.2f, 0.0f} }; clearValues[1].depthStencil = { 1.0f, 0 }; VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo(); diff --git a/examples/raytracing/raytracing.cpp b/examples/raytracing/raytracing.cpp index edfaa384..777613e1 100644 --- a/examples/raytracing/raytracing.cpp +++ b/examples/raytracing/raytracing.cpp @@ -219,7 +219,6 @@ public: VkClearValue clearValues[2]; clearValues[0].color = defaultClearColor; - clearValues[0].color = { {0.0f, 0.0f, 0.2f, 0.0f} }; clearValues[1].depthStencil = { 1.0f, 0 }; VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo(); diff --git a/examples/scenerendering/scenerendering.cpp b/examples/scenerendering/scenerendering.cpp index e8691ca0..6a34b122 100644 --- a/examples/scenerendering/scenerendering.cpp +++ b/examples/scenerendering/scenerendering.cpp @@ -613,7 +613,6 @@ public: VkClearValue clearValues[2]; clearValues[0].color = defaultClearColor; - clearValues[0].color = { { 0.25f, 0.25f, 0.25f, 1.0f} }; clearValues[1].depthStencil = { 1.0f, 0 }; VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo(); diff --git a/examples/shadowmappingcascade/shadowmappingcascade.cpp b/examples/shadowmappingcascade/shadowmappingcascade.cpp index 361e3a58..a373203e 100644 --- a/examples/shadowmappingcascade/shadowmappingcascade.cpp +++ b/examples/shadowmappingcascade/shadowmappingcascade.cpp @@ -452,7 +452,6 @@ public: VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo(); VkClearValue clearValues[2]; - clearValues[0].color = defaultClearColor; clearValues[0].color = { { 0.0f, 0.0f, 0.2f, 1.0f } }; clearValues[1].depthStencil = { 1.0f, 0 }; @@ -478,8 +477,6 @@ public: VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0); vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor); - VkDeviceSize offsets[1] = { 0 }; - // Visualize shadow map cascade if (displayDepthMap) { vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, NULL); diff --git a/examples/ssao/ssao.cpp b/examples/ssao/ssao.cpp index 86d7c1df..514f27c8 100644 --- a/examples/ssao/ssao.cpp +++ b/examples/ssao/ssao.cpp @@ -661,7 +661,6 @@ public: VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0); vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor); - VkDeviceSize offsets[1] = { 0 }; vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.composition, 0, 1, &descriptorSets.composition, 0, NULL); // Final composition pass diff --git a/examples/stencilbuffer/stencilbuffer.cpp b/examples/stencilbuffer/stencilbuffer.cpp index c0ffc1f9..a2f0671d 100644 --- a/examples/stencilbuffer/stencilbuffer.cpp +++ b/examples/stencilbuffer/stencilbuffer.cpp @@ -84,7 +84,6 @@ public: VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo(); VkClearValue clearValues[2]; - clearValues[0].color = { { 1.0f, 1.0f, 1.0f, 1.0f } }; clearValues[0].color = defaultClearColor; clearValues[1].depthStencil = { 1.0f, 0 }; diff --git a/examples/terraintessellation/terraintessellation.cpp b/examples/terraintessellation/terraintessellation.cpp index 9f5b87e3..366a67df 100644 --- a/examples/terraintessellation/terraintessellation.cpp +++ b/examples/terraintessellation/terraintessellation.cpp @@ -320,7 +320,6 @@ public: VkClearValue clearValues[2]; clearValues[0].color = defaultClearColor; - clearValues[0].color = { {0.2f, 0.2f, 0.2f, 0.0f} }; clearValues[1].depthStencil = { 1.0f, 0 }; VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo(); diff --git a/examples/texture3d/texture3d.cpp b/examples/texture3d/texture3d.cpp index 5d3b29de..ec17a076 100644 --- a/examples/texture3d/texture3d.cpp +++ b/examples/texture3d/texture3d.cpp @@ -234,7 +234,7 @@ public: VkFormatProperties formatProperties; vkGetPhysicalDeviceFormatProperties(physicalDevice, texture.format, &formatProperties); // Check if format supports transfer - if (!formatProperties.optimalTilingFeatures && VK_IMAGE_USAGE_TRANSFER_DST_BIT) + if (!(formatProperties.optimalTilingFeatures & VK_IMAGE_USAGE_TRANSFER_DST_BIT)) { std::cout << "Error: Device does not support flag TRANSFER_DST for selected texture format!" << std::endl; return; @@ -255,7 +255,6 @@ public: imageCreateInfo.arrayLayers = 1; imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT; imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; - imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT; imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageCreateInfo.extent.width = texture.width; imageCreateInfo.extent.height = texture.width; @@ -326,7 +325,6 @@ public: PerlinNoise perlinNoise; FractalNoise fractalNoise(perlinNoise); - std::default_random_engine rndEngine(std::random_device{}()); const int32_t noiseType = rand() % 2; const float noiseScale = static_cast(rand() % 10) + 4.0f; diff --git a/examples/texturearray/texturearray.cpp b/examples/texturearray/texturearray.cpp index be4306c9..be61b0db 100644 --- a/examples/texturearray/texturearray.cpp +++ b/examples/texturearray/texturearray.cpp @@ -194,7 +194,6 @@ public: imageCreateInfo.mipLevels = 1; imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT; imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; - imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT; imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; imageCreateInfo.extent = { textureArray.width, textureArray.height, 1 }; diff --git a/examples/texturecubemap/texturecubemap.cpp b/examples/texturecubemap/texturecubemap.cpp index da638536..660e0361 100644 --- a/examples/texturecubemap/texturecubemap.cpp +++ b/examples/texturecubemap/texturecubemap.cpp @@ -186,7 +186,6 @@ public: imageCreateInfo.mipLevels = cubeMap.mipLevels; imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT; imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; - imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT; imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; imageCreateInfo.extent = { cubeMap.width, cubeMap.height, 1 }; diff --git a/examples/texturemipmapgen/texturemipmapgen.cpp b/examples/texturemipmapgen/texturemipmapgen.cpp index 14aebe32..7dc68bc1 100644 --- a/examples/texturemipmapgen/texturemipmapgen.cpp +++ b/examples/texturemipmapgen/texturemipmapgen.cpp @@ -181,7 +181,6 @@ public: imageCreateInfo.arrayLayers = 1; imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT; imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; - imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT; imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; imageCreateInfo.extent = { texture.width, texture.height, 1 }; diff --git a/examples/texturesparseresidency/texturesparseresidency.cpp b/examples/texturesparseresidency/texturesparseresidency.cpp index 16803928..12968f56 100644 --- a/examples/texturesparseresidency/texturesparseresidency.cpp +++ b/examples/texturesparseresidency/texturesparseresidency.cpp @@ -346,7 +346,6 @@ public: sparseImageCreateInfo.arrayLayers = texture.layerCount; sparseImageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT; sparseImageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; - sparseImageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT; sparseImageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; sparseImageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; sparseImageCreateInfo.extent = { texture.width, texture.height, 1 }; @@ -558,7 +557,6 @@ public: sampler.compareOp = VK_COMPARE_OP_NEVER; sampler.minLod = 0.0f; sampler.maxLod = static_cast(texture.mipLevels); - sampler.anisotropyEnable = vulkanDevice->features.samplerAnisotropy; sampler.maxAnisotropy = vulkanDevice->features.samplerAnisotropy ? vulkanDevice->properties.limits.maxSamplerAnisotropy : 1.0f; sampler.anisotropyEnable = false; sampler.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE; @@ -888,19 +886,8 @@ public: void updateUniformBuffers() { - // Vertex shader - uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - - uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); - uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); - uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); - uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); - uboVS.projection = camera.matrices.perspective; uboVS.model = camera.matrices.view; - //uboVS.model = glm::mat4(1.0f); - uboVS.viewPos = glm::vec4(0.0f, 0.0f, -zoom, 0.0f); VK_CHECK_RESULT(uniformBufferVS.map()); @@ -961,8 +948,6 @@ public: void fillVirtualTexture(int32_t &mipLevel) { vkDeviceWaitIdle(device); - std::default_random_engine rndEngine(benchmark.active ? 0 : (unsigned)time(nullptr)); - std::uniform_real_distribution rndDist(0.0f, 1.0f); std::vector imageBlits; for (auto& page : texture.pages) { diff --git a/examples/vulkanscene/vulkanscene.cpp b/examples/vulkanscene/vulkanscene.cpp index a2899b59..2013ccb6 100644 --- a/examples/vulkanscene/vulkanscene.cpp +++ b/examples/vulkanscene/vulkanscene.cpp @@ -169,7 +169,6 @@ public: vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, NULL); - VkDeviceSize offsets[1] = { 0 }; for (auto model : demoModels) { model.draw(drawCmdBuffers[i]); }