spirv: handle multiview bits of SPV_NV_mesh_shader

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14263>
This commit is contained in:
Marcin Ślusarz
2021-12-17 17:02:18 +01:00
committed by Marge Bot
parent 4fed440724
commit ce5a8bff77
3 changed files with 11 additions and 5 deletions
+1
View File
@@ -75,6 +75,7 @@ struct spirv_supported_capabilities {
bool mesh_shading_nv;
bool min_lod;
bool multiview;
bool per_view_attributes_nv;
bool physical_storage_buffer_address;
bool post_depth_coverage;
bool printf;
+5 -5
View File
@@ -1105,6 +1105,7 @@ struct_member_decoration_cb(struct vtn_builder *b,
case SpvDecorationPatch:
case SpvDecorationPerPrimitiveNV:
case SpvDecorationPerTaskNV:
case SpvDecorationPerViewNV:
break;
case SpvDecorationSpecId:
@@ -1149,11 +1150,6 @@ struct_member_decoration_cb(struct vtn_builder *b,
/* User semantic decorations can safely be ignored by the driver. */
break;
case SpvDecorationPerViewNV:
/* TODO(mesh): Handle multiview. */
vtn_warn("Mesh multiview not yet supported. Needed for decoration PerViewNV.");
break;
default:
vtn_fail_with_decoration("Unhandled decoration", dec->decoration);
}
@@ -4805,6 +4801,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
spv_check_supported(mesh_shading_nv, cap);
break;
case SpvCapabilityPerViewAttributesNV:
spv_check_supported(per_view_attributes_nv, cap);
break;
case SpvCapabilityShaderViewportMaskNV:
spv_check_supported(shader_viewport_mask_nv, cap);
break;
+5
View File
@@ -837,6 +837,7 @@ vtn_get_builtin_location(struct vtn_builder *b,
set_mode_system_value(b, mode);
break;
case SpvBuiltInLayer:
case SpvBuiltInLayerPerViewNV:
*location = VARYING_SLOT_LAYER;
if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
*mode = nir_var_shader_in;
@@ -865,6 +866,7 @@ vtn_get_builtin_location(struct vtn_builder *b,
vtn_fail("invalid stage for SpvBuiltInViewportIndex");
break;
case SpvBuiltInViewportMaskNV:
case SpvBuiltInViewportMaskPerViewNV:
*location = VARYING_SLOT_VIEWPORT_MASK;
*mode = nir_var_shader_out;
break;
@@ -1342,6 +1344,9 @@ gather_var_kind_cb(struct vtn_builder *b, struct vtn_value *val, int member,
case SpvDecorationPerPrimitiveNV:
vtn_var->var->data.per_primitive = true;
break;
case SpvDecorationPerViewNV:
vtn_var->var->data.per_view = true;
break;
default:
/* Nothing to do. */
break;