fixed SampledImage::sample() fns being marked as unsafe

This commit is contained in:
Firestar99 2023-04-06 21:06:35 +02:00 committed by Eduard-Mihai Burtescu
parent ff53483822
commit 9ae674aa76

View File

@ -979,19 +979,13 @@ impl<
>
{
/// Sample texels at `coord` from the sampled image with an implicit lod.
///
/// # Safety
/// Sampling with a type (`S`) that doesn't match the image's image format
/// will result in undefined behaviour.
#[crate::macros::gpu_only]
pub unsafe fn sample<F>(
&self,
coord: impl ImageCoordinate<F, DIM, ARRAYED>,
) -> SampledType::Vec4
pub fn sample<F>(&self, coord: impl ImageCoordinate<F, DIM, ARRAYED>) -> SampledType::Vec4
where
F: Float,
{
let mut result = Default::default();
unsafe {
asm!(
"%sampledImage = OpLoad typeof*{1} {1}",
"%coord = OpLoad typeof*{2} {2}",
@ -1001,16 +995,13 @@ impl<
in(reg) self,
in(reg) &coord
);
}
result
}
/// Sample texels at `coord` from the sampled image with an explicit lod.
///
/// # Safety
/// Sampling with a type (`S`) that doesn't match the image's image format
/// will result in undefined behaviour.
#[crate::macros::gpu_only]
pub unsafe fn sample_by_lod<F>(
pub fn sample_by_lod<F>(
&self,
coord: impl ImageCoordinate<F, DIM, ARRAYED>,
lod: f32,
@ -1019,6 +1010,7 @@ impl<
F: Float,
{
let mut result = Default::default();
unsafe {
asm!(
"%sampledImage = OpLoad typeof*{1} {1}",
"%coord = OpLoad typeof*{2} {2}",
@ -1030,6 +1022,7 @@ impl<
in(reg) &coord,
in(reg) &lod,
);
}
result
}
}