Fix unittests that are broken by --enable-toggles=use_tint_generator
Tests fixed by this CL: BindGroupLayoutCompatibilityTest.ROStorageInBGLWithRWStorageInShader BindGroupLayoutCompatibilityTest.TextureViewDimension BindingsValidationTest.PipelineLayoutWithLessBindingsThanPipeline GetBindGroupLayoutTests.SameObject GetBindGroupLayoutTests.DefaultShaderStageAndDynamicOffsets GetBindGroupLayoutTests.ComputePipeline GetBindGroupLayoutTests.BindingType GetBindGroupLayoutTests.ViewDimension GetBindGroupLayoutTests.TextureComponentType GetBindGroupLayoutTests.BindingIndices GetBindGroupLayoutTests.MinBufferSize GetBindGroupLayoutTests.StageAggregation GetBindGroupLayoutTests.ConflictingBindingType GetBindGroupLayoutTests.ConflictingBindingTextureMultisampling GetBindGroupLayoutTests.ConflictingBindingViewDimension GetBindGroupLayoutTests.ConflictingBindingTextureComponentType GetBindGroupLayoutTests.UnusedIndex MinBufferSizePipelineCreationTests.LayoutSizesTooSmall MinBufferSizePipelineCreationTests.LayoutSizesTooSmallMultipleGroups MinBufferSizeDrawTimeValidationTests.ZeroMinSizeAndTooSmallBinding MinBufferSizeDrawTimeValidationTests.UnorderedBindings MinBufferSizeDrawTimeValidationTests.MultipleGroups MinBufferSizeDefaultLayoutTests.DefaultLayoutVariousWGSLTypes MinBufferSizeDefaultLayoutTests.DefaultLayoutVariousBindingTypes MinBufferSizeDefaultLayoutTests.MultipleBindGroups MinBufferSizeDefaultLayoutTests.NonDefaultLayout RenderPipelineValidationTest.TextureComponentTypeCompatibility RenderPipelineValidationTest.TextureViewDimensionCompatibility StorageTextureValidationTests.BindGroupLayoutEntryTypeMatchesShaderDeclaration StorageTextureValidationTests.BindGroupLayoutStorageTextureFormatMatchesShaderDeclaration StorageTextureValidationTests.BindGroupLayoutViewDimensionMatchesShaderDeclaration Also enables GetBindGroupLayoutTests.FromCorrectEntryPoint for use_tint_generator, since it handles this case, unlike SPIRV-Cross. These tests remain skipped, but with bugs listed for fixing the underlying issues: MinBufferSizeDefaultLayoutTests.RenderPassConsidersBothStages ShaderModuleValidationTest.MultisampledArrayTexture StorageTextureValidationTests.ReadWriteStorageTexture StorageTextureValidationTests.StorageTextureFormatInShaders StorageTextureValidationTests.UnsupportedWGSLStorageTextureFormat BUG=dawn:756 Change-Id: Ib6b0d4144927073d949cb8d1409063a767fd47e9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47823 Auto-Submit: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
e87ea2bedc
commit
0a5696079b
|
@ -1715,6 +1715,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
|||
[[group(1), binding(0)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var val : vec2<f32> = sBufferDynamic.value;
|
||||
val = sReadonlyBufferDynamic.value;
|
||||
})",
|
||||
std::move(bindGroupLayouts));
|
||||
}
|
||||
|
@ -1748,6 +1750,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
|||
[[group(1), binding(0)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
|
||||
|
||||
[[stage(compute), workgroup_size(4, 4, 1)]] fn main() {
|
||||
var val : vec2<f32> = sBufferDynamic.value;
|
||||
val = sReadonlyBufferDynamic.value;
|
||||
})",
|
||||
std::move(bindGroupLayouts));
|
||||
}
|
||||
|
@ -1772,8 +1776,6 @@ TEST_F(BindGroupLayoutCompatibilityTest, RWStorageInBGLWithROStorageInShader) {
|
|||
// Test that it is invalid to pass a readonly storage buffer in the pipeline layout when the shader
|
||||
// uses the binding as a writable storage buffer.
|
||||
TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// Set up the bind group layout.
|
||||
wgpu::BindGroupLayout bgl0 = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Compute | wgpu::ShaderStage::Fragment,
|
||||
|
@ -1788,15 +1790,15 @@ TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) {
|
|||
}
|
||||
|
||||
TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
constexpr char kTexture2DShaderFS[] = R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})";
|
||||
constexpr char kTexture2DShaderCS[] = R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||
[[stage(compute)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})";
|
||||
|
||||
// Render: Test that 2D texture with 2D view dimension works
|
||||
|
@ -1830,10 +1832,12 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
|
|||
constexpr char kTexture2DArrayShaderFS[] = R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})";
|
||||
constexpr char kTexture2DArrayShaderCS[] = R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
|
||||
[[stage(compute)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})";
|
||||
|
||||
// Render: Test that 2D texture array with 2D array view dimension works
|
||||
|
@ -1933,8 +1937,6 @@ TEST_F(BindingsValidationTest, PipelineLayoutWithMoreBindingsThanPipeline) {
|
|||
// Test that it is invalid to set a pipeline layout that doesn't have all necessary bindings
|
||||
// required by the pipeline.
|
||||
TEST_F(BindingsValidationTest, PipelineLayoutWithLessBindingsThanPipeline) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// Set up bind group layout.
|
||||
wgpu::BindGroupLayout bgl0 = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Compute | wgpu::ShaderStage::Fragment,
|
||||
|
@ -2085,6 +2087,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
|
|||
CreateFragmentPipeline(&bindGroupLayout, R"(
|
||||
[[group(0), binding(0)]] var mySampler: sampler;
|
||||
[[stage(fragment)]] fn main() {
|
||||
let s : sampler = mySampler;
|
||||
})");
|
||||
}
|
||||
|
||||
|
@ -2096,6 +2099,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
|
|||
CreateFragmentPipeline(&bindGroupLayout, R"(
|
||||
[[group(0), binding(0)]] var mySampler: sampler_comparison;
|
||||
[[stage(fragment)]] fn main() {
|
||||
let s : sampler_comparison = mySampler;
|
||||
})");
|
||||
}
|
||||
|
||||
|
@ -2107,6 +2111,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
|
|||
ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"(
|
||||
[[group(0), binding(0)]] var mySampler: sampler_comparison;
|
||||
[[stage(fragment)]] fn main() {
|
||||
let s : sampler_comparison = mySampler;
|
||||
})"));
|
||||
}
|
||||
|
||||
|
@ -2118,6 +2123,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
|
|||
ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"(
|
||||
[[group(0), binding(0)]] var mySampler: sampler;
|
||||
[[stage(fragment)]] fn main() {
|
||||
let s : sampler = mySampler;
|
||||
})"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,6 @@ class GetBindGroupLayoutTests : public ValidationTest {
|
|||
// Test that GetBindGroupLayout returns the same object for the same index
|
||||
// and for matching layouts.
|
||||
TEST_F(GetBindGroupLayoutTests, SameObject) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -53,6 +51,8 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
|||
[[group(1), binding(0)]] var<uniform> uniform1 : S;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
var pos : vec4<f32> = uniform0.pos;
|
||||
pos = uniform1.pos;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
|
@ -67,6 +67,8 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
|||
[[group(3), binding(0)]] var<storage> storage3 : [[access(read_write)]] S3;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos_u : vec4<f32> = uniform2.pos;
|
||||
var pos_s : mat4x4<f32> = storage3.pos;
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
|
@ -93,8 +95,6 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
|||
// - shader stage visibility is the stage that adds the binding.
|
||||
// - dynamic offsets is false
|
||||
TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -107,6 +107,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms.pos;
|
||||
})");
|
||||
|
||||
wgpu::BindGroupLayoutEntry binding = {};
|
||||
|
@ -138,8 +139,6 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
|
|||
|
||||
// Test GetBindGroupLayout works with a compute pipeline
|
||||
TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -152,6 +151,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(compute)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms.pos;
|
||||
})");
|
||||
|
||||
wgpu::ComputePipelineDescriptor descriptor;
|
||||
|
@ -177,8 +177,6 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
|||
|
||||
// Test that the binding type matches the shader.
|
||||
TEST_F(GetBindGroupLayoutTests, BindingType) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -205,6 +203,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = ssbo.pos;
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -217,6 +216,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms.pos;
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -230,6 +230,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
[[group(0), binding(0)]] var<storage> ssbo : [[access(read)]] S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = ssbo.pos;
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -242,6 +243,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -252,6 +254,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -263,6 +266,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
[[group(0), binding(0)]] var mySampler: sampler;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
let s : sampler = mySampler;
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -270,8 +274,6 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||
|
||||
// Test that texture view dimension matches the shader.
|
||||
TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -292,6 +294,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_1d<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -302,6 +305,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -312,6 +316,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -322,6 +327,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -332,6 +338,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_cube<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -342,6 +349,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_cube_array<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -349,8 +357,6 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||
|
||||
// Test that texture component type matches the shader.
|
||||
TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -370,6 +376,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -380,6 +387,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -390,6 +398,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
|||
[[group(0), binding(0)]] var myTexture : texture_2d<u32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -397,8 +406,6 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
|||
|
||||
// Test that binding= indices match.
|
||||
TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -423,6 +430,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms.pos;
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -436,6 +444,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
|||
[[group(0), binding(1)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms.pos;
|
||||
})");
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -449,6 +458,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
|||
[[group(0), binding(1)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms.pos;
|
||||
})");
|
||||
EXPECT_NE(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
|
@ -464,6 +474,8 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
|||
[[group(1), binding(0)]] var<uniform> uniform1 : S;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
var pos : vec4<f32> = uniform0.pos;
|
||||
pos = uniform1.pos;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
|
@ -473,6 +485,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
|||
[[group(1), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms.pos;
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
|
@ -485,8 +498,6 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
|||
|
||||
// Test that minBufferSize is set on the BGL and that the max of the min buffer sizes is used.
|
||||
TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -499,6 +510,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
var pos : f32 = uniforms.pos;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule vsModule64 = utils::CreateShaderModule(device, R"(
|
||||
|
@ -508,6 +520,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
var pos : mat4x4<f32> = uniforms.pos;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule4 = utils::CreateShaderModule(device, R"(
|
||||
|
@ -517,6 +530,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : f32 = uniforms.pos;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule64 = utils::CreateShaderModule(device, R"(
|
||||
|
@ -526,6 +540,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : mat4x4<f32> = uniforms.pos;
|
||||
})");
|
||||
|
||||
// Create BGLs with minBufferBindingSize 4 and 64.
|
||||
|
@ -573,8 +588,6 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
|||
|
||||
// Test that the visibility is correctly aggregated if two stages have the exact same binding.
|
||||
TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -587,6 +600,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
|||
wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var mySampler: sampler;
|
||||
[[stage(vertex)]] fn main() {
|
||||
let s : sampler = mySampler;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModuleNoSampler = utils::CreateShaderModule(device, R"(
|
||||
|
@ -596,6 +610,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
|||
wgpu::ShaderModule fsModuleSampler = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var mySampler: sampler;
|
||||
[[stage(fragment)]] fn main() {
|
||||
let s : sampler = mySampler;
|
||||
})");
|
||||
|
||||
// Create BGLs with minBufferBindingSize 4 and 64.
|
||||
|
@ -643,8 +658,6 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
|||
|
||||
// Test it is invalid to have conflicting binding types in the shaders.
|
||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct S {
|
||||
pos : vec4<f32>;
|
||||
|
@ -652,6 +665,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
|||
[[group(0), binding(0)]] var<uniform> ubo : S;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
var pos : vec4<f32> = ubo.pos;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
|
@ -661,6 +675,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
|||
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = ssbo.pos;
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
|
@ -673,18 +688,18 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
|||
|
||||
// Test it is invalid to have conflicting binding texture multisampling in the shaders.
|
||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
|
@ -697,18 +712,18 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
|
|||
|
||||
// Test it is invalid to have conflicting binding texture dimension in the shaders.
|
||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
|
@ -721,18 +736,18 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
|
|||
|
||||
// Test it is invalid to have conflicting binding texture component type in the shaders.
|
||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
|
@ -758,8 +773,6 @@ TEST_F(GetBindGroupLayoutTests, OutOfRangeIndex) {
|
|||
|
||||
// Test that unused indices return the empty bind group layout.
|
||||
TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// This test works assuming Dawn Native's object deduplication.
|
||||
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
|
||||
// Native.
|
||||
|
@ -773,6 +786,8 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
|
|||
[[group(2), binding(0)]] var<uniform> uniforms2 : S;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms0.pos;
|
||||
pos = uniforms2.pos;
|
||||
})");
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
|
@ -819,6 +834,7 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
|||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
[[stage(vertex)]] fn main() {
|
||||
var pos : vec4<f32> = uniforms.pos;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
|
@ -850,24 +866,23 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
|||
|
||||
// Test that fragment output validation is for the correct entryPoint
|
||||
// TODO(dawn:216): Re-enable when we correctly reflect which bindings are used for an entryPoint.
|
||||
TEST_F(GetBindGroupLayoutTests, DISABLED_FromCorrectEntryPoint) {
|
||||
TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) {
|
||||
DAWN_SKIP_TEST_IF(!HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Data {
|
||||
data : f32;
|
||||
};
|
||||
[[binding 0, set 0]] var<storage> data0 : [[access(read_write)]] Data;
|
||||
[[binding 1, set 0]] var<storage> data1 : [[access(read_write)]] Data;
|
||||
[[group(0), binding(0)]] var<storage> data0 : [[access(read_write)]] Data;
|
||||
[[group(0), binding(1)]] var<storage> data1 : [[access(read_write)]] Data;
|
||||
|
||||
fn compute0() {
|
||||
[[stage(compute)]] fn compute0() {
|
||||
data0.data = 0.0;
|
||||
return;
|
||||
}
|
||||
fn compute1() {
|
||||
|
||||
[[stage(compute)]] fn compute1() {
|
||||
data1.data = 0.0;
|
||||
return;
|
||||
}
|
||||
entry_point compute = compute0;
|
||||
entry_point compute = compute1;
|
||||
)");
|
||||
|
||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||
|
|
|
@ -24,7 +24,9 @@ namespace {
|
|||
struct BindingDescriptor {
|
||||
uint32_t group;
|
||||
uint32_t binding;
|
||||
std::string text;
|
||||
std::string decl;
|
||||
std::string ref_type;
|
||||
std::string ref_mem;
|
||||
uint64_t size;
|
||||
wgpu::BufferBindingType type = wgpu::BufferBindingType::Storage;
|
||||
wgpu::ShaderStage visibility = wgpu::ShaderStage::Compute | wgpu::ShaderStage::Fragment;
|
||||
|
@ -71,7 +73,7 @@ namespace {
|
|||
std::ostringstream ostream;
|
||||
size_t index = 0;
|
||||
for (const BindingDescriptor& b : bindings) {
|
||||
ostream << "[[block]] struct S" << index << " { " << b.text << "};\n";
|
||||
ostream << "[[block]] struct S" << index << " { " << b.decl << "};\n";
|
||||
ostream << "[[group(" << b.group << "), binding(" << b.binding << ")]] ";
|
||||
switch (b.type) {
|
||||
case wgpu::BufferBindingType::Uniform:
|
||||
|
@ -93,23 +95,42 @@ namespace {
|
|||
return ostream.str();
|
||||
}
|
||||
|
||||
std::string GenerateReferenceString(const std::vector<BindingDescriptor>& bindings,
|
||||
wgpu::ShaderStage stage) {
|
||||
std::ostringstream ostream;
|
||||
size_t index = 0;
|
||||
for (const BindingDescriptor& b : bindings) {
|
||||
if (b.visibility & stage) {
|
||||
if (!b.ref_type.empty() && !b.ref_mem.empty()) {
|
||||
ostream << "var r" << index << " : " << b.ref_type << " = b" << index << "."
|
||||
<< b.ref_mem << ";\n";
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return ostream.str();
|
||||
}
|
||||
|
||||
// Used for adding custom types available throughout the tests
|
||||
static const std::string kStructs = "struct ThreeFloats {f1 : f32; f2 : f32; f3 : f32;};\n";
|
||||
|
||||
// Creates a compute shader with given bindings
|
||||
std::string CreateComputeShaderWithBindings(const std::vector<BindingDescriptor>& bindings) {
|
||||
return kStructs + GenerateBindingString(bindings) +
|
||||
"[[stage(compute), workgroup_size(1,1,1)]] fn main() {}";
|
||||
"[[stage(compute), workgroup_size(1,1,1)]] fn main() {\n" +
|
||||
GenerateReferenceString(bindings, wgpu::ShaderStage::Compute) + "}";
|
||||
}
|
||||
|
||||
// Creates a vertex shader with given bindings
|
||||
std::string CreateVertexShaderWithBindings(const std::vector<BindingDescriptor>& bindings) {
|
||||
return kStructs + GenerateBindingString(bindings) + "[[stage(vertex)]] fn main() {}";
|
||||
return kStructs + GenerateBindingString(bindings) + "[[stage(vertex)]] fn main() {\n" +
|
||||
GenerateReferenceString(bindings, wgpu::ShaderStage::Vertex) + "}";
|
||||
}
|
||||
|
||||
// Creates a fragment shader with given bindings
|
||||
std::string CreateFragmentShaderWithBindings(const std::vector<BindingDescriptor>& bindings) {
|
||||
return kStructs + GenerateBindingString(bindings) + "[[stage(fragment)]] fn main() {}";
|
||||
return kStructs + GenerateBindingString(bindings) + "[[stage(fragment)]] fn main() {\n" +
|
||||
GenerateReferenceString(bindings, wgpu::ShaderStage::Fragment) + "}";
|
||||
}
|
||||
|
||||
// Concatenates vectors containing BindingDescriptor
|
||||
|
@ -301,8 +322,8 @@ class MinBufferSizePipelineCreationTests : public MinBufferSizeTestsBase {};
|
|||
|
||||
// Pipeline can be created if minimum buffer size in layout is specified as 0
|
||||
TEST_F(MinBufferSizePipelineCreationTests, ZeroMinBufferSize) {
|
||||
std::vector<BindingDescriptor> bindings = {{0, 0, "a : f32; b : f32;", 8},
|
||||
{0, 1, "c : f32;", 4}};
|
||||
std::vector<BindingDescriptor> bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8},
|
||||
{0, 1, "c : f32;", "f32", "c", 4}};
|
||||
|
||||
std::string computeShader = CreateComputeShaderWithBindings(bindings);
|
||||
std::string vertexShader = CreateVertexShaderWithBindings({});
|
||||
|
@ -315,10 +336,8 @@ TEST_F(MinBufferSizePipelineCreationTests, ZeroMinBufferSize) {
|
|||
|
||||
// Fail if layout given has non-zero minimum sizes smaller than shader requirements
|
||||
TEST_F(MinBufferSizePipelineCreationTests, LayoutSizesTooSmall) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
std::vector<BindingDescriptor> bindings = {{0, 0, "a : f32; b : f32;", 8},
|
||||
{0, 1, "c : f32;", 4}};
|
||||
std::vector<BindingDescriptor> bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8},
|
||||
{0, 1, "c : f32;", "f32", "c", 4}};
|
||||
|
||||
std::string computeShader = CreateComputeShaderWithBindings(bindings);
|
||||
std::string vertexShader = CreateVertexShaderWithBindings({});
|
||||
|
@ -338,12 +357,11 @@ TEST_F(MinBufferSizePipelineCreationTests, LayoutSizesTooSmall) {
|
|||
|
||||
// Fail if layout given has non-zero minimum sizes smaller than shader requirements
|
||||
TEST_F(MinBufferSizePipelineCreationTests, LayoutSizesTooSmallMultipleGroups) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
std::vector<BindingDescriptor> bg0Bindings = {{0, 0, "a : f32; b : f32;", 8},
|
||||
{0, 1, "c : f32;", 4}};
|
||||
std::vector<BindingDescriptor> bg1Bindings = {{1, 0, "d : f32; e : f32; f : f32;", 12},
|
||||
{1, 1, "g : mat2x2<f32>;", 16}};
|
||||
std::vector<BindingDescriptor> bg0Bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8},
|
||||
{0, 1, "c : f32;", "f32", "c", 4}};
|
||||
std::vector<BindingDescriptor> bg1Bindings = {
|
||||
{1, 0, "d : f32; e : f32; f : f32;", "f32", "e", 12},
|
||||
{1, 1, "g : mat2x2<f32>;", "mat2x2<f32>", "g", 16}};
|
||||
std::vector<BindingDescriptor> bindings = CombineBindings({bg0Bindings, bg1Bindings});
|
||||
|
||||
std::string computeShader = CreateComputeShaderWithBindings(bindings);
|
||||
|
@ -368,8 +386,8 @@ class MinBufferSizeBindGroupCreationTests : public MinBufferSizeTestsBase {};
|
|||
|
||||
// Fail if a binding is smaller than minimum buffer size
|
||||
TEST_F(MinBufferSizeBindGroupCreationTests, BindingTooSmall) {
|
||||
std::vector<BindingDescriptor> bindings = {{0, 0, "a : f32; b : f32;", 8},
|
||||
{0, 1, "c : f32;", 4}};
|
||||
std::vector<BindingDescriptor> bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8},
|
||||
{0, 1, "c : f32;", "f32", "c", 4}};
|
||||
wgpu::BindGroupLayout layout = CreateBindGroupLayout(bindings, {8, 4});
|
||||
|
||||
CheckSizeBounds({8, 4}, [&](const std::vector<uint64_t>& sizes, bool expectation) {
|
||||
|
@ -402,10 +420,8 @@ class MinBufferSizeDrawTimeValidationTests : public MinBufferSizeTestsBase {};
|
|||
|
||||
// Fail if binding sizes are too small at draw time
|
||||
TEST_F(MinBufferSizeDrawTimeValidationTests, ZeroMinSizeAndTooSmallBinding) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
std::vector<BindingDescriptor> bindings = {{0, 0, "a : f32; b : f32;", 8},
|
||||
{0, 1, "c : f32;", 4}};
|
||||
std::vector<BindingDescriptor> bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8},
|
||||
{0, 1, "c : f32;", "f32", "c", 4}};
|
||||
|
||||
std::string computeShader = CreateComputeShaderWithBindings(bindings);
|
||||
std::string vertexShader = CreateVertexShaderWithBindings({});
|
||||
|
@ -425,11 +441,10 @@ TEST_F(MinBufferSizeDrawTimeValidationTests, ZeroMinSizeAndTooSmallBinding) {
|
|||
|
||||
// Draw time validation works for non-contiguous bindings
|
||||
TEST_F(MinBufferSizeDrawTimeValidationTests, UnorderedBindings) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
std::vector<BindingDescriptor> bindings = {{0, 2, "a : f32; b : f32;", 8},
|
||||
{0, 0, "c : f32;", 4},
|
||||
{0, 4, "d : f32; e : f32; f : f32;", 12}};
|
||||
std::vector<BindingDescriptor> bindings = {
|
||||
{0, 2, "a : f32; b : f32;", "f32", "a", 8},
|
||||
{0, 0, "c : f32;", "f32", "c", 4},
|
||||
{0, 4, "d : f32; e : f32; f : f32;", "f32", "e", 12}};
|
||||
|
||||
std::string computeShader = CreateComputeShaderWithBindings(bindings);
|
||||
std::string vertexShader = CreateVertexShaderWithBindings({});
|
||||
|
@ -449,12 +464,11 @@ TEST_F(MinBufferSizeDrawTimeValidationTests, UnorderedBindings) {
|
|||
|
||||
// Draw time validation works for multiple bind groups
|
||||
TEST_F(MinBufferSizeDrawTimeValidationTests, MultipleGroups) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
std::vector<BindingDescriptor> bg0Bindings = {{0, 0, "a : f32; b : f32;", 8},
|
||||
{0, 1, "c : f32;", 4}};
|
||||
std::vector<BindingDescriptor> bg1Bindings = {{1, 0, "d : f32; e : f32; f : f32;", 12},
|
||||
{1, 1, "g : mat2x2<f32>;", 16}};
|
||||
std::vector<BindingDescriptor> bg0Bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8},
|
||||
{0, 1, "c : f32;", "f32", "c", 4}};
|
||||
std::vector<BindingDescriptor> bg1Bindings = {
|
||||
{1, 0, "d : f32; e : f32; f : f32;", "f32", "e", 12},
|
||||
{1, 1, "g : mat2x2<f32>;", "mat2x2<f32>", "g", 16}};
|
||||
std::vector<BindingDescriptor> bindings = CombineBindings({bg0Bindings, bg1Bindings});
|
||||
|
||||
std::string computeShader = CreateComputeShaderWithBindings(bindings);
|
||||
|
@ -522,57 +536,54 @@ class MinBufferSizeDefaultLayoutTests : public MinBufferSizeTestsBase {
|
|||
|
||||
// Test the minimum size computations for various WGSL types.
|
||||
TEST_F(MinBufferSizeDefaultLayoutTests, DefaultLayoutVariousWGSLTypes) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
CheckShaderBindingSizeReflection(
|
||||
{{{0, 0, "a : f32;", 4}, {0, 1, "b : array<f32>;", 4}, {0, 2, "c : mat2x2<f32>;", 16}}});
|
||||
CheckShaderBindingSizeReflection({{{0, 3, "d : u32; e : array<f32>;", 8},
|
||||
{0, 4, "f : ThreeFloats;", 12},
|
||||
{0, 5, "g : array<ThreeFloats>;", 12}}});
|
||||
CheckShaderBindingSizeReflection({{{0, 0, "a : f32;", "f32", "a", 4},
|
||||
{0, 1, "b : array<f32>;", "f32", "b[0]", 4},
|
||||
{0, 2, "c : mat2x2<f32>;", "mat2x2<f32>", "c", 16}}});
|
||||
CheckShaderBindingSizeReflection({{{0, 3, "d : u32; e : array<f32>;", "u32", "d", 8},
|
||||
{0, 4, "f : ThreeFloats;", "f32", "f.f1", 12},
|
||||
{0, 5, "g : array<ThreeFloats>;", "f32", "g[0].f1", 12}}});
|
||||
}
|
||||
|
||||
// Test the minimum size computations for various buffer binding types.
|
||||
TEST_F(MinBufferSizeDefaultLayoutTests, DefaultLayoutVariousBindingTypes) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
CheckShaderBindingSizeReflection(
|
||||
{{{0, 0, "a : f32;", 4, wgpu::BufferBindingType::Uniform},
|
||||
{0, 1, "a : f32; b : f32;", 8, wgpu::BufferBindingType::Storage},
|
||||
{0, 2, "a : f32; b : f32; c: f32;", 12, wgpu::BufferBindingType::ReadOnlyStorage}}});
|
||||
{{{0, 0, "a : f32;", "f32", "a", 4, wgpu::BufferBindingType::Uniform},
|
||||
{0, 1, "a : f32; b : f32;", "f32", "a", 8, wgpu::BufferBindingType::Storage},
|
||||
{0, 2, "a : f32; b : f32; c: f32;", "f32", "a", 12,
|
||||
wgpu::BufferBindingType::ReadOnlyStorage}}});
|
||||
}
|
||||
|
||||
// Test the minimum size computations works with multiple bind groups.
|
||||
TEST_F(MinBufferSizeDefaultLayoutTests, MultipleBindGroups) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
CheckShaderBindingSizeReflection(
|
||||
{{{0, 0, "a : f32;", 4, wgpu::BufferBindingType::Uniform}},
|
||||
{{1, 0, "a : f32; b : f32;", 8, wgpu::BufferBindingType::Storage}},
|
||||
{{2, 0, "a : f32; b : f32; c : f32;", 12, wgpu::BufferBindingType::ReadOnlyStorage}}});
|
||||
{{{0, 0, "a : f32;", "f32", "a", 4, wgpu::BufferBindingType::Uniform}},
|
||||
{{1, 0, "a : f32; b : f32;", "f32", "a", 8, wgpu::BufferBindingType::Storage}},
|
||||
{{2, 0, "a : f32; b : f32; c : f32;", "f32", "a", 12,
|
||||
wgpu::BufferBindingType::ReadOnlyStorage}}});
|
||||
}
|
||||
|
||||
// Test the minimum size computations with manual size/align/stride decorations.
|
||||
TEST_F(MinBufferSizeDefaultLayoutTests, NonDefaultLayout) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
CheckShaderBindingSizeReflection({{{0, 0, "[[size(256)]] a : u32; b : u32;", 260},
|
||||
{0, 1, "c : u32; [[align(16)]] d : u32;", 20},
|
||||
{0, 2, "d : [[stride(40)]] array<u32, 3>;", 120},
|
||||
{0, 3, "e : [[stride(40)]] array<u32>;", 40}}});
|
||||
CheckShaderBindingSizeReflection(
|
||||
{{{0, 0, "[[size(256)]] a : u32; b : u32;", "u32", "a", 260},
|
||||
{0, 1, "c : u32; [[align(16)]] d : u32;", "u32", "c", 20},
|
||||
{0, 2, "d : [[stride(40)]] array<u32, 3>;", "u32", "d[0]", 120},
|
||||
{0, 3, "e : [[stride(40)]] array<u32>;", "u32", "e[0]", 40}}});
|
||||
}
|
||||
|
||||
// Minimum size should be the max requirement of both vertex and fragment stages.
|
||||
TEST_F(MinBufferSizeDefaultLayoutTests, RenderPassConsidersBothStages) {
|
||||
// TODO(https://crbug.com/tint/716): Remove skip once this is resolved.
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
std::string vertexShader = CreateVertexShaderWithBindings(
|
||||
{{0, 0, "a : f32;", 4, wgpu::BufferBindingType::Uniform},
|
||||
{0, 1, "b : vec4<f32>;", 16, wgpu::BufferBindingType::Uniform}});
|
||||
{{0, 0, "a : f32;", "f32", "a", 4, wgpu::BufferBindingType::Uniform},
|
||||
{0, 1, "b : vec4<f32>;", "vec4<f32>", "b", 16, wgpu::BufferBindingType::Uniform}});
|
||||
std::string fragShader = CreateFragmentShaderWithBindings(
|
||||
{{0, 0, "a : f32; b : f32;", 8, wgpu::BufferBindingType::Uniform},
|
||||
{0, 1, "c : f32; d : f32;", 8, wgpu::BufferBindingType::Uniform}});
|
||||
{{0, 0, "a : f32; b : f32;", "f32", "a", 8, wgpu::BufferBindingType::Uniform},
|
||||
{0, 1, "c : f32; d : f32;", "f32", "c", 8, wgpu::BufferBindingType::Uniform}});
|
||||
|
||||
wgpu::BindGroupLayout renderLayout = GetBGLFromRenderShaders(vertexShader, fragShader, 0);
|
||||
|
||||
CheckLayoutBindingSizeValidation(renderLayout, {{0, 0, "", 8}, {0, 1, "", 16}});
|
||||
CheckLayoutBindingSizeValidation(renderLayout, {{0, 0, "", "", "", 8}, {0, 1, "", "", "", 16}});
|
||||
}
|
||||
|
|
|
@ -393,8 +393,6 @@ TEST_F(RenderPipelineValidationTest, AlphaToCoverageAndSampleCount) {
|
|||
|
||||
// Tests that the texture component type in shader must match the bind group layout.
|
||||
TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
constexpr uint32_t kNumTextureComponentType = 3u;
|
||||
std::array<const char*, kNumTextureComponentType> kScalarTypes = {{"f32", "i32", "u32"}};
|
||||
std::array<wgpu::TextureSampleType, kNumTextureComponentType> kTextureComponentTypes = {{
|
||||
|
@ -414,6 +412,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
|||
<< kScalarTypes[i] << R"(>;
|
||||
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})";
|
||||
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
|
||||
|
||||
|
@ -432,8 +431,6 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
|||
|
||||
// Tests that the texture view dimension in shader must match the bind group layout.
|
||||
TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
constexpr uint32_t kNumTextureViewDimensions = 6u;
|
||||
std::array<const char*, kNumTextureViewDimensions> kTextureKeywords = {{
|
||||
"texture_1d",
|
||||
|
@ -463,6 +460,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
|||
[[group(0), binding(0)]] var myTexture : )"
|
||||
<< kTextureKeywords[i] << R"(<f32>;
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(myTexture);
|
||||
})";
|
||||
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ TEST_F(ShaderModuleValidationTest, CombinedTextureAndSampler) {
|
|||
// Test that it is not allowed to declare a multisampled-array interface texture.
|
||||
// TODO(enga): Also test multisampled cube, cube array, and 3D. These have no GLSL keywords.
|
||||
TEST_F(ShaderModuleValidationTest, MultisampledArrayTexture) {
|
||||
// TODO(https://crbug.com/tint/717): Remove skip once this is fixed
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// SPIR-V ASM produced by glslang for the following fragment shader:
|
||||
|
|
|
@ -87,6 +87,7 @@ class StorageTextureValidationTests : public ValidationTest {
|
|||
<< imageFormatQualifier
|
||||
<< ">;\n"
|
||||
"[[stage(compute)]] fn main() {\n"
|
||||
" textureDimensions(image0);\n"
|
||||
"}\n";
|
||||
|
||||
return ostream.str();
|
||||
|
@ -226,6 +227,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
|
|||
|
||||
// Validate read-write storage textures are not currently supported.
|
||||
TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
|
||||
// TODO(https://crbug.com/tint/692): Remove skip once this is fixed.
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// Read-write storage textures cannot be declared in a vertex shader by default.
|
||||
|
@ -233,6 +235,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
|
|||
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
||||
[[stage(vertex)]] fn main() {
|
||||
textureDimensions(image0);
|
||||
})"));
|
||||
}
|
||||
|
||||
|
@ -241,6 +244,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
|
|||
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
||||
[[stage(fragment)]] fn main() {
|
||||
textureDimensions(image0);
|
||||
})"));
|
||||
}
|
||||
|
||||
|
@ -249,6 +253,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
|
|||
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
|
||||
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
||||
[[stage(compute)]] fn main() {
|
||||
textureDimensions(image0);
|
||||
})"));
|
||||
}
|
||||
}
|
||||
|
@ -288,6 +293,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutWithStorageTextureBindingTy
|
|||
// Validate it is an error to declare a read-only or write-only storage texture in shaders with any
|
||||
// format that doesn't support TextureUsage::Storage texture usages.
|
||||
TEST_F(StorageTextureValidationTests, StorageTextureFormatInShaders) {
|
||||
// TODO(https://crbug.com/tint/718): Remove skip once this is fixed.
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
// Not include RGBA8UnormSrgb, BGRA8Unorm, BGRA8UnormSrgb because they are not related to any
|
||||
|
@ -326,6 +332,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureFormatInShaders) {
|
|||
// Verify that declaring a storage texture format that is not supported in WebGPU causes validation
|
||||
// error.
|
||||
TEST_F(StorageTextureValidationTests, UnsupportedWGSLStorageTextureFormat) {
|
||||
// TODO(https://crbug.com/tint/718): Remove skip once this is fixed.
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
constexpr std::array<wgpu::TextureFormat, 16> kUnsupportedTextureFormats = {
|
||||
|
@ -384,8 +391,6 @@ TEST_F(StorageTextureValidationTests, UnsupportedTextureViewDimensionInBindGroup
|
|||
// render and compute pipeline, the binding type in the bind group layout must match the
|
||||
// declaration in the shader.
|
||||
TEST_F(StorageTextureValidationTests, BindGroupLayoutEntryTypeMatchesShaderDeclaration) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
constexpr wgpu::TextureFormat kStorageTextureFormat = wgpu::TextureFormat::R32Float;
|
||||
|
||||
std::initializer_list<utils::BindingLayoutEntryInitializationHelper> kSupportedBindingTypes = {
|
||||
|
@ -469,8 +474,6 @@ TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroupLayout) {
|
|||
|
||||
// Verify the storage texture format in the bind group layout must match the declaration in shader.
|
||||
TEST_F(StorageTextureValidationTests, BindGroupLayoutStorageTextureFormatMatchesShaderDeclaration) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
for (wgpu::StorageTextureAccess bindingType : kSupportedStorageTextureAccess) {
|
||||
for (wgpu::TextureFormat storageTextureFormatInShader : utils::kAllTextureFormats) {
|
||||
if (!utils::TextureFormatSupportsStorageTexture(storageTextureFormatInShader)) {
|
||||
|
@ -527,8 +530,6 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutStorageTextureFormatMatches
|
|||
// Verify the dimension of the bind group layout with storage textures must match the one declared
|
||||
// in shader.
|
||||
TEST_F(StorageTextureValidationTests, BindGroupLayoutViewDimensionMatchesShaderDeclaration) {
|
||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
||||
|
||||
constexpr std::array<wgpu::TextureViewDimension, 4> kSupportedDimensions = {
|
||||
wgpu::TextureViewDimension::e1D, wgpu::TextureViewDimension::e2D,
|
||||
wgpu::TextureViewDimension::e2DArray, wgpu::TextureViewDimension::e3D};
|
||||
|
|
Loading…
Reference in New Issue