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:
Ben Clayton 2020-05-29 16:08:53 +01:00
parent cac1d2e850
commit ca884587a4
1043 changed files with 1207 additions and 1201 deletions

View file

@ -101,7 +101,7 @@ public:
} pipelines;
struct {
VkPipelineLayout deferred;
VkPipelineLayout deferred;
VkPipelineLayout offscreen;
} pipelineLayouts;
@ -122,12 +122,12 @@ public:
};
struct FrameBuffer {
int32_t width, height;
VkFramebuffer frameBuffer;
VkFramebuffer frameBuffer;
FrameBufferAttachment position, normal, albedo;
FrameBufferAttachment depth;
VkRenderPass renderPass;
} offScreenFrameBuf;
// One sampler for the frame buffer color attachments
VkSampler colorSampler;
@ -152,7 +152,7 @@ public:
~VulkanExample()
{
// Clean up used Vulkan resources
// Clean up used Vulkan resources
// Note : Inherited destructor cleans up resources stored in base class
vkDestroySampler(device, colorSampler, nullptr);
@ -210,14 +210,14 @@ public:
vkDestroySemaphore(device, offscreenSemaphore, nullptr);
}
// Enable physical device features required for this example
// Enable physical device features required for this example
virtual void getEnabledFeatures()
{
// Enable anisotropic filtering if supported
if (deviceFeatures.samplerAnisotropy) {
enabledFeatures.samplerAnisotropy = VK_TRUE;
}
// Enable texture compression
// Enable texture compression
if (deviceFeatures.textureCompressionBC) {
enabledFeatures.textureCompressionBC = VK_TRUE;
}
@ -231,7 +231,7 @@ public:
// Create a frame buffer attachment
void createAttachment(
VkFormat format,
VkFormat format,
VkImageUsageFlagBits usage,
FrameBufferAttachment *attachment)
{
@ -274,7 +274,7 @@ public:
memAlloc.memoryTypeIndex = vulkanDevice->getMemoryType(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
VK_CHECK_RESULT(vkAllocateMemory(device, &memAlloc, nullptr, &attachment->mem));
VK_CHECK_RESULT(vkBindImageMemory(device, attachment->image, attachment->mem, 0));
VkImageViewCreateInfo imageView = vks::initializers::imageViewCreateInfo();
imageView.viewType = VK_IMAGE_VIEW_TYPE_2D;
imageView.format = format;
@ -381,8 +381,8 @@ public:
dependencies[0].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
dependencies[0].dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT;
dependencies[1].srcSubpass = 0;
dependencies[1].dstSubpass = VK_SUBPASS_EXTERNAL;
dependencies[1].srcSubpass = 0;
dependencies[1].dstSubpass = VK_SUBPASS_EXTERNAL;
dependencies[1].srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
dependencies[1].dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
dependencies[1].srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
@ -397,9 +397,9 @@ public:
renderPassInfo.pSubpasses = &subpass;
renderPassInfo.dependencyCount = 2;
renderPassInfo.pDependencies = dependencies.data();
VK_CHECK_RESULT(vkCreateRenderPass(device, &renderPassInfo, nullptr, &offScreenFrameBuf.renderPass));
std::array<VkImageView,4> attachments;
attachments[0] = offScreenFrameBuf.position.view;
attachments[1] = offScreenFrameBuf.normal.view;
@ -595,7 +595,7 @@ public:
void generateQuads()
{
// Setup vertices for multiple screen aligned quads
// Used for displaying final result and debug
// Used for displaying final result and debug
struct Vertex {
float pos[3];
float uv[2];
@ -847,7 +847,7 @@ public:
// Model
VK_CHECK_RESULT(vkAllocateDescriptorSets(device, &allocInfo, &descriptorSets.model));
writeDescriptorSets =
writeDescriptorSets =
{
// Binding 0: Vertex shader uniform buffer
vks::initializers::writeDescriptorSet(
@ -923,7 +923,7 @@ public:
VkPipelineDepthStencilStateCreateInfo depthStencilState =
vks::initializers::pipelineDepthStencilStateCreateInfo(
VK_TRUE,
VK_TRUE,
VK_TRUE,
VK_COMPARE_OP_LESS_OR_EQUAL);
@ -964,8 +964,8 @@ public:
pipelineCreateInfo.pStages = shaderStages.data();
// Final fullscreen composition pass pipeline
shaderStages[0] = loadShader(getAssetPath() + "shaders/deferred/deferred.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getAssetPath() + "shaders/deferred/deferred.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
shaderStages[0] = loadShader(getShadersPath() + "deferred/deferred.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getShadersPath() + "deferred/deferred.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
// Empty vertex input state, quads are generated by the vertex shader
VkPipelineVertexInputStateCreateInfo emptyInputState = vks::initializers::pipelineVertexInputStateCreateInfo();
pipelineCreateInfo.pVertexInputState = &emptyInputState;
@ -974,13 +974,13 @@ public:
// Debug display pipeline
pipelineCreateInfo.pVertexInputState = &vertices.inputState;
shaderStages[0] = loadShader(getAssetPath() + "shaders/deferred/debug.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getAssetPath() + "shaders/deferred/debug.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
shaderStages[0] = loadShader(getShadersPath() + "deferred/debug.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getShadersPath() + "deferred/debug.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.debug));
// Offscreen pipeline
shaderStages[0] = loadShader(getAssetPath() + "shaders/deferred/mrt.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getAssetPath() + "shaders/deferred/mrt.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
shaderStages[0] = loadShader(getShadersPath() + "deferred/mrt.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getShadersPath() + "deferred/mrt.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
// Separate render pass
pipelineCreateInfo.renderPass = offScreenFrameBuf.renderPass;
@ -1048,7 +1048,7 @@ public:
if (debugDisplay)
{
uboVS.projection = glm::ortho(0.0f, 2.0f, 0.0f, 2.0f, -1.0f, 1.0f);
}
}
else
{
uboVS.projection = glm::ortho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
@ -1121,7 +1121,7 @@ public:
VulkanExampleBase::prepareFrame();
// The scene render command buffer has to wait for the offscreen
// rendering to be finished before we can use the framebuffer
// rendering to be finished before we can use the framebuffer
// color image for sampling during final rendering
// To ensure this we use a dedicated offscreen synchronization
// semaphore that will be signaled when offscreen renderin
@ -1170,7 +1170,7 @@ public:
setupDescriptorPool();
setupDescriptorSet();
buildCommandBuffers();
buildDeferredCommandBuffer();
buildDeferredCommandBuffer();
prepared = true;
}