Update majority of unittests to use RenderPipelineDescriptor2
Bug: dawn:642 Change-Id: I437967f590e03b7d85d7eda28400db9e3e5d0745 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44820 Auto-Submit: Brandon Jones <bajones@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
parent
6f9bc3ac2c
commit
6e5d47a396
|
@ -1100,13 +1100,13 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
pipelineDescriptor.vertexStage.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::PipelineLayout pipelineLayout =
|
wgpu::PipelineLayout pipelineLayout =
|
||||||
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ComputePipeline CreateComputePipeline() {
|
wgpu::ComputePipeline CreateComputePipeline() {
|
||||||
|
@ -1559,11 +1559,11 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, ss.str().c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, ss.str().c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
pipelineDescriptor.vertexStage.module = mVsModule;
|
pipelineDescriptor.vertex.module = mVsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||||
|
|
||||||
return std::make_tuple(bindGroupLayouts, pipeline);
|
return std::make_tuple(bindGroupLayouts, pipeline);
|
||||||
}
|
}
|
||||||
|
@ -1697,12 +1697,12 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
||||||
wgpu::PipelineLayoutDescriptor descriptor;
|
wgpu::PipelineLayoutDescriptor descriptor;
|
||||||
descriptor.bindGroupLayoutCount = bindGroupLayout.size();
|
descriptor.bindGroupLayoutCount = bindGroupLayout.size();
|
||||||
descriptor.bindGroupLayouts = bindGroupLayout.data();
|
descriptor.bindGroupLayouts = bindGroupLayout.data();
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
pipelineDescriptor.vertexStage.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&descriptor);
|
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&descriptor);
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::RenderPipeline CreateRenderPipeline(std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
|
wgpu::RenderPipeline CreateRenderPipeline(std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
|
||||||
|
@ -2058,13 +2058,13 @@ class ComparisonSamplerBindingTest : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, fragmentSource);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, fragmentSource);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
pipelineDescriptor.vertexStage.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::PipelineLayout pipelineLayout =
|
wgpu::PipelineLayout pipelineLayout =
|
||||||
utils::MakeBasicPipelineLayout(device, bindGroupLayout);
|
utils::MakeBasicPipelineLayout(device, bindGroupLayout);
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,12 @@ class DrawIndirectValidationTest : public ValidationTest {
|
||||||
// Set up render pipeline
|
// Set up render pipeline
|
||||||
wgpu::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
|
wgpu::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = pipelineLayout;
|
descriptor.layout = pipelineLayout;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidateExpectation(wgpu::CommandEncoder encoder, utils::Expectation expectation) {
|
void ValidateExpectation(wgpu::CommandEncoder encoder, utils::Expectation expectation) {
|
||||||
|
|
|
@ -26,12 +26,12 @@ class GetBindGroupLayoutTests : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, shader);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, shader);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
return device.CreateRenderPipeline(&descriptor);
|
return device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,12 +67,12 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
|
|
||||||
// The same value is returned for the same index.
|
// The same value is returned for the same index.
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), pipeline.GetBindGroupLayout(0).Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||||
|
@ -461,12 +461,12 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that minBufferSize is set on the BGL and that the max of the min buffer sizes is used.
|
// Test that minBufferSize is set on the BGL and that the max of the min buffer sizes is used.
|
||||||
|
@ -527,30 +527,30 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||||
binding.buffer.minBindingSize = 64;
|
binding.buffer.minBindingSize = 64;
|
||||||
wgpu::BindGroupLayout bgl64 = device.CreateBindGroupLayout(&desc);
|
wgpu::BindGroupLayout bgl64 = device.CreateBindGroupLayout(&desc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
|
|
||||||
// Check with both stages using 4 bytes.
|
// Check with both stages using 4 bytes.
|
||||||
{
|
{
|
||||||
descriptor.vertexStage.module = vsModule4;
|
descriptor.vertex.module = vsModule4;
|
||||||
descriptor.cFragmentStage.module = fsModule4;
|
descriptor.cFragment.module = fsModule4;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl4.Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl4.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the max is taken between 4 and 64.
|
// Check that the max is taken between 4 and 64.
|
||||||
{
|
{
|
||||||
descriptor.vertexStage.module = vsModule64;
|
descriptor.vertex.module = vsModule64;
|
||||||
descriptor.cFragmentStage.module = fsModule4;
|
descriptor.cFragment.module = fsModule4;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the order doesn't change that the max is taken.
|
// Check that the order doesn't change that the max is taken.
|
||||||
{
|
{
|
||||||
descriptor.vertexStage.module = vsModule4;
|
descriptor.vertex.module = vsModule4;
|
||||||
descriptor.cFragmentStage.module = fsModule64;
|
descriptor.cFragment.module = fsModule64;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,14 +589,14 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||||
desc.entryCount = 1;
|
desc.entryCount = 1;
|
||||||
desc.entries = &binding;
|
desc.entries = &binding;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
|
|
||||||
// Check with only the vertex shader using the sampler
|
// Check with only the vertex shader using the sampler
|
||||||
{
|
{
|
||||||
descriptor.vertexStage.module = vsModuleSampler;
|
descriptor.vertex.module = vsModuleSampler;
|
||||||
descriptor.cFragmentStage.module = fsModuleNoSampler;
|
descriptor.cFragment.module = fsModuleNoSampler;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
|
|
||||||
binding.visibility = wgpu::ShaderStage::Vertex;
|
binding.visibility = wgpu::ShaderStage::Vertex;
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
||||||
|
@ -604,9 +604,9 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||||
|
|
||||||
// Check with only the fragment shader using the sampler
|
// Check with only the fragment shader using the sampler
|
||||||
{
|
{
|
||||||
descriptor.vertexStage.module = vsModuleNoSampler;
|
descriptor.vertex.module = vsModuleNoSampler;
|
||||||
descriptor.cFragmentStage.module = fsModuleSampler;
|
descriptor.cFragment.module = fsModuleSampler;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
|
|
||||||
binding.visibility = wgpu::ShaderStage::Fragment;
|
binding.visibility = wgpu::ShaderStage::Fragment;
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
||||||
|
@ -614,9 +614,9 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||||
|
|
||||||
// Check with both shaders using the sampler
|
// Check with both shaders using the sampler
|
||||||
{
|
{
|
||||||
descriptor.vertexStage.module = vsModuleSampler;
|
descriptor.vertex.module = vsModuleSampler;
|
||||||
descriptor.cFragmentStage.module = fsModuleSampler;
|
descriptor.cFragment.module = fsModuleSampler;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
|
|
||||||
binding.visibility = wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Vertex;
|
binding.visibility = wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Vertex;
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
||||||
|
@ -643,12 +643,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test it is invalid to have conflicting binding texture multisampling in the shaders.
|
// Test it is invalid to have conflicting binding texture multisampling in the shaders.
|
||||||
|
@ -665,12 +665,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test it is invalid to have conflicting binding texture dimension in the shaders.
|
// Test it is invalid to have conflicting binding texture dimension in the shaders.
|
||||||
|
@ -687,12 +687,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test it is invalid to have conflicting binding texture component type in the shaders.
|
// Test it is invalid to have conflicting binding texture component type in the shaders.
|
||||||
|
@ -709,12 +709,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test it is an error to query an out of range bind group layout.
|
// Test it is an error to query an out of range bind group layout.
|
||||||
|
@ -797,12 +797,12 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||||
pipelineDesc.layout = pipelineLayout;
|
pipelineDesc.layout = pipelineLayout;
|
||||||
pipelineDesc.vertexStage.module = vsModule;
|
pipelineDesc.vertex.module = vsModule;
|
||||||
pipelineDesc.cFragmentStage.module = fsModule;
|
pipelineDesc.cFragment.module = fsModule;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
||||||
|
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bindGroupLayout.Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bindGroupLayout.Get());
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,14 @@ class IndexBufferValidationTest : public ValidationTest {
|
||||||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitiveTopology = primitiveTopology;
|
descriptor.primitive.topology = primitiveTopology;
|
||||||
descriptor.cVertexState.indexFormat = format;
|
descriptor.primitive.stripIndexFormat = format;
|
||||||
descriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
return device.CreateRenderPipeline(&descriptor);
|
return device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -172,9 +172,9 @@ class MinBufferSizeTestsBase : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, fragShader.c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, fragShader.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
pipelineDescriptor.vertexStage.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = nullptr;
|
pipelineDescriptor.layout = nullptr;
|
||||||
if (!layouts.empty()) {
|
if (!layouts.empty()) {
|
||||||
wgpu::PipelineLayoutDescriptor descriptor;
|
wgpu::PipelineLayoutDescriptor descriptor;
|
||||||
|
@ -183,7 +183,7 @@ class MinBufferSizeTestsBase : public ValidationTest {
|
||||||
pipelineDescriptor.layout = device.CreatePipelineLayout(&descriptor);
|
pipelineDescriptor.layout = device.CreatePipelineLayout(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates render pipeline with default layout
|
// Creates render pipeline with default layout
|
||||||
|
|
|
@ -67,9 +67,9 @@ namespace {
|
||||||
|
|
||||||
pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
|
pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
InitializeRenderPipelineDescriptor(&descriptor);
|
InitializeRenderPipelineDescriptor(&descriptor);
|
||||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||||
|
|
||||||
float data[8];
|
float data[8];
|
||||||
wgpu::Buffer buffer = utils::CreateBufferFromData(device, data, 8 * sizeof(float),
|
wgpu::Buffer buffer = utils::CreateBufferFromData(device, data, 8 * sizeof(float),
|
||||||
|
@ -99,15 +99,15 @@ namespace {
|
||||||
{1, vertexStorageBuffer, 0, sizeof(kVertices)}});
|
{1, vertexStorageBuffer, 0, sizeof(kVertices)}});
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor* descriptor) {
|
void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor2* descriptor) {
|
||||||
descriptor->layout = pipelineLayout;
|
descriptor->layout = pipelineLayout;
|
||||||
descriptor->vertexStage.module = vsModule;
|
descriptor->vertex.module = vsModule;
|
||||||
descriptor->cFragmentStage.module = fsModule;
|
descriptor->cFragment.module = fsModule;
|
||||||
descriptor->cVertexState.vertexBufferCount = 1;
|
descriptor->vertex.bufferCount = 1;
|
||||||
descriptor->cVertexState.cVertexBuffers[0].arrayStride = 2 * sizeof(float);
|
descriptor->cBuffers[0].arrayStride = 2 * sizeof(float);
|
||||||
descriptor->cVertexState.cVertexBuffers[0].attributeCount = 1;
|
descriptor->cBuffers[0].attributeCount = 1;
|
||||||
descriptor->cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x2;
|
descriptor->cAttributes[0].format = wgpu::VertexFormat::Float32x2;
|
||||||
descriptor->cVertexState.cAttributes[0].shaderLocation = 0;
|
descriptor->cAttributes[0].shaderLocation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule;
|
wgpu::ShaderModule vsModule;
|
||||||
|
@ -730,48 +730,48 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
|
||||||
renderBundleDesc.cColorFormats[1] = wgpu::TextureFormat::RG16Float;
|
renderBundleDesc.cColorFormats[1] = wgpu::TextureFormat::RG16Float;
|
||||||
renderBundleDesc.cColorFormats[2] = wgpu::TextureFormat::R16Sint;
|
renderBundleDesc.cColorFormats[2] = wgpu::TextureFormat::R16Sint;
|
||||||
|
|
||||||
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
|
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor2* desc) {
|
||||||
InitializeRenderPipelineDescriptor(desc);
|
InitializeRenderPipelineDescriptor(desc);
|
||||||
desc->colorStateCount = 3;
|
desc->cFragment.targetCount = 3;
|
||||||
desc->cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
desc->cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
desc->cColorStates[1].format = wgpu::TextureFormat::RG16Float;
|
desc->cTargets[1].format = wgpu::TextureFormat::RG16Float;
|
||||||
desc->cColorStates[2].format = wgpu::TextureFormat::R16Sint;
|
desc->cTargets[2].format = wgpu::TextureFormat::R16Sint;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test the success case.
|
// Test the success case.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor2 desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
renderBundleEncoder.Finish();
|
renderBundleEncoder.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case for mismatched format types.
|
// Test the failure case for mismatched format types.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor2 desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.cColorStates[1].format = wgpu::TextureFormat::RGBA8Unorm;
|
desc.cTargets[1].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case for missing format
|
// Test the failure case for missing format
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor2 desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.colorStateCount = 2;
|
desc.cFragment.targetCount = 2;
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
@ -784,48 +784,47 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
|
||||||
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
|
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
renderBundleDesc.depthStencilFormat = wgpu::TextureFormat::Depth24PlusStencil8;
|
renderBundleDesc.depthStencilFormat = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||||
|
|
||||||
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
|
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor2* desc) {
|
||||||
InitializeRenderPipelineDescriptor(desc);
|
InitializeRenderPipelineDescriptor(desc);
|
||||||
desc->colorStateCount = 1;
|
desc->cFragment.targetCount = 1;
|
||||||
desc->cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
desc->cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
desc->depthStencilState = &desc->cDepthStencilState;
|
|
||||||
desc->cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test the success case.
|
// Test the success case.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor2 desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
|
desc.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
renderBundleEncoder.Finish();
|
renderBundleEncoder.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case for mismatched format.
|
// Test the failure case for mismatched format.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor2 desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.cDepthStencilState.format = wgpu::TextureFormat::Depth24Plus;
|
desc.EnableDepthStencil(wgpu::TextureFormat::Depth24Plus);
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case for missing format.
|
// Test the failure case for missing format.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor2 desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.depthStencilState = nullptr;
|
desc.depthStencil = nullptr;
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
@ -838,28 +837,28 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
|
||||||
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
|
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
renderBundleDesc.sampleCount = 4;
|
renderBundleDesc.sampleCount = 4;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
||||||
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
|
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
|
||||||
renderPipelineDesc.colorStateCount = 1;
|
renderPipelineDesc.cFragment.targetCount = 1;
|
||||||
renderPipelineDesc.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
renderPipelineDesc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
renderPipelineDesc.sampleCount = 4;
|
renderPipelineDesc.multisample.count = 4;
|
||||||
|
|
||||||
// Test the success case.
|
// Test the success case.
|
||||||
{
|
{
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
renderBundleEncoder.Finish();
|
renderBundleEncoder.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case.
|
// Test the failure case.
|
||||||
{
|
{
|
||||||
renderPipelineDesc.sampleCount = 1;
|
renderPipelineDesc.multisample.count = 1;
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.depthStencil = &descriptor.cDepthStencil;
|
descriptor.EnableDepthStencil();
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@ TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cDepthStencil.depthBiasClamp = INFINITY;
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
descriptor.depthStencil = &descriptor.cDepthStencil;
|
depthStencil->depthBiasClamp = INFINITY;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
// NAN depth bias clamp is invalid
|
// NAN depth bias clamp is invalid
|
||||||
|
@ -105,8 +105,8 @@ TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cDepthStencil.depthBiasClamp = NAN;
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
descriptor.depthStencil = &descriptor.cDepthStencil;
|
depthStencil->depthBiasClamp = NAN;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cDepthStencil.depthBiasSlopeScale = INFINITY;
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
descriptor.depthStencil = &descriptor.cDepthStencil;
|
depthStencil->depthBiasSlopeScale = INFINITY;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
// NAN depth bias slope is invalid
|
// NAN depth bias slope is invalid
|
||||||
|
@ -124,8 +124,8 @@ TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cDepthStencil.depthBiasSlopeScale = NAN;
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
descriptor.depthStencil = &descriptor.cDepthStencil;
|
depthStencil->depthBiasSlopeScale = NAN;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,9 +185,9 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) {
|
||||||
|
|
||||||
for (size_t i = 0; i < kNumTextureFormatBaseType; ++i) {
|
for (size_t i = 0; i < kNumTextureFormatBaseType; ++i) {
|
||||||
for (size_t j = 0; j < kNumTextureFormatBaseType; ++j) {
|
for (size_t j = 0; j < kNumTextureFormatBaseType; ++j) {
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cColorStates[0].format = kColorFormats[j];
|
descriptor.cTargets[0].format = kColorFormats[j];
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << R"(
|
stream << R"(
|
||||||
|
@ -195,13 +195,13 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) {
|
||||||
<< kScalarTypes[i] << R"(>;
|
<< kScalarTypes[i] << R"(>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
descriptor.cFragmentStage.module =
|
descriptor.cFragment.module =
|
||||||
utils::CreateShaderModuleFromWGSL(device, stream.str().c_str());
|
utils::CreateShaderModuleFromWGSL(device, stream.str().c_str());
|
||||||
|
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
} else {
|
} else {
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,31 +243,29 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
||||||
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 nonMultisampledPipelineDescriptor;
|
||||||
nonMultisampledPipelineDescriptor.sampleCount = 1;
|
nonMultisampledPipelineDescriptor.multisample.count = 1;
|
||||||
nonMultisampledPipelineDescriptor.vertexStage.module = vsModule;
|
nonMultisampledPipelineDescriptor.vertex.module = vsModule;
|
||||||
nonMultisampledPipelineDescriptor.cFragmentStage.module = fsModule;
|
nonMultisampledPipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::RenderPipeline nonMultisampledPipeline =
|
wgpu::RenderPipeline nonMultisampledPipeline =
|
||||||
device.CreateRenderPipeline(&nonMultisampledPipelineDescriptor);
|
device.CreateRenderPipeline2(&nonMultisampledPipelineDescriptor);
|
||||||
|
|
||||||
nonMultisampledPipelineDescriptor.colorStateCount = 0;
|
nonMultisampledPipelineDescriptor.cFragment.targetCount = 0;
|
||||||
nonMultisampledPipelineDescriptor.depthStencilState =
|
nonMultisampledPipelineDescriptor.EnableDepthStencil();
|
||||||
&nonMultisampledPipelineDescriptor.cDepthStencilState;
|
|
||||||
wgpu::RenderPipeline nonMultisampledPipelineWithDepthStencilOnly =
|
wgpu::RenderPipeline nonMultisampledPipelineWithDepthStencilOnly =
|
||||||
device.CreateRenderPipeline(&nonMultisampledPipelineDescriptor);
|
device.CreateRenderPipeline2(&nonMultisampledPipelineDescriptor);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor multisampledPipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 multisampledPipelineDescriptor;
|
||||||
multisampledPipelineDescriptor.sampleCount = kMultisampledCount;
|
multisampledPipelineDescriptor.multisample.count = kMultisampledCount;
|
||||||
multisampledPipelineDescriptor.vertexStage.module = vsModule;
|
multisampledPipelineDescriptor.vertex.module = vsModule;
|
||||||
multisampledPipelineDescriptor.cFragmentStage.module = fsModule;
|
multisampledPipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::RenderPipeline multisampledPipeline =
|
wgpu::RenderPipeline multisampledPipeline =
|
||||||
device.CreateRenderPipeline(&multisampledPipelineDescriptor);
|
device.CreateRenderPipeline2(&multisampledPipelineDescriptor);
|
||||||
|
|
||||||
multisampledPipelineDescriptor.colorStateCount = 0;
|
multisampledPipelineDescriptor.cFragment.targetCount = 0;
|
||||||
multisampledPipelineDescriptor.depthStencilState =
|
multisampledPipelineDescriptor.EnableDepthStencil();
|
||||||
&multisampledPipelineDescriptor.cDepthStencilState;
|
|
||||||
wgpu::RenderPipeline multisampledPipelineWithDepthStencilOnly =
|
wgpu::RenderPipeline multisampledPipelineWithDepthStencilOnly =
|
||||||
device.CreateRenderPipeline(&multisampledPipelineDescriptor);
|
device.CreateRenderPipeline2(&multisampledPipelineDescriptor);
|
||||||
|
|
||||||
// It is not allowed to use multisampled render pass and non-multisampled render pipeline.
|
// It is not allowed to use multisampled render pass and non-multisampled render pipeline.
|
||||||
{
|
{
|
||||||
|
@ -406,8 +404,8 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
||||||
|
|
||||||
for (size_t i = 0; i < kNumTextureComponentType; ++i) {
|
for (size_t i = 0; i < kNumTextureComponentType; ++i) {
|
||||||
for (size_t j = 0; j < kNumTextureComponentType; ++j) {
|
for (size_t j = 0; j < kNumTextureComponentType; ++j) {
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << R"(
|
stream << R"(
|
||||||
|
@ -416,7 +414,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
descriptor.cFragmentStage.module =
|
descriptor.cFragment.module =
|
||||||
utils::CreateShaderModuleFromWGSL(device, stream.str().c_str());
|
utils::CreateShaderModuleFromWGSL(device, stream.str().c_str());
|
||||||
|
|
||||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
|
@ -424,9 +422,9 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
} else {
|
} else {
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,8 +453,8 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
||||||
|
|
||||||
for (size_t i = 0; i < kNumTextureViewDimensions; ++i) {
|
for (size_t i = 0; i < kNumTextureViewDimensions; ++i) {
|
||||||
for (size_t j = 0; j < kNumTextureViewDimensions; ++j) {
|
for (size_t j = 0; j < kNumTextureViewDimensions; ++j) {
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << R"(
|
stream << R"(
|
||||||
|
@ -464,7 +462,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
||||||
<< kTextureKeywords[i] << R"(<f32>;
|
<< kTextureKeywords[i] << R"(<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
descriptor.cFragmentStage.module =
|
descriptor.cFragment.module =
|
||||||
utils::CreateShaderModuleFromWGSL(device, stream.str().c_str());
|
utils::CreateShaderModuleFromWGSL(device, stream.str().c_str());
|
||||||
|
|
||||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
|
@ -473,9 +471,9 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
} else {
|
} else {
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,11 +492,11 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
|
||||||
dst.data[VertexIndex] = 0x1234u;
|
dst.data[VertexIndex] = 0x1234u;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModuleWithStorageBuffer;
|
descriptor.vertex.module = vsModuleWithStorageBuffer;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that strip primitive topologies require an index format
|
// Tests that strip primitive topologies require an index format
|
||||||
|
@ -519,37 +517,37 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
|
||||||
|
|
||||||
for (wgpu::PrimitiveTopology primitiveTopology : kStripTopologyTypes) {
|
for (wgpu::PrimitiveTopology primitiveTopology : kStripTopologyTypes) {
|
||||||
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitiveTopology = primitiveTopology;
|
descriptor.primitive.topology = primitiveTopology;
|
||||||
descriptor.cVertexState.indexFormat = indexFormat;
|
descriptor.primitive.stripIndexFormat = indexFormat;
|
||||||
|
|
||||||
if (indexFormat == wgpu::IndexFormat::Undefined) {
|
if (indexFormat == wgpu::IndexFormat::Undefined) {
|
||||||
// Fail because the index format is undefined and the primitive
|
// Fail because the index format is undefined and the primitive
|
||||||
// topology is a strip type.
|
// topology is a strip type.
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
} else {
|
} else {
|
||||||
// Succeeds because the index format is given.
|
// Succeeds because the index format is given.
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (wgpu::PrimitiveTopology primitiveTopology : kListTopologyTypes) {
|
for (wgpu::PrimitiveTopology primitiveTopology : kListTopologyTypes) {
|
||||||
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitiveTopology = primitiveTopology;
|
descriptor.primitive.topology = primitiveTopology;
|
||||||
descriptor.cVertexState.indexFormat = indexFormat;
|
descriptor.primitive.stripIndexFormat = indexFormat;
|
||||||
|
|
||||||
if (indexFormat == wgpu::IndexFormat::Undefined) {
|
if (indexFormat == wgpu::IndexFormat::Undefined) {
|
||||||
// Succeeds even when the index format is undefined because the
|
// Succeeds even when the index format is undefined because the
|
||||||
// primitive topology isn't a strip type.
|
// primitive topology isn't a strip type.
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
} else {
|
} else {
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,11 +53,11 @@ namespace {
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
pipelineDescriptor.vertexStage.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, nullptr);
|
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, nullptr);
|
||||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ComputePipeline CreateNoOpComputePipeline() {
|
wgpu::ComputePipeline CreateNoOpComputePipeline() {
|
||||||
|
@ -782,11 +782,11 @@ namespace {
|
||||||
[[group(0), binding(0)]] var<storage_buffer> rBuffer : [[access(read)]] RBuffer;
|
[[group(0), binding(0)]] var<storage_buffer> rBuffer : [[access(read)]] RBuffer;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
pipelineDescriptor.vertexStage.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl0);
|
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl0);
|
||||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&pipelineDescriptor);
|
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||||
|
|
||||||
// Resource in bg1 conflicts with resources used in bg0. However, bindings in bg1 is
|
// Resource in bg1 conflicts with resources used in bg0. However, bindings in bg1 is
|
||||||
// not used in pipeline. But we still track this binding.
|
// not used in pipeline. But we still track this binding.
|
||||||
|
@ -1557,11 +1557,11 @@ namespace {
|
||||||
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||||
pipelineDescriptor.vertexStage.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &readBGL);
|
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &readBGL);
|
||||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&pipelineDescriptor);
|
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||||
|
|
||||||
// Texture binding in readBG conflicts with texture binding in writeBG. The binding
|
// Texture binding in readBG conflicts with texture binding in writeBG. The binding
|
||||||
// in writeBG is not used in pipeline. But we still track this binding.
|
// in writeBG is not used in pipeline. But we still track this binding.
|
||||||
|
|
|
@ -128,11 +128,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
Position = textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
|
Position = textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = mDefaultFSModule;
|
descriptor.cFragment.module = mDefaultFSModule;
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read-only storage textures can be declared in a fragment shader.
|
// Read-only storage textures can be declared in a fragment shader.
|
||||||
|
@ -145,11 +145,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
fragColor = textureLoad(image0, vec2<i32>(FragCoord.xy));
|
fragColor = textureLoad(image0, vec2<i32>(FragCoord.xy));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = mDefaultVSModule;
|
descriptor.vertex.module = mDefaultVSModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write-only storage textures cannot be declared in a vertex shader.
|
// Write-only storage textures cannot be declared in a vertex shader.
|
||||||
|
@ -161,11 +161,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = mDefaultFSModule;
|
descriptor.cFragment.module = mDefaultFSModule;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write-only storage textures can be declared in a fragment shader.
|
// Write-only storage textures can be declared in a fragment shader.
|
||||||
|
@ -177,11 +177,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
textureStore(image0, vec2<i32>(frag_coord.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
textureStore(image0, vec2<i32>(frag_coord.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertexStage.module = mDefaultVSModule;
|
descriptor.vertex.module = mDefaultVSModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,12 @@ TEST_F(UnsafeAPIValidationTest, DrawIndexedIndirectDisallowed) {
|
||||||
bundleDesc.colorFormatsCount = 1;
|
bundleDesc.colorFormatsCount = 1;
|
||||||
bundleDesc.cColorFormats[0] = renderPass.attachmentFormat;
|
bundleDesc.cColorFormats[0] = renderPass.attachmentFormat;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor2 desc;
|
||||||
desc.vertexStage.module =
|
desc.vertex.module =
|
||||||
utils::CreateShaderModuleFromWGSL(device, "[[stage(vertex)]] fn main() -> void {}");
|
utils::CreateShaderModuleFromWGSL(device, "[[stage(vertex)]] fn main() -> void {}");
|
||||||
desc.cFragmentStage.module =
|
desc.cFragment.module =
|
||||||
utils::CreateShaderModuleFromWGSL(device, "[[stage(fragment)]] fn main() -> void {}");
|
utils::CreateShaderModuleFromWGSL(device, "[[stage(fragment)]] fn main() -> void {}");
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||||
|
|
||||||
// Control cases: DrawIndirect and DrawIndexed are allowed inside a render pass.
|
// Control cases: DrawIndirect and DrawIndexed are allowed inside a render pass.
|
||||||
{
|
{
|
||||||
|
@ -249,7 +249,7 @@ TEST_F(UnsafeAPIValidationTest, CreateRenderPipelineAsyncDisallowed) {
|
||||||
desc.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
desc.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
// Control case: CreateRenderPipeline is allowed.
|
// Control case: CreateRenderPipeline is allowed.
|
||||||
device.CreateRenderPipeline(&desc);
|
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&desc));
|
||||||
|
|
||||||
testing::MockCallback<WGPUCreateRenderPipelineAsyncCallback> callback;
|
testing::MockCallback<WGPUCreateRenderPipelineAsyncCallback> callback;
|
||||||
EXPECT_CALL(callback,
|
EXPECT_CALL(callback,
|
||||||
|
|
|
@ -64,20 +64,19 @@ class VertexBufferValidationTest : public ValidationTest {
|
||||||
|
|
||||||
wgpu::RenderPipeline MakeRenderPipeline(const wgpu::ShaderModule& vsModule,
|
wgpu::RenderPipeline MakeRenderPipeline(const wgpu::ShaderModule& vsModule,
|
||||||
unsigned int bufferCount) {
|
unsigned int bufferCount) {
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < bufferCount; ++i) {
|
for (unsigned int i = 0; i < bufferCount; ++i) {
|
||||||
descriptor.cVertexState.cVertexBuffers[i].attributeCount = 1;
|
descriptor.cBuffers[i].attributeCount = 1;
|
||||||
descriptor.cVertexState.cVertexBuffers[i].attributes =
|
descriptor.cBuffers[i].attributes = &descriptor.cAttributes[i];
|
||||||
&descriptor.cVertexState.cAttributes[i];
|
descriptor.cAttributes[i].shaderLocation = i;
|
||||||
descriptor.cVertexState.cAttributes[i].shaderLocation = i;
|
descriptor.cAttributes[i].format = wgpu::VertexFormat::Float32x3;
|
||||||
descriptor.cVertexState.cAttributes[i].format = wgpu::VertexFormat::Float32x3;
|
|
||||||
}
|
}
|
||||||
descriptor.cVertexState.vertexBufferCount = bufferCount;
|
descriptor.vertex.bufferCount = bufferCount;
|
||||||
|
|
||||||
return device.CreateRenderPipeline(&descriptor);
|
return device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule;
|
wgpu::ShaderModule fsModule;
|
||||||
|
|
|
@ -30,16 +30,17 @@ class VertexStateTest : public ValidationTest {
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.vertex.bufferCount = state.vertexBufferCount;
|
||||||
descriptor.vertexState = &state;
|
descriptor.vertex.buffers = &state.cVertexBuffers[0];
|
||||||
descriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||||
} else {
|
} else {
|
||||||
device.CreateRenderPipeline(&descriptor);
|
device.CreateRenderPipeline2(&descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,4 +208,11 @@ namespace utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wgpu::DepthStencilState* ComboRenderPipelineDescriptor2::EnableDepthStencil(
|
||||||
|
wgpu::TextureFormat format) {
|
||||||
|
this->depthStencil = &cDepthStencil;
|
||||||
|
cDepthStencil.format = format;
|
||||||
|
return &cDepthStencil;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
|
@ -64,13 +64,18 @@ namespace utils {
|
||||||
ComboRenderPipelineDescriptor2(ComboRenderPipelineDescriptor2&&) = delete;
|
ComboRenderPipelineDescriptor2(ComboRenderPipelineDescriptor2&&) = delete;
|
||||||
ComboRenderPipelineDescriptor2& operator=(ComboRenderPipelineDescriptor2&&) = delete;
|
ComboRenderPipelineDescriptor2& operator=(ComboRenderPipelineDescriptor2&&) = delete;
|
||||||
|
|
||||||
|
wgpu::DepthStencilState* EnableDepthStencil(
|
||||||
|
wgpu::TextureFormat format = wgpu::TextureFormat::Depth24PlusStencil8);
|
||||||
|
|
||||||
std::array<wgpu::VertexBufferLayout, kMaxVertexBuffers> cBuffers;
|
std::array<wgpu::VertexBufferLayout, kMaxVertexBuffers> cBuffers;
|
||||||
std::array<wgpu::VertexAttribute, kMaxVertexAttributes> cAttributes;
|
std::array<wgpu::VertexAttribute, kMaxVertexAttributes> cAttributes;
|
||||||
std::array<wgpu::ColorTargetState, kMaxColorAttachments> cTargets;
|
std::array<wgpu::ColorTargetState, kMaxColorAttachments> cTargets;
|
||||||
std::array<wgpu::BlendState, kMaxColorAttachments> cBlends;
|
std::array<wgpu::BlendState, kMaxColorAttachments> cBlends;
|
||||||
|
|
||||||
wgpu::DepthStencilState cDepthStencil;
|
|
||||||
wgpu::FragmentState cFragment;
|
wgpu::FragmentState cFragment;
|
||||||
|
|
||||||
|
private:
|
||||||
|
wgpu::DepthStencilState cDepthStencil;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
Loading…
Reference in New Issue