mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 01:46:35 +00:00
Remove deprecated vertex formats
Bug: dawn:22 Change-Id: Iae2c742e6c7e44f7d99fa9eb9c92bcd4ed516b3f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51763 Commit-Queue: Brandon Jones <bajones@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
a548578f67
commit
4139fa5ca6
@@ -214,72 +214,6 @@ class ImageCopyBufferDeprecationTests : public DeprecationTests {
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
};
|
||||
|
||||
// Tests that deprecated vertex formats properly raise a deprecation warning when used
|
||||
class VertexFormatDeprecationTests : public DeprecationTests {
|
||||
protected:
|
||||
// Runs the test
|
||||
void DoTest(const wgpu::VertexFormat vertexFormat, bool deprecated) {
|
||||
std::string attribute = "[[location(0)]] a : ";
|
||||
attribute += dawn::GetWGSLVertexFormatType(vertexFormat);
|
||||
|
||||
std::string attribAccess = dawn::VertexFormatNumComponents(vertexFormat) > 1
|
||||
? "vec4<f32>(f32(a.x), 0.0, 0.0, 1.0)"
|
||||
: "vec4<f32>(f32(a), 0.0, 0.0, 1.0)";
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, (R"(
|
||||
[[stage(vertex)]] fn main()" + attribute + R"() -> [[builtin(position)]] vec4<f32> {
|
||||
return )" + attribAccess + R"(;
|
||||
}
|
||||
)")
|
||||
.c_str());
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
|
||||
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
)");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 32;
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = vertexFormat;
|
||||
descriptor.cAttributes[0].offset = 0;
|
||||
descriptor.cAttributes[0].shaderLocation = 0;
|
||||
descriptor.cTargets[0].format = utils::BasicRenderPass::kDefaultColorFormat;
|
||||
|
||||
if (deprecated) {
|
||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
|
||||
} else {
|
||||
device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(VertexFormatDeprecationTests, NewVertexFormats) {
|
||||
// Using the new vertex formats does not emit a warning.
|
||||
for (auto& format : dawn::kAllVertexFormats) {
|
||||
DoTest(format, false);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(VertexFormatDeprecationTests, DeprecatedVertexFormats) {
|
||||
// Using deprecated vertex formats does emit a warning.
|
||||
for (auto& format : dawn::kAllDeprecatedVertexFormats) {
|
||||
DoTest(format, true);
|
||||
}
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(VertexFormatDeprecationTests,
|
||||
D3D12Backend(),
|
||||
MetalBackend(),
|
||||
NullBackend(),
|
||||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
// Tests that deprecated blend factors properly raise a deprecation warning when used
|
||||
class BlendFactorDeprecationTests : public DeprecationTests {
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user