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:
parent
c05a0e1aac
commit
f70db58dce
|
@ -896,17 +896,16 @@ TEST_P(BindGroupTests, LastReferenceToBindGroupLayout) {
|
||||||
TEST_P(BindGroupTests, EmptyLayout) {
|
TEST_P(BindGroupTests, EmptyLayout) {
|
||||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {});
|
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {});
|
||||||
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {});
|
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {});
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {
|
|
||||||
.layout = utils::MakeBasicPipelineLayout(device, &bgl),
|
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||||
.computeStage =
|
pipelineDesc.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
{
|
pipelineDesc.computeStage.entryPoint = "main";
|
||||||
.module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
|
pipelineDesc.computeStage.module =
|
||||||
#version 450
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
|
||||||
void main() {
|
#version 450
|
||||||
})"),
|
void main() {
|
||||||
.entryPoint = "main",
|
})");
|
||||||
},
|
|
||||||
};
|
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
|
|
@ -61,31 +61,28 @@ class ComparisonSamplerTest : public DawnTest {
|
||||||
|
|
||||||
mRenderPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
mRenderPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
wgpu::BufferDescriptor uniformBufferDesc = {
|
wgpu::BufferDescriptor uniformBufferDesc;
|
||||||
.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst,
|
uniformBufferDesc.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst;
|
||||||
.size = sizeof(float),
|
uniformBufferDesc.size = sizeof(float);
|
||||||
};
|
|
||||||
mUniformBuffer = device.CreateBuffer(&uniformBufferDesc);
|
mUniformBuffer = device.CreateBuffer(&uniformBufferDesc);
|
||||||
|
|
||||||
wgpu::BufferDescriptor textureUploadDesc = {
|
wgpu::BufferDescriptor textureUploadDesc;
|
||||||
.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst,
|
textureUploadDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||||
.size = sizeof(float),
|
textureUploadDesc.size = sizeof(float);
|
||||||
};
|
|
||||||
mTextureUploadBuffer = device.CreateBuffer(&textureUploadDesc);
|
mTextureUploadBuffer = device.CreateBuffer(&textureUploadDesc);
|
||||||
|
|
||||||
wgpu::TextureDescriptor inputTextureDesc = {
|
wgpu::TextureDescriptor inputTextureDesc;
|
||||||
.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
|
inputTextureDesc.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::OutputAttachment;
|
||||||
.size = {1, 1, 1},
|
inputTextureDesc.size = {1, 1, 1};
|
||||||
.format = wgpu::TextureFormat::Depth32Float,
|
inputTextureDesc.format = wgpu::TextureFormat::Depth32Float;
|
||||||
};
|
|
||||||
mInputTexture = device.CreateTexture(&inputTextureDesc);
|
mInputTexture = device.CreateTexture(&inputTextureDesc);
|
||||||
|
|
||||||
wgpu::TextureDescriptor outputTextureDesc = {
|
wgpu::TextureDescriptor outputTextureDesc;
|
||||||
.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
outputTextureDesc.usage =
|
||||||
.size = {1, 1, 1},
|
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
.format = wgpu::TextureFormat::RGBA8Unorm,
|
outputTextureDesc.size = {1, 1, 1};
|
||||||
};
|
outputTextureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
mOutputTexture = device.CreateTexture(&outputTextureDesc);
|
mOutputTexture = device.CreateTexture(&outputTextureDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,9 +91,8 @@ class ComparisonSamplerTest : public DawnTest {
|
||||||
std::vector<float> textureValues) {
|
std::vector<float> textureValues) {
|
||||||
mUniformBuffer.SetSubData(0, sizeof(float), &compareRef);
|
mUniformBuffer.SetSubData(0, sizeof(float), &compareRef);
|
||||||
|
|
||||||
wgpu::SamplerDescriptor samplerDesc = {
|
wgpu::SamplerDescriptor samplerDesc;
|
||||||
.compare = compare,
|
samplerDesc.compare = compare;
|
||||||
};
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
|
@ -155,16 +151,14 @@ class ComparisonSamplerTest : public DawnTest {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mTextureUploadBuffer.SetSubData(0, sizeof(float), &textureValue);
|
mTextureUploadBuffer.SetSubData(0, sizeof(float), &textureValue);
|
||||||
wgpu::BufferCopyView bufferCopyView = {
|
wgpu::BufferCopyView bufferCopyView;
|
||||||
.buffer = mTextureUploadBuffer,
|
bufferCopyView.buffer = mTextureUploadBuffer;
|
||||||
.offset = 0,
|
bufferCopyView.offset = 0;
|
||||||
.rowPitch = kTextureBytesPerRowAlignment,
|
bufferCopyView.rowPitch = kTextureBytesPerRowAlignment;
|
||||||
.imageHeight = 1,
|
bufferCopyView.imageHeight = 1;
|
||||||
};
|
wgpu::TextureCopyView textureCopyView;
|
||||||
wgpu::TextureCopyView textureCopyView = {
|
textureCopyView.texture = mInputTexture;
|
||||||
.texture = mInputTexture,
|
textureCopyView.origin = {0, 0, 0};
|
||||||
.origin = {0, 0, 0},
|
|
||||||
};
|
|
||||||
wgpu::Extent3D copySize = {1, 1, 1};
|
wgpu::Extent3D copySize = {1, 1, 1};
|
||||||
commandEncoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
commandEncoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,74 +75,80 @@ TEST_P(DeprecationTests, CreateQueueReturnsFunctionalQueue) {
|
||||||
|
|
||||||
// Test that creating a BGL with textureDimension produces a deprecation warning.
|
// Test that creating a BGL with textureDimension produces a deprecation warning.
|
||||||
TEST_P(DeprecationTests, BGLEntryTextureDimensionIsDeprecated) {
|
TEST_P(DeprecationTests, BGLEntryTextureDimensionIsDeprecated) {
|
||||||
wgpu::BindGroupLayoutEntry entryDesc = {
|
wgpu::BindGroupLayoutEntry entryDesc;
|
||||||
.type = wgpu::BindingType::SampledTexture,
|
entryDesc.binding = 0;
|
||||||
.textureDimension = wgpu::TextureViewDimension::e2D,
|
entryDesc.visibility = wgpu::ShaderStage::None;
|
||||||
};
|
entryDesc.type = wgpu::BindingType::SampledTexture;
|
||||||
|
entryDesc.textureDimension = wgpu::TextureViewDimension::e2D;
|
||||||
|
|
||||||
wgpu::BindGroupLayoutDescriptor bglDesc = {
|
wgpu::BindGroupLayoutDescriptor bglDesc;
|
||||||
.entryCount = 1,
|
bglDesc.bindingCount = 0;
|
||||||
.entries = &entryDesc,
|
bglDesc.bindings = nullptr;
|
||||||
};
|
bglDesc.entryCount = 1;
|
||||||
|
bglDesc.entries = &entryDesc;
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateBindGroupLayout(&bglDesc));
|
EXPECT_DEPRECATION_WARNING(device.CreateBindGroupLayout(&bglDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that creating a BGL with default viewDimension and textureDimension doesn't emit a warning
|
// Test that creating a BGL with default viewDimension and textureDimension doesn't emit a warning
|
||||||
TEST_P(DeprecationTests, BGLEntryTextureDimensionAndViewUndefinedEmitsNoWarning) {
|
TEST_P(DeprecationTests, BGLEntryTextureDimensionAndViewUndefinedEmitsNoWarning) {
|
||||||
wgpu::BindGroupLayoutEntry entryDesc = {
|
wgpu::BindGroupLayoutEntry entryDesc;
|
||||||
.type = wgpu::BindingType::Sampler,
|
entryDesc.binding = 0;
|
||||||
};
|
entryDesc.visibility = wgpu::ShaderStage::None;
|
||||||
|
entryDesc.type = wgpu::BindingType::Sampler;
|
||||||
|
|
||||||
wgpu::BindGroupLayoutDescriptor bglDesc = {
|
wgpu::BindGroupLayoutDescriptor bglDesc;
|
||||||
.entryCount = 1,
|
bglDesc.bindingCount = 0;
|
||||||
.entries = &entryDesc,
|
bglDesc.bindings = nullptr;
|
||||||
};
|
bglDesc.entryCount = 1;
|
||||||
|
bglDesc.entries = &entryDesc;
|
||||||
device.CreateBindGroupLayout(&bglDesc);
|
device.CreateBindGroupLayout(&bglDesc);
|
||||||
}
|
}
|
||||||
// Test that creating a BGL with both textureDimension and viewDimension is an error
|
// Test that creating a BGL with both textureDimension and viewDimension is an error
|
||||||
TEST_P(DeprecationTests, BGLEntryTextureAndViewDimensionIsInvalid) {
|
TEST_P(DeprecationTests, BGLEntryTextureAndViewDimensionIsInvalid) {
|
||||||
wgpu::BindGroupLayoutEntry entryDesc = {
|
wgpu::BindGroupLayoutEntry entryDesc;
|
||||||
.type = wgpu::BindingType::SampledTexture,
|
entryDesc.binding = 0;
|
||||||
.textureDimension = wgpu::TextureViewDimension::e2D,
|
entryDesc.visibility = wgpu::ShaderStage::None;
|
||||||
.viewDimension = wgpu::TextureViewDimension::e2D,
|
entryDesc.type = wgpu::BindingType::SampledTexture;
|
||||||
};
|
entryDesc.textureDimension = wgpu::TextureViewDimension::e2D;
|
||||||
|
entryDesc.viewDimension = wgpu::TextureViewDimension::e2D;
|
||||||
|
|
||||||
wgpu::BindGroupLayoutDescriptor bglDesc = {
|
wgpu::BindGroupLayoutDescriptor bglDesc;
|
||||||
.entryCount = 1,
|
bglDesc.bindingCount = 0;
|
||||||
.entries = &entryDesc,
|
bglDesc.bindings = nullptr;
|
||||||
};
|
bglDesc.entryCount = 1;
|
||||||
|
bglDesc.entries = &entryDesc;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&bglDesc));
|
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&bglDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that creating a BGL with both textureDimension still does correct state tracking
|
// Test that creating a BGL with both textureDimension still does correct state tracking
|
||||||
TEST_P(DeprecationTests, BGLEntryTextureDimensionStateTracking) {
|
TEST_P(DeprecationTests, BGLEntryTextureDimensionStateTracking) {
|
||||||
// Create a BGL that expects a cube map
|
// Create a BGL that expects a cube map
|
||||||
wgpu::BindGroupLayoutEntry entryDesc = {
|
wgpu::BindGroupLayoutEntry entryDesc = {};
|
||||||
.type = wgpu::BindingType::SampledTexture,
|
entryDesc.binding = 0;
|
||||||
.textureDimension = wgpu::TextureViewDimension::Cube,
|
entryDesc.visibility = wgpu::ShaderStage::None;
|
||||||
};
|
entryDesc.type = wgpu::BindingType::SampledTexture;
|
||||||
|
entryDesc.textureDimension = wgpu::TextureViewDimension::Cube;
|
||||||
|
|
||||||
wgpu::BindGroupLayoutDescriptor bglDesc = {
|
wgpu::BindGroupLayoutDescriptor bglDesc = {};
|
||||||
.entryCount = 1,
|
bglDesc.bindingCount = 0;
|
||||||
.entries = &entryDesc,
|
bglDesc.bindings = nullptr;
|
||||||
};
|
bglDesc.entryCount = 1;
|
||||||
|
bglDesc.entries = &entryDesc;
|
||||||
wgpu::BindGroupLayout layout;
|
wgpu::BindGroupLayout layout;
|
||||||
EXPECT_DEPRECATION_WARNING(layout = device.CreateBindGroupLayout(&bglDesc));
|
EXPECT_DEPRECATION_WARNING(layout = device.CreateBindGroupLayout(&bglDesc));
|
||||||
|
|
||||||
// Create a 2D array view and a cube view
|
// Create a 2D array view and a cube view
|
||||||
wgpu::TextureDescriptor textureDesc = {
|
wgpu::TextureDescriptor textureDesc = {};
|
||||||
.usage = wgpu::TextureUsage::Sampled,
|
textureDesc.usage = wgpu::TextureUsage::Sampled;
|
||||||
.size = {1, 1, 1},
|
textureDesc.size = {1, 1, 1};
|
||||||
.arrayLayerCount = 6,
|
textureDesc.arrayLayerCount = 6;
|
||||||
.format = wgpu::TextureFormat::RGBA8Unorm,
|
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
};
|
|
||||||
wgpu::Texture texture = device.CreateTexture(&textureDesc);
|
wgpu::Texture texture = device.CreateTexture(&textureDesc);
|
||||||
|
|
||||||
wgpu::TextureViewDescriptor viewDesc = {
|
wgpu::TextureViewDescriptor viewDesc = {};
|
||||||
.dimension = wgpu::TextureViewDimension::e2DArray,
|
viewDesc.dimension = wgpu::TextureViewDimension::e2DArray;
|
||||||
.baseArrayLayer = 0,
|
viewDesc.baseArrayLayer = 0;
|
||||||
.arrayLayerCount = 6,
|
viewDesc.arrayLayerCount = 6;
|
||||||
};
|
|
||||||
wgpu::TextureView arrayView = texture.CreateView(&viewDesc);
|
wgpu::TextureView arrayView = texture.CreateView(&viewDesc);
|
||||||
|
|
||||||
viewDesc.dimension = wgpu::TextureViewDimension::Cube;
|
viewDesc.dimension = wgpu::TextureViewDimension::Cube;
|
||||||
|
@ -158,64 +164,67 @@ TEST_P(DeprecationTests, BGLEntryTextureDimensionStateTracking) {
|
||||||
|
|
||||||
// Test that creating a BGL with bindings emits a deprecation warning.
|
// Test that creating a BGL with bindings emits a deprecation warning.
|
||||||
TEST_P(DeprecationTests, BGLDescBindingIsDeprecated) {
|
TEST_P(DeprecationTests, BGLDescBindingIsDeprecated) {
|
||||||
wgpu::BindGroupLayoutEntry entryDesc = {
|
wgpu::BindGroupLayoutEntry entryDesc;
|
||||||
.type = wgpu::BindingType::Sampler,
|
entryDesc.binding = 0;
|
||||||
};
|
entryDesc.visibility = wgpu::ShaderStage::None;
|
||||||
|
entryDesc.type = wgpu::BindingType::Sampler;
|
||||||
|
|
||||||
wgpu::BindGroupLayoutDescriptor bglDesc = {
|
wgpu::BindGroupLayoutDescriptor bglDesc;
|
||||||
.bindingCount = 1,
|
bglDesc.bindingCount = 1;
|
||||||
.bindings = &entryDesc,
|
bglDesc.bindings = &entryDesc;
|
||||||
};
|
bglDesc.entryCount = 0;
|
||||||
|
bglDesc.entries = nullptr;
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateBindGroupLayout(&bglDesc));
|
EXPECT_DEPRECATION_WARNING(device.CreateBindGroupLayout(&bglDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that creating a BGL with both entries and bindings is an error
|
// Test that creating a BGL with both entries and bindings is an error
|
||||||
TEST_P(DeprecationTests, BGLDescBindingAndEntriesIsInvalid) {
|
TEST_P(DeprecationTests, BGLDescBindingAndEntriesIsInvalid) {
|
||||||
wgpu::BindGroupLayoutEntry entryDesc = {
|
wgpu::BindGroupLayoutEntry entryDesc;
|
||||||
.type = wgpu::BindingType::Sampler,
|
entryDesc.binding = 0;
|
||||||
};
|
entryDesc.visibility = wgpu::ShaderStage::None;
|
||||||
|
entryDesc.type = wgpu::BindingType::Sampler;
|
||||||
|
|
||||||
wgpu::BindGroupLayoutDescriptor bglDesc = {
|
wgpu::BindGroupLayoutDescriptor bglDesc;
|
||||||
.bindingCount = 1,
|
bglDesc.bindingCount = 1;
|
||||||
.bindings = &entryDesc,
|
bglDesc.bindings = &entryDesc;
|
||||||
.entryCount = 1,
|
bglDesc.entryCount = 1;
|
||||||
.entries = &entryDesc,
|
bglDesc.entries = &entryDesc;
|
||||||
};
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&bglDesc));
|
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&bglDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that creating a BGL with both entries and bindings to 0 doesn't emit warnings
|
// Test that creating a BGL with both entries and bindings to 0 doesn't emit warnings
|
||||||
TEST_P(DeprecationTests, BGLDescBindingAndEntriesBothZeroEmitsNoWarning) {
|
TEST_P(DeprecationTests, BGLDescBindingAndEntriesBothZeroEmitsNoWarning) {
|
||||||
wgpu::BindGroupLayoutDescriptor bglDesc = {
|
wgpu::BindGroupLayoutDescriptor bglDesc;
|
||||||
.bindingCount = 0,
|
bglDesc.bindingCount = 0;
|
||||||
.bindings = nullptr,
|
bglDesc.bindings = nullptr;
|
||||||
.entryCount = 0,
|
bglDesc.entryCount = 0;
|
||||||
.entries = nullptr,
|
bglDesc.entries = nullptr;
|
||||||
};
|
|
||||||
device.CreateBindGroupLayout(&bglDesc);
|
device.CreateBindGroupLayout(&bglDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that creating a BGL with bindings still does correct state tracking
|
// Test that creating a BGL with bindings still does correct state tracking
|
||||||
TEST_P(DeprecationTests, BGLDescBindingStateTracking) {
|
TEST_P(DeprecationTests, BGLDescBindingStateTracking) {
|
||||||
wgpu::BindGroupLayoutEntry entryDesc = {
|
wgpu::BindGroupLayoutEntry entryDesc;
|
||||||
.binding = 0,
|
entryDesc.binding = 0;
|
||||||
.type = wgpu::BindingType::Sampler,
|
entryDesc.type = wgpu::BindingType::Sampler;
|
||||||
};
|
entryDesc.visibility = wgpu::ShaderStage::None;
|
||||||
|
|
||||||
wgpu::BindGroupLayoutDescriptor bglDesc = {
|
wgpu::BindGroupLayoutDescriptor bglDesc;
|
||||||
.bindingCount = 1,
|
bglDesc.bindingCount = 1;
|
||||||
.bindings = &entryDesc,
|
bglDesc.bindings = &entryDesc;
|
||||||
};
|
bglDesc.entryCount = 0;
|
||||||
|
bglDesc.entries = nullptr;
|
||||||
wgpu::BindGroupLayout layout;
|
wgpu::BindGroupLayout layout;
|
||||||
EXPECT_DEPRECATION_WARNING(layout = device.CreateBindGroupLayout(&bglDesc));
|
EXPECT_DEPRECATION_WARNING(layout = device.CreateBindGroupLayout(&bglDesc));
|
||||||
|
|
||||||
// Test a case where if |bindings| wasn't taken into account, no validation error would happen
|
// Test a case where if |bindings| wasn't taken into account, no validation error would happen
|
||||||
// because the layout would be empty
|
// because the layout would be empty
|
||||||
wgpu::BindGroupDescriptor badBgDesc = {
|
wgpu::BindGroupDescriptor badBgDesc;
|
||||||
.layout = layout,
|
badBgDesc.layout = layout;
|
||||||
.entryCount = 0,
|
badBgDesc.bindingCount = 0;
|
||||||
.entries = nullptr,
|
badBgDesc.bindings = nullptr;
|
||||||
};
|
badBgDesc.entryCount = 0;
|
||||||
|
badBgDesc.entries = nullptr;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&badBgDesc));
|
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&badBgDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,16 +238,16 @@ TEST_P(DeprecationTests, BGDescBindingIsDeprecated) {
|
||||||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
||||||
|
|
||||||
wgpu::BindGroupEntry entryDesc = {
|
wgpu::BindGroupEntry entryDesc;
|
||||||
.binding = 0,
|
entryDesc.binding = 0;
|
||||||
.sampler = sampler,
|
entryDesc.sampler = sampler;
|
||||||
};
|
|
||||||
|
|
||||||
wgpu::BindGroupDescriptor bgDesc = {
|
wgpu::BindGroupDescriptor bgDesc;
|
||||||
.layout = layout,
|
bgDesc.layout = layout;
|
||||||
.bindingCount = 1,
|
bgDesc.bindingCount = 1;
|
||||||
.bindings = &entryDesc,
|
bgDesc.bindings = &entryDesc;
|
||||||
};
|
bgDesc.entryCount = 0;
|
||||||
|
bgDesc.entries = nullptr;
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateBindGroup(&bgDesc));
|
EXPECT_DEPRECATION_WARNING(device.CreateBindGroup(&bgDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,18 +259,16 @@ TEST_P(DeprecationTests, BGDescBindingAndEntriesIsInvalid) {
|
||||||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
||||||
|
|
||||||
wgpu::BindGroupEntry entryDesc = {
|
wgpu::BindGroupEntry entryDesc = {};
|
||||||
.binding = 0,
|
entryDesc.binding = 0;
|
||||||
.sampler = sampler,
|
entryDesc.sampler = sampler;
|
||||||
};
|
|
||||||
|
|
||||||
wgpu::BindGroupDescriptor bgDesc = {
|
wgpu::BindGroupDescriptor bgDesc;
|
||||||
.layout = layout,
|
bgDesc.layout = layout;
|
||||||
.bindingCount = 1,
|
bgDesc.bindingCount = 1;
|
||||||
.bindings = &entryDesc,
|
bgDesc.bindings = &entryDesc;
|
||||||
.entryCount = 1,
|
bgDesc.entryCount = 1;
|
||||||
.entries = &entryDesc,
|
bgDesc.entries = &entryDesc;
|
||||||
};
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&bgDesc));
|
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&bgDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,13 +276,12 @@ TEST_P(DeprecationTests, BGDescBindingAndEntriesIsInvalid) {
|
||||||
TEST_P(DeprecationTests, BGDescBindingAndEntriesBothZeroEmitsNoWarning) {
|
TEST_P(DeprecationTests, BGDescBindingAndEntriesBothZeroEmitsNoWarning) {
|
||||||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {});
|
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {});
|
||||||
|
|
||||||
wgpu::BindGroupDescriptor bgDesc = {
|
wgpu::BindGroupDescriptor bgDesc;
|
||||||
.layout = layout,
|
bgDesc.layout = layout;
|
||||||
.bindingCount = 0,
|
bgDesc.bindingCount = 0;
|
||||||
.bindings = nullptr,
|
bgDesc.bindings = nullptr;
|
||||||
.entryCount = 0,
|
bgDesc.entryCount = 0;
|
||||||
.entries = nullptr,
|
bgDesc.entries = nullptr;
|
||||||
};
|
|
||||||
device.CreateBindGroup(&bgDesc);
|
device.CreateBindGroup(&bgDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,16 +294,16 @@ TEST_P(DeprecationTests, BGDescBindingStateTracking) {
|
||||||
wgpu::SamplerDescriptor samplerDesc = {};
|
wgpu::SamplerDescriptor samplerDesc = {};
|
||||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||||
|
|
||||||
wgpu::BindGroupEntry entryDesc = {
|
wgpu::BindGroupEntry entryDesc = {};
|
||||||
.binding = 0,
|
entryDesc.binding = 0;
|
||||||
.sampler = sampler,
|
entryDesc.sampler = sampler;
|
||||||
};
|
|
||||||
|
|
||||||
wgpu::BindGroupDescriptor bgDesc = {
|
wgpu::BindGroupDescriptor bgDesc;
|
||||||
.layout = layout,
|
bgDesc.layout = layout;
|
||||||
.bindingCount = 1,
|
bgDesc.bindingCount = 1;
|
||||||
.bindings = &entryDesc,
|
bgDesc.bindings = &entryDesc;
|
||||||
};
|
bgDesc.entryCount = 0;
|
||||||
|
bgDesc.entries = nullptr;
|
||||||
EXPECT_DEPRECATION_WARNING(ASSERT_DEVICE_ERROR(device.CreateBindGroup(&bgDesc)));
|
EXPECT_DEPRECATION_WARNING(ASSERT_DEVICE_ERROR(device.CreateBindGroup(&bgDesc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,10 +318,9 @@ TEST_P(DeprecationTests, ShaderModuleNoSubDescriptorIsDeprecated) {
|
||||||
std::vector<uint32_t> spirv =
|
std::vector<uint32_t> spirv =
|
||||||
CompileGLSLToSpirv(utils::SingleShaderStage::Compute, kEmptyShader);
|
CompileGLSLToSpirv(utils::SingleShaderStage::Compute, kEmptyShader);
|
||||||
|
|
||||||
wgpu::ShaderModuleDescriptor descriptor = {
|
wgpu::ShaderModuleDescriptor descriptor;
|
||||||
.codeSize = static_cast<uint32_t>(spirv.size()),
|
descriptor.codeSize = static_cast<uint32_t>(spirv.size());
|
||||||
.code = spirv.data(),
|
descriptor.code = spirv.data();
|
||||||
};
|
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateShaderModule(&descriptor));
|
EXPECT_DEPRECATION_WARNING(device.CreateShaderModule(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,11 +333,10 @@ TEST_P(DeprecationTests, ShaderModuleBothInlinedAndChainedIsInvalid) {
|
||||||
spirvDesc.codeSize = static_cast<uint32_t>(spirv.size());
|
spirvDesc.codeSize = static_cast<uint32_t>(spirv.size());
|
||||||
spirvDesc.code = spirv.data();
|
spirvDesc.code = spirv.data();
|
||||||
|
|
||||||
wgpu::ShaderModuleDescriptor descriptor = {
|
wgpu::ShaderModuleDescriptor descriptor;
|
||||||
.nextInChain = &spirvDesc,
|
descriptor.nextInChain = &spirvDesc;
|
||||||
.codeSize = static_cast<uint32_t>(spirv.size()),
|
descriptor.codeSize = static_cast<uint32_t>(spirv.size());
|
||||||
.code = spirv.data(),
|
descriptor.code = spirv.data();
|
||||||
};
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateShaderModule(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateShaderModule(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,21 +345,17 @@ TEST_P(DeprecationTests, ShaderModuleInlinedCodeStateTracking) {
|
||||||
std::vector<uint32_t> spirv =
|
std::vector<uint32_t> spirv =
|
||||||
CompileGLSLToSpirv(utils::SingleShaderStage::Compute, kEmptyShader);
|
CompileGLSLToSpirv(utils::SingleShaderStage::Compute, kEmptyShader);
|
||||||
|
|
||||||
wgpu::ShaderModuleDescriptor descriptor = {
|
wgpu::ShaderModuleDescriptor descriptor;
|
||||||
.codeSize = static_cast<uint32_t>(spirv.size()),
|
descriptor.codeSize = static_cast<uint32_t>(spirv.size());
|
||||||
.code = spirv.data(),
|
descriptor.code = spirv.data();
|
||||||
};
|
|
||||||
wgpu::ShaderModule module;
|
wgpu::ShaderModule module;
|
||||||
EXPECT_DEPRECATION_WARNING(module = device.CreateShaderModule(&descriptor));
|
EXPECT_DEPRECATION_WARNING(module = device.CreateShaderModule(&descriptor));
|
||||||
|
|
||||||
// Creating a compute pipeline works, because it is a compute module.
|
// Creating a compute pipeline works, because it is a compute module.
|
||||||
wgpu::ComputePipelineDescriptor computePipelineDesc = {
|
wgpu::ComputePipelineDescriptor computePipelineDesc;
|
||||||
.computeStage =
|
computePipelineDesc.layout = nullptr;
|
||||||
{
|
computePipelineDesc.computeStage.module = module;
|
||||||
.module = module,
|
computePipelineDesc.computeStage.entryPoint = "main";
|
||||||
.entryPoint = "main",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
device.CreateComputePipeline(&computePipelineDesc);
|
device.CreateComputePipeline(&computePipelineDesc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||||
|
@ -372,17 +372,15 @@ class BufferCopyViewDeprecationTests : public DeprecationTests {
|
||||||
void TestSetUp() override {
|
void TestSetUp() override {
|
||||||
DeprecationTests::TestSetUp();
|
DeprecationTests::TestSetUp();
|
||||||
|
|
||||||
wgpu::BufferDescriptor bufferDesc = {
|
wgpu::BufferDescriptor bufferDesc;
|
||||||
.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst,
|
bufferDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||||
.size = kTextureBytesPerRowAlignment * 2,
|
bufferDesc.size = kTextureBytesPerRowAlignment * 2;
|
||||||
};
|
|
||||||
buffer = device.CreateBuffer(&bufferDesc);
|
buffer = device.CreateBuffer(&bufferDesc);
|
||||||
|
|
||||||
wgpu::TextureDescriptor textureDesc = {
|
wgpu::TextureDescriptor textureDesc;
|
||||||
.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst,
|
textureDesc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||||
.size = {2, 2, 1},
|
textureDesc.size = {2, 2, 1};
|
||||||
.format = wgpu::TextureFormat::RGBA8Unorm,
|
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
};
|
|
||||||
texture = device.CreateTexture(&textureDesc);
|
texture = device.CreateTexture(&textureDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,12 +389,11 @@ class BufferCopyViewDeprecationTests : public DeprecationTests {
|
||||||
T2B,
|
T2B,
|
||||||
};
|
};
|
||||||
void DoCopy(CopyType type, const wgpu::BufferCopyView& bufferView) {
|
void DoCopy(CopyType type, const wgpu::BufferCopyView& bufferView) {
|
||||||
wgpu::TextureCopyView textureCopyView = {
|
wgpu::TextureCopyView textureCopyView;
|
||||||
.texture = texture,
|
textureCopyView.texture = texture;
|
||||||
.mipLevel = 0,
|
textureCopyView.mipLevel = 0;
|
||||||
.arrayLayer = 0,
|
textureCopyView.arrayLayer = 0;
|
||||||
.origin = {0, 0},
|
textureCopyView.origin = {0, 0};
|
||||||
};
|
|
||||||
wgpu::Extent3D copySize = {2, 2, 1};
|
wgpu::Extent3D copySize = {2, 2, 1};
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
@ -417,54 +414,49 @@ class BufferCopyViewDeprecationTests : public DeprecationTests {
|
||||||
|
|
||||||
// Test that using rowPitch produces a deprecation warning.
|
// Test that using rowPitch produces a deprecation warning.
|
||||||
TEST_P(BufferCopyViewDeprecationTests, RowPitchIsDeprecated) {
|
TEST_P(BufferCopyViewDeprecationTests, RowPitchIsDeprecated) {
|
||||||
wgpu::BufferCopyView view = {
|
wgpu::BufferCopyView view;
|
||||||
.buffer = buffer,
|
view.buffer = buffer;
|
||||||
.rowPitch = 256,
|
view.rowPitch = 256;
|
||||||
};
|
|
||||||
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
|
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
|
||||||
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
|
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that using imageHeight produces a deprecation warning.
|
// Test that using imageHeight produces a deprecation warning.
|
||||||
TEST_P(BufferCopyViewDeprecationTests, ImageHeightIsDeprecated) {
|
TEST_P(BufferCopyViewDeprecationTests, ImageHeightIsDeprecated) {
|
||||||
wgpu::BufferCopyView view = {
|
wgpu::BufferCopyView view;
|
||||||
.buffer = buffer,
|
view.buffer = buffer;
|
||||||
.imageHeight = 2,
|
view.imageHeight = 2;
|
||||||
.bytesPerRow = 256,
|
view.bytesPerRow = 256;
|
||||||
};
|
|
||||||
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
|
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
|
||||||
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
|
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that using both rowPitch and bytesPerRow produces a validation error.
|
// Test that using both rowPitch and bytesPerRow produces a validation error.
|
||||||
TEST_P(BufferCopyViewDeprecationTests, BothRowPitchAndBytesPerRowIsInvalid) {
|
TEST_P(BufferCopyViewDeprecationTests, BothRowPitchAndBytesPerRowIsInvalid) {
|
||||||
wgpu::BufferCopyView view = {
|
wgpu::BufferCopyView view;
|
||||||
.buffer = buffer,
|
view.buffer = buffer;
|
||||||
.rowPitch = 256,
|
view.rowPitch = 256;
|
||||||
.bytesPerRow = 256,
|
view.bytesPerRow = 256;
|
||||||
};
|
|
||||||
ASSERT_DEVICE_ERROR(DoCopy(B2T, view));
|
ASSERT_DEVICE_ERROR(DoCopy(B2T, view));
|
||||||
ASSERT_DEVICE_ERROR(DoCopy(T2B, view));
|
ASSERT_DEVICE_ERROR(DoCopy(T2B, view));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that using both imageHeight and rowsPerImage produces a validation error.
|
// Test that using both imageHeight and rowsPerImage produces a validation error.
|
||||||
TEST_P(BufferCopyViewDeprecationTests, BothImageHeightAndRowsPerImageIsInvalid) {
|
TEST_P(BufferCopyViewDeprecationTests, BothImageHeightAndRowsPerImageIsInvalid) {
|
||||||
wgpu::BufferCopyView view = {
|
wgpu::BufferCopyView view;
|
||||||
.buffer = buffer,
|
view.buffer = buffer;
|
||||||
.imageHeight = 2,
|
view.imageHeight = 2;
|
||||||
.bytesPerRow = 256,
|
view.bytesPerRow = 256;
|
||||||
.rowsPerImage = 2,
|
view.rowsPerImage = 2;
|
||||||
};
|
|
||||||
ASSERT_DEVICE_ERROR(DoCopy(B2T, view));
|
ASSERT_DEVICE_ERROR(DoCopy(B2T, view));
|
||||||
ASSERT_DEVICE_ERROR(DoCopy(T2B, view));
|
ASSERT_DEVICE_ERROR(DoCopy(T2B, view));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that rowPitch is correctly taken into account for validation
|
// Test that rowPitch is correctly taken into account for validation
|
||||||
TEST_P(BufferCopyViewDeprecationTests, RowPitchTakenIntoAccountForValidation) {
|
TEST_P(BufferCopyViewDeprecationTests, RowPitchTakenIntoAccountForValidation) {
|
||||||
wgpu::BufferCopyView view = {
|
wgpu::BufferCopyView view;
|
||||||
.buffer = buffer,
|
view.buffer = buffer;
|
||||||
.rowPitch = 256,
|
view.rowPitch = 256;
|
||||||
};
|
|
||||||
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
|
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
|
||||||
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
|
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
|
||||||
|
|
||||||
|
@ -475,11 +467,10 @@ TEST_P(BufferCopyViewDeprecationTests, RowPitchTakenIntoAccountForValidation) {
|
||||||
|
|
||||||
// Test that imageHeight is correctly taken into account for validation
|
// Test that imageHeight is correctly taken into account for validation
|
||||||
TEST_P(BufferCopyViewDeprecationTests, ImageHeightTakenIntoAccountForValidation) {
|
TEST_P(BufferCopyViewDeprecationTests, ImageHeightTakenIntoAccountForValidation) {
|
||||||
wgpu::BufferCopyView view = {
|
wgpu::BufferCopyView view;
|
||||||
.buffer = buffer,
|
view.buffer = buffer;
|
||||||
.imageHeight = 2,
|
view.imageHeight = 2;
|
||||||
.bytesPerRow = 256,
|
view.bytesPerRow = 256;
|
||||||
};
|
|
||||||
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
|
EXPECT_DEPRECATION_WARNING(DoCopy(B2T, view));
|
||||||
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
|
EXPECT_DEPRECATION_WARNING(DoCopy(T2B, view));
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,16 @@
|
||||||
|
|
||||||
#include "tests/perf_tests/DawnPerfTest.h"
|
#include "tests/perf_tests/DawnPerfTest.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <fstream>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include "common/Assert.h"
|
#include "common/Assert.h"
|
||||||
#include "common/Log.h"
|
#include "common/Log.h"
|
||||||
#include "dawn_platform/tracing/TraceEvent.h"
|
#include "dawn_platform/tracing/TraceEvent.h"
|
||||||
#include "tests/perf_tests/DawnPerfTestPlatform.h"
|
#include "tests/perf_tests/DawnPerfTestPlatform.h"
|
||||||
#include "utils/Timer.h"
|
#include "utils/Timer.h"
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
DawnPerfTestEnvironment* gTestEnv = nullptr;
|
DawnPerfTestEnvironment* gTestEnv = nullptr;
|
||||||
|
|
|
@ -14,12 +14,13 @@
|
||||||
|
|
||||||
#include "tests/perf_tests/DawnPerfTestPlatform.h"
|
#include "tests/perf_tests/DawnPerfTestPlatform.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "common/Assert.h"
|
#include "common/Assert.h"
|
||||||
#include "common/HashUtils.h"
|
#include "common/HashUtils.h"
|
||||||
#include "dawn_platform/tracing/TraceEvent.h"
|
#include "dawn_platform/tracing/TraceEvent.h"
|
||||||
#include "tests/perf_tests/DawnPerfTest.h"
|
#include "tests/perf_tests/DawnPerfTest.h"
|
||||||
#include "utils/Timer.h"
|
#include "utils/Timer.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct TraceCategoryInfo {
|
struct TraceCategoryInfo {
|
||||||
|
|
|
@ -1601,9 +1601,8 @@ TEST_F(ComparisonSamplerBindingTest, SamplerAndBindGroupMatches) {
|
||||||
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ComparisonSampler}});
|
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ComparisonSampler}});
|
||||||
|
|
||||||
wgpu::SamplerDescriptor desc = {
|
wgpu::SamplerDescriptor desc = {};
|
||||||
.compare = wgpu::CompareFunction::Never,
|
desc.compare = wgpu::CompareFunction::Never;
|
||||||
};
|
|
||||||
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}});
|
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1612,9 +1611,8 @@ TEST_F(ComparisonSamplerBindingTest, SamplerAndBindGroupMatches) {
|
||||||
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
||||||
|
|
||||||
wgpu::SamplerDescriptor desc = {
|
wgpu::SamplerDescriptor desc;
|
||||||
.compare = wgpu::CompareFunction::Never,
|
desc.compare = wgpu::CompareFunction::Never;
|
||||||
};
|
|
||||||
ASSERT_DEVICE_ERROR(
|
ASSERT_DEVICE_ERROR(
|
||||||
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}}));
|
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,9 @@ class IndexBufferValidationTest : public ValidationTest {};
|
||||||
|
|
||||||
// Test that for OOB validation of index buffer offset and size.
|
// Test that for OOB validation of index buffer offset and size.
|
||||||
TEST_F(IndexBufferValidationTest, IndexBufferOffsetOOBValidation) {
|
TEST_F(IndexBufferValidationTest, IndexBufferOffsetOOBValidation) {
|
||||||
wgpu::BufferDescriptor bufferDesc = {
|
wgpu::BufferDescriptor bufferDesc;
|
||||||
.usage = wgpu::BufferUsage::Index,
|
bufferDesc.usage = wgpu::BufferUsage::Index;
|
||||||
.size = 256,
|
bufferDesc.size = 256;
|
||||||
};
|
|
||||||
wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc);
|
wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc);
|
||||||
|
|
||||||
DummyRenderPass renderPass(device);
|
DummyRenderPass renderPass(device);
|
||||||
|
|
|
@ -876,11 +876,10 @@ TEST_F(StorageTextureValidationTests, StorageTextureInRenderPass) {
|
||||||
|
|
||||||
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
||||||
// Create a bind group that contains a storage texture.
|
// Create a bind group that contains a storage texture.
|
||||||
wgpu::BindGroupLayout bindGroupLayout =
|
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
utils::MakeBindGroupLayout(device, {{.binding = 0,
|
device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false,
|
||||||
.visibility = wgpu::ShaderStage::Fragment,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.type = storageTextureType,
|
wgpu::TextureComponentType::Float, kFormat}});
|
||||||
.storageTextureFormat = kFormat}});
|
|
||||||
|
|
||||||
wgpu::BindGroup bindGroupWithStorageTexture =
|
wgpu::BindGroup bindGroupWithStorageTexture =
|
||||||
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
|
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
|
||||||
|
@ -910,15 +909,14 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
|
||||||
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
||||||
// Create a bind group that binds the same texture as both storage texture and sampled
|
// Create a bind group that binds the same texture as both storage texture and sampled
|
||||||
// texture.
|
// texture.
|
||||||
wgpu::BindGroupLayout bindGroupLayout =
|
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
utils::MakeBindGroupLayout(device, {{.binding = 0,
|
device,
|
||||||
.visibility = wgpu::ShaderStage::Fragment,
|
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false,
|
||||||
.type = storageTextureType,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.storageTextureFormat = kFormat},
|
wgpu::TextureComponentType::Float, kFormat},
|
||||||
{.binding = 1,
|
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, false,
|
||||||
.visibility = wgpu::ShaderStage::Fragment,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.type = wgpu::BindingType::SampledTexture,
|
wgpu::TextureComponentType::Float, kFormat}});
|
||||||
.storageTextureFormat = kFormat}});
|
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
||||||
device, bindGroupLayout,
|
device, bindGroupLayout,
|
||||||
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
|
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
|
||||||
|
@ -954,11 +952,10 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndOutputAttachmentInOneRend
|
||||||
|
|
||||||
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
||||||
// Create a bind group that contains a storage texture.
|
// Create a bind group that contains a storage texture.
|
||||||
wgpu::BindGroupLayout bindGroupLayout =
|
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
utils::MakeBindGroupLayout(device, {{.binding = 0,
|
device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false,
|
||||||
.visibility = wgpu::ShaderStage::Fragment,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.type = storageTextureType,
|
wgpu::TextureComponentType::Float, kFormat}});
|
||||||
.storageTextureFormat = kFormat}});
|
|
||||||
wgpu::BindGroup bindGroupWithStorageTexture =
|
wgpu::BindGroup bindGroupWithStorageTexture =
|
||||||
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
|
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
|
// Create a bind group that uses the same texture as both read-only and write-only storage
|
||||||
// texture.
|
// texture.
|
||||||
wgpu::BindGroupLayout bindGroupLayout =
|
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
utils::MakeBindGroupLayout(device, {{.binding = 0,
|
device,
|
||||||
.visibility = wgpu::ShaderStage::Fragment,
|
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, false, false,
|
||||||
.type = wgpu::BindingType::ReadonlyStorageTexture,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.storageTextureFormat = kFormat},
|
wgpu::TextureComponentType::Float, kFormat},
|
||||||
{.binding = 1,
|
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false, false,
|
||||||
.visibility = wgpu::ShaderStage::Fragment,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.type = wgpu::BindingType::WriteonlyStorageTexture,
|
wgpu::TextureComponentType::Float, kFormat}});
|
||||||
.storageTextureFormat = kFormat}});
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
utils::MakeBindGroup(device, bindGroupLayout,
|
utils::MakeBindGroup(device, bindGroupLayout,
|
||||||
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
|
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
|
||||||
|
@ -1014,15 +1010,14 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneComput
|
||||||
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
||||||
// Create a bind group that binds the same texture as both storage texture and sampled
|
// Create a bind group that binds the same texture as both storage texture and sampled
|
||||||
// texture.
|
// texture.
|
||||||
wgpu::BindGroupLayout bindGroupLayout =
|
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
utils::MakeBindGroupLayout(device, {{.binding = 0,
|
device,
|
||||||
.visibility = wgpu::ShaderStage::Compute,
|
{{0, wgpu::ShaderStage::Compute, storageTextureType, false, false,
|
||||||
.type = storageTextureType,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.storageTextureFormat = kFormat},
|
wgpu::TextureComponentType::Float, kFormat},
|
||||||
{.binding = 1,
|
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, false,
|
||||||
.visibility = wgpu::ShaderStage::Compute,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.type = wgpu::BindingType::SampledTexture,
|
wgpu::TextureComponentType::Float, kFormat}});
|
||||||
.storageTextureFormat = kFormat}});
|
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
||||||
device, bindGroupLayout,
|
device, bindGroupLayout,
|
||||||
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
|
{{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
|
// Create a bind group that uses the same texture as both read-only and write-only storage
|
||||||
// texture.
|
// texture.
|
||||||
wgpu::BindGroupLayout bindGroupLayout =
|
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
|
||||||
utils::MakeBindGroupLayout(device, {{.binding = 0,
|
device,
|
||||||
.visibility = wgpu::ShaderStage::Compute,
|
{{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, false, false,
|
||||||
.type = wgpu::BindingType::ReadonlyStorageTexture,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.storageTextureFormat = kFormat},
|
wgpu::TextureComponentType::Float, kFormat},
|
||||||
{.binding = 1,
|
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, false, false,
|
||||||
.visibility = wgpu::ShaderStage::Compute,
|
wgpu::TextureViewDimension::Undefined, wgpu::TextureViewDimension::Undefined,
|
||||||
.type = wgpu::BindingType::WriteonlyStorageTexture,
|
wgpu::TextureComponentType::Float, kFormat}});
|
||||||
.storageTextureFormat = kFormat}});
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
utils::MakeBindGroup(device, bindGroupLayout,
|
utils::MakeBindGroup(device, bindGroupLayout,
|
||||||
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
|
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "common/Constants.h"
|
#include "common/Constants.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue