Normalize all line endings to LF

And force shader code to always use LF endings.

Post merge, there were a number of files that crept in with CRLF endings.

Some Tint end-to-end tests take objection to CRLF endings.

CRLF endings can be detected with:

```
git grep -I --files-with-matches --perl-regexp '\r' HEAD
```

And fixed with:

```
find . -type f -exec dos2unix {} \;
```

Bug: dawn:1339
Change-Id: Iee054bafd15875de744b86e28393cd8229bd3cfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86140
Kokoro-Run: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-04-08 14:18:28 +00:00 committed by Dawn LUCI CQ
parent 6249b24581
commit 4d36557bce
54 changed files with 1248 additions and 1243 deletions

13
.gitattributes vendored
View File

@ -1,4 +1,9 @@
* text=auto * text=auto
*.sh eol=lf *.glsl eol=lf
*.gn eol=lf *.gn eol=lf
*.gni eol=lf *.gni eol=lf
*.hlsl eol=lf
*.msl eol=lf
*.sh eol=lf
*.spvasm eol=lf
*.wgsl eol=lf

View File

@ -1,100 +1,100 @@
{ {
"configurations": [ "configurations": [
{ {
"name": "x64-Debug", "name": "x64-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ], "inheritEnvironments": ["msvc_x64_x64"],
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"variables": [] "variables": []
}, },
{ {
"name": "x64-Release", "name": "x64-Release",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "RelWithDebInfo", "configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ], "inheritEnvironments": ["msvc_x64_x64"],
"variables": [] "variables": []
}, },
{ {
"name": "x86-Debug", "name": "x86-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ], "inheritEnvironments": ["msvc_x86"],
"variables": [] "variables": []
}, },
{ {
"name": "x86-Release", "name": "x86-Release",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "RelWithDebInfo", "configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ], "inheritEnvironments": ["msvc_x86"],
"variables": [] "variables": []
}, },
{ {
"name": "x64-Clang-Debug", "name": "x64-Clang-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ], "inheritEnvironments": ["clang_cl_x64_x64"],
"variables": [] "variables": []
}, },
{ {
"name": "x64-Clang-Release", "name": "x64-Clang-Release",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "RelWithDebInfo", "configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ], "inheritEnvironments": ["clang_cl_x64_x64"],
"variables": [] "variables": []
}, },
{ {
"name": "x86-Clang-Debug", "name": "x86-Clang-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x86" ], "inheritEnvironments": ["clang_cl_x86"],
"variables": [] "variables": []
}, },
{ {
"name": "x86-Clang-Release", "name": "x86-Clang-Release",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "RelWithDebInfo", "configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x86" ], "inheritEnvironments": ["clang_cl_x86"],
"variables": [] "variables": []
} }
] ]
} }

View File

@ -1,189 +1,189 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
/// Copyright 2021 The Tint Authors. /// Copyright 2021 The Tint Authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
--> -->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="tint::Symbol"> <Type Name="tint::Symbol">
<!-- Requires TINT_SYMBOL_STORE_DEBUG_NAME defined to 1 --> <!-- Requires TINT_SYMBOL_STORE_DEBUG_NAME defined to 1 -->
<DisplayString Optional="true">{debug_name_,sb}</DisplayString> <DisplayString Optional="true">{debug_name_,sb}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::AssignmentStatement"> <Type Name="tint::ast::AssignmentStatement">
<DisplayString>{*lhs} = {*rhs};</DisplayString> <DisplayString>{*lhs} = {*rhs};</DisplayString>
<Expand> <Expand>
<Item Name="lhs">*lhs</Item> <Item Name="lhs">*lhs</Item>
<Item Name="rhs">*rhs</Item> <Item Name="rhs">*rhs</Item>
</Expand> </Expand>
</Type> </Type>
<Type Name="tint::ast::IfStatement"> <Type Name="tint::ast::IfStatement">
<DisplayString Condition="else_statements.size() == 0">if ({*condition}) {*body}</DisplayString> <DisplayString Condition="else_statements.size() == 0">if ({*condition}) {*body}</DisplayString>
<DisplayString Condition="else_statements.size() == 1">if ({*condition}) {*body} {*else_statements[0]} </DisplayString> <DisplayString Condition="else_statements.size() == 1">if ({*condition}) {*body} {*else_statements[0]} </DisplayString>
<DisplayString Condition="else_statements.size() == 2">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} </DisplayString> <DisplayString Condition="else_statements.size() == 2">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} </DisplayString>
<DisplayString Condition="else_statements.size() == 3">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} {*else_statements[2]}</DisplayString> <DisplayString Condition="else_statements.size() == 3">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} {*else_statements[2]}</DisplayString>
<DisplayString Condition="else_statements.size() > 3">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} {*else_statements[2]} else {else_statements.size()-3} more...</DisplayString> <DisplayString Condition="else_statements.size() > 3">if ({*condition}) {*body} {*else_statements[0]} {*else_statements[1]} {*else_statements[2]} else {else_statements.size()-3} more...</DisplayString>
</Type> </Type>
<Type Name="tint::ast::ElseStatement"> <Type Name="tint::ast::ElseStatement">
<DisplayString Condition="!condition">else {*body}</DisplayString> <DisplayString Condition="!condition">else {*body}</DisplayString>
<DisplayString Condition="!!condition">else if ({*condition}) {*body}</DisplayString> <DisplayString Condition="!!condition">else if ({*condition}) {*body}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::BlockStatement"> <Type Name="tint::ast::BlockStatement">
<DisplayString Condition="statements.size() == 1">{{ {*statements[0]} }} </DisplayString> <DisplayString Condition="statements.size() == 1">{{ {*statements[0]} }} </DisplayString>
<DisplayString Condition="statements.size() == 2">{{ {*statements[0]} {*statements[1]} }} </DisplayString> <DisplayString Condition="statements.size() == 2">{{ {*statements[0]} {*statements[1]} }} </DisplayString>
<DisplayString Condition="statements.size() == 3">{{ {*statements[0]} {*statements[1]} {*statements[2]} }} </DisplayString> <DisplayString Condition="statements.size() == 3">{{ {*statements[0]} {*statements[1]} {*statements[2]} }} </DisplayString>
<DisplayString Condition="statements.size() > 3">{{ {*statements[0]} {*statements[1]} {*statements[2]} {statements.size()-3} more... }} </DisplayString> <DisplayString Condition="statements.size() > 3">{{ {*statements[0]} {*statements[1]} {*statements[2]} {statements.size()-3} more... }} </DisplayString>
</Type> </Type>
<Type Name="tint::ast::ReturnStatement"> <Type Name="tint::ast::ReturnStatement">
<DisplayString Condition="!value">return;</DisplayString> <DisplayString Condition="!value">return;</DisplayString>
<DisplayString Condition="!!value">return {*value};</DisplayString> <DisplayString Condition="!!value">return {*value};</DisplayString>
</Type> </Type>
<Type Name="tint::ast::Function"> <Type Name="tint::ast::Function">
<DisplayString Condition="params.size() == 0">fn {symbol}() -> {*return_type} {*body}</DisplayString> <DisplayString Condition="params.size() == 0">fn {symbol}() -> {*return_type} {*body}</DisplayString>
<DisplayString Condition="params.size() == 1">fn {symbol}({*params[0]}) -> {*return_type} {*body}</DisplayString> <DisplayString Condition="params.size() == 1">fn {symbol}({*params[0]}) -> {*return_type} {*body}</DisplayString>
<DisplayString Condition="params.size() == 2">fn {symbol}({*params[0]} {*params[1]}) -> {*return_type} {*body}</DisplayString> <DisplayString Condition="params.size() == 2">fn {symbol}({*params[0]} {*params[1]}) -> {*return_type} {*body}</DisplayString>
<DisplayString Condition="params.size() == 3">fn {symbol}({*params[0]} {*params[1]} {*params[2]}) -> {*return_type} {*body}</DisplayString> <DisplayString Condition="params.size() == 3">fn {symbol}({*params[0]} {*params[1]} {*params[2]}) -> {*return_type} {*body}</DisplayString>
<DisplayString Condition="params.size() > 3">fn {symbol}({*params[0]} {*params[1]} {*params[2]} {params.size()-3} more...) -> {*return_type} {*body}</DisplayString> <DisplayString Condition="params.size() > 3">fn {symbol}({*params[0]} {*params[1]} {*params[2]} {params.size()-3} more...) -> {*return_type} {*body}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::IdentifierExpression"> <Type Name="tint::ast::IdentifierExpression">
<!--the ",sb" specifier removes the double quotes on the displayed string --> <!--the ",sb" specifier removes the double quotes on the displayed string -->
<DisplayString>{symbol}</DisplayString> <DisplayString>{symbol}</DisplayString>
<Expand> <Expand>
<Item Name="symbol">symbol</Item> <Item Name="symbol">symbol</Item>
</Expand> </Expand>
</Type> </Type>
<Type Name="tint::ast::IndexAccessorExpression"> <Type Name="tint::ast::IndexAccessorExpression">
<DisplayString>{*object}[{*index}]</DisplayString> <DisplayString>{*object}[{*index}]</DisplayString>
<Expand> <Expand>
<Item Name="object">*object</Item> <Item Name="object">*object</Item>
<Item Name="index">*index</Item> <Item Name="index">*index</Item>
</Expand> </Expand>
</Type> </Type>
<Type Name="tint::ast::MemberAccessorExpression"> <Type Name="tint::ast::MemberAccessorExpression">
<DisplayString>{*structure}.{*member}</DisplayString> <DisplayString>{*structure}.{*member}</DisplayString>
<Expand> <Expand>
<Item Name="structure">*structure</Item> <Item Name="structure">*structure</Item>
<Item Name="member">*member</Item> <Item Name="member">*member</Item>
</Expand> </Expand>
</Type> </Type>
<Type Name="tint::ast::Variable"> <Type Name="tint::ast::Variable">
<!-- Hack: we can deduce that this variable is a parameter if it's const with a type but no constructor, which is illegal for a let --> <!-- Hack: we can deduce that this variable is a parameter if it's const with a type but no constructor, which is illegal for a let -->
<DisplayString Condition=" is_const &amp; !!type &amp; !constructor">{symbol} : {*type}</DisplayString> <DisplayString Condition=" is_const &amp; !!type &amp; !constructor">{symbol} : {*type}</DisplayString>
<DisplayString Condition=" is_const &amp; !!type &amp; !!constructor">let {symbol} : {*type} = {*constructor}</DisplayString> <DisplayString Condition=" is_const &amp; !!type &amp; !!constructor">let {symbol} : {*type} = {*constructor}</DisplayString>
<DisplayString Condition=" is_const &amp; !type &amp; !constructor">let {symbol} = {*constructor}</DisplayString> <DisplayString Condition=" is_const &amp; !type &amp; !constructor">let {symbol} = {*constructor}</DisplayString>
<DisplayString Condition="!is_const &amp; !!type &amp; !!constructor">var {symbol} : {*type} = {*constructor}</DisplayString> <DisplayString Condition="!is_const &amp; !!type &amp; !!constructor">var {symbol} : {*type} = {*constructor}</DisplayString>
<DisplayString Condition="!is_const &amp; !type &amp; !!constructor">var {symbol} = {*constructor}</DisplayString> <DisplayString Condition="!is_const &amp; !type &amp; !!constructor">var {symbol} = {*constructor}</DisplayString>
<DisplayString Condition="!is_const &amp; !!type &amp; !constructor">var {symbol}</DisplayString> <DisplayString Condition="!is_const &amp; !!type &amp; !constructor">var {symbol}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::VariableDeclStatement"> <Type Name="tint::ast::VariableDeclStatement">
<DisplayString>{*variable};</DisplayString> <DisplayString>{*variable};</DisplayString>
</Type> </Type>
<Type Name="tint::ast::UintLiteralExpression"> <Type Name="tint::ast::UintLiteralExpression">
<DisplayString>{value}</DisplayString> <DisplayString>{value}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::SintLiteralExpression"> <Type Name="tint::ast::SintLiteralExpression">
<DisplayString>{value}</DisplayString> <DisplayString>{value}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::BoolLiteralExpression"> <Type Name="tint::ast::BoolLiteralExpression">
<DisplayString>{value}</DisplayString> <DisplayString>{value}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::Void"> <Type Name="tint::ast::Void">
<DisplayString>void</DisplayString> <DisplayString>void</DisplayString>
</Type> </Type>
<Type Name="tint::ast::UnaryOpExpression"> <Type Name="tint::ast::UnaryOpExpression">
<DisplayString Condition="op==tint::ast::UnaryOp::kAddressOf">&amp;({expr})</DisplayString> <DisplayString Condition="op==tint::ast::UnaryOp::kAddressOf">&amp;({expr})</DisplayString>
<DisplayString Condition="op==tint::ast::UnaryOp::kComplement">~({expr})</DisplayString> <DisplayString Condition="op==tint::ast::UnaryOp::kComplement">~({expr})</DisplayString>
<DisplayString Condition="op==tint::ast::UnaryOp::kIndirection">*({expr})</DisplayString> <DisplayString Condition="op==tint::ast::UnaryOp::kIndirection">*({expr})</DisplayString>
<DisplayString Condition="op==tint::ast::UnaryOp::kNegation">-({expr})</DisplayString> <DisplayString Condition="op==tint::ast::UnaryOp::kNegation">-({expr})</DisplayString>
<DisplayString Condition="op==tint::ast::UnaryOp::kNot">!({expr})</DisplayString> <DisplayString Condition="op==tint::ast::UnaryOp::kNot">!({expr})</DisplayString>
</Type> </Type>
<Type Name="tint::ast::BinaryExpression"> <Type Name="tint::ast::BinaryExpression">
<DisplayString Condition="op==tint::ast::BinaryOp::kNone">({*lhs} NONE {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kNone">({*lhs} NONE {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kAnd">({*lhs} &amp; {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kAnd">({*lhs} &amp; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kOr">({*lhs} | {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kOr">({*lhs} | {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kXor">({*lhs} ^ {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kXor">({*lhs} ^ {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kLogicalAnd">({*lhs} &amp;&amp; {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kLogicalAnd">({*lhs} &amp;&amp; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kLogicalOr">({*lhs} || {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kLogicalOr">({*lhs} || {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kEqual">({*lhs} == {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kEqual">({*lhs} == {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kNotEqual">({*lhs} != {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kNotEqual">({*lhs} != {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kLessThan">({*lhs} &lt; {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kLessThan">({*lhs} &lt; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThan">({*lhs} &gt; {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThan">({*lhs} &gt; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kLessThanEqual">({*lhs} &lt;= {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kLessThanEqual">({*lhs} &lt;= {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThanEqual">({*lhs} &gt;= {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThanEqual">({*lhs} &gt;= {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kShiftLeft">({*lhs} &lt;&lt; {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kShiftLeft">({*lhs} &lt;&lt; {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kShiftRight">({*lhs} >> {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kShiftRight">({*lhs} >> {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kAdd">({*lhs} + {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kAdd">({*lhs} + {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kSubtract">({*lhs} - {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kSubtract">({*lhs} - {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kMultiply">({*lhs} * {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kMultiply">({*lhs} * {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kDivide">({*lhs} / {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kDivide">({*lhs} / {*rhs})</DisplayString>
<DisplayString Condition="op==tint::ast::BinaryOp::kModulo">({*lhs} % {*rhs})</DisplayString> <DisplayString Condition="op==tint::ast::BinaryOp::kModulo">({*lhs} % {*rhs})</DisplayString>
</Type> </Type>
<Type Name="tint::ast::CallExpression"> <Type Name="tint::ast::CallExpression">
<DisplayString Condition="args.size() == 0">{target}()</DisplayString> <DisplayString Condition="args.size() == 0">{target}()</DisplayString>
<DisplayString Condition="args.size() == 1">{target}({*args[0]})</DisplayString> <DisplayString Condition="args.size() == 1">{target}({*args[0]})</DisplayString>
<DisplayString Condition="args.size() == 2">{target}({*args[0]}, {*args[1]})</DisplayString> <DisplayString Condition="args.size() == 2">{target}({*args[0]}, {*args[1]})</DisplayString>
<DisplayString Condition="args.size() == 3">{target}({*args[0]}, {*args[1]}, {*args[2]})</DisplayString> <DisplayString Condition="args.size() == 3">{target}({*args[0]}, {*args[1]}, {*args[2]})</DisplayString>
<DisplayString Condition="args.size() > 3">{target}({*args[0]}, {*args[1]}, {*args[2]}, {args.size()-3} more...)</DisplayString> <DisplayString Condition="args.size() > 3">{target}({*args[0]}, {*args[1]}, {*args[2]}, {args.size()-3} more...)</DisplayString>
<!-- TODO: add more overloads --> <!-- TODO: add more overloads -->
</Type> </Type>
<Type Name="tint::ast::CallExpression::Target"> <Type Name="tint::ast::CallExpression::Target">
<DisplayString Condition ="name != nullptr">{*name}</DisplayString> <DisplayString Condition ="name != nullptr">{*name}</DisplayString>
<DisplayString Condition ="name == nullptr">{*type}</DisplayString> <DisplayString Condition ="name == nullptr">{*type}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::Array"> <Type Name="tint::ast::Array">
<DisplayString Condition="count != nullptr">array&lt;{*type},{*count}&gt;</DisplayString> <DisplayString Condition="count != nullptr">array&lt;{*type},{*count}&gt;</DisplayString>
<DisplayString Condition="count == nullptr">array&lt;{*type}&gt;</DisplayString> <DisplayString Condition="count == nullptr">array&lt;{*type}&gt;</DisplayString>
</Type> </Type>
<Type Name="tint::ast::TypeName"> <Type Name="tint::ast::TypeName">
<DisplayString>{name}</DisplayString> <DisplayString>{name}</DisplayString>
</Type> </Type>
<Type Name="tint::ast::Bool"> <Type Name="tint::ast::Bool">
<DisplayString>bool</DisplayString> <DisplayString>bool</DisplayString>
</Type> </Type>
<Type Name="tint::ast::I32"> <Type Name="tint::ast::I32">
<DisplayString>i32</DisplayString> <DisplayString>i32</DisplayString>
</Type> </Type>
<Type Name="tint::ast::U32"> <Type Name="tint::ast::U32">
<DisplayString>u32</DisplayString> <DisplayString>u32</DisplayString>
</Type> </Type>
<Type Name="tint::ast::F32"> <Type Name="tint::ast::F32">
<DisplayString>f32</DisplayString> <DisplayString>f32</DisplayString>
</Type> </Type>
</AutoVisualizer> </AutoVisualizer>

View File

@ -1,63 +1,63 @@
struct Uniforms { struct Uniforms {
u_scale : vec2<f32>, u_scale : vec2<f32>,
u_offset : vec2<f32>, u_offset : vec2<f32>,
}; };
@binding(0) @group(0) var<uniform> uniforms : Uniforms; @binding(0) @group(0) var<uniform> uniforms : Uniforms;
struct VertexOutputs { struct VertexOutputs {
@location(0) texcoords : vec2<f32>, @location(0) texcoords : vec2<f32>,
@builtin(position) position : vec4<f32>, @builtin(position) position : vec4<f32>,
}; };
@stage(vertex) fn vs_main( @stage(vertex) fn vs_main(
@builtin(vertex_index) VertexIndex : u32 @builtin(vertex_index) VertexIndex : u32
) -> VertexOutputs { ) -> VertexOutputs {
var texcoord = array<vec2<f32>, 3>( var texcoord = array<vec2<f32>, 3>(
vec2<f32>(-0.5, 0.0), vec2<f32>(-0.5, 0.0),
vec2<f32>( 1.5, 0.0), vec2<f32>( 1.5, 0.0),
vec2<f32>( 0.5, 2.0)); vec2<f32>( 0.5, 2.0));
var output : VertexOutputs; var output : VertexOutputs;
output.position = vec4<f32>((texcoord[VertexIndex] * 2.0 - vec2<f32>(1.0, 1.0)), 0.0, 1.0); output.position = vec4<f32>((texcoord[VertexIndex] * 2.0 - vec2<f32>(1.0, 1.0)), 0.0, 1.0);
// Y component of scale is calculated by the copySizeHeight / textureHeight. Only // Y component of scale is calculated by the copySizeHeight / textureHeight. Only
// flipY case can get negative number. // flipY case can get negative number.
var flipY = uniforms.u_scale.y < 0.0; var flipY = uniforms.u_scale.y < 0.0;
// Texture coordinate takes top-left as origin point. We need to map the // Texture coordinate takes top-left as origin point. We need to map the
// texture to triangle carefully. // texture to triangle carefully.
if (flipY) { if (flipY) {
// We need to get the mirror positions(mirrored based on y = 0.5) on flip cases. // We need to get the mirror positions(mirrored based on y = 0.5) on flip cases.
// Adopt transform to src texture and then mapping it to triangle coord which // Adopt transform to src texture and then mapping it to triangle coord which
// do a +1 shift on Y dimension will help us got that mirror position perfectly. // do a +1 shift on Y dimension will help us got that mirror position perfectly.
output.texcoords = (texcoord[VertexIndex] * uniforms.u_scale + uniforms.u_offset) * output.texcoords = (texcoord[VertexIndex] * uniforms.u_scale + uniforms.u_offset) *
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0); vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0);
} else { } else {
// For the normal case, we need to get the exact position. // For the normal case, we need to get the exact position.
// So mapping texture to triangle firstly then adopt the transform. // So mapping texture to triangle firstly then adopt the transform.
output.texcoords = (texcoord[VertexIndex] * output.texcoords = (texcoord[VertexIndex] *
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0)) * vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0)) *
uniforms.u_scale + uniforms.u_offset; uniforms.u_scale + uniforms.u_offset;
} }
return output; return output;
} }
@binding(1) @group(0) var mySampler: sampler; @binding(1) @group(0) var mySampler: sampler;
@binding(2) @group(0) var myTexture: texture_2d<f32>; @binding(2) @group(0) var myTexture: texture_2d<f32>;
@stage(fragment) fn fs_main( @stage(fragment) fn fs_main(
@location(0) texcoord : vec2<f32> @location(0) texcoord : vec2<f32>
) -> @location(0) vec4<f32> { ) -> @location(0) vec4<f32> {
// Clamp the texcoord and discard the out-of-bound pixels. // Clamp the texcoord and discard the out-of-bound pixels.
var clampedTexcoord = var clampedTexcoord =
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0)); clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
if (!all(clampedTexcoord == texcoord)) { if (!all(clampedTexcoord == texcoord)) {
discard; discard;
} }
var srcColor = textureSample(myTexture, mySampler, texcoord); var srcColor = textureSample(myTexture, mySampler, texcoord);
// Swizzling of texture formats when sampling / rendering is handled by the // Swizzling of texture formats when sampling / rendering is handled by the
// hardware so we don't need special logic in this shader. This is covered by tests. // hardware so we don't need special logic in this shader. This is covered by tests.
return srcColor; return srcColor;
} }

View File

@ -1,28 +1,28 @@
// 1112.wgsl // 1112.wgsl
@group(0) @binding(0) var Sampler: sampler; @group(0) @binding(0) var Sampler: sampler;
@group(0) @binding(1) var randomTexture: texture_2d<f32>; @group(0) @binding(1) var randomTexture: texture_2d<f32>;
@group(0) @binding(2) var depthTexture: texture_2d<f32>; @group(0) @binding(2) var depthTexture: texture_2d<f32>;
@stage(fragment) @stage(fragment)
fn main(@location(0) vUV : vec2<f32>) -> @location(0) vec4<f32> { fn main(@location(0) vUV : vec2<f32>) -> @location(0) vec4<f32> {
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb; let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb;
var i = 0; var i = 0;
loop { loop {
if (i < 1) { if (i < 1) {
} else { } else {
break; break;
} }
let offset : vec3<f32> = vec3<f32>(random.x); let offset : vec3<f32> = vec3<f32>(random.x);
if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) { if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) {
i = i + 1; i = i + 1;
continue; continue;
} }
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
i = i + 1; i = i + 1;
} }
return vec4<f32>(1.0); return vec4<f32>(1.0);
} }

View File

@ -1,23 +1,23 @@
struct Simulation { struct Simulation {
i : u32, i : u32,
}; };
struct Particle { struct Particle {
position : array<vec3<f32>, 8>, position : array<vec3<f32>, 8>,
lifetime : f32, lifetime : f32,
color : vec4<f32>, color : vec4<f32>,
velocity : vec3<f32>, velocity : vec3<f32>,
}; };
struct Particles { struct Particles {
p : array<Particle>, p : array<Particle>,
}; };
@group(1) @binding(3) var<storage, read> particles : Particles; @group(1) @binding(3) var<storage, read> particles : Particles;
@group(1) @binding(4) var<uniform> sim : Simulation; @group(1) @binding(4) var<uniform> sim : Simulation;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var particle = particles.p[0]; var particle = particles.p[0];
particle.position[sim.i] = particle.position[sim.i]; particle.position[sim.i] = particle.position[sim.i];
} }

View File

@ -1,12 +1,12 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var m1 : mat2x4<f32>; var m1 : mat2x4<f32>;
m1[uniforms.i][0] = 1.0; m1[uniforms.i][0] = 1.0;
} }

View File

@ -1,12 +1,12 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var m1 : mat2x4<f32>; var m1 : mat2x4<f32>;
m1[uniforms.i][uniforms.j] = 1.0; m1[uniforms.i][uniforms.j] = 1.0;
} }

View File

@ -1,13 +1,13 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
var<private> m1 : mat2x4<f32>; var<private> m1 : mat2x4<f32>;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
m1[0][uniforms.j] = 1.0; m1[0][uniforms.j] = 1.0;
} }

View File

@ -1,12 +1,12 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var m1 : mat2x4<f32>; var m1 : mat2x4<f32>;
m1[uniforms.i] = vec4<f32>(1.0); m1[uniforms.i] = vec4<f32>(1.0);
} }

View File

@ -1,13 +1,13 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
var<private> m1 : mat2x4<f32>; var<private> m1 : mat2x4<f32>;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
m1[uniforms.i][0] = 1.0; m1[uniforms.i][0] = 1.0;
} }

View File

@ -1,13 +1,13 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
var<private> m1 : mat2x4<f32>; var<private> m1 : mat2x4<f32>;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
m1[uniforms.i][uniforms.j] = 1.0; m1[uniforms.i][uniforms.j] = 1.0;
} }

View File

@ -1,13 +1,13 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
var<private> m1 : mat2x4<f32>; var<private> m1 : mat2x4<f32>;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
m1[0][uniforms.j] = 1.0; m1[0][uniforms.j] = 1.0;
} }

View File

@ -1,13 +1,13 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
var<private> m1 : mat2x4<f32>; var<private> m1 : mat2x4<f32>;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
m1[uniforms.i] = vec4<f32>(1.0); m1[uniforms.i] = vec4<f32>(1.0);
} }

View File

@ -1,117 +1,117 @@
struct Scene { struct Scene {
vEyePosition : vec4<f32>, vEyePosition : vec4<f32>,
}; };
struct Material { struct Material {
vDiffuseColor : vec4<f32>, vDiffuseColor : vec4<f32>,
vAmbientColor : vec3<f32>, vAmbientColor : vec3<f32>,
dummy: f32, dummy: f32,
vEmissiveColor : vec3<f32>, vEmissiveColor : vec3<f32>,
dummy2: f32, dummy2: f32,
}; };
struct Mesh { struct Mesh {
visibility : f32, visibility : f32,
}; };
var<private> fClipDistance3 : f32; var<private> fClipDistance3 : f32;
var<private> fClipDistance4 : f32; var<private> fClipDistance4 : f32;
@group(0) @binding(0) var<uniform> x_29 : Scene; @group(0) @binding(0) var<uniform> x_29 : Scene;
@group(0) @binding(1) var<uniform> x_49 : Material; @group(0) @binding(1) var<uniform> x_49 : Material;
@group(0) @binding(2) var<uniform> x_137 : Mesh; @group(0) @binding(2) var<uniform> x_137 : Mesh;
var<private> glFragColor : vec4<f32>; var<private> glFragColor : vec4<f32>;
fn main_1() { fn main_1() {
var viewDirectionW : vec3<f32>; var viewDirectionW : vec3<f32>;
var baseColor : vec4<f32>; var baseColor : vec4<f32>;
var diffuseColor : vec3<f32>; var diffuseColor : vec3<f32>;
var alpha : f32; var alpha : f32;
var normalW : vec3<f32>; var normalW : vec3<f32>;
var uvOffset : vec2<f32>; var uvOffset : vec2<f32>;
var baseAmbientColor : vec3<f32>; var baseAmbientColor : vec3<f32>;
var glossiness : f32; var glossiness : f32;
var diffuseBase : vec3<f32>; var diffuseBase : vec3<f32>;
var shadow : f32; var shadow : f32;
var refractionColor : vec4<f32>; var refractionColor : vec4<f32>;
var reflectionColor : vec4<f32>; var reflectionColor : vec4<f32>;
var emissiveColor : vec3<f32>; var emissiveColor : vec3<f32>;
var finalDiffuse : vec3<f32>; var finalDiffuse : vec3<f32>;
var finalSpecular : vec3<f32>; var finalSpecular : vec3<f32>;
var color : vec4<f32>; var color : vec4<f32>;
let x_9 : f32 = fClipDistance3; let x_9 : f32 = fClipDistance3;
if ((x_9 > 0.0)) { if ((x_9 > 0.0)) {
discard; discard;
} }
let x_17 : f32 = fClipDistance4; let x_17 : f32 = fClipDistance4;
if ((x_17 > 0.0)) { if ((x_17 > 0.0)) {
discard; discard;
} }
let x_34 : vec4<f32> = x_29.vEyePosition; let x_34 : vec4<f32> = x_29.vEyePosition;
let x_38 : vec3<f32> = vec3<f32>(0., 0., 0.); let x_38 : vec3<f32> = vec3<f32>(0., 0., 0.);
viewDirectionW = normalize((vec3<f32>(x_34.x, x_34.y, x_34.z) - x_38)); viewDirectionW = normalize((vec3<f32>(x_34.x, x_34.y, x_34.z) - x_38));
baseColor = vec4<f32>(1.0, 1.0, 1.0, 1.0); baseColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
let x_52 : vec4<f32> = x_49.vDiffuseColor; let x_52 : vec4<f32> = x_49.vDiffuseColor;
diffuseColor = vec3<f32>(x_52.x, x_52.y, x_52.z); diffuseColor = vec3<f32>(x_52.x, x_52.y, x_52.z);
let x_60 : f32 = x_49.vDiffuseColor.w; let x_60 : f32 = x_49.vDiffuseColor.w;
alpha = x_60; alpha = x_60;
let x_62 : vec3<f32> = vec3<f32>(0., 0., 0.); let x_62 : vec3<f32> = vec3<f32>(0., 0., 0.);
let x_64 : vec3<f32> = vec3<f32>(0., 0., 0.); let x_64 : vec3<f32> = vec3<f32>(0., 0., 0.);
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64)))); normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
uvOffset = vec2<f32>(0.0, 0.0); uvOffset = vec2<f32>(0.0, 0.0);
let x_74 : vec4<f32> = vec4<f32>(0., 0., 0., 0.); let x_74 : vec4<f32> = vec4<f32>(0., 0., 0., 0.);
let x_76 : vec4<f32> = baseColor; let x_76 : vec4<f32> = baseColor;
let x_78 : vec3<f32> = (vec3<f32>(x_76.x, x_76.y, x_76.z) * vec3<f32>(x_74.x, x_74.y, x_74.z)); let x_78 : vec3<f32> = (vec3<f32>(x_76.x, x_76.y, x_76.z) * vec3<f32>(x_74.x, x_74.y, x_74.z));
let x_79 : vec4<f32> = baseColor; let x_79 : vec4<f32> = baseColor;
baseColor = vec4<f32>(x_78.x, x_78.y, x_78.z, x_79.w); baseColor = vec4<f32>(x_78.x, x_78.y, x_78.z, x_79.w);
baseAmbientColor = vec3<f32>(1.0, 1.0, 1.0); baseAmbientColor = vec3<f32>(1.0, 1.0, 1.0);
glossiness = 0.0; glossiness = 0.0;
diffuseBase = vec3<f32>(0.0, 0.0, 0.0); diffuseBase = vec3<f32>(0.0, 0.0, 0.0);
shadow = 1.0; shadow = 1.0;
refractionColor = vec4<f32>(0.0, 0.0, 0.0, 1.0); refractionColor = vec4<f32>(0.0, 0.0, 0.0, 1.0);
reflectionColor = vec4<f32>(0.0, 0.0, 0.0, 1.0); reflectionColor = vec4<f32>(0.0, 0.0, 0.0, 1.0);
let x_94 : vec3<f32> = x_49.vEmissiveColor; let x_94 : vec3<f32> = x_49.vEmissiveColor;
emissiveColor = x_94; emissiveColor = x_94;
let x_96 : vec3<f32> = diffuseBase; let x_96 : vec3<f32> = diffuseBase;
let x_97 : vec3<f32> = diffuseColor; let x_97 : vec3<f32> = diffuseColor;
let x_99 : vec3<f32> = emissiveColor; let x_99 : vec3<f32> = emissiveColor;
let x_103 : vec3<f32> = x_49.vAmbientColor; let x_103 : vec3<f32> = x_49.vAmbientColor;
let x_108 : vec4<f32> = baseColor; let x_108 : vec4<f32> = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(1.0, 1.0, 1.0)) * vec3<f32>(x_108.x, x_108.y, x_108.z)); finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(1.0, 1.0, 1.0)) * vec3<f32>(x_108.x, x_108.y, x_108.z));
finalSpecular = vec3<f32>(0.0, 0.0, 0.0); finalSpecular = vec3<f32>(0.0, 0.0, 0.0);
let x_113 : vec3<f32> = finalDiffuse; let x_113 : vec3<f32> = finalDiffuse;
let x_114 : vec3<f32> = baseAmbientColor; let x_114 : vec3<f32> = baseAmbientColor;
let x_116 : vec3<f32> = finalSpecular; let x_116 : vec3<f32> = finalSpecular;
let x_118 : vec4<f32> = reflectionColor; let x_118 : vec4<f32> = reflectionColor;
let x_121 : vec4<f32> = refractionColor; let x_121 : vec4<f32> = refractionColor;
let x_123 : vec3<f32> = ((((x_113 * x_114) + x_116) + vec3<f32>(x_118.x, x_118.y, x_118.z)) + vec3<f32>(x_121.x, x_121.y, x_121.z)); let x_123 : vec3<f32> = ((((x_113 * x_114) + x_116) + vec3<f32>(x_118.x, x_118.y, x_118.z)) + vec3<f32>(x_121.x, x_121.y, x_121.z));
let x_124 : f32 = alpha; let x_124 : f32 = alpha;
color = vec4<f32>(x_123.x, x_123.y, x_123.z, x_124); color = vec4<f32>(x_123.x, x_123.y, x_123.z, x_124);
let x_129 : vec4<f32> = color; let x_129 : vec4<f32> = color;
let x_132 : vec3<f32> = max(vec3<f32>(x_129.x, x_129.y, x_129.z), vec3<f32>(0.0, 0.0, 0.0)); let x_132 : vec3<f32> = max(vec3<f32>(x_129.x, x_129.y, x_129.z), vec3<f32>(0.0, 0.0, 0.0));
let x_133 : vec4<f32> = color; let x_133 : vec4<f32> = color;
color = vec4<f32>(x_132.x, x_132.y, x_132.z, x_133.w); color = vec4<f32>(x_132.x, x_132.y, x_132.z, x_133.w);
let x_140 : f32 = x_137.visibility; let x_140 : f32 = x_137.visibility;
let x_142 : f32 = color.w; let x_142 : f32 = color.w;
color.w = (x_142 * x_140); color.w = (x_142 * x_140);
let x_147 : vec4<f32> = color; let x_147 : vec4<f32> = color;
glFragColor = x_147; glFragColor = x_147;
return; return;
} }
struct main_out { struct main_out {
@location(0) @location(0)
glFragColor_1 : vec4<f32>, glFragColor_1 : vec4<f32>,
}; };
@stage(fragment) @stage(fragment)
fn main(@location(2) fClipDistance3_param : f32, @location(3) fClipDistance4_param : f32) -> main_out { fn main(@location(2) fClipDistance3_param : f32, @location(3) fClipDistance4_param : f32) -> main_out {
fClipDistance3 = fClipDistance3_param; fClipDistance3 = fClipDistance3_param;
fClipDistance4 = fClipDistance4_param; fClipDistance4 = fClipDistance4_param;
main_1(); main_1();
return main_out(glFragColor); return main_out(glFragColor);
} }

View File

@ -1,48 +1,48 @@
struct Uniforms { struct Uniforms {
dstTextureFlipY : u32, dstTextureFlipY : u32,
isFloat16 : u32, isFloat16 : u32,
isRGB10A2Unorm : u32, isRGB10A2Unorm : u32,
channelCount : u32, channelCount : u32,
}; };
struct OutputBuf { struct OutputBuf {
result : array<u32>, result : array<u32>,
}; };
@group(0) @binding(0) var src : texture_2d<f32>; @group(0) @binding(0) var src : texture_2d<f32>;
@group(0) @binding(1) var dst : texture_2d<f32>; @group(0) @binding(1) var dst : texture_2d<f32>;
@group(0) @binding(2) var<storage_buffer, read_write> output : OutputBuf; @group(0) @binding(2) var<storage_buffer, read_write> output : OutputBuf;
@group(0) @binding(3) var<uniform> uniforms : Uniforms; @group(0) @binding(3) var<uniform> uniforms : Uniforms;
//@builtin(global_invocation_id) var<in> GlobalInvocationID : vec3<u32>; //@builtin(global_invocation_id) var<in> GlobalInvocationID : vec3<u32>;
// Fp16 logic // Fp16 logic
// Infinity and NaN won't happen in this test case. // Infinity and NaN won't happen in this test case.
fn ConvertToFp16FloatValue(fp32 : f32) -> u32 { fn ConvertToFp16FloatValue(fp32 : f32) -> u32 {
return 1u; return 1u;
} }
@stage(compute) @workgroup_size(1, 1, 1) @stage(compute) @workgroup_size(1, 1, 1)
fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) { fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) {
var size : vec2<i32> = textureDimensions(src); var size : vec2<i32> = textureDimensions(src);
var dstTexCoord : vec2<i32> = vec2<i32>(GlobalInvocationID.xy); var dstTexCoord : vec2<i32> = vec2<i32>(GlobalInvocationID.xy);
var srcTexCoord : vec2<i32> = dstTexCoord; var srcTexCoord : vec2<i32> = dstTexCoord;
if (uniforms.dstTextureFlipY == 1u) { if (uniforms.dstTextureFlipY == 1u) {
srcTexCoord.y = size.y - dstTexCoord.y - 1; srcTexCoord.y = size.y - dstTexCoord.y - 1;
} }
var srcColor : vec4<f32> = textureLoad(src, srcTexCoord, 0); var srcColor : vec4<f32> = textureLoad(src, srcTexCoord, 0);
var dstColor : vec4<f32> = textureLoad(dst, dstTexCoord, 0); var dstColor : vec4<f32> = textureLoad(dst, dstTexCoord, 0);
var success : bool = true; var success : bool = true;
var srcColorBits : vec4<u32>; var srcColorBits : vec4<u32>;
var dstColorBits : vec4<u32> = vec4<u32>(dstColor); var dstColorBits : vec4<u32> = vec4<u32>(dstColor);
for (var i : u32 = 0u; i < uniforms.channelCount; i = i + 1u) { for (var i : u32 = 0u; i < uniforms.channelCount; i = i + 1u) {
srcColorBits[i] = ConvertToFp16FloatValue(srcColor[i]); srcColorBits[i] = ConvertToFp16FloatValue(srcColor[i]);
success = success && (srcColorBits[i] == dstColorBits[i]); success = success && (srcColorBits[i] == dstColorBits[i]);
} }
var outputIndex : u32 = GlobalInvocationID.y * u32(size.x) + GlobalInvocationID.x; var outputIndex : u32 = GlobalInvocationID.y * u32(size.x) + GlobalInvocationID.x;
if (success) { if (success) {
output.result[outputIndex] = u32(1); output.result[outputIndex] = u32(1);
} else { } else {
output.result[outputIndex] = u32(0); output.result[outputIndex] = u32(0);
} }
} }

View File

@ -1,24 +1,24 @@
struct MyStruct { struct MyStruct {
f1 : f32, f1 : f32,
}; };
type MyArray = array<f32, 10>; type MyArray = array<f32, 10>;
// Global lets // Global lets
let v1 = 1; let v1 = 1;
let v2 = 1u; let v2 = 1u;
let v3 = 1.0; let v3 = 1.0;
let v4 = vec3<i32>(1, 1, 1); let v4 = vec3<i32>(1, 1, 1);
let v5 = vec3<u32>(1u, 1u, 1u); let v5 = vec3<u32>(1u, 1u, 1u);
let v6 = vec3<f32>(1.0, 1.0, 1.0); let v6 = vec3<f32>(1.0, 1.0, 1.0);
let v7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0)); let v7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
let v8 = MyStruct(); let v8 = MyStruct();
let v9 = MyArray(); let v9 = MyArray();
@stage(fragment) @stage(fragment)
fn main() -> @location(0) vec4<f32> { fn main() -> @location(0) vec4<f32> {
return vec4<f32>(0.0,0.0,0.0,0.0); return vec4<f32>(0.0,0.0,0.0,0.0);
} }

View File

@ -1,39 +1,39 @@
struct MyStruct { struct MyStruct {
f1 : f32, f1 : f32,
}; };
type MyArray = array<f32, 10>; type MyArray = array<f32, 10>;
fn ret_i32() -> i32 { return 1; } fn ret_i32() -> i32 { return 1; }
fn ret_u32() -> u32 { return 1u; } fn ret_u32() -> u32 { return 1u; }
fn ret_f32() -> f32 { return 1.0; } fn ret_f32() -> f32 { return 1.0; }
fn ret_MyStruct() -> MyStruct { return MyStruct(); } fn ret_MyStruct() -> MyStruct { return MyStruct(); }
fn ret_MyArray() -> MyArray { return MyArray(); } fn ret_MyArray() -> MyArray { return MyArray(); }
// Local lets // Local lets
fn let_decls() { fn let_decls() {
let v1 = 1; let v1 = 1;
let v2 = 1u; let v2 = 1u;
let v3 = 1.0; let v3 = 1.0;
let v4 = vec3<i32>(1, 1, 1); let v4 = vec3<i32>(1, 1, 1);
let v5 = vec3<u32>(1u, 1u, 1u); let v5 = vec3<u32>(1u, 1u, 1u);
let v6 = vec3<f32>(1.0, 1.0, 1.0); let v6 = vec3<f32>(1.0, 1.0, 1.0);
let v7 = mat3x3<f32>(v6, v6, v6); let v7 = mat3x3<f32>(v6, v6, v6);
let v8 = MyStruct(1.0); let v8 = MyStruct(1.0);
let v9 = MyArray(); let v9 = MyArray();
let v10 = ret_i32(); let v10 = ret_i32();
let v11 = ret_u32(); let v11 = ret_u32();
let v12 = ret_f32(); let v12 = ret_f32();
let v13 = ret_MyStruct(); let v13 = ret_MyStruct();
let v14 = ret_MyStruct(); let v14 = ret_MyStruct();
let v15 = ret_MyArray(); let v15 = ret_MyArray();
} }
@stage(fragment) @stage(fragment)
fn main() -> @location(0) vec4<f32> { fn main() -> @location(0) vec4<f32> {
return vec4<f32>(0.0,0.0,0.0,0.0); return vec4<f32>(0.0,0.0,0.0,0.0);
} }

View File

@ -1,22 +1,22 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<InnerS, 8>, a1 : array<InnerS, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
for (var i: i32 = 0; i < 4; i = i + 1) { for (var i: i32 = 0; i < 4; i = i + 1) {
s1.a1[uniforms.i] = v; s1.a1[uniforms.i] = v;
} }
} }

View File

@ -1,22 +1,22 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<InnerS, 8>, a1 : array<InnerS, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
for (var i: i32 = 0; i < 4; s1.a1[uniforms.i] = v) { for (var i: i32 = 0; i < 4; s1.a1[uniforms.i] = v) {
i = i + 1; i = i + 1;
} }
} }

View File

@ -1,22 +1,22 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<InnerS, 8>, a1 : array<InnerS, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
var i: i32 = 0; var i: i32 = 0;
for (s1.a1[uniforms.i] = v; i < 4; i = i + 1) { for (s1.a1[uniforms.i] = v; i < 4; i = i + 1) {
} }
} }

View File

@ -1,31 +1,31 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct S1 { struct S1 {
a2 : array<InnerS, 8>, a2 : array<InnerS, 8>,
}; };
struct OuterS { struct OuterS {
a1 : array<S1, 8>, a1 : array<S1, 8>,
}; };
var<private> nextIndex : u32; var<private> nextIndex : u32;
fn getNextIndex() -> u32 { fn getNextIndex() -> u32 {
nextIndex = nextIndex + 1u; nextIndex = nextIndex + 1u;
return nextIndex; return nextIndex;
} }
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s : OuterS; var s : OuterS;
s.a1[getNextIndex()].a2[uniforms.j] = v; s.a1[getNextIndex()].a2[uniforms.j] = v;
} }

View File

@ -1,21 +1,21 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<InnerS, 8>, a1 : array<InnerS, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
s1.a1[uniforms.i] = v; s1.a1[uniforms.i] = v;
//s1.a1[0] = v; //s1.a1[0] = v;
} }

View File

@ -1,21 +1,21 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<array<InnerS, 8>, 8>, a1 : array<array<InnerS, 8>, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
s1.a1[uniforms.i][uniforms.j] = v; s1.a1[uniforms.i][uniforms.j] = v;
} }

View File

@ -1,24 +1,24 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct S1 { struct S1 {
s2 : InnerS, s2 : InnerS,
}; };
struct OuterS { struct OuterS {
a1 : array<S1, 8>, a1 : array<S1, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
s1.a1[uniforms.i].s2 = v; s1.a1[uniforms.i].s2 = v;
} }

View File

@ -1,25 +1,25 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct S1 { struct S1 {
a2 : array<InnerS, 8>, a2 : array<InnerS, 8>,
}; };
struct OuterS { struct OuterS {
a1 : array<S1, 8>, a1 : array<S1, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s : OuterS; var s : OuterS;
s.a1[uniforms.i].a2[uniforms.j] = v; s.a1[uniforms.i].a2[uniforms.j] = v;
} }

View File

@ -1,20 +1,20 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<InnerS>, a1 : array<InnerS>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@binding(0) @group(0) var<storage, read_write> s1 : OuterS; @binding(0) @group(0) var<storage, read_write> s1 : OuterS;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
s1.a1[uniforms.i] = v; s1.a1[uniforms.i] = v;
} }

View File

@ -1,25 +1,25 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
j : u32, j : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct S1 { struct S1 {
a2 : array<InnerS, 8>, a2 : array<InnerS, 8>,
}; };
struct OuterS { struct OuterS {
a1 : array<S1>, a1 : array<S1>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@binding(0) @group(0) var<storage, read_write> s : OuterS; @binding(0) @group(0) var<storage, read_write> s : OuterS;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
s.a1[uniforms.i].a2[uniforms.j] = v; s.a1[uniforms.i].a2[uniforms.j] = v;
} }

View File

@ -1,16 +1,16 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct OuterS { struct OuterS {
m1 : mat2x4<f32>, m1 : mat2x4<f32>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var s1 : OuterS; var s1 : OuterS;
s1.m1[uniforms.i] = vec4<f32>(1.0); s1.m1[uniforms.i] = vec4<f32>(1.0);
s1.m1[uniforms.i][uniforms.i] = 1.0; s1.m1[uniforms.i][uniforms.i] = 1.0;
} }

View File

@ -1,22 +1,22 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<InnerS, 8>, a1 : array<InnerS, 8>,
a2 : array<InnerS, 8>, a2 : array<InnerS, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
s1.a1[uniforms.i] = v; s1.a1[uniforms.i] = v;
s1.a2[uniforms.i] = v; s1.a2[uniforms.i] = v;
} }

View File

@ -1,24 +1,24 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct S1 { struct S1 {
a : array<InnerS, 8>, a : array<InnerS, 8>,
}; };
struct OuterS { struct OuterS {
s2 : S1, s2 : S1,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
s1.s2.a[uniforms.i] = v; s1.s2.a[uniforms.i] = v;
} }

View File

@ -1,15 +1,15 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct OuterS { struct OuterS {
v1 : vec3<f32>, v1 : vec3<f32>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var s1 : OuterS; var s1 : OuterS;
s1.v1[uniforms.i] = 1.0; s1.v1[uniforms.i] = 1.0;
} }

View File

@ -1,21 +1,21 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct OuterS { struct OuterS {
a1 : array<u32, 8>, a1 : array<u32, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
fn f(i: u32) -> u32 { fn f(i: u32) -> u32 {
return i + 1u; return i + 1u;
} }
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var s1 : OuterS; var s1 : OuterS;
var v : vec3<f32>; var v : vec3<f32>;
v[s1.a1[uniforms.i]] = 1.0; v[s1.a1[uniforms.i]] = 1.0;
v[f(s1.a1[uniforms.i])] = 1.0; v[f(s1.a1[uniforms.i])] = 1.0;
} }

View File

@ -1,21 +1,21 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<InnerS, 8>, a1 : array<InnerS, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var v : InnerS; var v : InnerS;
var s1 : OuterS; var s1 : OuterS;
let p = &(s1.a1[uniforms.i]); let p = &(s1.a1[uniforms.i]);
*p = v; *p = v;
} }

View File

@ -1,21 +1,21 @@
struct Uniforms { struct Uniforms {
i : u32, i : u32,
}; };
struct InnerS { struct InnerS {
v : i32, v : i32,
}; };
struct OuterS { struct OuterS {
a1 : array<InnerS, 8>, a1 : array<InnerS, 8>,
}; };
@group(1) @binding(4) var<uniform> uniforms : Uniforms; @group(1) @binding(4) var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, OuterS>) { fn f(p : ptr<function, OuterS>) {
var v : InnerS; var v : InnerS;
(*p).a1[uniforms.i] = v; (*p).a1[uniforms.i] = v;
} }
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn main() { fn main() {
var s1 : OuterS; var s1 : OuterS;
f(&s1); f(&s1);
} }

View File

@ -1,20 +1,20 @@
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn f() { fn f() {
var i : i32; var i : i32;
var result : i32; var result : i32;
switch(i) { switch(i) {
case 0: { case 0: {
result = 10; result = 10;
} }
case 1: { case 1: {
result = 22; result = 22;
} }
case 2: { case 2: {
result = 33; result = 33;
} }
default: { default: {
result = 44; result = 44;
break; break;
} }
} }
} }

View File

@ -1,11 +1,11 @@
@stage(compute) @workgroup_size(1) @stage(compute) @workgroup_size(1)
fn f() { fn f() {
var i : i32; var i : i32;
var result : i32; var result : i32;
switch(i) { switch(i) {
default: { default: {
result = 44; result = 44;
break; break;
} }
} }
} }

View File

@ -1,39 +1,39 @@
struct MyStruct { struct MyStruct {
f1 : f32, f1 : f32,
}; };
type MyArray = array<f32, 10>; type MyArray = array<f32, 10>;
fn ret_i32() -> i32 { return 1; } fn ret_i32() -> i32 { return 1; }
fn ret_u32() -> u32 { return 1u; } fn ret_u32() -> u32 { return 1u; }
fn ret_f32() -> f32 { return 1.0; } fn ret_f32() -> f32 { return 1.0; }
fn ret_MyStruct() -> MyStruct { return MyStruct(); } fn ret_MyStruct() -> MyStruct { return MyStruct(); }
fn ret_MyArray() -> MyArray { return MyArray(); } fn ret_MyArray() -> MyArray { return MyArray(); }
// Local variables // Local variables
fn var_decls() { fn var_decls() {
var v1 = 1; var v1 = 1;
var v2 = 1u; var v2 = 1u;
var v3 = 1.0; var v3 = 1.0;
var v4 = vec3<i32>(1, 1, 1); var v4 = vec3<i32>(1, 1, 1);
var v5 = vec3<u32>(1u, 1u, 1u); var v5 = vec3<u32>(1u, 1u, 1u);
var v6 = vec3<f32>(1.0, 1.0, 1.0); var v6 = vec3<f32>(1.0, 1.0, 1.0);
var v7 = mat3x3<f32>(v6, v6, v6); var v7 = mat3x3<f32>(v6, v6, v6);
var v8 = MyStruct(1.0); var v8 = MyStruct(1.0);
var v9 = MyArray(); var v9 = MyArray();
var v10 = ret_i32(); var v10 = ret_i32();
var v11 = ret_u32(); var v11 = ret_u32();
var v12 = ret_f32(); var v12 = ret_f32();
var v13 = ret_MyStruct(); var v13 = ret_MyStruct();
var v14 = ret_MyStruct(); var v14 = ret_MyStruct();
var v15 = ret_MyArray(); var v15 = ret_MyArray();
} }
@stage(fragment) @stage(fragment)
fn main() -> @location(0) vec4<f32> { fn main() -> @location(0) vec4<f32> {
return vec4<f32>(0.0,0.0,0.0,0.0); return vec4<f32>(0.0,0.0,0.0,0.0);
} }

View File

@ -82,9 +82,9 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\u1jmg.0:77: error: Loop must have break. C:\src\temp\u1jmg.0:77: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -82,9 +82,9 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\u1v1c.0:77: error: Loop must have break. C:\src\temp\u1v1c.0:77: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -93,9 +93,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\u1r54.0:88: error: Loop must have break. C:\src\temp\u1r54.0:88: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -93,9 +93,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\usgc.0:88: error: Loop must have break. C:\src\temp\usgc.0:88: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -67,9 +67,9 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\u17p0.0:62: error: Loop must have break. C:\src\temp\u17p0.0:62: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -67,9 +67,9 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\uvqg.0:62: error: Loop must have break. C:\src\temp\uvqg.0:62: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -115,5 +115,5 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 Internal compiler error: access violation. Attempted to read from address 0x0000000000000048

View File

@ -115,5 +115,5 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 Internal compiler error: access violation. Attempted to read from address 0x0000000000000048

View File

@ -45,9 +45,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\u11r8.0:40: error: Loop must have break. C:\src\temp\u11r8.0:40: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -45,9 +45,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\u1v50.0:40: error: Loop must have break. C:\src\temp\u1v50.0:40: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -50,9 +50,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\u1f84.0:45: error: Loop must have break. C:\src\temp\u1f84.0:45: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -50,9 +50,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\uk3k.0:45: error: Loop must have break. C:\src\temp\uk3k.0:45: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -54,5 +54,5 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 Internal compiler error: access violation. Attempted to read from address 0x0000000000000048

View File

@ -54,5 +54,5 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 Internal compiler error: access violation. Attempted to read from address 0x0000000000000048

View File

@ -98,9 +98,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\umdw.0:93: error: Loop must have break. C:\src\temp\umdw.0:93: error: Loop must have break.
Validation failed. Validation failed.

View File

@ -110,9 +110,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result; return wrapper_result;
} }
error: validation errors error: validation errors
C:\src\temp\u1tig.0:105: error: Loop must have break. C:\src\temp\u1tig.0:105: error: Loop must have break.
Validation failed. Validation failed.