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

@ -1,7 +1,7 @@
/*
* Vulkan Example - Multiview (VK_KHR_multiview)
*
* Uses VK_KHR_multiview for simultaneously rendering to multiple views and displays these with barrel distortion using a fragment shader
* Uses VK_KHR_multiview for simultaneously rendering to multiple views and displays these with barrel distortion using a fragment shader
*
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de
*
@ -86,7 +86,7 @@ public:
// Enable extension required for multiview
enabledDeviceExtensions.push_back(VK_KHR_MULTIVIEW_EXTENSION_NAME);
// Reading device properties and features for multiview requires VK_KHR_get_physical_device_properties2 to be enabled
enabledInstanceExtensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
}
@ -231,7 +231,7 @@ public:
samplerCI.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
VK_CHECK_RESULT(vkCreateSampler(device, &samplerCI, nullptr, &multiviewPass.sampler));
// Fill a descriptor for later use in a descriptor set
// Fill a descriptor for later use in a descriptor set
multiviewPass.descriptor.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
multiviewPass.descriptor.imageView = multiviewPass.color.view;
multiviewPass.descriptor.sampler = multiviewPass.sampler;
@ -302,7 +302,7 @@ public:
renderPassCI.pSubpasses = &subpassDescription;
renderPassCI.dependencyCount = static_cast<uint32_t>(dependencies.size());
renderPassCI.pDependencies = dependencies.data();
/*
Setup multiview info for the renderpass
*/
@ -454,7 +454,7 @@ public:
void loadAssets()
{
scene.loadFromFile(getAssetPath() + "models/sampleroom.dae", vertexLayout, 0.25f, vulkanDevice, queue);
scene.loadFromFile(getAssetPath() + "models/sampleroom.dae", vertexLayout, 0.25f, vulkanDevice, queue);
}
void prepareDescriptors()
@ -468,7 +468,7 @@ public:
};
VkDescriptorPoolCreateInfo descriptorPoolInfo = vks::initializers::descriptorPoolCreateInfo(static_cast<uint32_t>(poolSizes.size()), poolSizes.data(), 1);
VK_CHECK_RESULT(vkCreateDescriptorPool(device, &descriptorPoolInfo, nullptr, &descriptorPool));
/*
Layouts
*/
@ -545,8 +545,8 @@ public:
vks::initializers::vertexInputBindingDescription(0, vertexLayout.stride(), VK_VERTEX_INPUT_RATE_VERTEX),
};
std::vector<VkVertexInputAttributeDescription> vertexInputAttributes = {
vks::initializers::vertexInputAttributeDescription(0, 0, VK_FORMAT_R32G32B32_SFLOAT, 0), // Location 0: Position
vks::initializers::vertexInputAttributeDescription(0, 1, VK_FORMAT_R32G32B32_SFLOAT, sizeof(float) * 3), // Location 1: Normals
vks::initializers::vertexInputAttributeDescription(0, 0, VK_FORMAT_R32G32B32_SFLOAT, 0), // Location 0: Position
vks::initializers::vertexInputAttributeDescription(0, 1, VK_FORMAT_R32G32B32_SFLOAT, sizeof(float) * 3), // Location 1: Normals
vks::initializers::vertexInputAttributeDescription(0, 2, VK_FORMAT_R32G32B32_SFLOAT, sizeof(float) * 6), // Location 2: Color
};
@ -571,8 +571,8 @@ public:
Contrary to the viewport array example we don't need a geometry shader for broadcasting
*/
std::array<VkPipelineShaderStageCreateInfo, 2> shaderStages;
shaderStages[0] = loadShader(getAssetPath() + "shaders/multiview/multiview.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getAssetPath() + "shaders/multiview/multiview.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
shaderStages[0] = loadShader(getShadersPath() + "multiview/multiview.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getShadersPath() + "multiview/multiview.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
pipelineCI.stageCount = 2;
pipelineCI.pStages = shaderStages.data();
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipeline));
@ -595,8 +595,8 @@ public:
Separate pipelines per eye (view) using specialization constants to set view array layer to sample from
*/
for (uint32_t i = 0; i < 2; i++) {
shaderStages[0] = loadShader(getAssetPath() + "shaders/multiview/viewdisplay.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getAssetPath() + "shaders/multiview/viewdisplay.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
shaderStages[0] = loadShader(getShadersPath() + "multiview/viewdisplay.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
shaderStages[1] = loadShader(getShadersPath() + "multiview/viewdisplay.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
shaderStages[1].pSpecializationInfo = &specializationInfo;
multiviewArrayLayer = (float)i;
VkPipelineVertexInputStateCreateInfo emptyInputState = vks::initializers::pipelineVertexInputStateCreateInfo();
@ -646,7 +646,7 @@ public:
rotM = glm::rotate(rotM, glm::radians(camera.rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
rotM = glm::rotate(rotM, glm::radians(camera.rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
rotM = glm::rotate(rotM, glm::radians(camera.rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
// Left eye
left = -aspectRatio * wd2 + 0.5f * eyeSeparation * ndfl;
right = aspectRatio * wd2 + 0.5f * eyeSeparation * ndfl;