parent
bfb4b7607a
commit
1b8343d67b
19 changed files with 7 additions and 45 deletions
|
|
@ -437,7 +437,7 @@ namespace vks
|
||||||
void copyBuffer(vks::Buffer *src, vks::Buffer *dst, VkQueue queue, VkBufferCopy *copyRegion = nullptr)
|
void copyBuffer(vks::Buffer *src, vks::Buffer *dst, VkQueue queue, VkBufferCopy *copyRegion = nullptr)
|
||||||
{
|
{
|
||||||
assert(dst->size <= src->size);
|
assert(dst->size <= src->size);
|
||||||
assert(src->buffer && src->buffer);
|
assert(src->buffer);
|
||||||
VkCommandBuffer copyCmd = createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
VkCommandBuffer copyCmd = createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||||
VkBufferCopy bufferCopy{};
|
VkBufferCopy bufferCopy{};
|
||||||
if (copyRegion == nullptr)
|
if (copyRegion == nullptr)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Vulkan Example - Compute shader sloth simulation
|
* 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
|
* Copyright (C) 2016-2017 by Sascha Willems - www.saschawillems.de
|
||||||
*
|
*
|
||||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||||
|
|
|
||||||
|
|
@ -570,7 +570,7 @@ public:
|
||||||
shaderNames = { "emboss", "edgedetect", "sharpen" };
|
shaderNames = { "emboss", "edgedetect", "sharpen" };
|
||||||
for (auto& shaderName : shaderNames) {
|
for (auto& shaderName : shaderNames) {
|
||||||
std::string fileName = getAssetPath() + "shaders/computeshader/" + shaderName + ".comp.spv";
|
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;
|
VkPipeline pipeline;
|
||||||
VK_CHECK_RESULT(vkCreateComputePipelines(device, pipelineCache, 1, &computePipelineCreateInfo, nullptr, &pipeline));
|
VK_CHECK_RESULT(vkCreateComputePipelines(device, pipelineCache, 1, &computePipelineCreateInfo, nullptr, &pipeline));
|
||||||
compute.pipelines.push_back(pipeline);
|
compute.pipelines.push_back(pipeline);
|
||||||
|
|
|
||||||
|
|
@ -538,7 +538,6 @@ public:
|
||||||
VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0);
|
VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0);
|
||||||
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
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);
|
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.deferred, 0, 1, &descriptorSet, 0, NULL);
|
||||||
|
|
||||||
if (debugDisplay)
|
if (debugDisplay)
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,6 @@ public:
|
||||||
|
|
||||||
if (info == "char")
|
if (info == "char")
|
||||||
{
|
{
|
||||||
std::string pair;
|
|
||||||
|
|
||||||
// char id
|
// char id
|
||||||
uint32_t charid = nextValuePair(&lineStream);
|
uint32_t charid = nextValuePair(&lineStream);
|
||||||
// Char properties
|
// Char properties
|
||||||
|
|
|
||||||
|
|
@ -194,8 +194,7 @@ public:
|
||||||
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
||||||
|
|
||||||
VkClearValue clearValues[2];
|
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 };
|
clearValues[1].depthStencil = { 1.0f, 0 };
|
||||||
|
|
||||||
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
||||||
|
|
@ -207,7 +206,6 @@ public:
|
||||||
|
|
||||||
VkViewport viewport;
|
VkViewport viewport;
|
||||||
VkRect2D scissor;
|
VkRect2D scissor;
|
||||||
VkDeviceSize offsets[1] = { 0 };
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < drawCmdBuffers.size(); ++i)
|
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);
|
shaderStages[1] = loadShader(getAssetPath() + "shaders/hdr/composition.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||||
pipelineCreateInfo.layout = pipelineLayouts.composition;
|
pipelineCreateInfo.layout = pipelineLayouts.composition;
|
||||||
pipelineCreateInfo.renderPass = renderPass;
|
pipelineCreateInfo.renderPass = renderPass;
|
||||||
rasterizationState.cullMode = VK_CULL_MODE_BACK_BIT;
|
rasterizationState.cullMode = VK_CULL_MODE_FRONT_BIT;
|
||||||
rasterizationState.cullMode = VK_CULL_MODE_NONE;
|
|
||||||
colorBlendState.attachmentCount = 1;
|
colorBlendState.attachmentCount = 1;
|
||||||
colorBlendState.pAttachments = blendAttachmentStates.data();
|
colorBlendState.pAttachments = blendAttachmentStates.data();
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.composition));
|
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]));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.bloom[0]));
|
||||||
|
|
||||||
// Second blur pass (into separate framebuffer)
|
// Second blur pass (into separate framebuffer)
|
||||||
|
rasterizationState.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||||
pipelineCreateInfo.renderPass = filterPass.renderPass;
|
pipelineCreateInfo.renderPass = filterPass.renderPass;
|
||||||
dir = 0;
|
dir = 0;
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.bloom[1]));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.bloom[1]));
|
||||||
|
|
@ -871,7 +869,6 @@ public:
|
||||||
vertexInputState.vertexAttributeDescriptionCount = static_cast<uint32_t>(vertexInputAttributes.size());
|
vertexInputState.vertexAttributeDescriptionCount = static_cast<uint32_t>(vertexInputAttributes.size());
|
||||||
vertexInputState.pVertexAttributeDescriptions = vertexInputAttributes.data();
|
vertexInputState.pVertexAttributeDescriptions = vertexInputAttributes.data();
|
||||||
|
|
||||||
pipelineCreateInfo.renderPass = renderPass;
|
|
||||||
pipelineCreateInfo.pVertexInputState = &vertexInputState;
|
pipelineCreateInfo.pVertexInputState = &vertexInputState;
|
||||||
|
|
||||||
// Skybox pipeline (background cube)
|
// Skybox pipeline (background cube)
|
||||||
|
|
@ -900,7 +897,7 @@ public:
|
||||||
depthStencilState.depthWriteEnable = VK_TRUE;
|
depthStencilState.depthWriteEnable = VK_TRUE;
|
||||||
depthStencilState.depthTestEnable = VK_TRUE;
|
depthStencilState.depthTestEnable = VK_TRUE;
|
||||||
// Flip cull mode
|
// 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));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.reflect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,6 @@ public:
|
||||||
|
|
||||||
VkClearValue clearValues[2];
|
VkClearValue clearValues[2];
|
||||||
clearValues[0].color = defaultClearColor;
|
clearValues[0].color = defaultClearColor;
|
||||||
clearValues[0].color = { {0.0f, 0.0f, 0.2f, 0.0f} };
|
|
||||||
clearValues[1].depthStencil = { 1.0f, 0 };
|
clearValues[1].depthStencil = { 1.0f, 0 };
|
||||||
|
|
||||||
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,6 @@ public:
|
||||||
|
|
||||||
VkClearValue clearValues[2];
|
VkClearValue clearValues[2];
|
||||||
clearValues[0].color = defaultClearColor;
|
clearValues[0].color = defaultClearColor;
|
||||||
clearValues[0].color = { {0.0f, 0.0f, 0.2f, 0.0f} };
|
|
||||||
clearValues[1].depthStencil = { 1.0f, 0 };
|
clearValues[1].depthStencil = { 1.0f, 0 };
|
||||||
|
|
||||||
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
||||||
|
|
|
||||||
|
|
@ -613,7 +613,6 @@ public:
|
||||||
|
|
||||||
VkClearValue clearValues[2];
|
VkClearValue clearValues[2];
|
||||||
clearValues[0].color = defaultClearColor;
|
clearValues[0].color = defaultClearColor;
|
||||||
clearValues[0].color = { { 0.25f, 0.25f, 0.25f, 1.0f} };
|
|
||||||
clearValues[1].depthStencil = { 1.0f, 0 };
|
clearValues[1].depthStencil = { 1.0f, 0 };
|
||||||
|
|
||||||
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
||||||
|
|
|
||||||
|
|
@ -452,7 +452,6 @@ public:
|
||||||
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
||||||
|
|
||||||
VkClearValue clearValues[2];
|
VkClearValue clearValues[2];
|
||||||
clearValues[0].color = defaultClearColor;
|
|
||||||
clearValues[0].color = { { 0.0f, 0.0f, 0.2f, 1.0f } };
|
clearValues[0].color = { { 0.0f, 0.0f, 0.2f, 1.0f } };
|
||||||
clearValues[1].depthStencil = { 1.0f, 0 };
|
clearValues[1].depthStencil = { 1.0f, 0 };
|
||||||
|
|
||||||
|
|
@ -478,8 +477,6 @@ public:
|
||||||
VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0);
|
VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0);
|
||||||
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
||||||
|
|
||||||
VkDeviceSize offsets[1] = { 0 };
|
|
||||||
|
|
||||||
// Visualize shadow map cascade
|
// Visualize shadow map cascade
|
||||||
if (displayDepthMap) {
|
if (displayDepthMap) {
|
||||||
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, NULL);
|
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, NULL);
|
||||||
|
|
|
||||||
|
|
@ -661,7 +661,6 @@ public:
|
||||||
VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0);
|
VkRect2D scissor = vks::initializers::rect2D(width, height, 0, 0);
|
||||||
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
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);
|
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.composition, 0, 1, &descriptorSets.composition, 0, NULL);
|
||||||
|
|
||||||
// Final composition pass
|
// Final composition pass
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ public:
|
||||||
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
||||||
|
|
||||||
VkClearValue clearValues[2];
|
VkClearValue clearValues[2];
|
||||||
clearValues[0].color = { { 1.0f, 1.0f, 1.0f, 1.0f } };
|
|
||||||
clearValues[0].color = defaultClearColor;
|
clearValues[0].color = defaultClearColor;
|
||||||
clearValues[1].depthStencil = { 1.0f, 0 };
|
clearValues[1].depthStencil = { 1.0f, 0 };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,6 @@ public:
|
||||||
|
|
||||||
VkClearValue clearValues[2];
|
VkClearValue clearValues[2];
|
||||||
clearValues[0].color = defaultClearColor;
|
clearValues[0].color = defaultClearColor;
|
||||||
clearValues[0].color = { {0.2f, 0.2f, 0.2f, 0.0f} };
|
|
||||||
clearValues[1].depthStencil = { 1.0f, 0 };
|
clearValues[1].depthStencil = { 1.0f, 0 };
|
||||||
|
|
||||||
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ public:
|
||||||
VkFormatProperties formatProperties;
|
VkFormatProperties formatProperties;
|
||||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, texture.format, &formatProperties);
|
vkGetPhysicalDeviceFormatProperties(physicalDevice, texture.format, &formatProperties);
|
||||||
// Check if format supports transfer
|
// 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;
|
std::cout << "Error: Device does not support flag TRANSFER_DST for selected texture format!" << std::endl;
|
||||||
return;
|
return;
|
||||||
|
|
@ -255,7 +255,6 @@ public:
|
||||||
imageCreateInfo.arrayLayers = 1;
|
imageCreateInfo.arrayLayers = 1;
|
||||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||||
imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
|
||||||
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||||
imageCreateInfo.extent.width = texture.width;
|
imageCreateInfo.extent.width = texture.width;
|
||||||
imageCreateInfo.extent.height = texture.width;
|
imageCreateInfo.extent.height = texture.width;
|
||||||
|
|
@ -326,7 +325,6 @@ public:
|
||||||
PerlinNoise<float> perlinNoise;
|
PerlinNoise<float> perlinNoise;
|
||||||
FractalNoise<float> fractalNoise(perlinNoise);
|
FractalNoise<float> fractalNoise(perlinNoise);
|
||||||
|
|
||||||
std::default_random_engine rndEngine(std::random_device{}());
|
|
||||||
const int32_t noiseType = rand() % 2;
|
const int32_t noiseType = rand() % 2;
|
||||||
const float noiseScale = static_cast<float>(rand() % 10) + 4.0f;
|
const float noiseScale = static_cast<float>(rand() % 10) + 4.0f;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,6 @@ public:
|
||||||
imageCreateInfo.mipLevels = 1;
|
imageCreateInfo.mipLevels = 1;
|
||||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||||
imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
|
||||||
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
imageCreateInfo.extent = { textureArray.width, textureArray.height, 1 };
|
imageCreateInfo.extent = { textureArray.width, textureArray.height, 1 };
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,6 @@ public:
|
||||||
imageCreateInfo.mipLevels = cubeMap.mipLevels;
|
imageCreateInfo.mipLevels = cubeMap.mipLevels;
|
||||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||||
imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
|
||||||
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
imageCreateInfo.extent = { cubeMap.width, cubeMap.height, 1 };
|
imageCreateInfo.extent = { cubeMap.width, cubeMap.height, 1 };
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,6 @@ public:
|
||||||
imageCreateInfo.arrayLayers = 1;
|
imageCreateInfo.arrayLayers = 1;
|
||||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||||
imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
|
||||||
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
imageCreateInfo.extent = { texture.width, texture.height, 1 };
|
imageCreateInfo.extent = { texture.width, texture.height, 1 };
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,6 @@ public:
|
||||||
sparseImageCreateInfo.arrayLayers = texture.layerCount;
|
sparseImageCreateInfo.arrayLayers = texture.layerCount;
|
||||||
sparseImageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
sparseImageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
sparseImageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
sparseImageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||||
sparseImageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT;
|
|
||||||
sparseImageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
sparseImageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||||
sparseImageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
sparseImageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
sparseImageCreateInfo.extent = { texture.width, texture.height, 1 };
|
sparseImageCreateInfo.extent = { texture.width, texture.height, 1 };
|
||||||
|
|
@ -558,7 +557,6 @@ public:
|
||||||
sampler.compareOp = VK_COMPARE_OP_NEVER;
|
sampler.compareOp = VK_COMPARE_OP_NEVER;
|
||||||
sampler.minLod = 0.0f;
|
sampler.minLod = 0.0f;
|
||||||
sampler.maxLod = static_cast<float>(texture.mipLevels);
|
sampler.maxLod = static_cast<float>(texture.mipLevels);
|
||||||
sampler.anisotropyEnable = vulkanDevice->features.samplerAnisotropy;
|
|
||||||
sampler.maxAnisotropy = vulkanDevice->features.samplerAnisotropy ? vulkanDevice->properties.limits.maxSamplerAnisotropy : 1.0f;
|
sampler.maxAnisotropy = vulkanDevice->features.samplerAnisotropy ? vulkanDevice->properties.limits.maxSamplerAnisotropy : 1.0f;
|
||||||
sampler.anisotropyEnable = false;
|
sampler.anisotropyEnable = false;
|
||||||
sampler.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
sampler.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
||||||
|
|
@ -888,19 +886,8 @@ public:
|
||||||
|
|
||||||
void updateUniformBuffers()
|
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.projection = camera.matrices.perspective;
|
||||||
uboVS.model = camera.matrices.view;
|
uboVS.model = camera.matrices.view;
|
||||||
//uboVS.model = glm::mat4(1.0f);
|
|
||||||
|
|
||||||
uboVS.viewPos = glm::vec4(0.0f, 0.0f, -zoom, 0.0f);
|
uboVS.viewPos = glm::vec4(0.0f, 0.0f, -zoom, 0.0f);
|
||||||
|
|
||||||
VK_CHECK_RESULT(uniformBufferVS.map());
|
VK_CHECK_RESULT(uniformBufferVS.map());
|
||||||
|
|
@ -961,8 +948,6 @@ public:
|
||||||
void fillVirtualTexture(int32_t &mipLevel)
|
void fillVirtualTexture(int32_t &mipLevel)
|
||||||
{
|
{
|
||||||
vkDeviceWaitIdle(device);
|
vkDeviceWaitIdle(device);
|
||||||
std::default_random_engine rndEngine(benchmark.active ? 0 : (unsigned)time(nullptr));
|
|
||||||
std::uniform_real_distribution<float> rndDist(0.0f, 1.0f);
|
|
||||||
std::vector<VkImageBlit> imageBlits;
|
std::vector<VkImageBlit> imageBlits;
|
||||||
for (auto& page : texture.pages)
|
for (auto& page : texture.pages)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,6 @@ public:
|
||||||
|
|
||||||
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, NULL);
|
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, NULL);
|
||||||
|
|
||||||
VkDeviceSize offsets[1] = { 0 };
|
|
||||||
for (auto model : demoModels) {
|
for (auto model : demoModels) {
|
||||||
model.draw(drawCmdBuffers[i]);
|
model.draw(drawCmdBuffers[i]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue