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>fixes
parent
6249b24581
commit
4d36557bce
@ -1,4 +1,9 @@ |
||||
* text=auto |
||||
*.sh eol=lf |
||||
*.gn eol=lf |
||||
*.gni eol=lf |
||||
* text=auto |
||||
*.glsl eol=lf |
||||
*.gn eol=lf |
||||
*.gni eol=lf |
||||
*.hlsl eol=lf |
||||
*.msl eol=lf |
||||
*.sh eol=lf |
||||
*.spvasm eol=lf |
||||
*.wgsl eol=lf |
||||
|
@ -1,189 +1,189 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
/// Copyright 2021 The Tint Authors. |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
--> |
||||
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> |
||||
<Type Name="tint::Symbol"> |
||||
<!-- Requires TINT_SYMBOL_STORE_DEBUG_NAME defined to 1 --> |
||||
<DisplayString Optional="true">{debug_name_,sb}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::AssignmentStatement"> |
||||
<DisplayString>{*lhs} = {*rhs};</DisplayString> |
||||
<Expand> |
||||
<Item Name="lhs">*lhs</Item> |
||||
<Item Name="rhs">*rhs</Item> |
||||
</Expand> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::IfStatement"> |
||||
<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() == 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]} else {else_statements.size()-3} more...</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::ElseStatement"> |
||||
<DisplayString Condition="!condition">else {*body}</DisplayString> |
||||
<DisplayString Condition="!!condition">else if ({*condition}) {*body}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::BlockStatement"> |
||||
<DisplayString Condition="statements.size() == 1">{{ {*statements[0]} }} </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]} {statements.size()-3} more... }} </DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::ReturnStatement"> |
||||
<DisplayString Condition="!value">return;</DisplayString> |
||||
<DisplayString Condition="!!value">return {*value};</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::Function"> |
||||
<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() == 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]} {params.size()-3} more...) -> {*return_type} {*body}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::IdentifierExpression"> |
||||
<!--the ",sb" specifier removes the double quotes on the displayed string --> |
||||
<DisplayString>{symbol}</DisplayString> |
||||
<Expand> |
||||
<Item Name="symbol">symbol</Item> |
||||
</Expand> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::IndexAccessorExpression"> |
||||
<DisplayString>{*object}[{*index}]</DisplayString> |
||||
<Expand> |
||||
<Item Name="object">*object</Item> |
||||
<Item Name="index">*index</Item> |
||||
</Expand> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::MemberAccessorExpression"> |
||||
<DisplayString>{*structure}.{*member}</DisplayString> |
||||
<Expand> |
||||
<Item Name="structure">*structure</Item> |
||||
<Item Name="member">*member</Item> |
||||
</Expand> |
||||
</Type> |
||||
|
||||
<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 --> |
||||
<DisplayString Condition=" is_const & !!type & !constructor">{symbol} : {*type}</DisplayString> |
||||
|
||||
<DisplayString Condition=" is_const & !!type & !!constructor">let {symbol} : {*type} = {*constructor}</DisplayString> |
||||
<DisplayString Condition=" is_const & !type & !constructor">let {symbol} = {*constructor}</DisplayString> |
||||
<DisplayString Condition="!is_const & !!type & !!constructor">var {symbol} : {*type} = {*constructor}</DisplayString> |
||||
<DisplayString Condition="!is_const & !type & !!constructor">var {symbol} = {*constructor}</DisplayString> |
||||
<DisplayString Condition="!is_const & !!type & !constructor">var {symbol}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::VariableDeclStatement"> |
||||
<DisplayString>{*variable};</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::UintLiteralExpression"> |
||||
<DisplayString>{value}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::SintLiteralExpression"> |
||||
<DisplayString>{value}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::BoolLiteralExpression"> |
||||
<DisplayString>{value}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::Void"> |
||||
<DisplayString>void</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::UnaryOpExpression"> |
||||
<DisplayString Condition="op==tint::ast::UnaryOp::kAddressOf">&({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::kNegation">-({expr})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::UnaryOp::kNot">!({expr})</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::BinaryExpression"> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kNone">({*lhs} NONE {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kAnd">({*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::kLogicalAnd">({*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::kNotEqual">({*lhs} != {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kLessThan">({*lhs} < {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThan">({*lhs} > {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kLessThanEqual">({*lhs} <= {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThanEqual">({*lhs} >= {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kShiftLeft">({*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::kSubtract">({*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::kModulo">({*lhs} % {*rhs})</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::CallExpression"> |
||||
<DisplayString Condition="args.size() == 0">{target}()</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() == 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> |
||||
<!-- TODO: add more overloads --> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::CallExpression::Target"> |
||||
<DisplayString Condition ="name != nullptr">{*name}</DisplayString> |
||||
<DisplayString Condition ="name == nullptr">{*type}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::Array"> |
||||
<DisplayString Condition="count != nullptr">array<{*type},{*count}></DisplayString> |
||||
<DisplayString Condition="count == nullptr">array<{*type}></DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::TypeName"> |
||||
<DisplayString>{name}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::Bool"> |
||||
<DisplayString>bool</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::I32"> |
||||
<DisplayString>i32</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::U32"> |
||||
<DisplayString>u32</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::F32"> |
||||
<DisplayString>f32</DisplayString> |
||||
</Type> |
||||
|
||||
</AutoVisualizer> |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
/// Copyright 2021 The Tint Authors. |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
--> |
||||
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> |
||||
<Type Name="tint::Symbol"> |
||||
<!-- Requires TINT_SYMBOL_STORE_DEBUG_NAME defined to 1 --> |
||||
<DisplayString Optional="true">{debug_name_,sb}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::AssignmentStatement"> |
||||
<DisplayString>{*lhs} = {*rhs};</DisplayString> |
||||
<Expand> |
||||
<Item Name="lhs">*lhs</Item> |
||||
<Item Name="rhs">*rhs</Item> |
||||
</Expand> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::IfStatement"> |
||||
<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() == 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]} else {else_statements.size()-3} more...</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::ElseStatement"> |
||||
<DisplayString Condition="!condition">else {*body}</DisplayString> |
||||
<DisplayString Condition="!!condition">else if ({*condition}) {*body}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::BlockStatement"> |
||||
<DisplayString Condition="statements.size() == 1">{{ {*statements[0]} }} </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]} {statements.size()-3} more... }} </DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::ReturnStatement"> |
||||
<DisplayString Condition="!value">return;</DisplayString> |
||||
<DisplayString Condition="!!value">return {*value};</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::Function"> |
||||
<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() == 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]} {params.size()-3} more...) -> {*return_type} {*body}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::IdentifierExpression"> |
||||
<!--the ",sb" specifier removes the double quotes on the displayed string --> |
||||
<DisplayString>{symbol}</DisplayString> |
||||
<Expand> |
||||
<Item Name="symbol">symbol</Item> |
||||
</Expand> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::IndexAccessorExpression"> |
||||
<DisplayString>{*object}[{*index}]</DisplayString> |
||||
<Expand> |
||||
<Item Name="object">*object</Item> |
||||
<Item Name="index">*index</Item> |
||||
</Expand> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::MemberAccessorExpression"> |
||||
<DisplayString>{*structure}.{*member}</DisplayString> |
||||
<Expand> |
||||
<Item Name="structure">*structure</Item> |
||||
<Item Name="member">*member</Item> |
||||
</Expand> |
||||
</Type> |
||||
|
||||
<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 --> |
||||
<DisplayString Condition=" is_const & !!type & !constructor">{symbol} : {*type}</DisplayString> |
||||
|
||||
<DisplayString Condition=" is_const & !!type & !!constructor">let {symbol} : {*type} = {*constructor}</DisplayString> |
||||
<DisplayString Condition=" is_const & !type & !constructor">let {symbol} = {*constructor}</DisplayString> |
||||
<DisplayString Condition="!is_const & !!type & !!constructor">var {symbol} : {*type} = {*constructor}</DisplayString> |
||||
<DisplayString Condition="!is_const & !type & !!constructor">var {symbol} = {*constructor}</DisplayString> |
||||
<DisplayString Condition="!is_const & !!type & !constructor">var {symbol}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::VariableDeclStatement"> |
||||
<DisplayString>{*variable};</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::UintLiteralExpression"> |
||||
<DisplayString>{value}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::SintLiteralExpression"> |
||||
<DisplayString>{value}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::BoolLiteralExpression"> |
||||
<DisplayString>{value}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::Void"> |
||||
<DisplayString>void</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::UnaryOpExpression"> |
||||
<DisplayString Condition="op==tint::ast::UnaryOp::kAddressOf">&({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::kNegation">-({expr})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::UnaryOp::kNot">!({expr})</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::BinaryExpression"> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kNone">({*lhs} NONE {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kAnd">({*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::kLogicalAnd">({*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::kNotEqual">({*lhs} != {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kLessThan">({*lhs} < {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThan">({*lhs} > {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kLessThanEqual">({*lhs} <= {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kGreaterThanEqual">({*lhs} >= {*rhs})</DisplayString> |
||||
<DisplayString Condition="op==tint::ast::BinaryOp::kShiftLeft">({*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::kSubtract">({*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::kModulo">({*lhs} % {*rhs})</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::CallExpression"> |
||||
<DisplayString Condition="args.size() == 0">{target}()</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() == 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> |
||||
<!-- TODO: add more overloads --> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::CallExpression::Target"> |
||||
<DisplayString Condition ="name != nullptr">{*name}</DisplayString> |
||||
<DisplayString Condition ="name == nullptr">{*type}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::Array"> |
||||
<DisplayString Condition="count != nullptr">array<{*type},{*count}></DisplayString> |
||||
<DisplayString Condition="count == nullptr">array<{*type}></DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::TypeName"> |
||||
<DisplayString>{name}</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::Bool"> |
||||
<DisplayString>bool</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::I32"> |
||||
<DisplayString>i32</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::U32"> |
||||
<DisplayString>u32</DisplayString> |
||||
</Type> |
||||
|
||||
<Type Name="tint::ast::F32"> |
||||
<DisplayString>f32</DisplayString> |
||||
</Type> |
||||
|
||||
</AutoVisualizer> |
||||
|
@ -1,63 +1,63 @@ |
||||
struct Uniforms { |
||||
u_scale : vec2<f32>, |
||||
u_offset : vec2<f32>, |
||||
}; |
||||
@binding(0) @group(0) var<uniform> uniforms : Uniforms; |
||||
|
||||
struct VertexOutputs { |
||||
@location(0) texcoords : vec2<f32>, |
||||
@builtin(position) position : vec4<f32>, |
||||
}; |
||||
|
||||
@stage(vertex) fn vs_main( |
||||
@builtin(vertex_index) VertexIndex : u32 |
||||
) -> VertexOutputs { |
||||
var texcoord = array<vec2<f32>, 3>( |
||||
vec2<f32>(-0.5, 0.0), |
||||
vec2<f32>( 1.5, 0.0), |
||||
vec2<f32>( 0.5, 2.0)); |
||||
|
||||
var output : VertexOutputs; |
||||
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 |
||||
// flipY case can get negative number. |
||||
var flipY = uniforms.u_scale.y < 0.0; |
||||
|
||||
// Texture coordinate takes top-left as origin point. We need to map the |
||||
// texture to triangle carefully. |
||||
if (flipY) { |
||||
// 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 |
||||
// 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) * |
||||
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0); |
||||
} else { |
||||
// For the normal case, we need to get the exact position. |
||||
// So mapping texture to triangle firstly then adopt the transform. |
||||
output.texcoords = (texcoord[VertexIndex] * |
||||
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0)) * |
||||
uniforms.u_scale + uniforms.u_offset; |
||||
} |
||||
|
||||
return output; |
||||
} |
||||
|
||||
@binding(1) @group(0) var mySampler: sampler; |
||||
@binding(2) @group(0) var myTexture: texture_2d<f32>; |
||||
|
||||
@stage(fragment) fn fs_main( |
||||
@location(0) texcoord : vec2<f32> |
||||
) -> @location(0) vec4<f32> { |
||||
// Clamp the texcoord and discard the out-of-bound pixels. |
||||
var clampedTexcoord = |
||||
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0)); |
||||
if (!all(clampedTexcoord == texcoord)) { |
||||
discard; |
||||
} |
||||
|
||||
var srcColor = textureSample(myTexture, mySampler, texcoord); |
||||
// 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. |
||||
return srcColor; |
||||
} |
||||
struct Uniforms { |
||||
u_scale : vec2<f32>, |
||||
u_offset : vec2<f32>, |
||||
}; |
||||
@binding(0) @group(0) var<uniform> uniforms : Uniforms; |
||||
|
||||
struct VertexOutputs { |
||||
@location(0) texcoords : vec2<f32>, |
||||
@builtin(position) position : vec4<f32>, |
||||
}; |
||||
|
||||
@stage(vertex) fn vs_main( |
||||
@builtin(vertex_index) VertexIndex : u32 |
||||
) -> VertexOutputs { |
||||
var texcoord = array<vec2<f32>, 3>( |
||||
vec2<f32>(-0.5, 0.0), |
||||
vec2<f32>( 1.5, 0.0), |
||||
vec2<f32>( 0.5, 2.0)); |
||||
|
||||
var output : VertexOutputs; |
||||
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 |
||||
// flipY case can get negative number. |
||||
var flipY = uniforms.u_scale.y < 0.0; |
||||
|
||||
// Texture coordinate takes top-left as origin point. We need to map the |
||||
// texture to triangle carefully. |
||||
if (flipY) { |
||||
// 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 |
||||
// 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) * |
||||
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0); |
||||
} else { |
||||
// For the normal case, we need to get the exact position. |
||||
// So mapping texture to triangle firstly then adopt the transform. |
||||
output.texcoords = (texcoord[VertexIndex] * |
||||
vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0)) * |
||||
uniforms.u_scale + uniforms.u_offset; |
||||
} |
||||
|
||||
return output; |
||||
} |
||||
|
||||
@binding(1) @group(0) var mySampler: sampler; |
||||
@binding(2) @group(0) var myTexture: texture_2d<f32>; |
||||
|
||||
@stage(fragment) fn fs_main( |
||||
@location(0) texcoord : vec2<f32> |
||||
) -> @location(0) vec4<f32> { |
||||
// Clamp the texcoord and discard the out-of-bound pixels. |
||||
var clampedTexcoord = |
||||
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0)); |
||||
if (!all(clampedTexcoord == texcoord)) { |
||||
discard; |
||||
} |
||||
|
||||
var srcColor = textureSample(myTexture, mySampler, texcoord); |
||||
// 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. |
||||
return srcColor; |
||||
} |
||||
|
@ -1,28 +1,28 @@ |
||||
// 1112.wgsl |
||||
@group(0) @binding(0) var Sampler: sampler; |
||||
@group(0) @binding(1) var randomTexture: texture_2d<f32>; |
||||
@group(0) @binding(2) var depthTexture: texture_2d<f32>; |
||||
|
||||
@stage(fragment) |
||||
fn main(@location(0) vUV : vec2<f32>) -> @location(0) vec4<f32> { |
||||
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb; |
||||
|
||||
var i = 0; |
||||
loop { |
||||
if (i < 1) { |
||||
} else { |
||||
break; |
||||
} |
||||
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) { |
||||
i = i + 1; |
||||
continue; |
||||
} |
||||
|
||||
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; |
||||
i = i + 1; |
||||
} |
||||
|
||||
return vec4<f32>(1.0); |
||||
} |
||||
// 1112.wgsl |
||||
@group(0) @binding(0) var Sampler: sampler; |
||||
@group(0) @binding(1) var randomTexture: texture_2d<f32>; |
||||
@group(0) @binding(2) var depthTexture: texture_2d<f32>; |
||||
|
||||
@stage(fragment) |
||||
fn main(@location(0) vUV : vec2<f32>) -> @location(0) vec4<f32> { |
||||
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb; |
||||
|
||||
var i = 0; |
||||
loop { |
||||
if (i < 1) { |
||||
} else { |
||||
break; |
||||
} |
||||
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) { |
||||
i = i + 1; |
||||
continue; |
||||
} |
||||
|
||||
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; |
||||
i = i + 1; |
||||
} |
||||
|
||||
return vec4<f32>(1.0); |
||||
} |
||||
|
@ -1,23 +1,23 @@ |
||||
struct Simulation { |
||||
i : u32, |
||||
}; |
||||
|
||||
struct Particle { |
||||
position : array<vec3<f32>, 8>, |
||||
lifetime : f32, |
||||
color : vec4<f32>, |
||||
velocity : vec3<f32>, |
||||
}; |
||||
|
||||
struct Particles { |
||||
p : array<Particle>, |
||||
}; |
||||
|
||||
@group(1) @binding(3) var<storage, read> particles : Particles; |
||||
@group(1) @binding(4) var<uniform> sim : Simulation; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var particle = particles.p[0]; |
||||
particle.position[sim.i] = particle.position[sim.i]; |
||||
} |
||||
struct Simulation { |
||||
i : u32, |
||||
}; |
||||
|
||||
struct Particle { |
||||
position : array<vec3<f32>, 8>, |
||||
lifetime : f32, |
||||
color : vec4<f32>, |
||||
velocity : vec3<f32>, |
||||
}; |
||||
|
||||
struct Particles { |
||||
p : array<Particle>, |
||||
}; |
||||
|
||||
@group(1) @binding(3) var<storage, read> particles : Particles; |
||||
@group(1) @binding(4) var<uniform> sim : Simulation; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var particle = particles.p[0]; |
||||
particle.position[sim.i] = particle.position[sim.i]; |
||||
} |
||||
|
@ -1,12 +1,12 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var m1 : mat2x4<f32>; |
||||
m1[uniforms.i][0] = 1.0; |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var m1 : mat2x4<f32>; |
||||
m1[uniforms.i][0] = 1.0; |
||||
} |
||||
|
@ -1,12 +1,12 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var m1 : mat2x4<f32>; |
||||
m1[uniforms.i][uniforms.j] = 1.0; |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var m1 : mat2x4<f32>; |
||||
m1[uniforms.i][uniforms.j] = 1.0; |
||||
} |
||||
|
@ -1,13 +1,13 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[0][uniforms.j] = 1.0; |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[0][uniforms.j] = 1.0; |
||||
} |
||||
|
@ -1,12 +1,12 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var m1 : mat2x4<f32>; |
||||
m1[uniforms.i] = vec4<f32>(1.0); |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var m1 : mat2x4<f32>; |
||||
m1[uniforms.i] = vec4<f32>(1.0); |
||||
} |
||||
|
@ -1,13 +1,13 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[uniforms.i][0] = 1.0; |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[uniforms.i][0] = 1.0; |
||||
} |
||||
|
@ -1,13 +1,13 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[uniforms.i][uniforms.j] = 1.0; |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[uniforms.i][uniforms.j] = 1.0; |
||||
} |
||||
|
@ -1,13 +1,13 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[0][uniforms.j] = 1.0; |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[0][uniforms.j] = 1.0; |
||||
} |
||||
|
@ -1,13 +1,13 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[uniforms.i] = vec4<f32>(1.0); |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
j : u32, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
var<private> m1 : mat2x4<f32>; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
m1[uniforms.i] = vec4<f32>(1.0); |
||||
} |
||||
|
@ -1,117 +1,117 @@ |
||||
struct Scene { |
||||
vEyePosition : vec4<f32>, |
||||
}; |
||||
|
||||
struct Material { |
||||
vDiffuseColor : vec4<f32>, |
||||
vAmbientColor : vec3<f32>, |
||||
dummy: f32, |
||||
vEmissiveColor : vec3<f32>, |
||||
dummy2: f32, |
||||
}; |
||||
|
||||
struct Mesh { |
||||
visibility : f32, |
||||
}; |
||||
|
||||
var<private> fClipDistance3 : f32; |
||||
|
||||
var<private> fClipDistance4 : f32; |
||||
|
||||
@group(0) @binding(0) var<uniform> x_29 : Scene; |
||||
|
||||
@group(0) @binding(1) var<uniform> x_49 : Material; |
||||
|
||||
@group(0) @binding(2) var<uniform> x_137 : Mesh; |
||||
|
||||
var<private> glFragColor : vec4<f32>; |
||||
|
||||
fn main_1() { |
||||
var viewDirectionW : vec3<f32>; |
||||
var baseColor : vec4<f32>; |
||||
var diffuseColor : vec3<f32>; |
||||
var alpha : f32; |
||||
var normalW : vec3<f32>; |
||||
var uvOffset : vec2<f32>; |
||||
var baseAmbientColor : vec3<f32>; |
||||
var glossiness : f32; |
||||
var diffuseBase : vec3<f32>; |
||||
var shadow : f32; |
||||
var refractionColor : vec4<f32>; |
||||
var reflectionColor : vec4<f32>; |
||||
var emissiveColor : vec3<f32>; |
||||
var finalDiffuse : vec3<f32>; |
||||
var finalSpecular : vec3<f32>; |
||||
var color : vec4<f32>; |
||||
let x_9 : f32 = fClipDistance3; |
||||
if ((x_9 > 0.0)) { |
||||
discard; |
||||
} |
||||
let x_17 : f32 = fClipDistance4; |
||||
if ((x_17 > 0.0)) { |
||||
discard; |
||||
} |
||||
let x_34 : vec4<f32> = x_29.vEyePosition; |
||||
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)); |
||||
baseColor = vec4<f32>(1.0, 1.0, 1.0, 1.0); |
||||
let x_52 : vec4<f32> = x_49.vDiffuseColor; |
||||
diffuseColor = vec3<f32>(x_52.x, x_52.y, x_52.z); |
||||
let x_60 : f32 = x_49.vDiffuseColor.w; |
||||
alpha = x_60; |
||||
let x_62 : 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)))); |
||||
uvOffset = vec2<f32>(0.0, 0.0); |
||||
let x_74 : vec4<f32> = vec4<f32>(0., 0., 0., 0.); |
||||
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_79 : vec4<f32> = baseColor; |
||||
baseColor = vec4<f32>(x_78.x, x_78.y, x_78.z, x_79.w); |
||||
baseAmbientColor = vec3<f32>(1.0, 1.0, 1.0); |
||||
glossiness = 0.0; |
||||
diffuseBase = vec3<f32>(0.0, 0.0, 0.0); |
||||
shadow = 1.0; |
||||
refractionColor = 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; |
||||
emissiveColor = x_94; |
||||
let x_96 : vec3<f32> = diffuseBase; |
||||
let x_97 : vec3<f32> = diffuseColor; |
||||
let x_99 : vec3<f32> = emissiveColor; |
||||
let x_103 : vec3<f32> = x_49.vAmbientColor; |
||||
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)); |
||||
finalSpecular = vec3<f32>(0.0, 0.0, 0.0); |
||||
let x_113 : vec3<f32> = finalDiffuse; |
||||
let x_114 : vec3<f32> = baseAmbientColor; |
||||
let x_116 : vec3<f32> = finalSpecular; |
||||
let x_118 : vec4<f32> = reflectionColor; |
||||
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_124 : f32 = alpha; |
||||
color = vec4<f32>(x_123.x, x_123.y, x_123.z, x_124); |
||||
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_133 : vec4<f32> = color; |
||||
color = vec4<f32>(x_132.x, x_132.y, x_132.z, x_133.w); |
||||
let x_140 : f32 = x_137.visibility; |
||||
let x_142 : f32 = color.w; |
||||
color.w = (x_142 * x_140); |
||||
let x_147 : vec4<f32> = color; |
||||
glFragColor = x_147; |
||||
return; |
||||
} |
||||
|
||||
struct main_out { |
||||
@location(0) |
||||
glFragColor_1 : vec4<f32>, |
||||
}; |
||||
|
||||
@stage(fragment) |
||||
fn main(@location(2) fClipDistance3_param : f32, @location(3) fClipDistance4_param : f32) -> main_out { |
||||
fClipDistance3 = fClipDistance3_param; |
||||
fClipDistance4 = fClipDistance4_param; |
||||
main_1(); |
||||
return main_out(glFragColor); |
||||
} |
||||
struct Scene { |
||||
vEyePosition : vec4<f32>, |
||||
}; |
||||
|
||||
struct Material { |
||||
vDiffuseColor : vec4<f32>, |
||||
vAmbientColor : vec3<f32>, |
||||
dummy: f32, |
||||
vEmissiveColor : vec3<f32>, |
||||
dummy2: f32, |
||||
}; |
||||
|
||||
struct Mesh { |
||||
visibility : f32, |
||||
}; |
||||
|
||||
var<private> fClipDistance3 : f32; |
||||
|
||||
var<private> fClipDistance4 : f32; |
||||
|
||||
@group(0) @binding(0) var<uniform> x_29 : Scene; |
||||
|
||||
@group(0) @binding(1) var<uniform> x_49 : Material; |
||||
|
||||
@group(0) @binding(2) var<uniform> x_137 : Mesh; |
||||
|
||||
var<private> glFragColor : vec4<f32>; |
||||
|
||||
fn main_1() { |
||||
var viewDirectionW : vec3<f32>; |
||||
var baseColor : vec4<f32>; |
||||
var diffuseColor : vec3<f32>; |
||||
var alpha : f32; |
||||
var normalW : vec3<f32>; |
||||
var uvOffset : vec2<f32>; |
||||
var baseAmbientColor : vec3<f32>; |
||||
var glossiness : f32; |
||||
var diffuseBase : vec3<f32>; |
||||
var shadow : f32; |
||||
var refractionColor : vec4<f32>; |
||||
var reflectionColor : vec4<f32>; |
||||
var emissiveColor : vec3<f32>; |
||||
var finalDiffuse : vec3<f32>; |
||||
var finalSpecular : vec3<f32>; |
||||
var color : vec4<f32>; |
||||
let x_9 : f32 = fClipDistance3; |
||||
if ((x_9 > 0.0)) { |
||||
discard; |
||||
} |
||||
let x_17 : f32 = fClipDistance4; |
||||
if ((x_17 > 0.0)) { |
||||
discard; |
||||
} |
||||
let x_34 : vec4<f32> = x_29.vEyePosition; |
||||
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)); |
||||
baseColor = vec4<f32>(1.0, 1.0, 1.0, 1.0); |
||||
let x_52 : vec4<f32> = x_49.vDiffuseColor; |
||||
diffuseColor = vec3<f32>(x_52.x, x_52.y, x_52.z); |
||||
let x_60 : f32 = x_49.vDiffuseColor.w; |
||||
alpha = x_60; |
||||
let x_62 : 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)))); |
||||
uvOffset = vec2<f32>(0.0, 0.0); |
||||
let x_74 : vec4<f32> = vec4<f32>(0., 0., 0., 0.); |
||||
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_79 : vec4<f32> = baseColor; |
||||
baseColor = vec4<f32>(x_78.x, x_78.y, x_78.z, x_79.w); |
||||
baseAmbientColor = vec3<f32>(1.0, 1.0, 1.0); |
||||
glossiness = 0.0; |
||||
diffuseBase = vec3<f32>(0.0, 0.0, 0.0); |
||||
shadow = 1.0; |
||||
refractionColor = 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; |
||||
emissiveColor = x_94; |
||||
let x_96 : vec3<f32> = diffuseBase; |
||||
let x_97 : vec3<f32> = diffuseColor; |
||||
let x_99 : vec3<f32> = emissiveColor; |
||||
let x_103 : vec3<f32> = x_49.vAmbientColor; |
||||
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)); |
||||
finalSpecular = vec3<f32>(0.0, 0.0, 0.0); |
||||
let x_113 : vec3<f32> = finalDiffuse; |
||||
let x_114 : vec3<f32> = baseAmbientColor; |
||||
let x_116 : vec3<f32> = finalSpecular; |
||||
let x_118 : vec4<f32> = reflectionColor; |
||||
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_124 : f32 = alpha; |
||||
color = vec4<f32>(x_123.x, x_123.y, x_123.z, x_124); |
||||
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_133 : vec4<f32> = color; |
||||
color = vec4<f32>(x_132.x, x_132.y, x_132.z, x_133.w); |
||||
let x_140 : f32 = x_137.visibility; |
||||
let x_142 : f32 = color.w; |
||||
color.w = (x_142 * x_140); |
||||
let x_147 : vec4<f32> = color; |
||||
glFragColor = x_147; |
||||
return; |
||||
} |
||||
|
||||
struct main_out { |
||||
@location(0) |
||||
glFragColor_1 : vec4<f32>, |
||||
}; |
||||
|
||||
@stage(fragment) |
||||
fn main(@location(2) fClipDistance3_param : f32, @location(3) fClipDistance4_param : f32) -> main_out { |
||||
fClipDistance3 = fClipDistance3_param; |
||||
fClipDistance4 = fClipDistance4_param; |
||||
main_1(); |
||||
return main_out(glFragColor); |
||||
} |
||||
|
@ -1,48 +1,48 @@ |
||||
struct Uniforms { |
||||
dstTextureFlipY : u32, |
||||
isFloat16 : u32, |
||||
isRGB10A2Unorm : u32, |
||||
channelCount : u32, |
||||
}; |
||||
struct OutputBuf { |
||||
result : array<u32>, |
||||
}; |
||||
@group(0) @binding(0) var src : 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(3) var<uniform> uniforms : Uniforms; |
||||
//@builtin(global_invocation_id) var<in> GlobalInvocationID : vec3<u32>; |
||||
// Fp16 logic |
||||
// Infinity and NaN won't happen in this test case. |
||||
fn ConvertToFp16FloatValue(fp32 : f32) -> u32 { |
||||
return 1u; |
||||
} |
||||
|
||||
@stage(compute) @workgroup_size(1, 1, 1) |
||||
fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) { |
||||
var size : vec2<i32> = textureDimensions(src); |
||||
var dstTexCoord : vec2<i32> = vec2<i32>(GlobalInvocationID.xy); |
||||
var srcTexCoord : vec2<i32> = dstTexCoord; |
||||
if (uniforms.dstTextureFlipY == 1u) { |
||||
srcTexCoord.y = size.y - dstTexCoord.y - 1; |
||||
} |
||||
|
||||
var srcColor : vec4<f32> = textureLoad(src, srcTexCoord, 0); |
||||
var dstColor : vec4<f32> = textureLoad(dst, dstTexCoord, 0); |
||||
var success : bool = true; |
||||
|
||||
var srcColorBits : vec4<u32>; |
||||
var dstColorBits : vec4<u32> = vec4<u32>(dstColor); |
||||
|
||||
for (var i : u32 = 0u; i < uniforms.channelCount; i = i + 1u) { |
||||
srcColorBits[i] = ConvertToFp16FloatValue(srcColor[i]); |
||||
success = success && (srcColorBits[i] == dstColorBits[i]); |
||||
} |
||||
|
||||
var outputIndex : u32 = GlobalInvocationID.y * u32(size.x) + GlobalInvocationID.x; |
||||
if (success) { |
||||
output.result[outputIndex] = u32(1); |
||||
} else { |
||||
output.result[outputIndex] = u32(0); |
||||
} |
||||
} |
||||
struct Uniforms { |
||||
dstTextureFlipY : u32, |
||||
isFloat16 : u32, |
||||
isRGB10A2Unorm : u32, |
||||
channelCount : u32, |
||||
}; |
||||
struct OutputBuf { |
||||
result : array<u32>, |
||||
}; |
||||
@group(0) @binding(0) var src : 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(3) var<uniform> uniforms : Uniforms; |
||||
//@builtin(global_invocation_id) var<in> GlobalInvocationID : vec3<u32>; |
||||
// Fp16 logic |
||||
// Infinity and NaN won't happen in this test case. |
||||
fn ConvertToFp16FloatValue(fp32 : f32) -> u32 { |
||||
return 1u; |
||||
} |
||||
|
||||
@stage(compute) @workgroup_size(1, 1, 1) |
||||
fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) { |
||||
var size : vec2<i32> = textureDimensions(src); |
||||
var dstTexCoord : vec2<i32> = vec2<i32>(GlobalInvocationID.xy); |
||||
var srcTexCoord : vec2<i32> = dstTexCoord; |
||||
if (uniforms.dstTextureFlipY == 1u) { |
||||
srcTexCoord.y = size.y - dstTexCoord.y - 1; |
||||
} |
||||
|
||||
var srcColor : vec4<f32> = textureLoad(src, srcTexCoord, 0); |
||||
var dstColor : vec4<f32> = textureLoad(dst, dstTexCoord, 0); |
||||
var success : bool = true; |
||||
|
||||
var srcColorBits : vec4<u32>; |
||||
var dstColorBits : vec4<u32> = vec4<u32>(dstColor); |
||||
|
||||
for (var i : u32 = 0u; i < uniforms.channelCount; i = i + 1u) { |
||||
srcColorBits[i] = ConvertToFp16FloatValue(srcColor[i]); |
||||
success = success && (srcColorBits[i] == dstColorBits[i]); |
||||
} |
||||
|
||||
var outputIndex : u32 = GlobalInvocationID.y * u32(size.x) + GlobalInvocationID.x; |
||||
if (success) { |
||||
output.result[outputIndex] = u32(1); |
||||
} else { |
||||
output.result[outputIndex] = u32(0); |
||||
} |
||||
} |
||||
|
@ -1,24 +1,24 @@ |
||||
struct MyStruct { |
||||
f1 : f32, |
||||
}; |
||||
|
||||
type MyArray = array<f32, 10>; |
||||
|
||||
// Global lets |
||||
let v1 = 1; |
||||
let v2 = 1u; |
||||
let v3 = 1.0; |
||||
|
||||
let v4 = vec3<i32>(1, 1, 1); |
||||
let v5 = vec3<u32>(1u, 1u, 1u); |
||||
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 v8 = MyStruct(); |
||||
let v9 = MyArray(); |
||||
|
||||
@stage(fragment) |
||||
fn main() -> @location(0) vec4<f32> { |
||||
return vec4<f32>(0.0,0.0,0.0,0.0); |
||||
} |
||||
struct MyStruct { |
||||
f1 : f32, |
||||
}; |
||||
|
||||
type MyArray = array<f32, 10>; |
||||
|
||||
// Global lets |
||||
let v1 = 1; |
||||
let v2 = 1u; |
||||
let v3 = 1.0; |
||||
|
||||
let v4 = vec3<i32>(1, 1, 1); |
||||
let v5 = vec3<u32>(1u, 1u, 1u); |
||||
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 v8 = MyStruct(); |
||||
let v9 = MyArray(); |
||||
|
||||
@stage(fragment) |
||||
fn main() -> @location(0) vec4<f32> { |
||||
return vec4<f32>(0.0,0.0,0.0,0.0); |
||||
} |
||||
|
@ -1,39 +1,39 @@ |
||||
struct MyStruct { |
||||
f1 : f32, |
||||
}; |
||||
|
||||
type MyArray = array<f32, 10>; |
||||
|
||||
fn ret_i32() -> i32 { return 1; } |
||||
fn ret_u32() -> u32 { return 1u; } |
||||
fn ret_f32() -> f32 { return 1.0; } |
||||
fn ret_MyStruct() -> MyStruct { return MyStruct(); } |
||||
fn ret_MyArray() -> MyArray { return MyArray(); } |
||||
|
||||
// Local lets |
||||
fn let_decls() { |
||||
let v1 = 1; |
||||
let v2 = 1u; |
||||
let v3 = 1.0; |
||||
|
||||
let v4 = vec3<i32>(1, 1, 1); |
||||
let v5 = vec3<u32>(1u, 1u, 1u); |
||||
let v6 = vec3<f32>(1.0, 1.0, 1.0); |
||||
|
||||
let v7 = mat3x3<f32>(v6, v6, v6); |
||||
|
||||
let v8 = MyStruct(1.0); |
||||
let v9 = MyArray(); |
||||
|
||||
let v10 = ret_i32(); |
||||
let v11 = ret_u32(); |
||||
let v12 = ret_f32(); |
||||
let v13 = ret_MyStruct(); |
||||
let v14 = ret_MyStruct(); |
||||
let v15 = ret_MyArray(); |
||||
} |
||||
|
||||
@stage(fragment) |
||||
fn main() -> @location(0) vec4<f32> { |
||||
return vec4<f32>(0.0,0.0,0.0,0.0); |
||||
} |
||||
struct MyStruct { |
||||
f1 : f32, |
||||
}; |
||||
|
||||
type MyArray = array<f32, 10>; |
||||
|
||||
fn ret_i32() -> i32 { return 1; } |
||||
fn ret_u32() -> u32 { return 1u; } |
||||
fn ret_f32() -> f32 { return 1.0; } |
||||
fn ret_MyStruct() -> MyStruct { return MyStruct(); } |
||||
fn ret_MyArray() -> MyArray { return MyArray(); } |
||||
|
||||
// Local lets |
||||
fn let_decls() { |
||||
let v1 = 1; |
||||
let v2 = 1u; |
||||
let v3 = 1.0; |
||||
|
||||
let v4 = vec3<i32>(1, 1, 1); |
||||
let v5 = vec3<u32>(1u, 1u, 1u); |
||||
let v6 = vec3<f32>(1.0, 1.0, 1.0); |
||||
|
||||
let v7 = mat3x3<f32>(v6, v6, v6); |
||||
|
||||
let v8 = MyStruct(1.0); |
||||
let v9 = MyArray(); |
||||
|
||||
let v10 = ret_i32(); |
||||
let v11 = ret_u32(); |
||||
let v12 = ret_f32(); |
||||
let v13 = ret_MyStruct(); |
||||
let v14 = ret_MyStruct(); |
||||
let v15 = ret_MyArray(); |
||||
} |
||||
|
||||
@stage(fragment) |
||||
fn main() -> @location(0) vec4<f32> { |
||||
return vec4<f32>(0.0,0.0,0.0,0.0); |
||||
} |
||||
|
@ -1,22 +1,22 @@ |
||||
struct Uniforms { |
||||
i : u32, |
||||
}; |
||||
|
||||
struct InnerS { |
||||
v : i32, |
||||
}; |
||||
|
||||
struct OuterS { |
||||
a1 : array<InnerS, 8>, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var v : InnerS; |
||||
var s1 : OuterS; |
||||
for (var i: i32 = 0; i < 4; i = i + 1) { |
||||
s1.a1[uniforms.i] = v; |
||||
} |
||||
} |
||||
struct Uniforms { |
||||
i : u32, |
||||
}; |
||||
|
||||
struct InnerS { |
||||
v : i32, |
||||
}; |
||||
|
||||
struct OuterS { |
||||
a1 : array<InnerS, 8>, |
||||
}; |
||||
|
||||
@group(1) @binding(4) var<uniform> uniforms : Uniforms; |
||||
|
||||
@stage(compute) @workgroup_size(1) |
||||
fn main() { |
||||
var v : InnerS; |
||||
var s1 : OuterS; |
||||
for (var i: i32 = 0; i < 4; i = i + 1) { |
||||
s1.a1[uniforms.i] = v; |
||||
} |
||||
} |
||||
|