[vulkan] Remove depth buffer from lighting pass

It's not needed and exceeds the minimum maximum input attachments.
This commit is contained in:
Bill Currie 2023-08-01 13:32:46 +09:00
parent 4ccd4ba3c7
commit 2d7f671da8
6 changed files with 10 additions and 32 deletions

View file

@ -52,12 +52,10 @@ typedef struct qfv_lightmatset_s DARRAY_TYPE (mat4f_t) qfv_lightmatset_t;
typedef struct qfv_light_buffer_s {
light_t lights[MaxLights] __attribute__((aligned(16)));
int lightCount;
//mat4f_t shadowMat[MaxLights];
//vec4f_t shadowCascade[MaxLights];
} qfv_light_buffer_t;
#define LIGHTING_BUFFER_INFOS 1
#define LIGHTING_ATTACH_INFOS 5
#define LIGHTING_ATTACH_INFOS 4
#define LIGHTING_SHADOW_INFOS 32
#define LIGHTING_DESCRIPTORS (LIGHTING_BUFFER_INFOS + LIGHTING_ATTACH_INFOS + 1)

View file

@ -923,12 +923,6 @@ descriptorSetLayouts = {
descriptorCount = 1;
stageFlags = fragment;
},
{
binding = 4;
descriptorType = input_attachment;
descriptorCount = 1;
stageFlags = fragment;
},
);
};
lighting_lights = {
@ -1512,7 +1506,6 @@ renderpasses = {
};
attachments = {
input = {
depth = shader_read_only_optimal;
color = shader_read_only_optimal;
emission = shader_read_only_optimal;
normal = shader_read_only_optimal;
@ -1524,7 +1517,7 @@ renderpasses = {
blend = $blend_disable;
};
};
preserve = (output);
preserve = (depth, output);
};
pipelines = {
lights = {

View file

@ -3,11 +3,10 @@
#include "lighting.h"
layout (input_attachment_index = 0, set = 2, binding = 0) uniform subpassInput depth;
layout (input_attachment_index = 1, set = 2, binding = 1) uniform subpassInput color;
layout (input_attachment_index = 2, set = 2, binding = 2) uniform subpassInput emission;
layout (input_attachment_index = 3, set = 2, binding = 3) uniform subpassInput normal;
layout (input_attachment_index = 4, set = 2, binding = 4) uniform subpassInput position;
layout (input_attachment_index = 0, set = 2, binding = 0) uniform subpassInput color;
layout (input_attachment_index = 1, set = 2, binding = 1) uniform subpassInput emission;
layout (input_attachment_index = 2, set = 2, binding = 2) uniform subpassInput normal;
layout (input_attachment_index = 3, set = 2, binding = 3) uniform subpassInput position;
layout (set = 3, binding = 0) uniform sampler2DArrayShadow shadowCascade[MaxLights];
layout (set = 3, binding = 0) uniform sampler2DShadow shadowPlane[MaxLights];

View file

@ -3,11 +3,10 @@
#include "lighting.h"
layout (input_attachment_index = 0, set = 2, binding = 0) uniform subpassInput depth;
layout (input_attachment_index = 1, set = 2, binding = 1) uniform subpassInput color;
layout (input_attachment_index = 2, set = 2, binding = 2) uniform subpassInput emission;
layout (input_attachment_index = 3, set = 2, binding = 3) uniform subpassInput normal;
layout (input_attachment_index = 4, set = 2, binding = 4) uniform subpassInput position;
layout (input_attachment_index = 0, set = 2, binding = 0) uniform subpassInput color;
layout (input_attachment_index = 1, set = 2, binding = 1) uniform subpassInput emission;
layout (input_attachment_index = 2, set = 2, binding = 2) uniform subpassInput normal;
layout (input_attachment_index = 3, set = 2, binding = 3) uniform subpassInput position;
layout (set = 3, binding = 0) uniform sampler2DArrayShadow shadowCascade[MaxLights];
layout (set = 3, binding = 0) uniform sampler2DShadow shadowPlane[MaxLights];
@ -52,7 +51,6 @@ shadow_cube (samplerCubeShadow map)
void
main (void)
{
//float d = subpassLoad (depth).r;
vec3 c = subpassLoad (color).rgb;
vec3 e = subpassLoad (emission).rgb;
vec3 n = subpassLoad (normal).rgb;

View file

@ -10,6 +10,4 @@ layout (constant_id = 0) const int MaxLights = 768;
layout (set = 1, binding = 0) uniform Lights {
LightData lights[MaxLights];
int lightCount;
//mat4 shadowMat[MaxLights];
//vec4 shadowCascale[MaxLights];
};

View file

@ -393,8 +393,6 @@ lighting_update_descriptors (const exprval_t **params, exprval_t *result,
auto fb = &taskctx->renderpass->framebuffer;
VkDescriptorImageInfo attachInfo[] = {
{ .imageView = fb->views[QFV_attachDepth],
.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL },
{ .imageView = fb->views[QFV_attachColor],
.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL },
{ .imageView = fb->views[QFV_attachEmission],
@ -429,12 +427,6 @@ lighting_update_descriptors (const exprval_t **params, exprval_t *result,
.descriptorCount = 1,
.descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
.pImageInfo = &attachInfo[3], },
{ .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
.dstSet = lframe->attach_set,
.dstBinding = 4,
.descriptorCount = 1,
.descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
.pImageInfo = &attachInfo[4], },
};
//lframe->bufferInfo[0].buffer = lframe->light_buffer;
dfunc->vkUpdateDescriptorSets (device->dev,