Mesa (master): spirv: Implement SpvOpConvertUToAccelerationStructureKHR
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 24 16:06:16 UTC 2020
Module: Mesa
Branch: master
Commit: 7f223a2329a7d392b8860f488b3797012cdd37fe
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f223a2329a7d392b8860f488b3797012cdd37fe
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Thu Aug 13 18:05:50 2020 -0500
spirv: Implement SpvOpConvertUToAccelerationStructureKHR
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7734>
---
src/compiler/spirv/vtn_variables.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index a5f74679c16..a02e2b1de41 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -2616,6 +2616,25 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
break;
}
+ case SpvOpConvertUToAccelerationStructureKHR: {
+ struct vtn_type *as_type = vtn_get_type(b, w[1]);
+ struct vtn_type *u_type = vtn_get_value_type(b, w[3]);
+ vtn_fail_if(!((u_type->base_type == vtn_base_type_vector &&
+ u_type->type == glsl_vector_type(GLSL_TYPE_UINT, 2)) ||
+ (u_type->base_type == vtn_base_type_scalar &&
+ u_type->type == glsl_uint64_t_type())),
+ "OpConvertUToAccelerationStructure may only be used to "
+ "cast from a 64-bit scalar integer or a 2-component vector "
+ "of 32-bit integers");
+ vtn_fail_if(as_type->base_type != vtn_base_type_accel_struct,
+ "The result type of an OpConvertUToAccelerationStructure "
+ "must be OpTypeAccelerationStructure");
+
+ nir_ssa_def *u = vtn_get_nir_ssa(b, w[3]);
+ vtn_push_nir_ssa(b, w[2], nir_sloppy_bitcast(&b->nb, u, as_type->type));
+ break;
+ }
+
default:
vtn_fail_with_opcode("Unhandled opcode", opcode);
}
More information about the mesa-commit
mailing list