mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
[test] Add external texture GPU tests
These tests cover the external texture binding resource. They ensure the WGSL functions `textureDimensions()`, `textureLoad()`, and `textureSampleBaseClampToEdge()` work as expected for both `TextureView`s and `ExternalTexture`s bound to external texture resource bindings. For external textures, they ensure multiplanar YUV formats work as expected including handling color space transformation. And that the provided sample and load transforms correctly handle cropping, flipping, and rotation.
This commit is contained in:
parent
bd85c9a99a
commit
1bf1671ed8
10
tests/tests/wgpu-gpu/external_texture/dimensions.wgsl
Normal file
10
tests/tests/wgpu-gpu/external_texture/dimensions.wgsl
Normal file
@ -0,0 +1,10 @@
|
||||
@group(0) @binding(0)
|
||||
var tex: texture_external;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read_write> output: vec2<u32>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
||||
output = textureDimensions(tex);
|
||||
}
|
||||
12
tests/tests/wgpu-gpu/external_texture/load.wgsl
Normal file
12
tests/tests/wgpu-gpu/external_texture/load.wgsl
Normal file
@ -0,0 +1,12 @@
|
||||
@group(0) @binding(0)
|
||||
var tex: texture_external;
|
||||
|
||||
@group(0) @binding(1)
|
||||
var<storage, read> coords: array<vec2<u32>>;
|
||||
@group(0) @binding(2)
|
||||
var<storage, read_write> output: array<vec4<f32>>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
|
||||
output[id.x] = textureLoad(tex, coords[id.x]);
|
||||
}
|
||||
1121
tests/tests/wgpu-gpu/external_texture/mod.rs
Normal file
1121
tests/tests/wgpu-gpu/external_texture/mod.rs
Normal file
File diff suppressed because it is too large
Load Diff
14
tests/tests/wgpu-gpu/external_texture/sample.wgsl
Normal file
14
tests/tests/wgpu-gpu/external_texture/sample.wgsl
Normal file
@ -0,0 +1,14 @@
|
||||
@group(0) @binding(0)
|
||||
var tex: texture_external;
|
||||
@group(0) @binding(1)
|
||||
var samp: sampler;
|
||||
|
||||
@group(0) @binding(2)
|
||||
var<storage, read> coords: array<vec2<f32>>;
|
||||
@group(0) @binding(3)
|
||||
var<storage, read_write> output: array<vec4<f32>>;
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
|
||||
output[id.x] = textureSampleBaseClampToEdge(tex, samp, coords[id.x]);
|
||||
}
|
||||
@ -29,6 +29,7 @@ mod draw_indirect;
|
||||
mod dual_source_blending;
|
||||
mod encoder;
|
||||
mod external_image_copy;
|
||||
mod external_texture;
|
||||
mod float32_filterable;
|
||||
mod image_atomics;
|
||||
mod instance;
|
||||
@ -88,6 +89,7 @@ fn all_tests() -> Vec<wgpu_test::GpuTestInitializer> {
|
||||
draw_indirect::all_tests(&mut tests);
|
||||
dual_source_blending::all_tests(&mut tests);
|
||||
encoder::all_tests(&mut tests);
|
||||
external_texture::all_tests(&mut tests);
|
||||
float32_filterable::all_tests(&mut tests);
|
||||
image_atomics::all_tests(&mut tests);
|
||||
instance::all_tests(&mut tests);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user