mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 06:45:13 +00:00
spirv_std::ray_tracing: use actual OpTypeBool
for -> bool
intrinsics.
This commit is contained in:
parent
e206122a36
commit
8efc4220ae
@ -724,17 +724,19 @@ impl RayQuery {
|
|||||||
#[doc(alias = "OpRayQueryGetIntersectionFrontFaceKHR")]
|
#[doc(alias = "OpRayQueryGetIntersectionFrontFaceKHR")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_candidate_intersection_front_face(&self) -> bool {
|
pub unsafe fn get_candidate_intersection_front_face(&self) -> bool {
|
||||||
let result: u32;
|
let mut result = false;
|
||||||
|
|
||||||
asm! {
|
asm! {
|
||||||
|
"%bool = OpTypeBool",
|
||||||
"%u32 = OpTypeInt 32 0",
|
"%u32 = OpTypeInt 32 0",
|
||||||
"%intersection = OpConstant %u32 0",
|
"%intersection = OpConstant %u32 0",
|
||||||
"{result} = OpRayQueryGetIntersectionFrontFaceKHR %u32 {ray_query} %intersection",
|
"%result = OpRayQueryGetIntersectionFrontFaceKHR %bool {ray_query} %intersection",
|
||||||
|
"OpStore {result} %result",
|
||||||
ray_query = in(reg) self,
|
ray_query = in(reg) self,
|
||||||
result = out(reg) result,
|
result = in(reg) &mut result,
|
||||||
}
|
}
|
||||||
|
|
||||||
result != 0
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns whether the current intersection considered in a ray query was with
|
/// Returns whether the current intersection considered in a ray query was with
|
||||||
@ -749,17 +751,19 @@ impl RayQuery {
|
|||||||
#[doc(alias = "OpRayQueryGetIntersectionFrontFaceKHR")]
|
#[doc(alias = "OpRayQueryGetIntersectionFrontFaceKHR")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_committed_intersection_front_face(&self) -> bool {
|
pub unsafe fn get_committed_intersection_front_face(&self) -> bool {
|
||||||
let result: u32;
|
let mut result = false;
|
||||||
|
|
||||||
asm! {
|
asm! {
|
||||||
|
"%bool = OpTypeBool",
|
||||||
"%u32 = OpTypeInt 32 0",
|
"%u32 = OpTypeInt 32 0",
|
||||||
"%intersection = OpConstant %u32 1",
|
"%intersection = OpConstant %u32 1",
|
||||||
"{result} = OpRayQueryGetIntersectionFrontFaceKHR %u32 {ray_query} %intersection",
|
"%result = OpRayQueryGetIntersectionFrontFaceKHR %bool {ray_query} %intersection",
|
||||||
|
"OpStore {result} %result",
|
||||||
ray_query = in(reg) self,
|
ray_query = in(reg) self,
|
||||||
result = out(reg) result,
|
result = in(reg) &mut result,
|
||||||
}
|
}
|
||||||
|
|
||||||
result != 0
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns whether a candidate intersection considered in a ray query was with
|
/// Returns whether a candidate intersection considered in a ray query was with
|
||||||
@ -768,16 +772,17 @@ impl RayQuery {
|
|||||||
#[doc(alias = "OpRayQueryGetIntersectionCandidateAABBOpaqueKHR")]
|
#[doc(alias = "OpRayQueryGetIntersectionCandidateAABBOpaqueKHR")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_intersection_candidate_aabb_opaque(&self) -> bool {
|
pub unsafe fn get_intersection_candidate_aabb_opaque(&self) -> bool {
|
||||||
let result: u32;
|
let mut result = false;
|
||||||
|
|
||||||
asm! {
|
asm! {
|
||||||
"%u32 = OpTypeInt 8 0",
|
"%bool = OpTypeBool",
|
||||||
"{result} = OpRayQueryGetIntersectionCandidateAABBOpaqueKHR %u32 {ray_query}",
|
"%result = OpRayQueryGetIntersectionCandidateAABBOpaqueKHR %bool {ray_query}",
|
||||||
|
"OpStore {result} %result",
|
||||||
ray_query = in(reg) self,
|
ray_query = in(reg) self,
|
||||||
result = out(reg) result,
|
result = in(reg) &mut result,
|
||||||
}
|
}
|
||||||
|
|
||||||
result != 0
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the object-space ray direction for the current intersection considered
|
/// Gets the object-space ray direction for the current intersection considered
|
||||||
|
Loading…
Reference in New Issue
Block a user