spirv: Implement SPV_EXT_demote_to_helper_invocation
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
5a7c69399d
commit
1a83c9a619
|
@ -35,6 +35,7 @@ extern "C" {
|
||||||
struct spirv_supported_capabilities {
|
struct spirv_supported_capabilities {
|
||||||
bool address;
|
bool address;
|
||||||
bool atomic_storage;
|
bool atomic_storage;
|
||||||
|
bool demote_to_helper_invocation;
|
||||||
bool derivative_group;
|
bool derivative_group;
|
||||||
bool descriptor_array_dynamic_indexing;
|
bool descriptor_array_dynamic_indexing;
|
||||||
bool descriptor_array_non_uniform_indexing;
|
bool descriptor_array_non_uniform_indexing;
|
||||||
|
|
|
@ -3718,6 +3718,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
||||||
spv_check_supported(fragment_shader_pixel_interlock, cap);
|
spv_check_supported(fragment_shader_pixel_interlock, cap);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SpvCapabilityDemoteToHelperInvocationEXT:
|
||||||
|
spv_check_supported(demote_to_helper_invocation, cap);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
vtn_fail("Unhandled capability: %s (%u)",
|
vtn_fail("Unhandled capability: %s (%u)",
|
||||||
spirv_capability_to_string(cap), cap);
|
spirv_capability_to_string(cap), cap);
|
||||||
|
@ -4532,6 +4536,28 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
|
||||||
vtn_emit_barrier(b, nir_intrinsic_end_invocation_interlock);
|
vtn_emit_barrier(b, nir_intrinsic_end_invocation_interlock);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SpvOpDemoteToHelperInvocationEXT: {
|
||||||
|
nir_intrinsic_instr *intrin =
|
||||||
|
nir_intrinsic_instr_create(b->shader, nir_intrinsic_demote);
|
||||||
|
nir_builder_instr_insert(&b->nb, &intrin->instr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SpvOpIsHelperInvocationEXT: {
|
||||||
|
nir_intrinsic_instr *intrin =
|
||||||
|
nir_intrinsic_instr_create(b->shader, nir_intrinsic_is_helper_invocation);
|
||||||
|
nir_ssa_dest_init(&intrin->instr, &intrin->dest, 1, 1, NULL);
|
||||||
|
nir_builder_instr_insert(&b->nb, &intrin->instr);
|
||||||
|
|
||||||
|
struct vtn_type *res_type =
|
||||||
|
vtn_value(b, w[1], vtn_value_type_type)->type;
|
||||||
|
struct vtn_ssa_value *val = vtn_create_ssa_value(b, res_type->type);
|
||||||
|
val->def = &intrin->dest.ssa;
|
||||||
|
|
||||||
|
vtn_push_ssa(b, w[2], res_type, val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
vtn_fail_with_opcode("Unhandled opcode", opcode);
|
vtn_fail_with_opcode("Unhandled opcode", opcode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue