mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-26 08:45:43 +00:00
f88ae5b28a
* Add parameterized Image type * nits * Update crates/spirv-std/src/lib.rs * Update crates/rustc_codegen_spirv/src/symbols.rs * Update crates/rustc_codegen_spirv/src/symbols.rs * Update symbols.rs
20 lines
763 B
Rust
20 lines
763 B
Rust
// Test `OpImageSampleExplicitLod` Lod
|
|
// build-pass
|
|
|
|
use spirv_std::{arch, Image, Sampler};
|
|
|
|
#[spirv(fragment)]
|
|
pub fn main(
|
|
#[spirv(descriptor_set = 0, binding = 0)] image2d: &Image!(2D, type=f32, sampled),
|
|
#[spirv(descriptor_set = 1, binding = 1)] image2d_array: &Image!(2D, type=f32, arrayed, sampled),
|
|
#[spirv(descriptor_set = 2, binding = 2)] cubemap: &Image!(3D, type=f32, sampled),
|
|
#[spirv(descriptor_set = 3, binding = 3)] sampler: &Sampler,
|
|
output: &mut glam::Vec4,
|
|
) {
|
|
let v2 = glam::Vec2::new(0.0, 1.0);
|
|
let v3 = glam::Vec3::new(0.0, 1.0, 0.5);
|
|
*output = image2d.sample_by_lod(*sampler, v2, 0.0);
|
|
*output += image2d_array.sample_by_lod(*sampler, v3, 0.0);
|
|
*output += cubemap.sample_by_lod(*sampler, v3, 0.0);
|
|
}
|