Move shaders into glsl and hlsl directories
Move `data/shaders` to `data/shaders/glsl` Move `data/hlsl` to `data/shaders/hlsl` Fix up shader paths in the cpp files to point to the new glsl location. `data/shaders/hlsl/compile.py` still overwrites the glsl .spv files (for now). Issue: #723
This commit is contained in:
parent
cac1d2e850
commit
ca884587a4
1043 changed files with 1207 additions and 1201 deletions
|
|
@ -11,7 +11,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
#include <random>
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ public:
|
|||
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.plants);
|
||||
vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &models.lodObject.vertices.buffer, offsets);
|
||||
vkCmdBindVertexBuffers(drawCmdBuffers[i], INSTANCE_BUFFER_BIND_ID, 1, &instanceBuffer.buffer, offsets);
|
||||
|
||||
|
||||
vkCmdBindIndexBuffer(drawCmdBuffers[i], models.lodObject.indices.buffer, 0, VK_INDEX_TYPE_UINT32);
|
||||
|
||||
if (vulkanDevice->features.multiDrawIndirect)
|
||||
|
|
@ -209,7 +209,7 @@ public:
|
|||
{
|
||||
vkCmdDrawIndexedIndirect(drawCmdBuffers[i], indirectCommandsBuffer.buffer, j * sizeof(VkDrawIndexedIndirectCommand), 1, sizeof(VkDrawIndexedIndirectCommand));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drawUI(drawCmdBuffers[i]);
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ public:
|
|||
vks::initializers::vertexInputBindingDescription(VERTEX_BUFFER_BIND_ID, vertexLayout.stride(), VK_VERTEX_INPUT_RATE_VERTEX);
|
||||
|
||||
// Binding 1: Per instance
|
||||
vertices.bindingDescriptions[1] =
|
||||
vertices.bindingDescriptions[1] =
|
||||
vks::initializers::vertexInputBindingDescription(INSTANCE_BUFFER_BIND_ID, sizeof(InstanceData), VK_VERTEX_INPUT_RATE_INSTANCE);
|
||||
|
||||
// Attribute descriptions
|
||||
|
|
@ -295,10 +295,10 @@ public:
|
|||
VkBufferMemoryBarrier bufferBarrier = vks::initializers::bufferMemoryBarrier();
|
||||
bufferBarrier.buffer = indirectCommandsBuffer.buffer;
|
||||
bufferBarrier.size = indirectCommandsBuffer.descriptor.range;
|
||||
bufferBarrier.srcAccessMask = VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
|
||||
bufferBarrier.dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT;
|
||||
bufferBarrier.srcQueueFamilyIndex = vulkanDevice->queueFamilyIndices.graphics;
|
||||
bufferBarrier.dstQueueFamilyIndex = vulkanDevice->queueFamilyIndices.compute;
|
||||
bufferBarrier.srcAccessMask = VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
|
||||
bufferBarrier.dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT;
|
||||
bufferBarrier.srcQueueFamilyIndex = vulkanDevice->queueFamilyIndices.graphics;
|
||||
bufferBarrier.dstQueueFamilyIndex = vulkanDevice->queueFamilyIndices.compute;
|
||||
|
||||
vkCmdPipelineBarrier(
|
||||
compute.commandBuffer,
|
||||
|
|
@ -313,7 +313,7 @@ public:
|
|||
vkCmdBindDescriptorSets(compute.commandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, compute.pipelineLayout, 0, 1, &compute.descriptorSet, 0, 0);
|
||||
|
||||
// Dispatch the compute job
|
||||
// The compute shader will do the frustum culling and adjust the indirect draw calls depending on object visibility.
|
||||
// The compute shader will do the frustum culling and adjust the indirect draw calls depending on object visibility.
|
||||
// It also determines the lod to use depending on distance to the viewer.
|
||||
vkCmdDispatch(compute.commandBuffer, objectCount / 16, 1, 1);
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ public:
|
|||
|
||||
void setupDescriptorPool()
|
||||
{
|
||||
// Example uses one ubo
|
||||
// Example uses one ubo
|
||||
std::vector<VkDescriptorPoolSize> poolSizes =
|
||||
{
|
||||
vks::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2),
|
||||
|
|
@ -475,8 +475,8 @@ public:
|
|||
pipelineCreateInfo.pStages = shaderStages.data();
|
||||
|
||||
// Indirect (and instanced) pipeline for the plants
|
||||
shaderStages[0] = loadShader(getAssetPath() + "shaders/computecullandlod/indirectdraw.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
||||
shaderStages[1] = loadShader(getAssetPath() + "shaders/computecullandlod/indirectdraw.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||
shaderStages[0] = loadShader(getShadersPath() + "computecullandlod/indirectdraw.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
||||
shaderStages[1] = loadShader(getShadersPath() + "computecullandlod/indirectdraw.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.plants));
|
||||
}
|
||||
|
||||
|
|
@ -706,9 +706,9 @@ public:
|
|||
|
||||
vkUpdateDescriptorSets(device, static_cast<uint32_t>(computeWriteDescriptorSets.size()), computeWriteDescriptorSets.data(), 0, NULL);
|
||||
|
||||
// Create pipeline
|
||||
// Create pipeline
|
||||
VkComputePipelineCreateInfo computePipelineCreateInfo = vks::initializers::computePipelineCreateInfo(compute.pipelineLayout, 0);
|
||||
computePipelineCreateInfo.stage = loadShader(getAssetPath() + "shaders/computecullandlod/cull.comp.spv", VK_SHADER_STAGE_COMPUTE_BIT);
|
||||
computePipelineCreateInfo.stage = loadShader(getShadersPath() + "computecullandlod/cull.comp.spv", VK_SHADER_STAGE_COMPUTE_BIT);
|
||||
|
||||
// Use specialization constants to pass max. level of detail (determined by no. of meshes)
|
||||
VkSpecializationMapEntry specializationEntry{};
|
||||
|
|
@ -750,7 +750,7 @@ public:
|
|||
|
||||
VkSemaphoreCreateInfo semaphoreCreateInfo = vks::initializers::semaphoreCreateInfo();
|
||||
VK_CHECK_RESULT(vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &compute.semaphore));
|
||||
|
||||
|
||||
// Build a single command buffer containing the compute dispatch commands
|
||||
buildComputeCommandBuffer();
|
||||
}
|
||||
|
|
@ -789,7 +789,7 @@ public:
|
|||
computeSubmitInfo.pSignalSemaphores = &compute.semaphore;
|
||||
|
||||
VK_CHECK_RESULT(vkQueueSubmit(compute.queue, 1, &computeSubmitInfo, VK_NULL_HANDLE));
|
||||
|
||||
|
||||
// Submit graphics command buffer
|
||||
|
||||
submitInfo.commandBufferCount = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue