blob: 2296189e23287f2caf71bbe9750143eb4371823f [file] [log] [blame]
<?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">
<!--=================================================================-->
<!-- utils -->
<!--=================================================================-->
<Type Name="tint::utils::Slice&lt;*&gt;">
<DisplayString>{{ length={len}, capacity={cap} }}</DisplayString>
<Expand>
<!--<Item Name="[length]">len</Item>
<Item Name="[capacity]">cap</Item>-->
<ArrayItems>
<Size>len</Size>
<ValuePointer>data</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="tint::utils::Vector&lt;*,*&gt;">
<Intrinsic Name="Length" Expression="(size_t)(impl_.slice.len)" />
<Expand>
<Item Name="[heap]">impl_.slice.cap > (int)$T2</Item>
<!--<ExpandedItem>impl_.slice</ExpandedItem>-->
<!--<Item Name="[slice]">impl_.slice</Item>-->
<ArrayItems>
<Size>Length()</Size>
<ValuePointer>impl_.slice.data</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="tint::utils::VectorRef&lt;*&gt;">
<Expand>
<Item Name="[can move]">can_move_</Item>
<ExpandedItem>slice_</ExpandedItem>
<!--<Item Name="[slice]">slice_</Item>-->
</Expand>
</Type>
<Type Name="tint::Symbol">
<!-- Requires TINT_SYMBOL_STORE_DEBUG_NAME defined to 1 -->
<DisplayString Optional="true">{debug_name_,sb}</DisplayString>
</Type>
<!--=================================================================-->
<!-- ast -->
<!--=================================================================-->
<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_statement">if ({*condition}) {*body}</DisplayString>
<DisplayString Condition="else_statement">if ({*condition}) {*body} else { *else_statement }</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.Length() == 1">{{ {*statements[0]} }} </DisplayString>
<DisplayString Condition="statements.Length() == 2">{{ {*statements[0]} {*statements[1]} }} </DisplayString>
<DisplayString Condition="statements.Length() == 3">{{ {*statements[0]} {*statements[1]} {*statements[2]} }} </DisplayString>
<DisplayString Condition="statements.Length() > 3">{{ {*statements[0]} {*statements[1]} {*statements[2]} {statements.Length()-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::Let">
<DisplayString Condition="!!type">let {symbol} : {*type} = {*initializer}</DisplayString>
<DisplayString Condition=" !type">let {symbol} = {*initializer}</DisplayString>
</Type>
<Type Name="tint::ast::Variable">
<DisplayString Condition="!!type &amp; !!initializer">var {symbol} : {*type} = {*initializer}</DisplayString>
<DisplayString Condition="!!type &amp; !initializer">var {symbol} : {*type}</DisplayString>
<DisplayString Condition=" !type &amp; !!initializer">var {symbol} = {*initializer}</DisplayString>
<DisplayString Condition=" !type &amp; !initializer">var {symbol}</DisplayString>
</Type>
<Type Name="tint::ast::VariableDeclStatement">
<DisplayString>{*variable};</DisplayString>
</Type>
<Type Name="tint::ast::IntLiteralExpression">
<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">&amp;({*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} &amp; {*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} &amp;&amp; {*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} &lt; {*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::kGreaterThanEqual">({*lhs} &gt;= {*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::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.Length() == 0">{target}()</DisplayString>
<DisplayString Condition="args.Length() == 1">{target}({*args[0]})</DisplayString>
<DisplayString Condition="args.Length() == 2">{target}({*args[0]}, {*args[1]})</DisplayString>
<DisplayString Condition="args.Length() == 3">{target}({*args[0]}, {*args[1]}, {*args[2]})</DisplayString>
<DisplayString Condition="args.Length() == 4">{target}({*args[0]}, {*args[1]}, {*args[2]}, {*args[3]})</DisplayString>
<DisplayString Condition="args.Length() > 4">{target}({*args[0]}, {*args[1]}, {*args[2]}, {args.Length()-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&lt;{*type},{*count}&gt;</DisplayString>
<DisplayString Condition="count == nullptr">array&lt;{*type}&gt;</DisplayString>
</Type>
<Type Name="tint::ast::Vector">
<DisplayString Condition="width==2 &amp; !type">vec2</DisplayString>
<DisplayString Condition="width==3 &amp; !type">vec3</DisplayString>
<DisplayString Condition="width==4 &amp; !type">vec4</DisplayString>
<DisplayString Condition="width==2 &amp; !!type">vec2&lt;{*type}&gt;</DisplayString>
<DisplayString Condition="width==3 &amp; !!type">vec3&lt;{*type}&gt;</DisplayString>
<DisplayString Condition="width==4 &amp; !!type">vec4&lt;{*type}&gt;</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>
<!--=================================================================-->
<!-- sem -->
<!--=================================================================-->
<Type Name="tint::type::AbstractInt">
<DisplayString>AbstractInt</DisplayString>
</Type>
<Type Name="tint::type::AbstractFloat">
<DisplayString>AbstractFloat</DisplayString>
</Type>
<Type Name="tint::type::Bool">
<DisplayString>bool</DisplayString>
</Type>
<Type Name="tint::type::F32">
<DisplayString>f32</DisplayString>
</Type>
<Type Name="tint::type::Vector">
<DisplayString>vec{width_}&lt;{*subtype_}&gt;</DisplayString>
</Type>
<Type Name="tint::sem::Constant">
<DisplayString>Type={*Type()} Value={Value()}</DisplayString>
</Type>
<Type Name="tint::sem::Expression">
<DisplayString>Decl={*declaration_}</DisplayString>
</Type>
</AutoVisualizer>