[vulkan] Rework quad drawing to use a single pipeline

Any performance gains will be utterly swamped by the deferred renderer,
but it will allow better control of quad render order by any client
code (and should be slightly better for simpler renderers when I get
support for them working).

Right now, plenty is broken (much of the higher level draw functions are
disabled, and pics don't render correctly), but this gets at least the
basics in so I'm not bouncing diffs around as much.
This commit is contained in:
Bill Currie 2023-01-11 11:34:32 +09:00
parent c8afad4d3d
commit 8fff71ed4b
2 changed files with 308 additions and 432 deletions

View file

@ -121,28 +121,18 @@
},
);
};
twod_pool = {
flags = 0;
maxSets = "$frames.size * 2z";
quad_pool = {
maxSets = 64;
bindings = (
{
type = combined_image_sampler;
descriptorCount = $frames.size;
},
);
};
glyph_pool = {
maxSets = 16;
bindings = (
{
// glyph geometry data (offset and uv)
// quad geometry data (offset and uv)
type = uniform_texel_buffer;
descriptorCount = 16;
descriptorCount = 64;
},
{
// glyph texture data
// quad texture data
type = combined_image_sampler;
descriptorCount = 16;
descriptorCount = 64;
},
);
};
@ -269,17 +259,7 @@
},
);
};
twod_set = {
bindings = (
{
binding = 0;
descriptorType = combined_image_sampler;
descriptorCount = 1;
stageFlags = fragment;
},
);
};
glyph_data_set = {
quad_data_set = {
bindings = (
{
// glyph texture data
@ -453,11 +433,8 @@
};
};
pipelineLayouts = {
twod_layout = {
setLayouts = (matrix_set, twod_set);
};
glyph_layout = {
setLayouts = (matrix_set, glyph_data_set);
quad_layout = {
setLayouts = (matrix_set, quad_data_set);
};
lines_layout = {
setLayouts = (matrix_set);
@ -1159,30 +1136,6 @@
layout = sprite_layout;
};
twod = {
@inherit = $properties.pipelines.trans_base;
renderPass = output;
subpass = 0;
stages = (
{
stage = vertex;
name = main;
module = $builtin/twod.vert;
},
{
stage = fragment;
name = main;
module = $builtin/twod.frag;
},
);
vertexInput = $properties.vertexInput.twod;
inputAssembly = $properties.inputAssembly.twod;
rasterization = $properties.rasterization.counter_cw_cull_back;
depthStencil = $properties.depthStencil.disable;
colorBlend = {
logicOpEnable = false;
attachments = ($properties.attachmentBlendOp.alpha_blend);
};
layout = twod_layout;
};
slice = {
@inherit = $properties.pipelines.trans_base;
@ -1203,14 +1156,23 @@
logicOpEnable = false;
attachments = ($properties.attachmentBlendOp.alpha_blend);
};
layout = glyph_layout;//slices use the same descriptors as glyphs
layout = quad_layout;
};
lines = {
@inherit = $properties.pipelines.twod;
@inherit = $properties.pipelines.trans_base;
renderPass = output;
subpass = 0;
stages = (
{ stage = vertex; name = main; module = $builtin/line.vert; },
{ stage = fragment; name = main; module = $builtin/line.frag; },
);
vertexInput = $properties.vertexInput.twod;
rasterization = $properties.rasterization.counter_cw_cull_back;
depthStencil = $properties.depthStencil.disable;
colorBlend = {
logicOpEnable = false;
attachments = ($properties.attachmentBlendOp.alpha_blend);
};
inputAssembly = $properties.inputAssembly.lines;
layout = lines_layout;
};

File diff suppressed because it is too large Load diff