From 53782d60dc73f309726e1e858ae4b42127c3cbad Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Tue, 3 Dec 2019 21:40:05 +0000 Subject: [PATCH] Use GetBindGroupLayout in TextureViewTests Bug: dawn:276 Change-Id: If502f933d3fbefb03bc04a7aceacb89874187d3e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14032 Commit-Queue: Austin Eng Reviewed-by: Kai Ninomiya Reviewed-by: Corentin Wallez --- src/tests/end2end/TextureViewTests.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp index 62e0f5cc00..7d59b6148b 100644 --- a/src/tests/end2end/TextureViewTests.cpp +++ b/src/tests/end2end/TextureViewTests.cpp @@ -150,18 +150,8 @@ protected: } void Verify(const wgpu::TextureView& textureView, - wgpu::TextureViewDimension dimension, const char* fragmentShader, int expected) { - wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout( - device, { - {0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}, - {1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, - false, dimension, wgpu::TextureComponentType::Float}, - }); - - wgpu::BindGroup bindGroup = - utils::MakeBindGroup(device, bindGroupLayout, {{0, mSampler}, {1, textureView}}); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader); @@ -169,11 +159,13 @@ protected: utils::ComboRenderPipelineDescriptor textureDescriptor(device); textureDescriptor.vertexStage.module = mVSModule; textureDescriptor.cFragmentStage.module = fsModule; - textureDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout); textureDescriptor.cColorStates[0].format = mRenderPass.colorFormat; wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor); + wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), + {{0, mSampler}, {1, textureView}}); + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&mRenderPass.renderPassInfo); @@ -224,7 +216,7 @@ protected: )"; const int expected = GenerateTestPixelValue(textureViewBaseLayer, textureViewBaseMipLevel); - Verify(textureView, wgpu::TextureViewDimension::e2D, fragmentShader, expected); + Verify(textureView, fragmentShader, expected); } void Texture2DArrayViewTest(uint32_t textureArrayLayers, @@ -268,7 +260,7 @@ protected: for (int i = 0; i < static_cast(kTextureViewLayerCount); ++i) { expected += GenerateTestPixelValue(textureViewBaseLayer + i, textureViewBaseMipLevel); } - Verify(textureView, wgpu::TextureViewDimension::e2DArray, fragmentShader, expected); + Verify(textureView, fragmentShader, expected); } std::string CreateFragmentShaderForCubeMapFace(uint32_t layer, bool isCubeMapArray) { @@ -337,7 +329,7 @@ protected: CreateFragmentShaderForCubeMapFace(layer, isCubeMapArray); int expected = GenerateTestPixelValue(textureViewBaseLayer + layer, 0); - Verify(cubeMapTextureView, dimension, fragmentShader.c_str(), expected); + Verify(cubeMapTextureView, fragmentShader.c_str(), expected); } } @@ -376,7 +368,7 @@ TEST_P(TextureViewSamplingTest, Default2DArrayTexture) { const int expected = GenerateTestPixelValue(0, 0) + GenerateTestPixelValue(1, 0) + GenerateTestPixelValue(2, 0); - Verify(textureView, wgpu::TextureViewDimension::e2DArray, fragmentShader, expected); + Verify(textureView, fragmentShader, expected); } // Test sampling from a 2D texture view created on a 2D array texture.