Merge branch 'SaschaWillems:master' into master
This commit is contained in:
commit
b82ecd94a3
4 changed files with 15 additions and 15 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
#extension GL_EXT_ray_tracing : enable
|
#extension GL_EXT_ray_tracing : enable
|
||||||
#extension GL_EXT_ray_query : enable
|
#extension GL_EXT_ray_query : enable
|
||||||
|
|
||||||
layout (binding = 2, set = 0) uniform accelerationStructureEXT topLevelAS;
|
layout (binding = 1, set = 0) uniform accelerationStructureEXT topLevelAS;
|
||||||
|
|
||||||
layout (location = 0) in vec3 inNormal;
|
layout (location = 0) in vec3 inNormal;
|
||||||
layout (location = 1) in vec3 inColor;
|
layout (location = 1) in vec3 inColor;
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -50,7 +50,7 @@ public:
|
||||||
// Clean up used Vulkan resources
|
// Clean up used Vulkan resources
|
||||||
// Note : Inherited destructor cleans up resources stored in base class
|
// Note : Inherited destructor cleans up resources stored in base class
|
||||||
vkDestroyPipeline(device, pipelines.phong, nullptr);
|
vkDestroyPipeline(device, pipelines.phong, nullptr);
|
||||||
if (deviceFeatures.fillModeNonSolid)
|
if (enabledFeatures.fillModeNonSolid)
|
||||||
{
|
{
|
||||||
vkDestroyPipeline(device, pipelines.wireframe, nullptr);
|
vkDestroyPipeline(device, pipelines.wireframe, nullptr);
|
||||||
}
|
}
|
||||||
|
|
@ -68,11 +68,12 @@ public:
|
||||||
// Fill mode non solid is required for wireframe display
|
// Fill mode non solid is required for wireframe display
|
||||||
if (deviceFeatures.fillModeNonSolid) {
|
if (deviceFeatures.fillModeNonSolid) {
|
||||||
enabledFeatures.fillModeNonSolid = VK_TRUE;
|
enabledFeatures.fillModeNonSolid = VK_TRUE;
|
||||||
// Wide lines must be present for line width > 1.0f
|
|
||||||
if (deviceFeatures.wideLines) {
|
|
||||||
enabledFeatures.wideLines = VK_TRUE;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Wide lines must be present for line width > 1.0f
|
||||||
|
if (deviceFeatures.wideLines) {
|
||||||
|
enabledFeatures.wideLines = VK_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildCommandBuffers()
|
void buildCommandBuffers()
|
||||||
|
|
@ -114,6 +115,7 @@ public:
|
||||||
viewport.width = (float)width / 3.0;
|
viewport.width = (float)width / 3.0;
|
||||||
vkCmdSetViewport(drawCmdBuffers[i], 0, 1, &viewport);
|
vkCmdSetViewport(drawCmdBuffers[i], 0, 1, &viewport);
|
||||||
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.phong);
|
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.phong);
|
||||||
|
vkCmdSetLineWidth(drawCmdBuffers[i], 1.0f);
|
||||||
scene.draw(drawCmdBuffers[i]);
|
scene.draw(drawCmdBuffers[i]);
|
||||||
|
|
||||||
// Center : Toon
|
// Center : Toon
|
||||||
|
|
@ -121,12 +123,12 @@ public:
|
||||||
vkCmdSetViewport(drawCmdBuffers[i], 0, 1, &viewport);
|
vkCmdSetViewport(drawCmdBuffers[i], 0, 1, &viewport);
|
||||||
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.toon);
|
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.toon);
|
||||||
// Line width > 1.0f only if wide lines feature is supported
|
// Line width > 1.0f only if wide lines feature is supported
|
||||||
if (deviceFeatures.wideLines) {
|
if (enabledFeatures.wideLines) {
|
||||||
vkCmdSetLineWidth(drawCmdBuffers[i], 2.0f);
|
vkCmdSetLineWidth(drawCmdBuffers[i], 2.0f);
|
||||||
}
|
}
|
||||||
scene.draw(drawCmdBuffers[i]);
|
scene.draw(drawCmdBuffers[i]);
|
||||||
|
|
||||||
if (deviceFeatures.fillModeNonSolid)
|
if (enabledFeatures.fillModeNonSolid)
|
||||||
{
|
{
|
||||||
// Right : Wireframe
|
// Right : Wireframe
|
||||||
viewport.x = (float)width / 3.0 + (float)width / 3.0;
|
viewport.x = (float)width / 3.0 + (float)width / 3.0;
|
||||||
|
|
@ -268,7 +270,7 @@ public:
|
||||||
|
|
||||||
// Pipeline for wire frame rendering
|
// Pipeline for wire frame rendering
|
||||||
// Non solid rendering is not a mandatory Vulkan feature
|
// Non solid rendering is not a mandatory Vulkan feature
|
||||||
if (deviceFeatures.fillModeNonSolid)
|
if (enabledFeatures.fillModeNonSolid)
|
||||||
{
|
{
|
||||||
rasterizationState.polygonMode = VK_POLYGON_MODE_LINE;
|
rasterizationState.polygonMode = VK_POLYGON_MODE_LINE;
|
||||||
shaderStages[0] = loadShader(getShadersPath() + "pipelines/wireframe.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
shaderStages[0] = loadShader(getShadersPath() + "pipelines/wireframe.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
||||||
|
|
@ -342,7 +344,7 @@ public:
|
||||||
|
|
||||||
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
||||||
{
|
{
|
||||||
if (!deviceFeatures.fillModeNonSolid) {
|
if (!enabledFeatures.fillModeNonSolid) {
|
||||||
if (overlay->header("Info")) {
|
if (overlay->header("Info")) {
|
||||||
overlay->text("Non solid fill modes not supported!");
|
overlay->text("Non solid fill modes not supported!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -302,10 +302,8 @@ public:
|
||||||
std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings = {
|
std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings = {
|
||||||
// Binding 0 : Vertex shader uniform buffer
|
// Binding 0 : Vertex shader uniform buffer
|
||||||
vks::initializers::descriptorSetLayoutBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_VERTEX_BIT, 0),
|
vks::initializers::descriptorSetLayoutBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_VERTEX_BIT, 0),
|
||||||
// Binding 1 : Fragment shader image sampler (shadow map)
|
// Binding 1: Acceleration structure
|
||||||
vks::initializers::descriptorSetLayoutBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_SHADER_STAGE_FRAGMENT_BIT, 1),
|
vks::initializers::descriptorSetLayoutBinding(VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, VK_SHADER_STAGE_FRAGMENT_BIT, 1),
|
||||||
// Binding 2: Acceleration structure
|
|
||||||
vks::initializers::descriptorSetLayoutBinding(VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, VK_SHADER_STAGE_FRAGMENT_BIT, 2),
|
|
||||||
};
|
};
|
||||||
VkDescriptorSetLayoutCreateInfo descriptorLayout = vks::initializers::descriptorSetLayoutCreateInfo(setLayoutBindings);
|
VkDescriptorSetLayoutCreateInfo descriptorLayout = vks::initializers::descriptorSetLayoutCreateInfo(setLayoutBindings);
|
||||||
VK_CHECK_RESULT(vkCreateDescriptorSetLayout(device, &descriptorLayout, nullptr, &descriptorSetLayout));
|
VK_CHECK_RESULT(vkCreateDescriptorSetLayout(device, &descriptorLayout, nullptr, &descriptorSetLayout));
|
||||||
|
|
@ -338,7 +336,7 @@ public:
|
||||||
// The specialized acceleration structure descriptor has to be chained
|
// The specialized acceleration structure descriptor has to be chained
|
||||||
accelerationStructureWrite.pNext = &descriptorAccelerationStructureInfo;
|
accelerationStructureWrite.pNext = &descriptorAccelerationStructureInfo;
|
||||||
accelerationStructureWrite.dstSet = descriptorSet;
|
accelerationStructureWrite.dstSet = descriptorSet;
|
||||||
accelerationStructureWrite.dstBinding = 2;
|
accelerationStructureWrite.dstBinding = 1;
|
||||||
accelerationStructureWrite.descriptorCount = 1;
|
accelerationStructureWrite.descriptorCount = 1;
|
||||||
accelerationStructureWrite.descriptorType = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR;
|
accelerationStructureWrite.descriptorType = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue