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:
parent
a35b57f91f
commit
9894867678
|
@ -1110,14 +1110,14 @@ Expect<ast::type::Type*> ParserImpl::expect_type_decl_matrix(Token t) {
|
||||||
uint32_t rows = 2;
|
uint32_t rows = 2;
|
||||||
uint32_t columns = 2;
|
uint32_t columns = 2;
|
||||||
if (t.IsMat3x2() || t.IsMat3x3() || t.IsMat3x4()) {
|
if (t.IsMat3x2() || t.IsMat3x3() || t.IsMat3x4()) {
|
||||||
rows = 3;
|
columns = 3;
|
||||||
} else if (t.IsMat4x2() || t.IsMat4x3() || t.IsMat4x4()) {
|
} else if (t.IsMat4x2() || t.IsMat4x3() || t.IsMat4x4()) {
|
||||||
rows = 4;
|
columns = 4;
|
||||||
}
|
}
|
||||||
if (t.IsMat2x3() || t.IsMat3x3() || t.IsMat4x3()) {
|
if (t.IsMat2x3() || t.IsMat3x3() || t.IsMat4x3()) {
|
||||||
columns = 3;
|
rows = 3;
|
||||||
} else if (t.IsMat2x4() || t.IsMat3x4() || t.IsMat4x4()) {
|
} else if (t.IsMat2x4() || t.IsMat3x4() || t.IsMat4x4()) {
|
||||||
columns = 4;
|
rows = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* use = "matrix";
|
const char* use = "matrix";
|
||||||
|
|
|
@ -604,8 +604,8 @@ TEST_F(ParserImplTest, TypeDecl_Array_MissingComma) {
|
||||||
|
|
||||||
struct MatrixData {
|
struct MatrixData {
|
||||||
const char* input;
|
const char* input;
|
||||||
size_t rows;
|
|
||||||
size_t columns;
|
size_t columns;
|
||||||
|
size_t rows;
|
||||||
};
|
};
|
||||||
inline std::ostream& operator<<(std::ostream& out, MatrixData data) {
|
inline std::ostream& operator<<(std::ostream& out, MatrixData data) {
|
||||||
out << std::string(data.input);
|
out << std::string(data.input);
|
||||||
|
|
Loading…
Reference in New Issue