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

@ -79,7 +79,7 @@ public:
glm::mat4 viewMatrix;
} uboVS;
// The pipeline layout is used by a pipline to access the descriptor sets
// The pipeline layout is used by a pipline to access the descriptor sets
// It defines interface (without binding any actual data) between the shader stages used by the pipeline and the shader resources
// A pipeline layout can be shared among multiple pipelines as long as their interfaces match
VkPipelineLayout pipelineLayout;
@ -124,7 +124,7 @@ public:
~VulkanExample()
{
// Clean up used Vulkan resources
// Clean up used Vulkan resources
// Note: Inherited destructor cleans up resources stored in base class
vkDestroyPipeline(device, pipeline, nullptr);
@ -152,7 +152,7 @@ public:
// This function is used to request a device memory type that supports all the property flags we request (e.g. device local, host visibile)
// Upon success it will return the index of the memory type that fits our requestes memory properties
// This is necessary as implementations can offer an arbitrary number of memory types with different
// memory properties.
// memory properties.
// You can check http://vulkan.gpuinfo.org/ for details on different memory configurations
uint32_t getMemoryTypeIndex(uint32_t typeBits, VkMemoryPropertyFlags properties)
{
@ -209,7 +209,7 @@ public:
cmdBufAllocateInfo.commandPool = cmdPool;
cmdBufAllocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
cmdBufAllocateInfo.commandBufferCount = 1;
VK_CHECK_RESULT(vkAllocateCommandBuffers(device, &cmdBufAllocateInfo, &cmdBuffer));
// If requested, also start the new command buffer
@ -276,7 +276,7 @@ public:
renderPassBeginInfo.renderArea.extent.height = height;
renderPassBeginInfo.clearValueCount = 2;
renderPassBeginInfo.pClearValues = clearValues;
for (int32_t i = 0; i < drawCmdBuffers.size(); ++i)
{
// Set target frame buffer
@ -323,7 +323,7 @@ public:
vkCmdEndRenderPass(drawCmdBuffers[i]);
// Ending the render pass will add an implicit barrier transitioning the frame buffer color attachment to
// Ending the render pass will add an implicit barrier transitioning the frame buffer color attachment to
// VK_IMAGE_LAYOUT_PRESENT_SRC_KHR for presenting it to the windowing system
VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i]));
@ -374,7 +374,7 @@ public:
// what should be done a real-world application, where you should allocate large chunkgs of memory at once isntead.
// Setup vertices
std::vector<Vertex> vertexBuffer =
std::vector<Vertex> vertexBuffer =
{
{ { 1.0f, 1.0f, 0.0f }, { 1.0f, 0.0f, 0.0f } },
{ { -1.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f } },
@ -395,7 +395,7 @@ public:
if (useStagingBuffers)
{
// Static data like vertex and index buffer should be stored on the device memory
// Static data like vertex and index buffer should be stored on the device memory
// for optimal (and fastest) access by the GPU
//
// To achieve this we use so-called "staging buffers" :
@ -695,7 +695,7 @@ public:
}
// Render pass setup
// Render passes are a new concept in Vulkan. They describe the attachments used during rendering and may contain multiple subpasses with attachment dependencies
// Render passes are a new concept in Vulkan. They describe the attachments used during rendering and may contain multiple subpasses with attachment dependencies
// This allows the driver to know up-front what the rendering will look like and is a good opportunity to optimize especially on tile-based renderers (with multiple subpasses)
// Using sub pass dependencies also adds implicit layout transitions for the attachment used, so we don't need to add explicit image memory barriers to transform them
// Note: Override of virtual function in the base class and called from within VulkanExampleBase::prepare
@ -715,7 +715,7 @@ public:
attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; // Same for store
attachments[0].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; // Layout at render pass start. Initial doesn't matter, so we use undefined
attachments[0].finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; // Layout to which the attachment is transitioned when the render pass is finished
// As we want to present the color buffer to the swapchain, we transition to PRESENT_KHR
// As we want to present the color buffer to the swapchain, we transition to PRESENT_KHR
// Depth attachment
attachments[1].format = depthFormat; // A proper depth format is selected in the example base
attachments[1].samples = VK_SAMPLE_COUNT_1_BIT;
@ -926,7 +926,7 @@ public:
multisampleState.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
multisampleState.pSampleMask = nullptr;
// Vertex input descriptions
// Vertex input descriptions
// Specifies the vertex input parameters for a pipeline
// Vertex input binding
@ -970,7 +970,7 @@ public:
// Set pipeline stage for this shader
shaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
// Load binary SPIR-V shader
shaderStages[0].module = loadSPIRVShader(getAssetPath() + "shaders/triangle/triangle.vert.spv");
shaderStages[0].module = loadSPIRVShader(getShadersPath() + "triangle/triangle.vert.spv");
// Main entry point for the shader
shaderStages[0].pName = "main";
assert(shaderStages[0].module != VK_NULL_HANDLE);
@ -980,7 +980,7 @@ public:
// Set pipeline stage for this shader
shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
// Load binary SPIR-V shader
shaderStages[1].module = loadSPIRVShader(getAssetPath() + "shaders/triangle/triangle.frag.spv");
shaderStages[1].module = loadSPIRVShader(getShadersPath() + "triangle/triangle.frag.spv");
// Main entry point for the shader
shaderStages[1].pName = "main";
assert(shaderStages[1].module != VK_NULL_HANDLE);
@ -1029,7 +1029,7 @@ public:
// Create a new buffer
VK_CHECK_RESULT(vkCreateBuffer(device, &bufferInfo, nullptr, &uniformBufferVS.buffer));
// Get memory requirements including size, alignment and memory type
// Get memory requirements including size, alignment and memory type
vkGetBufferMemoryRequirements(device, uniformBufferVS.buffer, &memReqs);
allocInfo.allocationSize = memReqs.size;
// Get the memory type index that supports host visibile memory access
@ -1041,7 +1041,7 @@ public:
VK_CHECK_RESULT(vkAllocateMemory(device, &allocInfo, nullptr, &(uniformBufferVS.memory)));
// Bind memory to buffer
VK_CHECK_RESULT(vkBindBufferMemory(device, uniformBufferVS.buffer, uniformBufferVS.memory, 0));
// Store information in the uniform's descriptor that is used by the descriptor set
uniformBufferVS.descriptor.buffer = uniformBufferVS.buffer;
uniformBufferVS.descriptor.offset = 0;
@ -1052,7 +1052,7 @@ public:
void updateUniformBuffers()
{
// Pass matrices to the shaders
// Pass matrices to the shaders
uboVS.projectionMatrix = camera.matrices.perspective;
uboVS.viewMatrix = camera.matrices.view;
uboVS.modelMatrix = glm::mat4(1.0f);