-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added instructions for depth reference and project coordinate i…
…mage instructions (#545) * feat: Added instructions for depth reference and project coordinate image instructions * docs: add alias annotation for methods in spirv-std/src/textures.rs
- Loading branch information
Showing
10 changed files
with
643 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Test `OpImageSampleDrefImplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Cubemap, Image2d, Image2dArray, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] image_array: &Image2dArray, | ||
#[spirv(uniform_constant, descriptor_set = 2, binding = 2)] cubemap: &Cubemap, | ||
#[spirv(uniform_constant, descriptor_set = 3, binding = 3)] sampler: &Sampler, | ||
output: &mut f32, | ||
) { | ||
let v2 = glam::Vec2::new(0.0, 1.0); | ||
let v3 = glam::Vec3A::new(0.0, 0.0, 1.0); | ||
*output = image.sample_depth_reference(*sampler, v2, 1.0); | ||
*output += image_array.sample_depth_reference(*sampler, v3, 1.0); | ||
*output += cubemap.sample_depth_reference(*sampler, v3, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Test `OpImageSampleDrefExplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Cubemap, Image2d, Image2dArray, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] image_array: &Image2dArray, | ||
#[spirv(uniform_constant, descriptor_set = 2, binding = 2)] sampler: &Sampler, | ||
#[spirv(uniform_constant, descriptor_set = 3, binding = 3)] cubemap: &Cubemap, | ||
output: &mut f32, | ||
) { | ||
let v2 = glam::Vec2::new(0.0, 1.0); | ||
let v2_dx = glam::Vec2::new(0.0, 1.0); | ||
let v2_dy = glam::Vec2::new(0.0, 1.0); | ||
let v3 = glam::Vec3A::new(0.0, 0.0, 1.0); | ||
let v3_dx = glam::Vec3A::new(0.0, 1.0, 0.5); | ||
let v3_dy = glam::Vec3A::new(0.0, 1.0, 0.5); | ||
*output = image.sample_depth_reference_by_gradient(*sampler, v2, 1.0, v2_dx, v2_dy); | ||
*output += image_array.sample_depth_reference_by_gradient(*sampler, v3, 1.0, v2_dx, v2_dy); | ||
*output += cubemap.sample_depth_reference_by_gradient(*sampler, v3, 1.0, v3_dx, v3_dy); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Test `OpImageSampleDrefExplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Cubemap, Image2d, Image2dArray, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] image_array: &Image2dArray, | ||
#[spirv(uniform_constant, descriptor_set = 2, binding = 2)] sampler: &Sampler, | ||
#[spirv(uniform_constant, descriptor_set = 3, binding = 3)] cubemap: &Cubemap, | ||
output: &mut f32, | ||
) { | ||
let v2 = glam::Vec2::new(0.0, 1.0); | ||
let v3 = glam::Vec3A::new(0.0, 0.0, 1.0); | ||
*output = image.sample_depth_reference_by_lod(*sampler, v2, 1.0, 0.0); | ||
*output += image_array.sample_depth_reference_by_lod(*sampler, v3, 1.0, 0.0); | ||
*output += image_array.sample_depth_reference_by_lod(*sampler, v3, 1.0, 0.0); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/image/sample_depth_reference_with_project_coordinate/sample.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Test `OpImageSampleProjDrefImplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Image2d, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] sampler: &Sampler, | ||
output: &mut f32, | ||
) { | ||
let v3 = glam::Vec3A::new(0.0, 0.0, 1.0); | ||
*output = image.sample_depth_reference_with_project_coordinate(*sampler, v3, 1.0); | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/ui/image/sample_depth_reference_with_project_coordinate/sample_gradient.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Test `OpImageSampleProjDrefExplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Image2d, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] sampler: &Sampler, | ||
output: &mut f32, | ||
) { | ||
let v2_dx = glam::Vec2::new(0.0, 1.0); | ||
let v2_dy = glam::Vec2::new(0.0, 1.0); | ||
let v3 = glam::Vec3A::new(0.0, 0.0, 1.0); | ||
*output = image.sample_depth_reference_with_project_coordinate_by_gradient(*sampler, v3, 1.0, v2_dx, v2_dy); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/image/sample_depth_reference_with_project_coordinate/sample_lod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Test `OpImageSampleProjDrefExplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Image2d, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] sampler: &Sampler, | ||
output: &mut f32, | ||
) { | ||
let v3 = glam::Vec3A::new(0.0, 0.0, 1.0); | ||
*output = image.sample_depth_reference_with_project_coordinate_by_lod(*sampler, v3, 1.0, 0.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Test `OpImageSampleProjImplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Image2d, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image2d: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] sampler: &Sampler, | ||
output: &mut glam::Vec4, | ||
) { | ||
let v3 = glam::Vec3::new(0.0, 1.0, 0.5); | ||
*output = image2d.sample_with_project_coordinate(*sampler, v3); | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/ui/image/sample_with_project_coordinate/sample_gradient.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Test `OpImageSampleProjExplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Image2d, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image2d: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] 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_with_project_coordinate_by_gradient(*sampler, v3, v2, v2); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/image/sample_with_project_coordinate/sample_lod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Test `OpImageSampleProjExplicitLod` | ||
// build-pass | ||
|
||
use spirv_std::{arch, Image2d, Sampler}; | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
#[spirv(uniform_constant, descriptor_set = 0, binding = 0)] image2d: &Image2d, | ||
#[spirv(uniform_constant, descriptor_set = 1, binding = 1)] sampler: &Sampler, | ||
output: &mut glam::Vec4, | ||
) { | ||
let v3 = glam::Vec3::new(0.0, 1.0, 0.5); | ||
*output = image2d.sample_with_project_coordinate_by_lod(*sampler, v3, 0.0); | ||
} |