[vulkan] Clean up the pipeline specifications

While being able to write pipeline specs like this was the end goal of
the parsing sub-project, I didn't realize it was already usable. This
sure makes going through the pipeline specs much easier.
This commit is contained in:
Bill Currie 2021-03-23 10:01:13 +09:00
parent 81956095f1
commit d4e1bfb8b8

View file

@ -335,6 +335,169 @@
setLayouts = (compose_attach);
};
};
depthStencil = {
test_and_write = {
depthTestEnable = true;
depthWriteEnable = true;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
test_only = {
depthTestEnable = true;
depthWriteEnable = false;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
disable = {
depthTestEnable = false;
depthWriteEnable = false;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
};
inputAssembly = {
alias = {
topology = triangle_list;
primitiveRestartEnable = false;
};
brush = {
topology = triangle_fan;
primitiveRestartEnable = true;
};
twod = {
topology = triangle_strip;
primitiveRestartEnable = true;
};
};
vertexInput = {
alias = {
bindings = (
{ binding = 0; stride = "2 * 4 * 4"; inputRate = vertex; },
{ binding = 1; stride = "2 * 4 * 4"; inputRate = vertex; },
{ binding = 2; stride = "2 * 4"; inputRate = vertex; },
);
attributes = (
{ location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; },
{ location = 1; binding = 0; format = r32g32b32a32_sfloat; offset = 16; },
{ location = 2; binding = 1; format = r32g32b32a32_sfloat; offset = 0; },
{ location = 3; binding = 1; format = r32g32b32a32_sfloat; offset = 16; },
{ location = 4; binding = 2; format = r32g32_sfloat; offset = 0; },
);
};
brush = {
bindings = (
{ binding = 0; stride = "2 * 4 * 4"; inputRate = vertex; },
);
attributes = (
{ location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; },
{ location = 1; binding = 0; format = r32g32b32a32_sfloat; offset = 16; },
);
};
twod = {
bindings = (
{ binding = 0; stride = "2 * 4 * 4"; inputRate = vertex; },
);
attributes = (
{ location = 0; binding = 0; format = r32g32_sfloat; offset = 0; },
{ location = 1; binding = 0; format = r32g32_sfloat; offset = 8; },
{ location = 2; binding = 0; format = r32g32b32a32_sfloat; offset = 16; },
);
};
};
rasterization = {
cw_cull_back = {
depthClampEnable = false;
rasterizerDiscardEnable = false;
polygonMode = fill;
cullMode = back;
frontFace = clockwise;
depthBiasEnable = false;
lineWidth = 1;
};
counter_cw_cull_back = {
depthClampEnable = false;
rasterizerDiscardEnable = false;
polygonMode = fill;
cullMode = back;
frontFace = counter_clockwise;
depthBiasEnable = false;
lineWidth = 1;
};
};
multisample = {
rasterizationSamples = $msaaSamples;
sampleShadingEnable = false;
minSampleShading = 0.5f;
alphaToCoverageEnable = false;
alphaToOneEnable = false;
};
viewport = {
viewports = (
{
x = 0; y = 0;
width = 640; height = 480;
minDepth = 0; maxDepth = 1;
}
);
scissors = (
{
offset = { x = 0; y = 0 };
extent = { width = 640; height = 480; };
},
);
};
attachmentBlendOp = {
disabled = {
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
};
alpha_blend = {
blendEnable = true;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
};
};
fsquad = {
vertexInput = {
bindings = (
{ binding = 0; stride = "4 * 4"; inputRate = vertex; },
);
attributes = (
{ location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; },
);
};
inputAssembly = {
topology = triangle_strip;
primitiveRestartEnable = false;
};
colorBlend = {
logicOpEnable = false;
attachments = ($properties.attachmentBlendOp.disabled);
};
};
pipelines = {
alias_depth = {
subpass = 0;
@ -346,29 +509,24 @@
},
);
vertexInput = {
// depth pass doesn't use UVs
bindings = (
"$properties.pipelines.alias_gbuf.vertexInput.bindings[0]",
"$properties.pipelines.alias_gbuf.vertexInput.bindings[1]",
"$properties.vertexInput.alias.bindings[0]",
"$properties.vertexInput.alias.bindings[1]",
);
attributes = (
"$properties.pipelines.alias_gbuf.vertexInput.attributes[0]",
"$properties.pipelines.alias_gbuf.vertexInput.attributes[1]",
"$properties.pipelines.alias_gbuf.vertexInput.attributes[2]",
"$properties.pipelines.alias_gbuf.vertexInput.attributes[3]",
"$properties.vertexInput.alias.attributes[0]",
"$properties.vertexInput.alias.attributes[1]",
"$properties.vertexInput.alias.attributes[2]",
"$properties.vertexInput.alias.attributes[3]",
);
};
inputAssembly = $properties.pipelines.alias_gbuf.inputAssembly;
viewport = $properties.pipelines.alias_gbuf.viewport;
rasterization = $properties.pipelines.alias_gbuf.rasterization;
multisample = $properties.pipelines.alias_gbuf.multisample;
depthStencil = {
depthTestEnable = true;
depthWriteEnable = true;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
colorBlend = $properties.pipelines.alias_gbuf.colorBlend;
inputAssembly = $properties.inputAssembly.alias;
viewport = $properties.viewport;
rasterization = $properties.rasterization.cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_and_write;
colorBlend = $properties.pipelines.alias_gbuf.colorBlend;
dynamic = {
dynamicState = ( viewport, scissor );
};
@ -395,142 +553,19 @@
};
},
);
vertexInput = {
bindings = (
{
binding = 0;
stride = "2 * 4 * 4";
inputRate = vertex;
},
{
binding = 1;
stride = "2 * 4 * 4";
inputRate = vertex;
},
{
binding = 2;
stride = "2 * 4";
inputRate = vertex;
},
);
attributes = (
{
location = 0;
binding = 0;
format = r32g32b32a32_sfloat;
offset = 0;
},
{
location = 1;
binding = 0;
format = r32g32b32a32_sfloat;
offset = 16;
},
{
location = 2;
binding = 1;
format = r32g32b32a32_sfloat;
offset = 0;
},
{
location = 3;
binding = 1;
format = r32g32b32a32_sfloat;
offset = 16;
},
{
location = 4;
binding = 2;
format = r32g32_sfloat;
offset = 0;
},
);
};
inputAssembly = {
topology = triangle_list;
primitiveRestartEnable = false;
};
viewport = {
viewports = (
{
x = 0; y = 0;
width = 640; height = 480;
minDepth = 0; maxDepth = 1;
}
);
scissors = (
{
offset = { x = 0; y = 0 };
extent = { width = 640; height = 480; };
},
);
};
rasterization = {
depthClampEnable = false;
rasterizerDiscardEnable = false;
polygonMode = fill;
cullMode = back;
frontFace = clockwise;
depthBiasEnable = false;
lineWidth = 1;
};
multisample = {
rasterizationSamples = $msaaSamples;
sampleShadingEnable = false;
minSampleShading = 0.5f;
alphaToCoverageEnable = false;
alphaToOneEnable = false;
};
depthStencil = {
depthTestEnable = true;
depthWriteEnable = true;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
vertexInput = $properties.vertexInput.alias;
inputAssembly = $properties.inputAssembly.alias;
viewport = $properties.viewport;
rasterization = $properties.rasterization.cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_only;
colorBlend = {
logicOpEnable = false;
attachments = (
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
);
};
dynamic = {
@ -550,24 +585,18 @@
);
vertexInput = {
bindings = (
"$properties.pipelines.bsp_gbuf.vertexInput.bindings[0]",
"$properties.vertexInput.brush.bindings[0]",
);
attributes = (
"$properties.pipelines.bsp_gbuf.vertexInput.attributes[0]",
"$properties.vertexInput.brush.attributes[0]",
);
};
inputAssembly = $properties.pipelines.bsp_gbuf.inputAssembly;
viewport = $properties.pipelines.bsp_gbuf.viewport;
rasterization = $properties.pipelines.bsp_gbuf.rasterization;
multisample = $properties.pipelines.bsp_gbuf.multisample;
depthStencil = {
depthTestEnable = true;
depthWriteEnable = true;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
colorBlend = $properties.pipelines.bsp_gbuf.colorBlend;
inputAssembly = $properties.inputAssembly.brush;
viewport = $properties.viewport;
rasterization = $properties.rasterization.cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_and_write;
colorBlend = $properties.pipelines.bsp_gbuf.colorBlend;
dynamic = {
dynamicState = ( viewport, scissor );
};
@ -596,120 +625,25 @@
{ size = 4; offset = 0; constantID = 0; },
{ size = 4; offset = 0; constantID = 1; },
{ size = 4; offset = 0; constantID = 2; },
{ size = 4; offset = 4; constantID = 1; },
{ size = 4; offset = 0; constantID = 3; },
);
data = <00000000ffffffff>;
};
},
);
vertexInput = {
bindings = (
{
binding = 0;
stride = "2 * 4 * 4";
inputRate = vertex;
},
);
attributes = (
{
location = 0;
binding = 0;
format = r32g32b32a32_sfloat;
offset = 0;
},
{
location = 1;
binding = 0;
format = r32g32b32a32_sfloat;
offset = 16;
},
);
};
inputAssembly = {
topology = triangle_fan;
primitiveRestartEnable = true;
};
viewport = {
viewports = (
{
x = 0; y = 0;
width = 640; height = 480;
minDepth = 0; maxDepth = 1;
}
);
scissors = (
{
offset = { x = 0; y = 0 };
extent = { width = 640; height = 480; };
},
);
};
rasterization = {
depthClampEnable = false;
rasterizerDiscardEnable = false;
polygonMode = fill;
cullMode = back;
frontFace = clockwise;
depthBiasEnable = false;
lineWidth = 1;
};
multisample = {
rasterizationSamples = $msaaSamples;
sampleShadingEnable = false;
minSampleShading = 0.5f;
alphaToCoverageEnable = false;
alphaToOneEnable = false;
};
depthStencil = {
depthTestEnable = true;
depthWriteEnable = true;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
vertexInput = $properties.vertexInput.brush;
inputAssembly = $properties.inputAssembly.brush;
viewport = $properties.viewport;
rasterization = $properties.rasterization.cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_only;
colorBlend = {
logicOpEnable = false;
attachments = (
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
}
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
);
};
dynamic = {
@ -739,26 +673,15 @@
};
},
);
vertexInput = $properties.pipelines.bsp_gbuf.vertexInput;
inputAssembly = $properties.pipelines.bsp_gbuf.inputAssembly;
viewport = $properties.pipelines.bsp_gbuf.viewport;
rasterization = $properties.pipelines.bsp_gbuf.rasterization;
multisample = $properties.pipelines.bsp_gbuf.multisample;
depthStencil = $properties.pipelines.bsp_gbuf.depthStencil;
vertexInput = $properties.vertexInput.brush;
inputAssembly = $properties.inputAssembly.brush;
viewport = $properties.viewport;
rasterization = $properties.rasterization.cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_only;
colorBlend = {
logicOpEnable = false;
attachments = (
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
);
attachments = ($properties.attachmentBlendOp.disabled);
};
dynamic = {
dynamicState = ( viewport, scissor );
@ -780,89 +703,15 @@
module = $builtin/twod.frag;
},
);
vertexInput = {
bindings = (
{
binding = 0;
stride = "2 * 4 * 4";
inputRate = vertex;
},
);
attributes = (
{
location = 0;
binding = 0;
format = r32g32_sfloat;
offset = 0;
},
{
location = 1;
binding = 0;
format = r32g32_sfloat;
offset = 8;
},
{
location = 2;
binding = 0;
format = r32g32b32a32_sfloat;
offset = 16;
},
);
};
inputAssembly = {
topology = triangle_strip;
primitiveRestartEnable = true;
};
viewport = {
viewports = (
{
x = 0; y = 0;
width = 640; height = 480;
minDepth = 0; maxDepth = 1;
}
);
scissors = (
{
offset = { x = 0; y = 0 };
extent = { width = 640; height = 480; };
},
);
};
rasterization = {
depthClampEnable = false;
rasterizerDiscardEnable = false;
polygonMode = fill;
cullMode = back;
frontFace = counter_clockwise;
depthBiasEnable = false;
lineWidth = 1;
};
multisample = {
rasterizationSamples = $msaaSamples;
sampleShadingEnable = false;
minSampleShading = 0.5f;
alphaToCoverageEnable = false;
alphaToOneEnable = false;
};
depthStencil = {
depthTestEnable = true;
depthWriteEnable = true;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
vertexInput = $properties.vertexInput.twod;
inputAssembly = $properties.inputAssembly.twod;
viewport = $properties.viewport;
rasterization = $properties.rasterization.counter_cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_and_write;
colorBlend = {
logicOpEnable = false;
attachments = ({
blendEnable = true;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
});
attachments = ($properties.attachmentBlendOp.alpha_blend);
};
dynamic = {
dynamicState = ( viewport, scissor );
@ -890,80 +739,13 @@
};
},
);
vertexInput = {
bindings = (
{
binding = 0;
stride = "4 * 4";
inputRate = vertex;
},
);
attributes = (
{
location = 0;
binding = 0;
format = r32g32b32a32_sfloat;
offset = 0;
},
);
};
inputAssembly = {
topology = triangle_strip;
primitiveRestartEnable = false;
};
viewport = {
viewports = (
{
x = 0; y = 0;
width = 640; height = 480;
minDepth = 0; maxDepth = 1;
}
);
scissors = (
{
offset = { x = 0; y = 0 };
extent = { width = 640; height = 480; };
},
);
};
rasterization = {
depthClampEnable = false;
rasterizerDiscardEnable = false;
polygonMode = fill;
cullMode = back;
frontFace = counter_clockwise;
depthBiasEnable = false;
lineWidth = 1;
};
multisample = {
rasterizationSamples = $msaaSamples;
sampleShadingEnable = false;
minSampleShading = 0.5f;
alphaToCoverageEnable = false;
alphaToOneEnable = false;
};
depthStencil = {
depthTestEnable = false;
depthWriteEnable = false;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
colorBlend = {
logicOpEnable = false;
attachments = (
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
);
};
vertexInput = $properties.fsquad.vertexInput;
inputAssembly = $properties.fsquad.inputAssembly;
viewport = $properties.viewport;
rasterization = $properties.rasterization.counter_cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.disable;
colorBlend = $properties.fsquad.colorBlend;
dynamic = {
dynamicState = ( viewport, scissor );
};
@ -984,80 +766,13 @@
module = $builtin/compose.frag;
},
);
vertexInput = {
bindings = (
{
binding = 0;
stride = "4 * 4";
inputRate = vertex;
},
);
attributes = (
{
location = 0;
binding = 0;
format = r32g32b32a32_sfloat;
offset = 0;
},
);
};
inputAssembly = {
topology = triangle_strip;
primitiveRestartEnable = false;
};
viewport = {
viewports = (
{
x = 0; y = 0;
width = 640; height = 480;
minDepth = 0; maxDepth = 1;
}
);
scissors = (
{
offset = { x = 0; y = 0 };
extent = { width = 640; height = 480; };
},
);
};
rasterization = {
depthClampEnable = false;
rasterizerDiscardEnable = false;
polygonMode = fill;
cullMode = back;
frontFace = counter_clockwise;
depthBiasEnable = false;
lineWidth = 1;
};
multisample = {
rasterizationSamples = $msaaSamples;
sampleShadingEnable = false;
minSampleShading = 0.5f;
alphaToCoverageEnable = false;
alphaToOneEnable = false;
};
depthStencil = {
depthTestEnable = false;
depthWriteEnable = false;
depthCompareOp = less_or_equal;
depthBoundsTestEnable = false;
stencilTestEnable = false;
};
colorBlend = {
logicOpEnable = false;
attachments = (
{
blendEnable = false;
srcColorBlendFactor = src_alpha;
dstColorBlendFactor = one_minus_src_alpha;
colorBlendOp = add;
srcAlphaBlendFactor = src_alpha;
dstAlphaBlendFactor = one_minus_src_alpha;
alphaBlendOp = add;
colorWriteMask = r|g|b|a;
},
);
};
vertexInput = $properties.fsquad.vertexInput;
inputAssembly = $properties.fsquad.inputAssembly;
viewport = $properties.viewport;
rasterization = $properties.rasterization.counter_cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.disable;
colorBlend = $properties.fsquad.colorBlend;
dynamic = {
dynamicState = ( viewport, scissor );
};