unittests: Add a position return value for vertex shaders
Fixes new validation errors added with: https://dawn-review.googlesource.com/c/tint/+/48560 Change-Id: Icb9a3bc46574c365a812685d01aab336a11792c1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/48681 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
b395605ab3
commit
6dd1d37da8
|
@ -1084,7 +1084,8 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||||
|
|
||||||
wgpu::RenderPipeline CreateRenderPipeline() {
|
wgpu::RenderPipeline CreateRenderPipeline() {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -1487,7 +1488,8 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
mVsModule = utils::CreateShaderModule(device, R"(
|
mVsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1689,7 +1691,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
||||||
const char* fsShader,
|
const char* fsShader,
|
||||||
std::vector<wgpu::BindGroupLayout> bindGroupLayout) {
|
std::vector<wgpu::BindGroupLayout> bindGroupLayout) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fsShader);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fsShader);
|
||||||
|
@ -2061,7 +2064,8 @@ class ComparisonSamplerBindingTest : public ValidationTest {
|
||||||
wgpu::RenderPipeline CreateFragmentPipeline(wgpu::BindGroupLayout* bindGroupLayout,
|
wgpu::RenderPipeline CreateFragmentPipeline(wgpu::BindGroupLayout* bindGroupLayout,
|
||||||
const char* fragmentSource) {
|
const char* fragmentSource) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentSource);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentSource);
|
||||||
|
|
|
@ -21,7 +21,8 @@ class GetBindGroupLayoutTests : public ValidationTest {
|
||||||
protected:
|
protected:
|
||||||
wgpu::RenderPipeline RenderPipelineFromFragmentShader(const char* shader) {
|
wgpu::RenderPipeline RenderPipelineFromFragmentShader(const char* shader) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shader);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shader);
|
||||||
|
@ -50,9 +51,10 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
||||||
[[group(0), binding(0)]] var<uniform> uniform0 : S;
|
[[group(0), binding(0)]] var<uniform> uniform0 : S;
|
||||||
[[group(1), binding(0)]] var<uniform> uniform1 : S;
|
[[group(1), binding(0)]] var<uniform> uniform1 : S;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
var pos : vec4<f32> = uniform0.pos;
|
var pos : vec4<f32> = uniform0.pos;
|
||||||
pos = uniform1.pos;
|
pos = uniform1.pos;
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -473,9 +475,10 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
||||||
[[group(0), binding(0)]] var<uniform> uniform0 : S;
|
[[group(0), binding(0)]] var<uniform> uniform0 : S;
|
||||||
[[group(1), binding(0)]] var<uniform> uniform1 : S;
|
[[group(1), binding(0)]] var<uniform> uniform1 : S;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
var pos : vec4<f32> = uniform0.pos;
|
var pos : vec4<f32> = uniform0.pos;
|
||||||
pos = uniform1.pos;
|
pos = uniform1.pos;
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -509,8 +512,9 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
var pos : f32 = uniforms.pos;
|
var pos : f32 = uniforms.pos;
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule64 = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule64 = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -519,8 +523,9 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
var pos : mat4x4<f32> = uniforms.pos;
|
var pos : mat4x4<f32> = uniforms.pos;
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule4 = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule4 = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -594,13 +599,15 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
|
|
||||||
wgpu::ShaderModule vsModuleNoSampler = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModuleNoSampler = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var mySampler: sampler;
|
[[group(0), binding(0)]] var mySampler: sampler;
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
let s : sampler = mySampler;
|
let s : sampler = mySampler;
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModuleNoSampler = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModuleNoSampler = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -664,8 +671,9 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> ubo : S;
|
[[group(0), binding(0)]] var<uniform> ubo : S;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
var pos : vec4<f32> = ubo.pos;
|
var pos : vec4<f32> = ubo.pos;
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -691,8 +699,9 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
textureDimensions(myTexture);
|
textureDimensions(myTexture);
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -715,8 +724,9 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
textureDimensions(myTexture);
|
textureDimensions(myTexture);
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -739,8 +749,9 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
textureDimensions(myTexture);
|
textureDimensions(myTexture);
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -833,8 +844,9 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
var pos : vec4<f32> = uniforms.pos;
|
var pos : vec4<f32> = uniforms.pos;
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
|
|
@ -123,8 +123,10 @@ namespace {
|
||||||
|
|
||||||
// Creates a vertex shader with given bindings
|
// Creates a vertex shader with given bindings
|
||||||
std::string CreateVertexShaderWithBindings(const std::vector<BindingDescriptor>& bindings) {
|
std::string CreateVertexShaderWithBindings(const std::vector<BindingDescriptor>& bindings) {
|
||||||
return kStructs + GenerateBindingString(bindings) + "[[stage(vertex)]] fn main() {\n" +
|
return kStructs + GenerateBindingString(bindings) +
|
||||||
GenerateReferenceString(bindings, wgpu::ShaderStage::Vertex) + "}";
|
"[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {\n" +
|
||||||
|
GenerateReferenceString(bindings, wgpu::ShaderStage::Vertex) +
|
||||||
|
"\n return vec4<f32>(); " + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a fragment shader with given bindings
|
// Creates a fragment shader with given bindings
|
||||||
|
|
|
@ -33,7 +33,8 @@ namespace {
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main([[location(0)]] pos : vec2<f32>) {
|
[[stage(vertex)]] fn main([[location(0)]] pos : vec2<f32>) -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, R"(
|
fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
|
|
@ -486,8 +486,9 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
|
||||||
data : array<u32, 100>;
|
data : array<u32, 100>;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<storage> dst : [[access(read_write)]] Dst;
|
[[group(0), binding(0)]] var<storage> dst : [[access(read_write)]] Dst;
|
||||||
[[stage(vertex)]] fn main([[builtin(vertex_index)]] VertexIndex : u32) {
|
[[stage(vertex)]] fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
|
||||||
dst.data[VertexIndex] = 0x1234u;
|
dst.data[VertexIndex] = 0x1234u;
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
|
|
|
@ -47,7 +47,8 @@ namespace {
|
||||||
// pipeline. But those bind groups in caller can be used for validation for other purposes.
|
// pipeline. But those bind groups in caller can be used for validation for other purposes.
|
||||||
wgpu::RenderPipeline CreateNoOpRenderPipeline() {
|
wgpu::RenderPipeline CreateNoOpRenderPipeline() {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -772,7 +773,8 @@ namespace {
|
||||||
|
|
||||||
// Create a passthrough render pipeline with a readonly buffer
|
// Create a passthrough render pipeline with a readonly buffer
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -1550,7 +1552,8 @@ namespace {
|
||||||
{
|
{
|
||||||
// Create a passthrough render pipeline with a readonly storage texture
|
// Create a passthrough render pipeline with a readonly storage texture
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
|
|
@ -65,7 +65,11 @@ TEST_F(UnsafeAPIValidationTest, DrawIndexedIndirectDisallowed) {
|
||||||
bundleDesc.cColorFormats[0] = renderPass.attachmentFormat;
|
bundleDesc.cColorFormats[0] = renderPass.attachmentFormat;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor2 desc;
|
||||||
desc.vertex.module = utils::CreateShaderModule(device, "[[stage(vertex)]] fn main() {}");
|
desc.vertex.module = utils::CreateShaderModule(
|
||||||
|
device,
|
||||||
|
R"([[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
|
return vec4<f32>();
|
||||||
|
})");
|
||||||
desc.cFragment.module = utils::CreateShaderModule(device, "[[stage(fragment)]] fn main() {}");
|
desc.cFragment.module = utils::CreateShaderModule(device, "[[stage(fragment)]] fn main() {}");
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue