mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
panvk: Eliminate unused vertex attributes
We use nir_assign_io_var_locations() which compacts the varyings and eliminates any unused input slots. We need to do the same thing when processing pVertexAttributeDescriptions[] or else we'll end up with mismatches between the shader and the state setup code. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16183>
This commit is contained in:
parent
e248c64f06
commit
3f824e0e85
4 changed files with 17 additions and 9 deletions
|
|
@ -20,6 +20,7 @@ include = [
|
|||
"dEQP-VK.glsl.derivate.*.constant.*",
|
||||
"dEQP-VK.glsl.derivate.*.linear.*",
|
||||
"dEQP-VK.glsl.derivate.*.uniform_*",
|
||||
"dEQP-VK.glsl.operator.*",
|
||||
"dEQP-VK.image.load_store.with_format.*",
|
||||
"dEQP-VK.pipeline.input_assembly.*",
|
||||
"dEQP-VK.pipeline.sampler.view_type.*.format.r*.address_modes.all_mode_clamp_to_border*",
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ GENX(pan_shader_compile)(nir_shader *s,
|
|||
switch (info->stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
info->attribute_count = util_bitcount64(s->info.inputs_read);
|
||||
info->attributes_read = s->info.inputs_read;
|
||||
|
||||
#if PAN_ARCH <= 5
|
||||
bool vertex_id = BITSET_TEST(s->info.system_values_read,
|
||||
|
|
|
|||
|
|
@ -334,6 +334,7 @@ struct pan_shader_info {
|
|||
unsigned texture_count;
|
||||
unsigned ubo_count;
|
||||
unsigned attribute_count;
|
||||
unsigned attributes_read;
|
||||
|
||||
struct {
|
||||
unsigned input_count;
|
||||
|
|
|
|||
|
|
@ -902,15 +902,6 @@ panvk_pipeline_builder_parse_vertex_input(struct panvk_pipeline_builder *builder
|
|||
attribs->buf[desc->binding].special = false;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < info->vertexAttributeDescriptionCount; i++) {
|
||||
const VkVertexInputAttributeDescription *desc =
|
||||
&info->pVertexAttributeDescriptions[i];
|
||||
attribs->attrib[desc->location].buf = desc->binding;
|
||||
attribs->attrib[desc->location].format =
|
||||
vk_format_to_pipe_format(desc->format);
|
||||
attribs->attrib[desc->location].offset = desc->offset;
|
||||
}
|
||||
|
||||
if (div_info) {
|
||||
for (unsigned i = 0; i < div_info->vertexBindingDivisorCount; i++) {
|
||||
const VkVertexInputBindingDivisorDescriptionEXT *div =
|
||||
|
|
@ -922,6 +913,20 @@ panvk_pipeline_builder_parse_vertex_input(struct panvk_pipeline_builder *builder
|
|||
const struct pan_shader_info *vs =
|
||||
&builder->shaders[MESA_SHADER_VERTEX]->info;
|
||||
|
||||
for (unsigned i = 0; i < info->vertexAttributeDescriptionCount; i++) {
|
||||
const VkVertexInputAttributeDescription *desc =
|
||||
&info->pVertexAttributeDescriptions[i];
|
||||
|
||||
unsigned attrib = desc->location + VERT_ATTRIB_GENERIC0;
|
||||
unsigned slot = util_bitcount64(vs->attributes_read &
|
||||
BITFIELD64_MASK(attrib));
|
||||
|
||||
attribs->attrib[slot].buf = desc->binding;
|
||||
attribs->attrib[slot].format =
|
||||
vk_format_to_pipe_format(desc->format);
|
||||
attribs->attrib[slot].offset = desc->offset;
|
||||
}
|
||||
|
||||
if (vs->attribute_count >= PAN_VERTEX_ID) {
|
||||
attribs->buf[attribs->buf_count].special = true;
|
||||
attribs->buf[attribs->buf_count].special_id = PAN_VERTEX_ID;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue