Fix MSVC compilation.

Add missing includes:
- Add missing vector include WGPUHelper.h
- Add missing algorithm include as there is a std::transform used in DawnPerfTestPlatform.cpp

Remove c++20 designated initializers from tests.
Removing these as we target c++14 and they trigger warnings in MSVC.

Bug: dawn:394
Change-Id: Id7aea9ef953cc9baa5b7633a036dd09a96aca130
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20460
Commit-Queue: Felix Maier <xilefmai@gmail.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Felix Maier
2020-04-27 20:29:01 +00:00
committed by Commit Bot service account
parent c05a0e1aac
commit f70db58dce
9 changed files with 259 additions and 281 deletions

View File

@@ -1601,9 +1601,8 @@ TEST_F(ComparisonSamplerBindingTest, SamplerAndBindGroupMatches) {
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ComparisonSampler}});
wgpu::SamplerDescriptor desc = {
.compare = wgpu::CompareFunction::Never,
};
wgpu::SamplerDescriptor desc = {};
desc.compare = wgpu::CompareFunction::Never;
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}});
}
@@ -1612,9 +1611,8 @@ TEST_F(ComparisonSamplerBindingTest, SamplerAndBindGroupMatches) {
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
wgpu::SamplerDescriptor desc = {
.compare = wgpu::CompareFunction::Never,
};
wgpu::SamplerDescriptor desc;
desc.compare = wgpu::CompareFunction::Never;
ASSERT_DEVICE_ERROR(
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}}));
}

View File

@@ -20,10 +20,9 @@ class IndexBufferValidationTest : public ValidationTest {};
// Test that for OOB validation of index buffer offset and size.
TEST_F(IndexBufferValidationTest, IndexBufferOffsetOOBValidation) {
wgpu::BufferDescriptor bufferDesc = {
.usage = wgpu::BufferUsage::Index,
.size = 256,
};
wgpu::BufferDescriptor bufferDesc;
bufferDesc.usage = wgpu::BufferUsage::Index;
bufferDesc.size = 256;
wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc);
DummyRenderPass renderPass(device);

View File

@@ -876,11 +876,10 @@ TEST_F(StorageTextureValidationTests, StorageTextureInRenderPass) {
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
// Create a bind group that contains a storage texture.
wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {{.binding = 0,
.visibility = wgpu::ShaderStage::Fragment,
.type = storageTextureType,
.storageTextureFormat = kFormat}});
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture =
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
@@ -910,15 +909,14 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
// Create a bind group that binds the same texture as both storage texture and sampled
// texture.
wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {{.binding = 0,
.visibility = wgpu::ShaderStage::Fragment,
.type = storageTextureType,
.storageTextureFormat = kFormat},
{.binding = 1,
.visibility = wgpu::ShaderStage::Fragment,
.type = wgpu::BindingType::SampledTexture,
.storageTextureFormat = kFormat}});
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
@@ -954,11 +952,10 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndOutputAttachmentInOneRend
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
// Create a bind group that contains a storage texture.
wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {{.binding = 0,
.visibility = wgpu::ShaderStage::Fragment,
.type = storageTextureType,
.storageTextureFormat = kFormat}});
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture =
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
@@ -980,15 +977,14 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneRen
// Create a bind group that uses the same texture as both read-only and write-only storage
// texture.
wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {{.binding = 0,
.visibility = wgpu::ShaderStage::Fragment,
.type = wgpu::BindingType::ReadonlyStorageTexture,
.storageTextureFormat = kFormat},
{.binding = 1,
.visibility = wgpu::ShaderStage::Fragment,
.type = wgpu::BindingType::WriteonlyStorageTexture,
.storageTextureFormat = kFormat}});
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
@@ -1014,15 +1010,14 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneComput
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
// Create a bind group that binds the same texture as both storage texture and sampled
// texture.
wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {{.binding = 0,
.visibility = wgpu::ShaderStage::Compute,
.type = storageTextureType,
.storageTextureFormat = kFormat},
{.binding = 1,
.visibility = wgpu::ShaderStage::Compute,
.type = wgpu::BindingType::SampledTexture,
.storageTextureFormat = kFormat}});
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, storageTextureType, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
@@ -1045,15 +1040,14 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneCom
// Create a bind group that uses the same texture as both read-only and write-only storage
// texture.
wgpu::BindGroupLayout bindGroupLayout =
utils::MakeBindGroupLayout(device, {{.binding = 0,
.visibility = wgpu::ShaderStage::Compute,
.type = wgpu::BindingType::ReadonlyStorageTexture,
.storageTextureFormat = kFormat},
{.binding = 1,
.visibility = wgpu::ShaderStage::Compute,
.type = wgpu::BindingType::WriteonlyStorageTexture,
.storageTextureFormat = kFormat}});
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});