diff --git a/include/QF/Vulkan/qf_lighting.h b/include/QF/Vulkan/qf_lighting.h index 5bb448de2..a96f22e70 100644 --- a/include/QF/Vulkan/qf_lighting.h +++ b/include/QF/Vulkan/qf_lighting.h @@ -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) diff --git a/libs/video/renderer/vulkan/rp_main_def.plist b/libs/video/renderer/vulkan/rp_main_def.plist index ec5aae302..261746c81 100644 --- a/libs/video/renderer/vulkan/rp_main_def.plist +++ b/libs/video/renderer/vulkan/rp_main_def.plist @@ -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 = { diff --git a/libs/video/renderer/vulkan/shader/light_splat.frag b/libs/video/renderer/vulkan/shader/light_splat.frag index 98cc64c56..23628e1e2 100644 --- a/libs/video/renderer/vulkan/shader/light_splat.frag +++ b/libs/video/renderer/vulkan/shader/light_splat.frag @@ -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]; diff --git a/libs/video/renderer/vulkan/shader/lighting.frag b/libs/video/renderer/vulkan/shader/lighting.frag index 1a2f34c60..9bbe49d53 100644 --- a/libs/video/renderer/vulkan/shader/lighting.frag +++ b/libs/video/renderer/vulkan/shader/lighting.frag @@ -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; diff --git a/libs/video/renderer/vulkan/shader/lighting.h b/libs/video/renderer/vulkan/shader/lighting.h index d564843c0..2599e6161 100644 --- a/libs/video/renderer/vulkan/shader/lighting.h +++ b/libs/video/renderer/vulkan/shader/lighting.h @@ -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]; }; diff --git a/libs/video/renderer/vulkan/vulkan_lighting.c b/libs/video/renderer/vulkan/vulkan_lighting.c index 32f5a2794..4f59fecda 100644 --- a/libs/video/renderer/vulkan/vulkan_lighting.c +++ b/libs/video/renderer/vulkan/vulkan_lighting.c @@ -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,