mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-09 22:56:06 +00:00
Use GetBindGroupLayout in TextureFormatTests
Bug: dawn:276 Change-Id: I34c36b4835485858cd0fd8bd84f0961a7c00a17b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14031 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
1fe9979ad8
commit
cd62568bc8
@ -169,8 +169,7 @@ class TextureFormatTest : public DawnTest {
|
|||||||
// Return a pipeline that can be used in a full-texture draw to sample from the texture in the
|
// Return a pipeline that can be used in a full-texture draw to sample from the texture in the
|
||||||
// bindgroup and output its decompressed values to the render target.
|
// bindgroup and output its decompressed values to the render target.
|
||||||
wgpu::RenderPipeline CreateSamplePipeline(FormatTestInfo sampleFormatInfo,
|
wgpu::RenderPipeline CreateSamplePipeline(FormatTestInfo sampleFormatInfo,
|
||||||
FormatTestInfo renderFormatInfo,
|
FormatTestInfo renderFormatInfo) {
|
||||||
wgpu::BindGroupLayout bgl) {
|
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor desc(device);
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule =
|
wgpu::ShaderModule vsModule =
|
||||||
@ -218,7 +217,6 @@ class TextureFormatTest : public DawnTest {
|
|||||||
|
|
||||||
desc.vertexStage.module = vsModule;
|
desc.vertexStage.module = vsModule;
|
||||||
desc.cFragmentStage.module = fsModule;
|
desc.cFragmentStage.module = fsModule;
|
||||||
desc.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
|
||||||
desc.cColorStates[0].format = renderFormatInfo.format;
|
desc.cColorStates[0].format = renderFormatInfo.format;
|
||||||
|
|
||||||
return device.CreateRenderPipeline(&desc);
|
return device.CreateRenderPipeline(&desc);
|
||||||
@ -269,19 +267,13 @@ class TextureFormatTest : public DawnTest {
|
|||||||
readbackBufferDesc.size = 4 * width * sampleFormatInfo.componentCount;
|
readbackBufferDesc.size = 4 * width * sampleFormatInfo.componentCount;
|
||||||
wgpu::Buffer readbackBuffer = device.CreateBuffer(&readbackBufferDesc);
|
wgpu::Buffer readbackBuffer = device.CreateBuffer(&readbackBufferDesc);
|
||||||
|
|
||||||
// Create the bind group layout for sampling the texture
|
|
||||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
|
||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler},
|
|
||||||
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false,
|
|
||||||
false, wgpu::TextureViewDimension::e2D, sampleFormatInfo.type}});
|
|
||||||
|
|
||||||
// Prepare objects needed to sample from texture in the renderpass
|
// Prepare objects needed to sample from texture in the renderpass
|
||||||
wgpu::RenderPipeline pipeline =
|
wgpu::RenderPipeline pipeline = CreateSamplePipeline(sampleFormatInfo, renderFormatInfo);
|
||||||
CreateSamplePipeline(sampleFormatInfo, renderFormatInfo, bgl);
|
|
||||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, sampleTexture.CreateView()}});
|
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||||
|
{{0, sampler}, {1, sampleTexture.CreateView()}});
|
||||||
|
|
||||||
// Encode commands for the test that fill texture, sample it to render to renderTarget then
|
// Encode commands for the test that fill texture, sample it to render to renderTarget then
|
||||||
// copy renderTarget in a buffer so we can read it easily.
|
// copy renderTarget in a buffer so we can read it easily.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user