[vulkan] Clean up duplication in qfpipeline

That @inherit is pretty useful :) This makes it much easier to see how
different pipelines differ or how they are the similar. It also makes it
much clearer which sub-pass they're for.
This commit is contained in:
Bill Currie 2022-05-06 19:38:14 +09:00
parent 79add5590b
commit b69b7b6a4a

View file

@ -558,6 +558,11 @@
}; };
fstriangle = { fstriangle = {
vertexStage = {
stage = vertex;
name = main;
module = $builtin/fstriangle.vert;
};
vertexInput = { vertexInput = {
bindings = (); bindings = ();
attributes = (); attributes = ();
@ -573,8 +578,62 @@
}; };
pipelines = { pipelines = {
alias_shadow = { base = {
viewport = $properties.viewport;
rasterization = $properties.rasterization.counter_cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.disable;
colorBlend = {
logicOpEnable = false;
attachments = (
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
);
};
dynamic = {
dynamicState = ( viewport, scissor );
};
renderPass = renderpass;
};
depth_base = {
@inherit = $properties.pipelines.base;
subpass = 0; subpass = 0;
rasterization = $properties.rasterization.cw_cull_back;
depthStencil = $properties.depthStencil.test_and_write;
};
trans_base = {
@inherit = $properties.pipelines.base;
subpass = 1;
rasterization = $properties.rasterization.cw_cull_back;
depthStencil = $properties.depthStencil.test_only;
colorBlend = {
logicOpEnable = false;
attachments = ($properties.attachmentBlendOp.disabled);
};
};
gbuf_base = {
@inherit = $properties.pipelines.base;
subpass = 2;
rasterization = $properties.rasterization.cw_cull_back;
depthStencil = $properties.depthStencil.test_only;
dynamic = {//FIXME why?
dynamicState = ( viewport, scissor );
};
};
comp_base = {
@inherit = $properties.pipelines.base;
vertexInput = $properties.fstriangle.vertexInput;
inputAssembly = $properties.fstriangle.inputAssembly;
colorBlend = $properties.fstriangle.colorBlend;
};
shadow_base = {
@inherit = $properties.pipelines.depth_base;
};
alias_shadow = {
@inherit = $properties.pipelines.shadow_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -595,18 +654,10 @@
); );
}; };
inputAssembly = $properties.inputAssembly.alias; 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 );
};
layout = alias_layout; layout = alias_layout;
}; };
bsp_shadow = { bsp_shadow = {
subpass = 0; @inherit = $properties.pipelines.shadow_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -623,19 +674,9 @@
); );
}; };
inputAssembly = $properties.inputAssembly.brush; 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 );
};
layout = quakebsp_layout;
renderPass = renderpass;
}; };
alias_depth = { alias_depth = {
subpass = 0; @inherit = $properties.pipelines.depth_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -657,19 +698,10 @@
); );
}; };
inputAssembly = $properties.inputAssembly.alias; 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 );
};
layout = alias_layout; layout = alias_layout;
renderPass = renderpass;
}; };
alias_gbuf = { alias_gbuf = {
subpass = 2; @inherit = $properties.pipelines.gbuf_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -684,27 +716,10 @@
); );
vertexInput = $properties.vertexInput.alias; vertexInput = $properties.vertexInput.alias;
inputAssembly = $properties.inputAssembly.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 = (
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
);
};
dynamic = {
dynamicState = ( viewport, scissor, blend_constants );
};
layout = alias_layout; layout = alias_layout;
renderPass = renderpass;
}; };
bsp_depth = { bsp_depth = {
subpass = 0; @inherit = $properties.pipelines.depth_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -721,19 +736,10 @@
); );
}; };
inputAssembly = $properties.inputAssembly.brush; 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 );
};
layout = quakebsp_layout; layout = quakebsp_layout;
renderPass = renderpass;
}; };
bsp_gbuf = { bsp_gbuf = {
subpass = 2; @inherit = $properties.pipelines.gbuf_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -753,27 +759,10 @@
); );
vertexInput = $properties.vertexInput.brush; vertexInput = $properties.vertexInput.brush;
inputAssembly = $properties.inputAssembly.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 = (
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
$properties.attachmentBlendOp.disabled,
);
};
dynamic = {
dynamicState = ( viewport, scissor, blend_constants );
};
layout = quakebsp_layout; layout = quakebsp_layout;
renderPass = renderpass;
}; };
bsp_skybox = { bsp_skybox = {
subpass = 1; @inherit = $properties.pipelines.trans_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -797,22 +786,10 @@
); );
vertexInput = $properties.vertexInput.brush; vertexInput = $properties.vertexInput.brush;
inputAssembly = $properties.inputAssembly.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 = ($properties.attachmentBlendOp.disabled);
};
dynamic = {
dynamicState = ( viewport, scissor );
};
layout = quakebsp_layout; layout = quakebsp_layout;
renderPass = renderpass;
}; };
bsp_skysheet = { bsp_skysheet = {
subpass = 1; @inherit = $properties.pipelines.trans_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -836,22 +813,10 @@
); );
vertexInput = $properties.vertexInput.brush; vertexInput = $properties.vertexInput.brush;
inputAssembly = $properties.inputAssembly.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 = ($properties.attachmentBlendOp.disabled);
};
dynamic = {
dynamicState = ( viewport, scissor );
};
layout = quakebsp_layout; layout = quakebsp_layout;
renderPass = renderpass;
}; };
bsp_turb = { bsp_turb = {
subpass = 1; @inherit = $properties.pipelines.trans_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -866,22 +831,10 @@
); );
vertexInput = $properties.vertexInput.brush; vertexInput = $properties.vertexInput.brush;
inputAssembly = $properties.inputAssembly.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 = ($properties.attachmentBlendOp.disabled);
};
dynamic = {
dynamicState = ( viewport, scissor );
};
layout = quakebsp_layout; layout = quakebsp_layout;
renderPass = renderpass;
}; };
partdraw = { partdraw = {
subpass = 1; @inherit = $properties.pipelines.trans_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -901,19 +854,10 @@
); );
vertexInput = $properties.vertexInput.particle; vertexInput = $properties.vertexInput.particle;
inputAssembly = $properties.inputAssembly.sprite; inputAssembly = $properties.inputAssembly.sprite;
viewport = $properties.viewport;
rasterization = $properties.rasterization.cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_only;
colorBlend = $properties.pipelines.bsp_turb.colorBlend;
dynamic = {
dynamicState = ( viewport, scissor, blend_constants );
};
layout = partdraw_layout; layout = partdraw_layout;
renderPass = renderpass;
}; };
sprite_gbuf = { sprite_gbuf = {
subpass = 2; @inherit = $properties.pipelines.gbuf_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -928,19 +872,10 @@
); );
vertexInput = $properties.vertexInput.index_only; vertexInput = $properties.vertexInput.index_only;
inputAssembly = $properties.inputAssembly.sprite; inputAssembly = $properties.inputAssembly.sprite;
viewport = $properties.viewport;
rasterization = $properties.rasterization.cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_only;
colorBlend = $properties.pipelines.alias_gbuf.colorBlend;
dynamic = {
dynamicState = ( viewport, scissor, blend_constants );
};
layout = sprite_layout; layout = sprite_layout;
renderPass = renderpass;
}; };
sprite_depth = { sprite_depth = {
subpass = 0; @inherit = $properties.pipelines.depth_base;
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -955,19 +890,10 @@
); );
vertexInput = $properties.vertexInput.index_only; vertexInput = $properties.vertexInput.index_only;
inputAssembly = $properties.inputAssembly.alias; 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 );
};
layout = sprite_layout; layout = sprite_layout;
renderPass = renderpass;
}; };
twod = { twod = {
subpass = 1; @inherit = $properties.pipelines.trans_base;//FIXME should be sparate
stages = ( stages = (
{ {
stage = vertex; stage = vertex;
@ -982,28 +908,18 @@
); );
vertexInput = $properties.vertexInput.twod; vertexInput = $properties.vertexInput.twod;
inputAssembly = $properties.inputAssembly.twod; inputAssembly = $properties.inputAssembly.twod;
viewport = $properties.viewport;
rasterization = $properties.rasterization.counter_cw_cull_back; rasterization = $properties.rasterization.counter_cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.test_only;
colorBlend = { colorBlend = {
logicOpEnable = false; logicOpEnable = false;
attachments = ($properties.attachmentBlendOp.alpha_blend); attachments = ($properties.attachmentBlendOp.alpha_blend);
}; };
dynamic = {
dynamicState = ( viewport, scissor );
};
layout = twod_layout; layout = twod_layout;
renderPass = renderpass;
}; };
lighting = { lighting = {
@inherit = $properties.pipelines.comp_base;
subpass = 3; subpass = 3;
stages = ( stages = (
{ $properties.fstriangle.vertexStage,
stage = vertex;
name = main;
module = $builtin/fstriangle.vert;
},
{ {
stage = fragment; stage = fragment;
name = main; name = main;
@ -1016,46 +932,22 @@
}; };
}, },
); );
vertexInput = $properties.fstriangle.vertexInput;
inputAssembly = $properties.fstriangle.inputAssembly;
viewport = $properties.viewport;
rasterization = $properties.rasterization.counter_cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.disable;
colorBlend = $properties.fstriangle.colorBlend;
dynamic = {
dynamicState = ( viewport, scissor );
};
layout = lighting_layout; layout = lighting_layout;
renderPass = renderpass;
}; };
compose = { compose = {
@inherit = $properties.pipelines.comp_base;
subpass = 4; subpass = 4;
stages = ( stages = (
{ $properties.fstriangle.vertexStage,
stage = vertex;
name = main;
module = $builtin/fstriangle.vert;
},
{ {
stage = fragment; stage = fragment;
name = main; name = main;
module = $builtin/compose.frag; module = $builtin/compose.frag;
}, },
); );
vertexInput = $properties.fstriangle.vertexInput;
inputAssembly = $properties.fstriangle.inputAssembly;
viewport = $properties.viewport;
rasterization = $properties.rasterization.counter_cw_cull_back;
multisample = $properties.multisample;
depthStencil = $properties.depthStencil.disable;
colorBlend = $properties.fstriangle.colorBlend;
dynamic = {
dynamicState = ( viewport, scissor );
};
layout = compose_layout; layout = compose_layout;
renderPass = renderpass;
}; };
partphysics = { partphysics = {
stage = { stage = {
stage = compute; stage = compute;