mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 01:15:39 +00:00
Fix the vertex attribute offset alignment rule.
Bug: dawn:130 Change-Id: Ib5fa24bf5520cb1ffe1653f1504dff244df928b4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44300 Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
693b76bcd5
commit
a94c9acd01
@@ -292,17 +292,32 @@ TEST_F(VertexStateTest, SetAttributeOffsetOutOfBounds) {
|
||||
CreatePipeline(false, state, kDummyVertexShader);
|
||||
}
|
||||
|
||||
// Check multiple of 4 bytes constraint on offset
|
||||
// Check the "component byte size" alignment constraint for the offset.
|
||||
TEST_F(VertexStateTest, SetOffsetNotAligned) {
|
||||
// Control case, setting offset 4 bytes.
|
||||
// Control case, setting the offset at the correct alignments.
|
||||
utils::ComboVertexStateDescriptor state;
|
||||
state.vertexBufferCount = 1;
|
||||
state.cVertexBuffers[0].attributeCount = 1;
|
||||
|
||||
state.cAttributes[0].format = wgpu::VertexFormat::Float32;
|
||||
state.cAttributes[0].offset = 4;
|
||||
CreatePipeline(true, state, kDummyVertexShader);
|
||||
|
||||
// Test offset not multiple of 4 bytes
|
||||
state.cAttributes[0].format = wgpu::VertexFormat::Snorm16x2;
|
||||
state.cAttributes[0].offset = 2;
|
||||
CreatePipeline(true, state, kDummyVertexShader);
|
||||
|
||||
state.cAttributes[0].format = wgpu::VertexFormat::Uint8x2;
|
||||
state.cAttributes[0].offset = 1;
|
||||
CreatePipeline(true, state, kDummyVertexShader);
|
||||
|
||||
// Test offset not multiple of the component byte size.
|
||||
state.cAttributes[0].format = wgpu::VertexFormat::Float32;
|
||||
state.cAttributes[0].offset = 2;
|
||||
CreatePipeline(false, state, kDummyVertexShader);
|
||||
|
||||
state.cAttributes[0].format = wgpu::VertexFormat::Snorm16x2;
|
||||
state.cAttributes[0].offset = 1;
|
||||
CreatePipeline(false, state, kDummyVertexShader);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user