mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01: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:
1 parent
bd85c9a99a
commit
1bf1671ed8
5 files changed
+1159
No files matched your search
@@ -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);
|
||||
}
|
||||
@@ -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]);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user