Use GetBindGroupLayout in IOSurfaceWrappingTests
Bug: dawn:276
Change-Id: Ie9bc27e8cc0ec5892b6e63429124249232e69725
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14027
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/end2end/IOSurfaceWrappingTests.cpp b/src/tests/end2end/IOSurfaceWrappingTests.cpp
index 4705835..f2fe59a 100644
--- a/src/tests/end2end/IOSurfaceWrappingTests.cpp
+++ b/src/tests/end2end/IOSurfaceWrappingTests.cpp
@@ -237,34 +237,6 @@
memcpy(IOSurfaceGetBaseAddress(ioSurface), data, dataSize);
IOSurfaceUnlock(ioSurface, 0, nullptr);
- // The bindgroup containing the texture view for the ioSurface as well as the sampler.
- wgpu::BindGroupLayout bgl;
- wgpu::BindGroup bindGroup;
- {
- wgpu::TextureDescriptor textureDescriptor;
- textureDescriptor.dimension = wgpu::TextureDimension::e2D;
- textureDescriptor.format = format;
- textureDescriptor.size = {1, 1, 1};
- textureDescriptor.sampleCount = 1;
- textureDescriptor.arrayLayerCount = 1;
- textureDescriptor.mipLevelCount = 1;
- textureDescriptor.usage = wgpu::TextureUsage::Sampled;
- wgpu::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
-
- wgpu::TextureView textureView = wrappingTexture.CreateView();
-
- wgpu::SamplerDescriptor samplerDescriptor = utils::GetDefaultSamplerDescriptor();
- wgpu::Sampler sampler = device.CreateSampler(&samplerDescriptor);
-
- bgl = utils::MakeBindGroupLayout(
- device, {
- {0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler},
- {1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture},
- });
-
- bindGroup = utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, textureView}});
- }
-
// The simplest texture sampling pipeline.
wgpu::RenderPipeline pipeline;
{
@@ -305,12 +277,33 @@
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.vertexStage.module = vs;
descriptor.cFragmentStage.module = fs;
- descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
pipeline = device.CreateRenderPipeline(&descriptor);
}
+ // The bindgroup containing the texture view for the ioSurface as well as the sampler.
+ wgpu::BindGroup bindGroup;
+ {
+ wgpu::TextureDescriptor textureDescriptor;
+ textureDescriptor.dimension = wgpu::TextureDimension::e2D;
+ textureDescriptor.format = format;
+ textureDescriptor.size = {1, 1, 1};
+ textureDescriptor.sampleCount = 1;
+ textureDescriptor.arrayLayerCount = 1;
+ textureDescriptor.mipLevelCount = 1;
+ textureDescriptor.usage = wgpu::TextureUsage::Sampled;
+ wgpu::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
+
+ wgpu::TextureView textureView = wrappingTexture.CreateView();
+
+ wgpu::SamplerDescriptor samplerDescriptor = utils::GetDefaultSamplerDescriptor();
+ wgpu::Sampler sampler = device.CreateSampler(&samplerDescriptor);
+
+ bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
+ {{0, sampler}, {1, textureView}});
+ }
+
// Submit commands samping from the ioSurface and writing the result to renderPass.color
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();