2021-02-14 02:35:06 +00:00
|
|
|
{
|
2022-04-03 03:25:04 +00:00
|
|
|
flat_color_image_template = {
|
|
|
|
imageType = `2d;
|
|
|
|
samples = 1;
|
|
|
|
extent = {
|
|
|
|
width = $output.extent.width;
|
|
|
|
height = $output.extent.height;
|
|
|
|
depth = 1;
|
|
|
|
};
|
|
|
|
mipLevels = 1;
|
|
|
|
arrayLayers = 1;
|
|
|
|
tiling = optimal;
|
|
|
|
usage = color_attachment|input_attachment|transient_attachment;
|
|
|
|
initialLayout = undefined;
|
|
|
|
};
|
2021-02-14 02:35:06 +00:00
|
|
|
images = {
|
|
|
|
depth = {
|
2022-04-03 03:25:04 +00:00
|
|
|
@inherit = $properties.flat_color_image_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
format = x8_d24_unorm_pack32;
|
2021-02-25 04:46:33 +00:00
|
|
|
usage = depth_stencil_attachment|input_attachment|transient_attachment;
|
2021-02-14 02:35:06 +00:00
|
|
|
};
|
|
|
|
color = {
|
2022-04-03 03:25:04 +00:00
|
|
|
@inherit = $properties.flat_color_image_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
format = r8g8b8a8_unorm;
|
|
|
|
};
|
2021-03-22 10:08:16 +00:00
|
|
|
emission = {
|
2022-04-03 03:25:04 +00:00
|
|
|
@inherit = $properties.flat_color_image_template;
|
2021-03-22 10:08:16 +00:00
|
|
|
format = r16g16b16a16_sfloat;
|
|
|
|
};
|
2021-02-25 04:46:33 +00:00
|
|
|
normal = {
|
2022-04-03 03:25:04 +00:00
|
|
|
@inherit = $properties.flat_color_image_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
format = r16g16b16a16_sfloat;
|
2021-02-25 04:46:33 +00:00
|
|
|
};
|
|
|
|
position = {
|
2022-04-03 03:25:04 +00:00
|
|
|
@inherit = $properties.flat_color_image_template;
|
2021-02-25 04:46:33 +00:00
|
|
|
format = r32g32b32a32_sfloat;
|
2021-02-14 02:35:06 +00:00
|
|
|
};
|
|
|
|
opaque = {
|
2022-04-03 03:25:04 +00:00
|
|
|
@inherit = $properties.flat_color_image_template;
|
2022-04-03 03:02:13 +00:00
|
|
|
format = r16g16b16a16_sfloat;
|
2021-02-14 02:35:06 +00:00
|
|
|
};
|
|
|
|
};
|
2022-04-03 02:47:53 +00:00
|
|
|
flat_color_view_template = {
|
|
|
|
viewType = VK_IMAGE_VIEW_TYPE_2D;
|
|
|
|
components = {
|
|
|
|
r = identity;
|
|
|
|
g = identity;
|
|
|
|
b = identity;
|
|
|
|
a = identity;
|
|
|
|
};
|
|
|
|
subresourceRange = {
|
|
|
|
aspectMask = color;
|
|
|
|
levelCount = 1;
|
|
|
|
layerCount = 1;
|
|
|
|
};
|
|
|
|
};
|
2021-02-14 02:35:06 +00:00
|
|
|
imageViews = {
|
|
|
|
depth = {
|
2022-04-03 02:47:53 +00:00
|
|
|
@inherit = $properties.flat_color_view_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
image = depth;
|
|
|
|
format = $properties.images.depth.format;
|
|
|
|
subresourceRange = {
|
|
|
|
aspectMask = depth;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
color = {
|
2022-04-03 02:47:53 +00:00
|
|
|
@inherit = $properties.flat_color_view_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
image = color;
|
|
|
|
format = $properties.images.color.format;
|
|
|
|
};
|
2021-03-22 10:08:16 +00:00
|
|
|
emission = {
|
2022-04-03 02:47:53 +00:00
|
|
|
@inherit = $properties.flat_color_view_template;
|
2021-03-22 10:08:16 +00:00
|
|
|
image = emission;
|
|
|
|
format = $properties.images.emission.format;
|
|
|
|
};
|
2021-02-25 04:46:33 +00:00
|
|
|
normal = {
|
2022-04-03 02:47:53 +00:00
|
|
|
@inherit = $properties.flat_color_view_template;
|
2021-02-25 04:46:33 +00:00
|
|
|
image = normal;
|
|
|
|
format = $properties.images.normal.format;
|
|
|
|
};
|
|
|
|
position = {
|
2022-04-03 02:47:53 +00:00
|
|
|
@inherit = $properties.flat_color_view_template;
|
2021-02-25 04:46:33 +00:00
|
|
|
image = position;
|
|
|
|
format = $properties.images.position.format;
|
2021-02-14 02:35:06 +00:00
|
|
|
};
|
|
|
|
opaque = {
|
2022-04-03 02:47:53 +00:00
|
|
|
@inherit = $properties.flat_color_view_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
image = opaque;
|
|
|
|
format = $properties.images.opaque.format;
|
|
|
|
};
|
|
|
|
};
|
2022-11-26 13:23:59 +00:00
|
|
|
output = {
|
|
|
|
image = {
|
|
|
|
@inherit = $properties.flat_color_image_template;
|
|
|
|
usage = color_attachment|input_attachment|sampled;
|
|
|
|
format = $output.format;
|
|
|
|
};
|
|
|
|
view = {
|
|
|
|
@inherit = $properties.flat_color_view_template;
|
|
|
|
image = $output.image;
|
|
|
|
format = $output.format;
|
|
|
|
};
|
|
|
|
format = r16g16b16a16_sfloat;
|
|
|
|
finalLayout = shader_read_only_optimal;
|
|
|
|
};
|
2021-02-14 02:35:06 +00:00
|
|
|
framebuffer = {
|
2022-05-30 06:58:22 +00:00
|
|
|
renderPass = deferred;
|
2021-03-22 10:08:16 +00:00
|
|
|
attachments = (depth, color, emission, normal, position, opaque,
|
2022-12-01 14:03:55 +00:00
|
|
|
$output.view);
|
2022-04-02 02:42:36 +00:00
|
|
|
width = $output.extent.width;
|
|
|
|
height = $output.extent.height;
|
2021-02-23 05:37:48 +00:00
|
|
|
layers = 1;
|
2021-02-14 02:35:06 +00:00
|
|
|
};
|
2021-02-23 05:37:48 +00:00
|
|
|
clearValues = (
|
|
|
|
{ depthStencil = { depth = 1; stencil = 0; }; },
|
|
|
|
{ color = "[0, 0, 0, 1]"; }, // color
|
2021-03-22 10:08:16 +00:00
|
|
|
{ color = "[0, 0, 0, 1]"; }, // emission
|
2021-02-25 04:46:33 +00:00
|
|
|
{ color = "[0, 0, 0, 1]"; }, // normal
|
|
|
|
{ color = "[0, 0, 0, 1]"; }, // position
|
2021-02-23 05:37:48 +00:00
|
|
|
{ color = "[0, 0, 0, 1]"; }, // opaque
|
2022-04-02 02:42:36 +00:00
|
|
|
{ color = "[0, 0, 0, 1]"; }, // output
|
2021-02-23 05:37:48 +00:00
|
|
|
);
|
2022-04-03 04:15:30 +00:00
|
|
|
attachment_template = {
|
|
|
|
samples = 1;
|
|
|
|
loadOp = dont_care;
|
|
|
|
storeOp = dont_care;
|
|
|
|
stencilLoadOp = dont_care;
|
|
|
|
stencilStoreOp = dont_care;
|
|
|
|
initialLayout = undefined;
|
|
|
|
finalLayout = color_attachment_optimal;
|
|
|
|
};
|
2022-05-30 06:58:22 +00:00
|
|
|
info = {
|
|
|
|
color = "[0, 1, 0, 1]";
|
|
|
|
subpass_info = (
|
|
|
|
{ name = depth; color = "[ 0.5, 0.5, 0.5, 1]" },
|
|
|
|
{ name = translucent; color = "[ 0.25, 0.25, 0.6, 1]" },
|
|
|
|
{ name = g-buffef; color = "[ 0.3, 0.7, 0.3, 1]" },
|
|
|
|
{ name = lighting; color = "[ 0.8, 0.8, 0.8, 1]" },
|
|
|
|
{ name = compose; color = "[ 0.7, 0.3, 0.3, 1]" },
|
|
|
|
);
|
|
|
|
};
|
2021-02-14 02:35:06 +00:00
|
|
|
renderpass = {
|
|
|
|
attachments = (
|
|
|
|
{
|
2022-04-03 04:15:30 +00:00
|
|
|
@inherit = $properties.attachment_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
format = $properties.images.depth.format;
|
2021-02-24 10:58:31 +00:00
|
|
|
loadOp = clear;
|
2021-02-14 02:35:06 +00:00
|
|
|
finalLayout = depth_stencil_attachment_optimal;
|
|
|
|
},
|
|
|
|
{
|
2022-04-03 04:15:30 +00:00
|
|
|
@inherit = $properties.attachment_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
format = $properties.images.color.format;
|
2021-12-17 05:51:16 +00:00
|
|
|
loadOp = clear;
|
2021-02-14 02:35:06 +00:00
|
|
|
},
|
2021-03-22 10:08:16 +00:00
|
|
|
{
|
2022-04-03 04:15:30 +00:00
|
|
|
@inherit = $properties.attachment_template;
|
2021-03-22 10:08:16 +00:00
|
|
|
format = $properties.images.emission.format;
|
2021-12-17 05:51:16 +00:00
|
|
|
loadOp = clear;
|
2021-03-22 10:08:16 +00:00
|
|
|
},
|
2021-02-14 02:35:06 +00:00
|
|
|
{
|
2022-04-03 04:15:30 +00:00
|
|
|
@inherit = $properties.attachment_template;
|
2021-02-25 04:46:33 +00:00
|
|
|
format = $properties.images.normal.format;
|
|
|
|
},
|
|
|
|
{
|
2022-04-03 04:15:30 +00:00
|
|
|
@inherit = $properties.attachment_template;
|
2021-02-25 04:46:33 +00:00
|
|
|
format = $properties.images.position.format;
|
2021-02-14 02:35:06 +00:00
|
|
|
},
|
|
|
|
{
|
2022-04-03 04:15:30 +00:00
|
|
|
@inherit = $properties.attachment_template;
|
2021-02-14 02:35:06 +00:00
|
|
|
format = $properties.images.opaque.format;
|
|
|
|
},
|
|
|
|
{
|
2022-04-03 04:15:30 +00:00
|
|
|
@inherit = $properties.attachment_template;
|
2022-04-02 02:42:36 +00:00
|
|
|
format = $output.format;
|
2021-02-14 02:35:06 +00:00
|
|
|
loadOp = clear;
|
|
|
|
storeOp = store;
|
2022-11-26 13:23:59 +00:00
|
|
|
finalLayout = $output.finalLayout;
|
2021-02-14 02:35:06 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
subpasses = (
|
2021-02-24 10:58:31 +00:00
|
|
|
{ // 0 depth
|
2021-02-14 02:35:06 +00:00
|
|
|
pipelineBindPoint = graphics;
|
|
|
|
depthStencilAttachment = {
|
|
|
|
attachment = 0;
|
|
|
|
layout = depth_stencil_attachment_optimal;
|
|
|
|
};
|
|
|
|
},
|
2022-11-30 18:00:47 +00:00
|
|
|
{ // 1 translucent-frags
|
2021-03-23 02:26:24 +00:00
|
|
|
pipelineBindPoint = graphics;
|
|
|
|
depthStencilAttachment = {
|
|
|
|
attachment = 0;
|
|
|
|
layout = depth_stencil_read_only_optimal;
|
|
|
|
};
|
|
|
|
preserveAttachments = (1, 2, 3, 4, 5);
|
|
|
|
},
|
|
|
|
{ // 2 g-buffer generation
|
2021-02-14 02:35:06 +00:00
|
|
|
pipelineBindPoint = graphics;
|
|
|
|
colorAttachments = (
|
|
|
|
{ // color
|
|
|
|
attachment = 1;
|
|
|
|
layout = color_attachment_optimal;
|
|
|
|
},
|
2021-03-22 10:08:16 +00:00
|
|
|
{ // emission
|
2021-02-14 02:35:06 +00:00
|
|
|
attachment = 2;
|
|
|
|
layout = color_attachment_optimal;
|
|
|
|
},
|
2021-03-22 10:08:16 +00:00
|
|
|
{ // normal
|
2021-02-25 04:46:33 +00:00
|
|
|
attachment = 3;
|
|
|
|
layout = color_attachment_optimal;
|
|
|
|
},
|
2021-03-22 10:08:16 +00:00
|
|
|
{ // position
|
|
|
|
attachment = 4;
|
|
|
|
layout = color_attachment_optimal;
|
|
|
|
},
|
2021-02-14 02:35:06 +00:00
|
|
|
);
|
|
|
|
depthStencilAttachment = {
|
|
|
|
attachment = 0;
|
2021-03-23 02:26:24 +00:00
|
|
|
layout = depth_stencil_read_only_optimal;
|
2021-02-14 02:35:06 +00:00
|
|
|
};
|
2021-03-22 10:08:16 +00:00
|
|
|
preserveAttachments = (6);
|
2021-02-14 02:35:06 +00:00
|
|
|
},
|
2021-03-23 02:26:24 +00:00
|
|
|
{ // 3 lighting
|
2021-02-14 02:35:06 +00:00
|
|
|
pipelineBindPoint = graphics;
|
|
|
|
inputAttachments = (
|
|
|
|
{ // depth
|
|
|
|
attachment = 0;
|
|
|
|
layout = shader_read_only_optimal;
|
|
|
|
},
|
|
|
|
{ // color
|
|
|
|
attachment = 1;
|
|
|
|
layout = shader_read_only_optimal;
|
|
|
|
},
|
2021-03-22 10:08:16 +00:00
|
|
|
{ // emission
|
2021-02-14 02:35:06 +00:00
|
|
|
attachment = 2;
|
|
|
|
layout = shader_read_only_optimal;
|
|
|
|
},
|
2021-03-22 10:08:16 +00:00
|
|
|
{ // normal
|
2021-02-25 04:46:33 +00:00
|
|
|
attachment = 3;
|
|
|
|
layout = shader_read_only_optimal;
|
|
|
|
},
|
2021-03-22 10:08:16 +00:00
|
|
|
{ // position
|
|
|
|
attachment = 4;
|
|
|
|
layout = shader_read_only_optimal;
|
|
|
|
},
|
2021-02-14 02:35:06 +00:00
|
|
|
);
|
|
|
|
colorAttachments = (
|
|
|
|
{ // opaque
|
2021-03-22 10:08:16 +00:00
|
|
|
attachment = 5;
|
2021-02-14 02:35:06 +00:00
|
|
|
layout = color_attachment_optimal;
|
|
|
|
},
|
|
|
|
);
|
2021-03-22 10:08:16 +00:00
|
|
|
preserveAttachments = (6);
|
2021-02-14 02:35:06 +00:00
|
|
|
},
|
2022-12-01 14:03:55 +00:00
|
|
|
{ // 4 compose
|
2021-02-14 02:35:06 +00:00
|
|
|
pipelineBindPoint = graphics;
|
|
|
|
inputAttachments = (
|
|
|
|
{ // opaque
|
2021-03-22 10:08:16 +00:00
|
|
|
attachment = 5;
|
2021-02-14 02:35:06 +00:00
|
|
|
layout = shader_read_only_optimal;
|
|
|
|
},
|
|
|
|
);
|
|
|
|
colorAttachments = (
|
2022-04-02 02:42:36 +00:00
|
|
|
{ // output
|
2022-12-01 14:03:55 +00:00
|
|
|
attachment = 6;
|
2021-02-14 02:35:06 +00:00
|
|
|
layout = color_attachment_optimal;
|
|
|
|
},
|
|
|
|
);
|
2021-03-22 10:08:16 +00:00
|
|
|
preserveAttachments = (0, 1, 2, 3, 4);
|
2021-02-14 02:35:06 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
dependencies = (
|
|
|
|
{
|
2021-02-24 10:58:31 +00:00
|
|
|
srcSubpass = 0; // depth
|
2021-03-23 02:26:24 +00:00
|
|
|
dstSubpass = 1; // translucent
|
2021-04-18 09:56:31 +00:00
|
|
|
srcStageMask = late_fragment_tests;
|
|
|
|
dstStageMask = fragment_shader|early_fragment_tests;
|
|
|
|
srcAccessMask = depth_stencil_attachment_write;
|
|
|
|
dstAccessMask = input_attachment_read|depth_stencil_attachment_read;
|
2021-03-23 02:26:24 +00:00
|
|
|
dependencyFlags = by_region;
|
|
|
|
},
|
|
|
|
{
|
|
|
|
srcSubpass = 0; // depth
|
|
|
|
dstSubpass = 2; // g-buffer
|
2021-04-18 09:56:31 +00:00
|
|
|
srcStageMask = late_fragment_tests;
|
|
|
|
dstStageMask = early_fragment_tests;
|
|
|
|
srcAccessMask = depth_stencil_attachment_write;
|
|
|
|
dstAccessMask = depth_stencil_attachment_read;
|
2021-02-14 02:35:06 +00:00
|
|
|
dependencyFlags = by_region;
|
|
|
|
},
|
|
|
|
{
|
2021-03-23 02:26:24 +00:00
|
|
|
srcSubpass = 2; // g-buffer
|
|
|
|
dstSubpass = 3; // lighting
|
2021-02-14 02:35:06 +00:00
|
|
|
srcStageMask = color_attachment_output;
|
|
|
|
dstStageMask = fragment_shader;
|
|
|
|
srcAccessMask = color_attachment_write;
|
2021-04-18 09:56:31 +00:00
|
|
|
dstAccessMask = input_attachment_read;
|
2021-02-14 02:35:06 +00:00
|
|
|
dependencyFlags = by_region;
|
|
|
|
},
|
|
|
|
{
|
2021-03-23 02:26:24 +00:00
|
|
|
srcSubpass = 3; // lighting
|
2022-12-01 14:03:55 +00:00
|
|
|
dstSubpass = 4; // compose
|
2022-11-30 18:00:47 +00:00
|
|
|
srcStageMask = color_attachment_output;
|
|
|
|
dstStageMask = fragment_shader;
|
|
|
|
srcAccessMask = color_attachment_write;
|
|
|
|
dstAccessMask = input_attachment_read;
|
|
|
|
dependencyFlags = by_region;
|
|
|
|
},
|
|
|
|
{
|
|
|
|
srcSubpass = 1; // translucent-frags
|
2022-12-01 14:03:55 +00:00
|
|
|
dstSubpass = 4; // translucent-final/compose
|
2021-02-14 02:35:06 +00:00
|
|
|
srcStageMask = color_attachment_output;
|
|
|
|
dstStageMask = fragment_shader;
|
|
|
|
srcAccessMask = color_attachment_write;
|
2021-04-18 09:56:31 +00:00
|
|
|
dstAccessMask = input_attachment_read;
|
2021-02-14 02:35:06 +00:00
|
|
|
dependencyFlags = by_region;
|
|
|
|
},
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|