reader/wgsl: Fix parsing of matrices.

https://gpuweb.github.io/gpuweb/wgsl.html#matrix-types :
"matNxM<T>	Matrix of N columns and M rows"

Fixed: tint:432
Change-Id: Ib8fdb836b02c5e6be87acea850f095355545adbd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36421
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2021-01-05 20:53:10 +00:00 committed by Commit Bot service account
parent a35b57f91f
commit 9894867678
2 changed files with 5 additions and 5 deletions

View File

@ -1110,14 +1110,14 @@ Expect<ast::type::Type*> ParserImpl::expect_type_decl_matrix(Token t) {
uint32_t rows = 2;
uint32_t columns = 2;
if (t.IsMat3x2() || t.IsMat3x3() || t.IsMat3x4()) {
rows = 3;
columns = 3;
} else if (t.IsMat4x2() || t.IsMat4x3() || t.IsMat4x4()) {
rows = 4;
columns = 4;
}
if (t.IsMat2x3() || t.IsMat3x3() || t.IsMat4x3()) {
columns = 3;
rows = 3;
} else if (t.IsMat2x4() || t.IsMat3x4() || t.IsMat4x4()) {
columns = 4;
rows = 4;
}
const char* use = "matrix";

View File

@ -604,8 +604,8 @@ TEST_F(ParserImplTest, TypeDecl_Array_MissingComma) {
struct MatrixData {
const char* input;
size_t rows;
size_t columns;
size_t rows;
};
inline std::ostream& operator<<(std::ostream& out, MatrixData data) {
out << std::string(data.input);