WebKit Bugzilla
Attachment 357967 Details for
Bug 192991
: [WHLSL] Implement parser AST nodes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192991-20181221124643.patch (text/plain), 205.98 KB, created by
Myles C. Maxfield
on 2018-12-21 12:46:44 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-12-21 12:46:44 PST
Size:
205.98 KB
patch
obsolete
>Subversion Revision: 239495 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1675be7bfc8d1cb0d3cd0de663f6da41129ba0d8..1ce1a8daf8e04b49ab666f6ff7825385dd3a1cbd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,193 @@ >+2018-12-21 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [WHLSL] Implement parser AST nodes >+ https://bugs.webkit.org/show_bug.cgi?id=192991 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch creates all the AST nodes which will be the result of running the parser. >+ This patch used to be a part of the "create a WHLSL parser" patch but I split them >+ out in order to aid reviewing. >+ >+ The classes were mechanically created to match the result of the parser. There are >+ nodes for things like ForLoops, LogicalNotExpressions, DereferenceExpressions, >+ StructureDefinitions, and things like that. The classes don't actually have any logic >+ in them - they are currently just containers to hold the structure of the parsed >+ program. Some of these nodes (like constexprs) are just Variants of the various things >+ they can in the form of. >+ >+ No new tests because the parser doesn't exist to create the new AST nodes yet. >+ >+ * Modules/webgpu/WHLSL/AST/WHLSLAnonymousVariableDeclaration.h: Added. >+ (WebCore::WHLSL::AST::AnonymousVariableDeclaration::AnonymousVariableDeclaration): >+ (WebCore::WHLSL::AST::AnonymousVariableDeclaration::origin const): >+ * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h: Added. >+ (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): >+ * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. >+ (WebCore::WHLSL::AST::ArrayType::ArrayType): >+ (WebCore::WHLSL::AST::ArrayType::numElements const): >+ * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. >+ (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h: Added. >+ (WebCore::WHLSL::AST::BaseFunctionAttribute::BaseFunctionAttribute): >+ * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h: Added. >+ (WebCore::WHLSL::AST::BaseSemantic::BaseSemantic): >+ * Modules/webgpu/WHLSL/AST/WHLSLBlock.h: Added. >+ (WebCore::WHLSL::AST::Block::Block): >+ * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. >+ (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): >+ (WebCore::WHLSL::AST::BooleanLiteral::value const): >+ * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. >+ (WebCore::WHLSL::AST::Break::Break): >+ * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. >+ (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): >+ (WebCore::WHLSL::AST::BuiltInSemantic::variable const): >+ * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. >+ (WebCore::WHLSL::AST::CallExpression::CallExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. >+ (WebCore::WHLSL::AST::CommaExpression::CommaExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. >+ (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. >+ (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): >+ * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. >+ (WebCore::WHLSL::AST::Continue::Continue): >+ * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. >+ (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. >+ (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): >+ * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. >+ (WebCore::WHLSL::AST::DotExpression::DotExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. >+ (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): >+ * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. >+ (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): >+ * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. >+ (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): >+ * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. >+ (WebCore::WHLSL::AST::Expression::Expression): >+ (WebCore::WHLSL::AST::Expression::origin const): >+ * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h: Added. >+ (WebCore::WHLSL::AST::Fallthrough::Fallthrough): >+ * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h: Added. >+ (WebCore::WHLSL::AST::FloatLiteral::FloatLiteral): >+ (WebCore::WHLSL::AST::FloatLiteral::value const): >+ * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. >+ (WebCore::WHLSL::AST::ForLoop::ForLoop): >+ (WebCore::WHLSL::AST::ForLoop::~ForLoop): >+ * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. >+ * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. >+ (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): >+ (WebCore::WHLSL::AST::FunctionDeclaration::takeOrigin): >+ (WebCore::WHLSL::AST::FunctionDeclaration::takeAttributeBlock): >+ (WebCore::WHLSL::AST::FunctionDeclaration::takeEntryPointType): >+ (WebCore::WHLSL::AST::FunctionDeclaration::takeType): >+ (WebCore::WHLSL::AST::FunctionDeclaration::takeName): >+ (WebCore::WHLSL::AST::FunctionDeclaration::takeParameters): >+ (WebCore::WHLSL::AST::FunctionDeclaration::takeSemantic): >+ * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. >+ (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): >+ (WebCore::WHLSL::AST::FunctionDefinition::restricted const): >+ * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. >+ (WebCore::WHLSL::AST::IfStatement::IfStatement): >+ * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. >+ (WebCore::WHLSL::AST::IndexExpression::IndexExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. >+ (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): >+ (WebCore::WHLSL::AST::IntegerLiteral::value const): >+ * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. >+ (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): >+ (WebCore::WHLSL::AST::LogicalExpression::type const): >+ * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. >+ (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. >+ (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. >+ (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h: Added. >+ (WebCore::WHLSL::AST::NativeFunctionDeclaration::NativeFunctionDeclaration): >+ (WebCore::WHLSL::AST::NativeFunctionDeclaration::restricted const): >+ * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: Added. >+ (WebCore::WHLSL::AST::NativeTypeDeclaration::NativeTypeDeclaration): >+ * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. >+ * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. >+ (WebCore::WHLSL::AST::NullLiteral::NullLiteral): >+ * Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h: Added. >+ (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::NumThreadsFunctionAttribute): >+ (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::width const): >+ (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::height const): >+ (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::depth const): >+ * Modules/webgpu/WHLSL/AST/WHLSLParameter.h: Added. >+ (WebCore::WHLSL::AST::Parameter::Parameter): >+ * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h: Added. >+ (WebCore::WHLSL::AST::PointerType::PointerType): >+ * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. >+ (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. >+ * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. >+ (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): >+ (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): >+ (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): >+ (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): >+ (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): >+ * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. >+ (WebCore::WHLSL::AST::ReferenceType::ReferenceType): >+ (WebCore::WHLSL::AST::ReferenceType::origin const): >+ (WebCore::WHLSL::AST::ReferenceType::addressSpace const): >+ (WebCore::WHLSL::AST::ReferenceType::elementType const): >+ * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h: Added. >+ (WebCore::WHLSL::AST::ResourceSemantic::ResourceSemantic): >+ (WebCore::WHLSL::AST::ResourceSemantic::mode const): >+ (WebCore::WHLSL::AST::ResourceSemantic::index const): >+ (WebCore::WHLSL::AST::ResourceSemantic::space const): >+ * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. >+ (WebCore::WHLSL::AST::Return::Return): >+ * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. >+ * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. >+ (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): >+ * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. >+ (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): >+ (WebCore::WHLSL::AST::StageInOutSemantic::index const): >+ * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. >+ (WebCore::WHLSL::AST::Statement::Statement): >+ * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. >+ (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): >+ * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. >+ (WebCore::WHLSL::AST::StructureElement::StructureElement): >+ * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. >+ (WebCore::WHLSL::AST::SwitchCase::SwitchCase): >+ * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. >+ (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): >+ * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. >+ (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): >+ * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. >+ (WebCore::WHLSL::AST::Trap::Trap): >+ * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. >+ * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. >+ * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. >+ (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): >+ * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. >+ (WebCore::WHLSL::AST::TypeReference::TypeReference): >+ * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. >+ (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): >+ (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): >+ * Modules/webgpu/WHLSL/AST/WHLSLValue.h: Added. >+ (WebCore::WHLSL::AST::Value::Value): >+ * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: Added. >+ (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration): >+ (WebCore::WHLSL::AST::VariableDeclaration::origin const): >+ * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. >+ (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): >+ * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. >+ (WebCore::WHLSL::AST::VariableReference::VariableReference): >+ (WebCore::WHLSL::AST::VariableReference::wrap): >+ * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. >+ (WebCore::WHLSL::AST::WhileLoop::WhileLoop): >+ * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. >+ * Modules/webgpu/WHLSL/WHLSLParser.h: Added. >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ > 2018-12-20 Justin Fan <justin_fan@apple.com> > > [WebGPU] Convert WebGPUBindGroups into MTLArgumentEncoders >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAnonymousVariableDeclaration.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAnonymousVariableDeclaration.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ef61ed126191070103f8e87c80e310c414d349b6 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAnonymousVariableDeclaration.h >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLValue.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class AnonymousVariableDeclaration : public Value { >+public: >+ AnonymousVariableDeclaration(Lexer::Token&& origin) >+ : m_origin(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~AnonymousVariableDeclaration() = default; >+ >+ AnonymousVariableDeclaration(const AnonymousVariableDeclaration&) = delete; >+ AnonymousVariableDeclaration(AnonymousVariableDeclaration&&) = default; >+ >+ Lexer::Token origin() const { return m_origin; } >+ >+private: >+ Lexer::Token m_origin; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0bd1b365f18c554ddbc4f3d16d3cb01eb6f142b9 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLReferenceType.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class ArrayReferenceType : public ReferenceType { >+public: >+ ArrayReferenceType(Lexer::Token&& origin, String&& addressSpace, std::unique_ptr<Type>&& elementType) >+ : ReferenceType(WTFMove(origin), WTFMove(addressSpace), WTFMove(elementType)) >+ { >+ } >+ >+ virtual ~ArrayReferenceType() = default; >+ >+ ArrayReferenceType(const ArrayReferenceType&) = delete; >+ ArrayReferenceType(ArrayReferenceType&&) = default; >+ >+ std::unique_ptr<Type> clone() const override >+ { >+ return std::make_unique<ArrayReferenceType>(Lexer::Token(origin()), String(addressSpace()), elementType()->clone()); >+ } >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayType.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayType.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0dda2848af4c0db90be592274449ae637a13085c >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayType.h >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLType.h" >+#include "WHLSLTypeArgument.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class ArrayType : public Type { >+public: >+ ArrayType(Lexer::Token&& origin, std::unique_ptr<Type>&& elementType, unsigned numElements) >+ : m_origin(WTFMove(origin)) >+ , m_elementType(WTFMove(elementType)) >+ , m_numElements(numElements) >+ { >+ } >+ >+ virtual ~ArrayType() = default; >+ >+ ArrayType(const ArrayType&) = delete; >+ ArrayType(ArrayType&&) = default; >+ >+ unsigned numElements() const { return m_numElements; } >+ >+ std::unique_ptr<Type> clone() const override >+ { >+ return std::make_unique<ArrayType>(Lexer::Token(m_origin), m_elementType->clone(), m_numElements); >+ } >+ >+private: >+ Lexer::Token m_origin; >+ std::unique_ptr<Type> m_elementType; >+ unsigned m_numElements; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1e634cca7bffaf2556258b32aae85f12a15aa75a >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class AssignmentExpression : public Expression { >+public: >+ AssignmentExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& left, std::unique_ptr<Expression>&& right) >+ : Expression(WTFMove(origin)) >+ , m_left(WTFMove(left)) >+ , m_right(WTFMove(right)) >+ { >+ } >+ >+ virtual ~AssignmentExpression() = default; >+ >+ AssignmentExpression(const AssignmentExpression&) = delete; >+ AssignmentExpression(AssignmentExpression&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_left; >+ std::unique_ptr<Expression> m_right; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h >new file mode 100644 >index 0000000000000000000000000000000000000000..5c244ca82a911dc561ea4bba8904e8d184edf69f >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h >@@ -0,0 +1,61 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLNode.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class BaseFunctionAttribute : public Node { >+public: >+ BaseFunctionAttribute(Lexer::Token&& origin) >+ : m_origin(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~BaseFunctionAttribute() = default; >+ >+ BaseFunctionAttribute(const BaseFunctionAttribute&) = delete; >+ BaseFunctionAttribute(BaseFunctionAttribute&&) = default; >+ >+private: >+ Lexer::Token m_origin; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6573372f137018004e3c4d5f2333441474493b52 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h >@@ -0,0 +1,61 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLNode.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class BaseSemantic : public Node { >+public: >+ BaseSemantic(Lexer::Token&& origin) >+ : m_origin(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~BaseSemantic() = default; >+ >+ BaseSemantic(const BaseSemantic&) = delete; >+ BaseSemantic(BaseSemantic&&) = default; >+ >+private: >+ Lexer::Token m_origin; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBlock.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBlock.h >new file mode 100644 >index 0000000000000000000000000000000000000000..cc1726a31a048175c29049e822ec9022c7f93789 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBlock.h >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Block : public Statement { >+public: >+ Block(Lexer::Token&& origin, Vector<std::unique_ptr<Statement>>&& statements) >+ : Statement(WTFMove(origin)) >+ , m_statements(WTFMove(statements)) >+ { >+ } >+ >+ virtual ~Block() = default; >+ >+ Block(const Block&) = delete; >+ Block(Block&&) = default; >+ >+private: >+ Vector<std::unique_ptr<Statement>> m_statements; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ae90881bd77832205a64d9255080bca1d383d68d >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class BooleanLiteral : public Expression { >+public: >+ BooleanLiteral(Lexer::Token&& origin, bool value) >+ : Expression(WTFMove(origin)) >+ , m_value(value) >+ { >+ } >+ >+ virtual ~BooleanLiteral() = default; >+ >+ explicit BooleanLiteral(const BooleanLiteral&) = default; >+ BooleanLiteral(BooleanLiteral&&) = default; >+ >+ bool value() const { return m_value; } >+ >+private: >+ bool m_value; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBreak.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBreak.h >new file mode 100644 >index 0000000000000000000000000000000000000000..dc92521ae583f8a41fdcc6235951cfe368350090 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBreak.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Break : public Statement { >+public: >+ Break(Lexer::Token&& origin) >+ : Statement(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~Break() = default; >+ >+ Break(const Break&) = delete; >+ Break(Break&&) = default; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h >new file mode 100644 >index 0000000000000000000000000000000000000000..7046df32cfaa2e6bfe43dfbdb33079c1c4e8b063 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h >@@ -0,0 +1,84 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBaseSemantic.h" >+#include "WHLSLLexer.h" >+#include <wtf/Optional.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class BuiltInSemantic : public BaseSemantic { >+public: >+ enum class Variable { >+ SVInstanceID, >+ SVVertexID, >+ PSize, >+ SVPosition, >+ SVIsFrontFace, >+ SVSampleIndex, >+ SVInnerCoverage, >+ SVTarget, >+ SVDepth, >+ SVCoverage, >+ SVDispatchThreadID, >+ SVGroupID, >+ SVGroupIndex, >+ SVGroupThreadID >+ }; >+ >+ BuiltInSemantic(Lexer::Token&& origin, Variable variable, Optional<unsigned>&& targetIndex = WTF::nullopt) >+ : BaseSemantic(WTFMove(origin)) >+ , m_variable(variable) >+ , m_targetIndex(WTFMove(targetIndex)) >+ { >+ } >+ >+ virtual ~BuiltInSemantic() = default; >+ >+ BuiltInSemantic(const BuiltInSemantic&) = delete; >+ BuiltInSemantic(BuiltInSemantic&&) = default; >+ >+ Variable variable() const { return m_variable; } >+ >+private: >+ Variable m_variable; >+ Optional<unsigned> m_targetIndex; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e1ba8563b41c44b3e236f020a4b6116721cf3052 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class CallExpression : public Expression { >+public: >+ CallExpression(Lexer::Token&& origin, String&& name, Vector<std::unique_ptr<Expression>>&& arguments) >+ : Expression(WTFMove(origin)) >+ , m_name(WTFMove(name)) >+ , m_arguments(WTFMove(arguments)) >+ { >+ } >+ >+ virtual ~CallExpression() = default; >+ >+ CallExpression(const CallExpression&) = delete; >+ CallExpression(CallExpression&&) = default; >+ >+private: >+ String m_name; >+ Vector<std::unique_ptr<Expression>> m_arguments; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6c7dc70ba2013e6e4e55ac7920a0961bcb8a3323 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class CommaExpression : public Expression { >+public: >+ CommaExpression(Lexer::Token&& origin, Vector<std::unique_ptr<Expression>>&& list) >+ : Expression(WTFMove(origin)) >+ , m_list(WTFMove(list)) >+ { >+ } >+ >+ virtual ~CommaExpression() = default; >+ >+ CommaExpression(const CommaExpression&) = delete; >+ CommaExpression(CommaExpression&&) = default; >+ >+private: >+ Vector<std::unique_ptr<Expression>> m_list; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8ca8b369d6a92bf599833dc45c00478e225b9e09 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h >@@ -0,0 +1,136 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBooleanLiteral.h" >+#include "WHLSLConstantExpressionEnumerationMemberReference.h" >+#include "WHLSLFloatLiteral.h" >+#include "WHLSLIntegerLiteral.h" >+#include "WHLSLNullLiteral.h" >+#include "WHLSLUnsignedIntegerLiteral.h" >+#include <wtf/Variant.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+// FIXME: macOS Sierra doesn't seem to support putting Variants inside Variants, >+// so this is a wrapper class to make sure that doesn't happen. As soon as we don't >+// have to support Sierra, this can be migrated to a Variant proper. >+class ConstantExpression : public Variant< >+ IntegerLiteral, >+ UnsignedIntegerLiteral, >+ FloatLiteral, >+ NullLiteral, >+ BooleanLiteral, >+ ConstantExpressionEnumerationMemberReference >+ > { >+public: >+ ConstantExpression(IntegerLiteral&& integerLiteral) >+ : Variant< >+ IntegerLiteral, >+ UnsignedIntegerLiteral, >+ FloatLiteral, >+ NullLiteral, >+ BooleanLiteral, >+ ConstantExpressionEnumerationMemberReference >+ >(WTFMove(integerLiteral)) >+ { >+ } >+ >+ ConstantExpression(UnsignedIntegerLiteral&& unsignedIntegerLiteral) >+ : Variant< >+ IntegerLiteral, >+ UnsignedIntegerLiteral, >+ FloatLiteral, >+ NullLiteral, >+ BooleanLiteral, >+ ConstantExpressionEnumerationMemberReference >+ >(WTFMove(unsignedIntegerLiteral)) >+ { >+ } >+ >+ ConstantExpression(FloatLiteral&& floatLiteral) >+ : Variant< >+ IntegerLiteral, >+ UnsignedIntegerLiteral, >+ FloatLiteral, >+ NullLiteral, >+ BooleanLiteral, >+ ConstantExpressionEnumerationMemberReference >+ >(WTFMove(floatLiteral)) >+ { >+ } >+ >+ ConstantExpression(NullLiteral&& nullLiteral) >+ : Variant< >+ IntegerLiteral, >+ UnsignedIntegerLiteral, >+ FloatLiteral, >+ NullLiteral, >+ BooleanLiteral, >+ ConstantExpressionEnumerationMemberReference >+ >(WTFMove(nullLiteral)) >+ { >+ } >+ >+ ConstantExpression(BooleanLiteral&& booleanLiteral) >+ : Variant< >+ IntegerLiteral, >+ UnsignedIntegerLiteral, >+ FloatLiteral, >+ NullLiteral, >+ BooleanLiteral, >+ ConstantExpressionEnumerationMemberReference >+ >(WTFMove(booleanLiteral)) >+ { >+ } >+ >+ ConstantExpression(ConstantExpressionEnumerationMemberReference&& constantExpressionEnumerationMemberReference) >+ : Variant< >+ IntegerLiteral, >+ UnsignedIntegerLiteral, >+ FloatLiteral, >+ NullLiteral, >+ BooleanLiteral, >+ ConstantExpressionEnumerationMemberReference >+ >(WTFMove(constantExpressionEnumerationMemberReference)) >+ { >+ } >+ >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h >new file mode 100644 >index 0000000000000000000000000000000000000000..2c24a98b2cabb0f9ea85c0ba1e090a6608de824f >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h >@@ -0,0 +1,65 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class ConstantExpressionEnumerationMemberReference : public Node { >+public: >+ ConstantExpressionEnumerationMemberReference(Lexer::Token&& origin, String&& left, String&& right) >+ : m_origin(WTFMove(origin)) >+ , m_left(WTFMove(left)) >+ , m_right(WTFMove(right)) >+ { >+ } >+ >+ virtual ~ConstantExpressionEnumerationMemberReference() = default; >+ >+ explicit ConstantExpressionEnumerationMemberReference(const ConstantExpressionEnumerationMemberReference&) = default; >+ ConstantExpressionEnumerationMemberReference(ConstantExpressionEnumerationMemberReference&&) = default; >+ >+private: >+ Lexer::Token m_origin; >+ String m_left; >+ String m_right; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLContinue.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLContinue.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e295a5a77872aadb5e4ba2073f3bba927ed6e390 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLContinue.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Continue : public Statement { >+public: >+ Continue(Lexer::Token&& origin) >+ : Statement(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~Continue() = default; >+ >+ Continue(const Continue&) = delete; >+ Continue(Continue&&) = default; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..982433ba2597c5be5615517b27e387a5a66eba57 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class DereferenceExpression : public Expression { >+public: >+ DereferenceExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& pointer) >+ : Expression(WTFMove(origin)) >+ , m_pointer(WTFMove(pointer)) >+ { >+ } >+ >+ virtual ~DereferenceExpression() = default; >+ >+ DereferenceExpression(const DereferenceExpression&) = delete; >+ DereferenceExpression(DereferenceExpression&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_pointer; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6023d8dc7aff92e4e26f28404db4949303612e28 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h >@@ -0,0 +1,65 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class DoWhileLoop : public Statement { >+public: >+ DoWhileLoop(Lexer::Token&& origin, std::unique_ptr<Statement>&& body, std::unique_ptr<Expression>&& conditional) >+ : Statement(WTFMove(origin)) >+ , m_body(WTFMove(body)) >+ , m_conditional(WTFMove(conditional)) >+ { >+ } >+ >+ virtual ~DoWhileLoop() = default; >+ >+ DoWhileLoop(const DoWhileLoop&) = delete; >+ DoWhileLoop(DoWhileLoop&&) = default; >+ >+private: >+ std::unique_ptr<Statement> m_body; >+ std::unique_ptr<Expression> m_conditional; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..c43c69ee5411899ec315fd52ec1cfc644aae7581 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLPropertyAccessExpression.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class DotExpression : public PropertyAccessExpression { >+public: >+ DotExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& base, String&& fieldName) >+ : PropertyAccessExpression(WTFMove(origin), WTFMove(base)) >+ , m_fieldName(WTFMove(fieldName)) >+ { >+ } >+ >+ virtual ~DotExpression() = default; >+ >+ DotExpression(const DotExpression&) = delete; >+ DotExpression(DotExpression&&) = default; >+ >+private: >+ String m_fieldName; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h >new file mode 100644 >index 0000000000000000000000000000000000000000..24d07512c38c777082bb29508e5591bd247c0ee2 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class EffectfulExpressionStatement : public Statement { >+public: >+ EffectfulExpressionStatement(std::unique_ptr<Expression>&& effectfulExpression) >+ : Statement(Lexer::Token(effectfulExpression->origin())) >+ , m_effectfulExpression(WTFMove(effectfulExpression)) >+ { >+ } >+ >+ virtual ~EffectfulExpressionStatement() = default; >+ >+ EffectfulExpressionStatement(const EffectfulExpressionStatement&) = delete; >+ EffectfulExpressionStatement(EffectfulExpressionStatement&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_effectfulExpression; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9a670cebea0cfe95e7da8b129145515194482415 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h >@@ -0,0 +1,76 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLEnumerationMember.h" >+#include "WHLSLLexer.h" >+#include "WHLSLType.h" >+#include <wtf/Vector.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class EnumerationDefinition : public Type { >+public: >+ EnumerationDefinition(Lexer::Token&& origin, String&& name, std::unique_ptr<Type>&& type, Vector<EnumerationMember> members) >+ : m_origin(WTFMove(origin)) >+ , m_name(WTFMove(name)) >+ , m_type(WTFMove(type)) >+ , m_members(WTFMove(members)) >+ { >+ } >+ >+ virtual ~EnumerationDefinition() = default; >+ >+ EnumerationDefinition(const EnumerationDefinition&) = delete; >+ EnumerationDefinition(EnumerationDefinition&&) = default; >+ >+ std::unique_ptr<Type> clone() const override >+ { >+ ASSERT_NOT_REACHED(); >+ return nullptr; >+ } >+ >+private: >+ Lexer::Token m_origin; >+ String m_name; >+ std::unique_ptr<Type> m_type; >+ Vector<EnumerationMember> m_members; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h >new file mode 100644 >index 0000000000000000000000000000000000000000..c8343ab4adb38e1aa5d5b6944c0a98834b4af569 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h >@@ -0,0 +1,68 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLConstantExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLNode.h" >+#include <wtf/Optional.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class EnumerationMember : public Node { >+public: >+ EnumerationMember(Lexer::Token&& origin, String&& name, Optional<ConstantExpression>&& value = WTF::nullopt) >+ : m_origin(WTFMove(origin)) >+ , m_name(WTFMove(name)) >+ , m_value(WTFMove(value)) >+ { >+ } >+ >+ virtual ~EnumerationMember() = default; >+ >+ EnumerationMember(const EnumerationMember&) = delete; >+ EnumerationMember(EnumerationMember&&) = default; >+ >+private: >+ Lexer::Token m_origin; >+ String m_name; >+ Optional<ConstantExpression> m_value; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8e314cf2082987e50fe7004db161db9c8b8bb8d1 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLExpression.h >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLValue.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Expression : public Value { >+public: >+ Expression(Lexer::Token&& origin) >+ : m_origin(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~Expression() = default; >+ >+ explicit Expression(const Expression&) = default; >+ Expression(Expression&&) = default; >+ >+ Lexer::Token origin() const { return m_origin; } >+ >+private: >+ Lexer::Token m_origin; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1fc74d8f8d9e04a2cd60c5583f2113a6f232116b >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Fallthrough : public Statement { >+public: >+ Fallthrough(Lexer::Token&& origin) >+ : Statement(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~Fallthrough() = default; >+ >+ Fallthrough(const Fallthrough&) = delete; >+ Fallthrough(Fallthrough&&) = default; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h >new file mode 100644 >index 0000000000000000000000000000000000000000..abf1dfb076c1a70560c2c21d8efb0203c1f6104d >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class FloatLiteral : public Expression { >+public: >+ FloatLiteral(Lexer::Token&& origin, float value) >+ : Expression(WTFMove(origin)) >+ , m_value(value) >+ { >+ } >+ >+ virtual ~FloatLiteral() = default; >+ >+ explicit FloatLiteral(const FloatLiteral&) = default; >+ FloatLiteral(FloatLiteral&&) = default; >+ >+ float value() const { return m_value; } >+ >+private: >+ float m_value; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLForLoop.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLForLoop.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1abde9c58e0a51412ee702f7bf0099c861509d07 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLForLoop.h >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+#include "WHLSLVariableDeclarationsStatement.h" >+#include <wtf/Variant.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class ForLoop : public Statement { >+public: >+ ForLoop(Lexer::Token&& origin, Variant<VariableDeclarationsStatement, std::unique_ptr<Expression>>&& initialization, std::unique_ptr<Expression>&& condition, std::unique_ptr<Expression>&& increment, std::unique_ptr<Statement>&& body) >+ : Statement(WTFMove(origin)) >+ , m_initialization(WTFMove(initialization)) >+ , m_condition(WTFMove(condition)) >+ , m_increment(WTFMove(increment)) >+ , m_body(WTFMove(body)) >+ { >+ } >+ >+ virtual ~ForLoop() >+ { >+ } >+ >+ ForLoop(const ForLoop&) = delete; >+ ForLoop(ForLoop&&) = default; >+ >+private: >+ Variant<VariableDeclarationsStatement, std::unique_ptr<Expression>> m_initialization; >+ std::unique_ptr<Expression> m_condition; // nullable >+ std::unique_ptr<Expression> m_increment; // nullable >+ std::unique_ptr<Statement> m_body; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h >new file mode 100644 >index 0000000000000000000000000000000000000000..cbd72d4a90c51df7a2b0ffcc183328436e2b670f >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h >@@ -0,0 +1,49 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLNumThreadsFunctionAttribute.h" >+#include <wtf/Variant.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+typedef Variant<NumThreadsFunctionAttribute> FunctionAttribute; >+typedef Vector<FunctionAttribute> AttributeBlock; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e6060aaa840a7590c2851fdafa38bb78da8a98de >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h >@@ -0,0 +1,92 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLFunctionAttribute.h" >+#include "WHLSLLexer.h" >+#include "WHLSLNode.h" >+#include "WHLSLParameter.h" >+#include "WHLSLSemantic.h" >+#include "WHLSLType.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class FunctionDeclaration : public Node { >+public: >+ enum class EntryPointType { >+ Vertex, >+ Fragment, >+ Compute >+ }; >+ >+ FunctionDeclaration(Lexer::Token&& origin, AttributeBlock&& attributeBlock, Optional<EntryPointType> entryPointType, std::unique_ptr<AST::Type>&& type, String&& name, Parameters&& parameters, Optional<AST::Semantic>&& semantic) >+ : m_origin(WTFMove(origin)) >+ , m_attributeBlock(WTFMove(attributeBlock)) >+ , m_entryPointType(entryPointType) >+ , m_type(WTFMove(type)) >+ , m_name(WTFMove(name)) >+ , m_parameters(WTFMove(parameters)) >+ , m_semantic(WTFMove(semantic)) >+ { >+ } >+ >+ virtual ~FunctionDeclaration() = default; >+ >+ FunctionDeclaration(const FunctionDeclaration&) = delete; >+ FunctionDeclaration(FunctionDeclaration&&) = default; >+ >+ Lexer::Token&& takeOrigin() { return WTFMove(m_origin); } >+ AttributeBlock&& takeAttributeBlock() { return WTFMove(m_attributeBlock); } >+ Optional<EntryPointType>&& takeEntryPointType() { return WTFMove(m_entryPointType); } >+ std::unique_ptr<AST::Type>&& takeType() { return WTFMove(m_type); } >+ String&& takeName() { return WTFMove(m_name); } >+ Parameters&& takeParameters() { return WTFMove(m_parameters); } >+ Optional<AST::Semantic>&& takeSemantic() { return WTFMove(m_semantic); } >+ >+private: >+ Lexer::Token m_origin; >+ AttributeBlock m_attributeBlock; >+ Optional<EntryPointType> m_entryPointType; >+ std::unique_ptr<AST::Type> m_type; >+ String m_name; >+ Parameters m_parameters; >+ Optional<AST::Semantic> m_semantic; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h >new file mode 100644 >index 0000000000000000000000000000000000000000..05f0b1f081a205305f768d8affc5aa566b1ed3c5 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBlock.h" >+#include "WHLSLFunctionDeclaration.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class FunctionDefinition : public FunctionDeclaration { >+public: >+ FunctionDefinition(FunctionDeclaration&& functionDeclaration, Block&& block, bool restricted) >+ : FunctionDeclaration(WTFMove(functionDeclaration)) >+ , m_block(WTFMove(block)) >+ , m_restricted(restricted) >+ { >+ } >+ >+ virtual ~FunctionDefinition() = default; >+ >+ FunctionDefinition(const FunctionDefinition&) = delete; >+ FunctionDefinition(FunctionDefinition&&) = default; >+ >+ bool restricted() const { return m_restricted; } >+ >+private: >+ Block m_block; >+ bool m_restricted; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h >new file mode 100644 >index 0000000000000000000000000000000000000000..94b08b1a2af86018646da9e7375a738d72efc2e3 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h >@@ -0,0 +1,67 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class IfStatement : public Statement { >+public: >+ IfStatement(Lexer::Token&& origin, std::unique_ptr<Expression>&& conditional, std::unique_ptr<Statement>&& body, std::unique_ptr<Statement>&& elseBody) >+ : Statement(WTFMove(origin)) >+ , m_conditional(WTFMove(conditional)) >+ , m_body(WTFMove(body)) >+ , m_elseBody(WTFMove(elseBody)) >+ { >+ } >+ >+ virtual ~IfStatement() = default; >+ >+ IfStatement(const IfStatement&) = delete; >+ IfStatement(IfStatement&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_conditional; >+ std::unique_ptr<Statement> m_body; >+ std::unique_ptr<Statement> m_elseBody; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6bb6a0f0dab14d8866ec7fb22fb86b0c7e3fd2da >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLPropertyAccessExpression.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class IndexExpression : public PropertyAccessExpression { >+public: >+ IndexExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& base, std::unique_ptr<Expression>&& index) >+ : PropertyAccessExpression(WTFMove(origin), WTFMove(base)) >+ , m_index(WTFMove(index)) >+ { >+ } >+ >+ virtual ~IndexExpression() = default; >+ >+ IndexExpression(const IndexExpression&) = delete; >+ IndexExpression(IndexExpression&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_index; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h >new file mode 100644 >index 0000000000000000000000000000000000000000..acd25346c4329f546734b5ca37ae1acb90c528bc >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class IntegerLiteral : public Expression { >+public: >+ IntegerLiteral(Lexer::Token&& origin, int value) >+ : Expression(WTFMove(origin)) >+ , m_value(value) >+ { >+ } >+ >+ virtual ~IntegerLiteral() = default; >+ >+ explicit IntegerLiteral(const IntegerLiteral&) = default; >+ IntegerLiteral(IntegerLiteral&&) = default; >+ >+ int value() const { return m_value; } >+ >+private: >+ int m_value; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..bfb0475d7b27ea9f503ff7aaf275c9dd2952db4b >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h >@@ -0,0 +1,73 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class LogicalExpression : public Expression { >+public: >+ enum class Type { >+ And, >+ Or >+ }; >+ >+ LogicalExpression(Lexer::Token&& origin, Type type, std::unique_ptr<Expression>&& left, std::unique_ptr<Expression>&& right) >+ : Expression(WTFMove(origin)) >+ , m_type(type) >+ , m_left(WTFMove(left)) >+ , m_right(WTFMove(right)) >+ { >+ } >+ >+ virtual ~LogicalExpression() = default; >+ >+ LogicalExpression(const LogicalExpression&) = delete; >+ LogicalExpression(LogicalExpression&&) = default; >+ >+ Type type() const { return m_type; } >+ >+private: >+ Type m_type; >+ std::unique_ptr<Expression> m_left; >+ std::unique_ptr<Expression> m_right; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..993344f3b0d80f93c1e246aff2f13554c4a71c2f >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class LogicalNotExpression : public Expression { >+public: >+ LogicalNotExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& operand) >+ : Expression(WTFMove(origin)) >+ , m_operand(WTFMove(operand)) >+ { >+ } >+ >+ virtual ~LogicalNotExpression() = default; >+ >+ LogicalNotExpression(const LogicalNotExpression&) = delete; >+ LogicalNotExpression(LogicalNotExpression&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_operand; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0b9ac24d249bd47f8d742ebd9433b8f80ee3272e >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class MakeArrayReferenceExpression : public Expression { >+public: >+ MakeArrayReferenceExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& lValue) >+ : Expression(WTFMove(origin)) >+ , m_lValue(WTFMove(lValue)) >+ { >+ } >+ >+ virtual ~MakeArrayReferenceExpression() = default; >+ >+ MakeArrayReferenceExpression(const MakeArrayReferenceExpression&) = delete; >+ MakeArrayReferenceExpression(MakeArrayReferenceExpression&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_lValue; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..146fe203bbbcdb6b17e48126b03e5a13ce6423ce >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class MakePointerExpression : public Expression { >+public: >+ MakePointerExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& lValue) >+ : Expression(WTFMove(origin)) >+ , m_lValue(WTFMove(lValue)) >+ { >+ } >+ >+ virtual ~MakePointerExpression() = default; >+ >+ MakePointerExpression(const MakePointerExpression&) = delete; >+ MakePointerExpression(MakePointerExpression&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_lValue; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h >new file mode 100644 >index 0000000000000000000000000000000000000000..010e6eba700fb03c433142d09d823ac624e7cb4f >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLFunctionDeclaration.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class NativeFunctionDeclaration : public FunctionDeclaration { >+public: >+ NativeFunctionDeclaration(Lexer::Token&& origin, AttributeBlock&& attributeBlock, Optional<EntryPointType> entryPointType, std::unique_ptr<AST::Type>&& type, String&& name, Parameters&& parameters, Optional<AST::Semantic>&& semantic, bool restricted) >+ : FunctionDeclaration(WTFMove(origin), WTFMove(attributeBlock), WTFMove(entryPointType), WTFMove(type), WTFMove(name), WTFMove(parameters), WTFMove(semantic)) >+ , m_restricted(restricted) >+ { >+ } >+ >+ virtual ~NativeFunctionDeclaration() = default; >+ >+ NativeFunctionDeclaration(const NativeFunctionDeclaration&) = delete; >+ NativeFunctionDeclaration(NativeFunctionDeclaration&&) = default; >+ >+ bool restricted() const { return m_restricted; } >+ >+private: >+ bool m_restricted; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h >new file mode 100644 >index 0000000000000000000000000000000000000000..7adfe2ffbb7f8ee13cd1c3b1f0b5c1ef96e2d89a >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h >@@ -0,0 +1,73 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLType.h" >+#include "WHLSLTypeArgument.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class NativeTypeDeclaration : public Type { >+public: >+ NativeTypeDeclaration(Lexer::Token&& origin, String&& name, TypeArguments&& typeArguments) >+ : m_origin(WTFMove(origin)) >+ , m_name(WTFMove(name)) >+ , m_typeArguments(WTFMove(typeArguments)) >+ { >+ } >+ >+ virtual ~NativeTypeDeclaration() = default; >+ >+ NativeTypeDeclaration(const NativeTypeDeclaration&) = delete; >+ NativeTypeDeclaration(NativeTypeDeclaration&&) = default; >+ >+ std::unique_ptr<Type> clone() const override >+ { >+ ASSERT_NOT_REACHED(); >+ return nullptr; >+ } >+ >+private: >+ Lexer::Token m_origin; >+ String m_name; >+ TypeArguments m_typeArguments; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNode.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNode.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f6c4f0060c04d7722fe64b2c31727b54b2b2e166 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNode.h >@@ -0,0 +1,54 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Node { >+public: >+ Node() = default; >+ >+ virtual ~Node() = default; >+ >+ explicit Node(const Node&) = default; >+ Node(Node&&) = default; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h >new file mode 100644 >index 0000000000000000000000000000000000000000..905f2b3fb7cd72875abaacef8821edd2a0b7c6a8 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class NullLiteral : public Expression { >+public: >+ NullLiteral(Lexer::Token&& origin) >+ : Expression(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~NullLiteral() = default; >+ >+ explicit NullLiteral(const NullLiteral&) = default; >+ NullLiteral(NullLiteral&&) = default; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h >new file mode 100644 >index 0000000000000000000000000000000000000000..837e8668e2ca18f57e4a2a75a539e56a8b430866 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h >@@ -0,0 +1,69 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBaseFunctionAttribute.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class NumThreadsFunctionAttribute : public BaseFunctionAttribute { >+public: >+ NumThreadsFunctionAttribute(Lexer::Token&& origin, unsigned width, unsigned height, unsigned depth) >+ : BaseFunctionAttribute(WTFMove(origin)) >+ , m_width(width) >+ , m_height(height) >+ , m_depth(depth) >+ { >+ } >+ >+ virtual ~NumThreadsFunctionAttribute() = default; >+ >+ NumThreadsFunctionAttribute(const NumThreadsFunctionAttribute&) = delete; >+ NumThreadsFunctionAttribute(NumThreadsFunctionAttribute&&) = default; >+ >+ unsigned width() const { return m_width; } >+ unsigned height() const { return m_height; } >+ unsigned depth() const { return m_depth; } >+ >+private: >+ unsigned m_width; >+ unsigned m_height; >+ unsigned m_depth; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLParameter.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLParameter.h >new file mode 100644 >index 0000000000000000000000000000000000000000..aad7167b1cbbf12043da30d50e650d01ebc0b851 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLParameter.h >@@ -0,0 +1,76 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLQualifier.h" >+#include "WHLSLSemantic.h" >+#include "WHLSLType.h" >+#include "WHLSLValue.h" >+#include <wtf/Vector.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Parameter : public Value { >+public: >+ Parameter(Lexer::Token&& origin, Qualifiers&& qualifiers, std::unique_ptr<AST::Type>&& type, Optional<String>&& name, Optional<AST::Semantic>&& semantic) >+ : m_origin(WTFMove(origin)) >+ , m_qualifiers(WTFMove(qualifiers)) >+ , m_type(WTFMove(type)) >+ , m_name(WTFMove(name)) >+ , m_semantic(WTFMove(semantic)) >+ { >+ } >+ >+ virtual ~Parameter() = default; >+ >+ Parameter(const Parameter&) = delete; >+ Parameter(Parameter&&) = default; >+ >+private: >+ Lexer::Token m_origin; >+ Qualifiers m_qualifiers; >+ std::unique_ptr<AST::Type> m_type; >+ Optional<String> m_name; >+ Optional<AST::Semantic> m_semantic; >+}; >+ >+typedef Vector<Parameter> Parameters; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPointerType.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPointerType.h >new file mode 100644 >index 0000000000000000000000000000000000000000..bf5fcbab83b0056f4a29beedc3f9be31240e9b02 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPointerType.h >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLReferenceType.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class PointerType : public ReferenceType { >+public: >+ PointerType(Lexer::Token&& origin, String&& addressSpace, std::unique_ptr<Type> elementType) >+ : ReferenceType(WTFMove(origin), WTFMove(addressSpace), WTFMove(elementType)) >+ { >+ } >+ >+ virtual ~PointerType() = default; >+ >+ PointerType(const PointerType&) = delete; >+ PointerType(PointerType&&) = default; >+ >+ std::unique_ptr<Type> clone() const override >+ { >+ return std::make_unique<PointerType>(Lexer::Token(origin()), String(addressSpace()), elementType()->clone()); >+ } >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..08d257e41ece3fd84622e3652a4be6201ca5aae6 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class PropertyAccessExpression : public Expression { >+public: >+ PropertyAccessExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& base) >+ : Expression(WTFMove(origin)) >+ , m_base(WTFMove(base)) >+ { >+ } >+ >+ virtual ~PropertyAccessExpression() = default; >+ >+ PropertyAccessExpression(const PropertyAccessExpression&) = delete; >+ PropertyAccessExpression(PropertyAccessExpression&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_base; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLQualifier.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLQualifier.h >new file mode 100644 >index 0000000000000000000000000000000000000000..333f0522441bc13a32117096162b0fdf8f402c4b >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLQualifier.h >@@ -0,0 +1,57 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLType.h" >+#include <wtf/Vector.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+enum class Qualifier { >+ Nointerpolation, >+ Noperspective, >+ Uniform, >+ Centroid, >+ Sample >+}; >+ >+typedef Vector<Qualifier> Qualifiers; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9b27ee15686496729aedef2217bf6061395be174 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h >@@ -0,0 +1,101 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLAnonymousVariableDeclaration.h" >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLVariableReference.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+/* >+ * 1. Evaluate m_lValue >+ * 2. Assign the result to m_oldValue >+ * 3. Evaluate m_newValueExpression >+ * 4. Assign the result to m_newValue >+ * 5. Assign the result to m_lValue >+ * 6. Evaluate m_resultExpression >+ * 7. Return the result >+ */ >+class ReadModifyWriteExpression : public Expression { >+public: >+ ReadModifyWriteExpression(Lexer::Token&& origin, std::unique_ptr<Expression> lValue) >+ : Expression(Lexer::Token(origin)) >+ , m_lValue(WTFMove(lValue)) >+ , m_oldValue(Lexer::Token(origin)) >+ , m_newValue(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~ReadModifyWriteExpression() = default; >+ >+ ReadModifyWriteExpression(const ReadModifyWriteExpression&) = delete; >+ ReadModifyWriteExpression(ReadModifyWriteExpression&&) = default; >+ >+ void setNewValueExpression(std::unique_ptr<Expression>&& newValueExpression) >+ { >+ m_newValueExpression = WTFMove(newValueExpression); >+ } >+ >+ void setResultExpression(std::unique_ptr<Expression>&& resultExpression) >+ { >+ m_resultExpression = WTFMove(resultExpression); >+ } >+ >+ std::unique_ptr<VariableReference> oldVariableReference() >+ { >+ // The only reason we don't get use-after-frees is the fact that every instance of ReadModifyWriteExpression is allocated on the heap. >+ return std::make_unique<VariableReference>(VariableReference::wrap(m_oldValue)); >+ } >+ >+ std::unique_ptr<VariableReference> newVariableReference() >+ { >+ // The only reason we don't get use-after-frees is the fact that every instance of ReadModifyWriteExpression is allocated on the heap. >+ return std::make_unique<VariableReference>(VariableReference::wrap(m_newValue)); >+ } >+ >+private: >+ std::unique_ptr<Expression> m_lValue; >+ AnonymousVariableDeclaration m_oldValue; >+ AnonymousVariableDeclaration m_newValue; >+ std::unique_ptr<Expression> m_newValueExpression; >+ std::unique_ptr<Expression> m_resultExpression; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f7b8857adf9d8aee41f5e35be6e3a2ff611fa052 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLType.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class ReferenceType : public Type { >+public: >+ ReferenceType(Lexer::Token&& origin, String&& addressSpace, std::unique_ptr<Type>&& elementType) >+ : m_origin(WTFMove(origin)) >+ , m_addressSpace(WTFMove(addressSpace)) >+ , m_elementType(WTFMove(elementType)) >+ { >+ } >+ >+ virtual ~ReferenceType() = default; >+ >+ ReferenceType(const ReferenceType&) = delete; >+ ReferenceType(ReferenceType&&) = default; >+ >+protected: >+ const Lexer::Token& origin() const { return m_origin; } >+ const String& addressSpace() const { return m_addressSpace; } >+ const std::unique_ptr<Type>& elementType() const { return m_elementType; } >+ >+private: >+ Lexer::Token m_origin; >+ String m_addressSpace; >+ std::unique_ptr<Type> m_elementType; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ab3b430f4427cd9ae48653e94b8f98cf25fc9c6d >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h >@@ -0,0 +1,77 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBaseSemantic.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class ResourceSemantic : public BaseSemantic { >+public: >+ enum class Mode { >+ UnorderedAccessView, >+ Texture, >+ Buffer, >+ Sampler >+ }; >+ >+ ResourceSemantic(Lexer::Token&& origin, Mode mode, unsigned index, unsigned space) >+ : BaseSemantic(WTFMove(origin)) >+ , m_mode(mode) >+ , m_index(index) >+ , m_space(space) >+ { >+ } >+ >+ virtual ~ResourceSemantic() = default; >+ >+ ResourceSemantic(const ResourceSemantic&) = delete; >+ ResourceSemantic(ResourceSemantic&&) = default; >+ >+ Mode mode() const { return m_mode; } >+ unsigned index() const { return m_index; } >+ unsigned space() const { return m_space; } >+ >+private: >+ Mode m_mode; >+ unsigned m_index; >+ unsigned m_space; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReturn.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReturn.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f4548edb60fed6827b2c56aac0f5c5908da186a7 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReturn.h >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Return : public Statement { >+public: >+ Return(Lexer::Token&& origin, std::unique_ptr<Expression>&& value) >+ : Statement(WTFMove(origin)) >+ , m_value(WTFMove(value)) >+ { >+ } >+ >+ virtual ~Return() = default; >+ >+ Return(const Return&) = delete; >+ Return(Return&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_value; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSemantic.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSemantic.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b052b92ea2646fa00e4abf81099ab7b56b312666 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSemantic.h >@@ -0,0 +1,50 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBuiltInSemantic.h" >+#include "WHLSLResourceSemantic.h" >+#include "WHLSLSpecializationConstantSemantic.h" >+#include "WHLSLStageInOutSemantic.h" >+#include <wtf/Variant.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+typedef Variant<BuiltInSemantic, ResourceSemantic, SpecializationConstantSemantic, StageInOutSemantic> Semantic; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9a7c53fd4b6135882af3170f0384abe1abfe3a4b >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBaseSemantic.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class SpecializationConstantSemantic : public BaseSemantic { >+public: >+ SpecializationConstantSemantic(Lexer::Token&& origin) >+ : BaseSemantic(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~SpecializationConstantSemantic() = default; >+ >+ SpecializationConstantSemantic(const SpecializationConstantSemantic&) = delete; >+ SpecializationConstantSemantic(SpecializationConstantSemantic&&) = default; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h >new file mode 100644 >index 0000000000000000000000000000000000000000..a3992781e3a43f4a56255e188bc4ed066a1c9662 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBaseSemantic.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class StageInOutSemantic : public BaseSemantic { >+public: >+ StageInOutSemantic(Lexer::Token&& origin, unsigned index) >+ : BaseSemantic(WTFMove(origin)) >+ , m_index(index) >+ { >+ } >+ >+ virtual ~StageInOutSemantic() = default; >+ >+ StageInOutSemantic(const StageInOutSemantic&) = delete; >+ StageInOutSemantic(StageInOutSemantic&&) = default; >+ >+ unsigned index() const { return m_index; } >+ >+private: >+ unsigned m_index; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatement.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatement.h >new file mode 100644 >index 0000000000000000000000000000000000000000..2b9786e51a449285305ce71166a7b7c871d2e23d >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatement.h >@@ -0,0 +1,61 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLValue.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Statement : public Value { >+public: >+ Statement(Lexer::Token&& origin) >+ : m_origin(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~Statement() = default; >+ >+ Statement(const Statement&) = delete; >+ Statement(Statement&&) = default; >+ >+private: >+ Lexer::Token m_origin; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h >new file mode 100644 >index 0000000000000000000000000000000000000000..5f657d5b092611a61d08191e9dd5fa8f7c2624a3 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLStructureElement.h" >+#include "WHLSLType.h" >+#include <wtf/Vector.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class StructureDefinition : public Type { >+public: >+ StructureDefinition(Lexer::Token&& origin, String&& name, StructureElements&& structureElements) >+ : m_origin(WTFMove(origin)) >+ , m_name(WTFMove(name)) >+ , m_structureElements(WTFMove(structureElements)) >+ { >+ } >+ >+ virtual ~StructureDefinition() = default; >+ >+ StructureDefinition(const StructureDefinition&) = delete; >+ StructureDefinition(StructureDefinition&&) = default; >+ >+ std::unique_ptr<Type> clone() const override >+ { >+ ASSERT_NOT_REACHED(); >+ return nullptr; >+ } >+ >+private: >+ Lexer::Token m_origin; >+ String m_name; >+ StructureElements m_structureElements; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h >new file mode 100644 >index 0000000000000000000000000000000000000000..7893d59bc17410043bc229767d1201b6ff7bf86a >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLNode.h" >+#include "WHLSLQualifier.h" >+#include "WHLSLSemantic.h" >+#include "WHLSLType.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class StructureElement : public Node { >+public: >+ StructureElement(Lexer::Token&& origin, Qualifiers&& qualifiers, std::unique_ptr<Type>&& type, String&& name, Optional<Semantic> semantic) >+ : m_origin(WTFMove(origin)) >+ , m_qualifiers(WTFMove(qualifiers)) >+ , m_type(WTFMove(type)) >+ , m_name(WTFMove(name)) >+ , m_semantic(WTFMove(semantic)) >+ { >+ } >+ >+ virtual ~StructureElement() = default; >+ >+ StructureElement(const StructureElement&) = delete; >+ StructureElement(StructureElement&&) = default; >+ >+private: >+ Lexer::Token m_origin; >+ Qualifiers m_qualifiers; >+ std::unique_ptr<Type> m_type; >+ String m_name; >+ Optional<Semantic> m_semantic; >+}; >+ >+typedef Vector<StructureElement> StructureElements; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h >new file mode 100644 >index 0000000000000000000000000000000000000000..93cefc72e00ad1d03ba0be30d227e99c0dea3062 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h >@@ -0,0 +1,67 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLBlock.h" >+#include "WHLSLConstantExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+#include <wtf/Optional.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class SwitchCase : public Statement { >+public: >+ SwitchCase(Lexer::Token&& origin, Optional<ConstantExpression>&& value, Block&& block) >+ : Statement(WTFMove(origin)) >+ , m_value(WTFMove(value)) >+ , m_block(WTFMove(block)) >+ { >+ } >+ >+ virtual ~SwitchCase() = default; >+ >+ SwitchCase(const SwitchCase&) = delete; >+ SwitchCase(SwitchCase&&) = default; >+ >+private: >+ Optional<ConstantExpression> m_value; >+ Block m_block; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e214d78c5d6bd819503d62cf58f08013c3f70c1d >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+#include "WHLSLSwitchCase.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class SwitchStatement : public Statement { >+public: >+ SwitchStatement(Lexer::Token&& origin, std::unique_ptr<Expression>&& value, Vector<SwitchCase>&& switchCases) >+ : Statement(WTFMove(origin)) >+ , m_value(WTFMove(value)) >+ , m_switchCases(WTFMove(switchCases)) >+ { >+ } >+ >+ virtual ~SwitchStatement() = default; >+ >+ SwitchStatement(const SwitchStatement&) = delete; >+ SwitchStatement(SwitchStatement&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_value; >+ Vector<SwitchCase> m_switchCases; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h >new file mode 100644 >index 0000000000000000000000000000000000000000..defcf622e8ea525feb9967cbb9ef76b760a12d14 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class TernaryExpression : public Expression { >+public: >+ TernaryExpression(Lexer::Token&& origin, std::unique_ptr<Expression>&& predicate, std::unique_ptr<Expression>&& bodyExpression, std::unique_ptr<Expression>&& elseExpression) >+ : Expression(WTFMove(origin)) >+ , m_predicate(WTFMove(predicate)) >+ , m_bodyExpression(WTFMove(bodyExpression)) >+ , m_elseExpression(WTFMove(elseExpression)) >+ { >+ } >+ >+ virtual ~TernaryExpression() = default; >+ >+ TernaryExpression(const TernaryExpression&) = delete; >+ TernaryExpression(TernaryExpression&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_predicate; >+ std::unique_ptr<Expression> m_bodyExpression; >+ std::unique_ptr<Expression> m_elseExpression; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTrap.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTrap.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6ad009b9362d170dd593c4086193880f099cd7f9 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTrap.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Trap : public Statement { >+public: >+ Trap(Lexer::Token&& origin) >+ : Statement(WTFMove(origin)) >+ { >+ } >+ >+ virtual ~Trap() = default; >+ >+ Trap(const Trap&) = delete; >+ Trap(Trap&&) = default; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLType.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLType.h >new file mode 100644 >index 0000000000000000000000000000000000000000..12135e6a734a668871bc7392ae101f38be0da33a >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLType.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLNode.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Type : public Node { >+public: >+ Type() = default; >+ >+ virtual ~Type() = default; >+ >+ Type(const Type&) = delete; >+ Type(Type&&) = default; >+ >+ virtual std::unique_ptr<Type> clone() const = 0; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1591ae9772ffa0d667f16fbe749c3efb06ecf5e5 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLConstantExpression.h" >+#include "WHLSLLexer.h" >+#include <wtf/Variant.h> >+#include <wtf/Vector.h> >+#include <wtf/text/StringView.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+typedef Variant<ConstantExpression, String> TypeArgument; >+typedef Vector<TypeArgument> TypeArguments; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h >new file mode 100644 >index 0000000000000000000000000000000000000000..aa48b0294622250ad48518cd4e9dca6e244ba84c >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h >@@ -0,0 +1,73 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLNode.h" >+#include "WHLSLType.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class TypeDefinition : public Type { >+public: >+ TypeDefinition(Lexer::Token&& origin, String&& name, std::unique_ptr<AST::Type>&& type) >+ : m_origin(WTFMove(origin)) >+ , m_name(WTFMove(name)) >+ , m_type(WTFMove(type)) >+ { >+ } >+ >+ virtual ~TypeDefinition() = default; >+ >+ TypeDefinition(const TypeDefinition&) = delete; >+ TypeDefinition(TypeDefinition&&) = default; >+ >+ std::unique_ptr<Type> clone() const override >+ { >+ ASSERT_NOT_REACHED(); >+ return nullptr; >+ } >+ >+private: >+ Lexer::Token m_origin; >+ String m_name; >+ std::unique_ptr<AST::Type> m_type; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h >new file mode 100644 >index 0000000000000000000000000000000000000000..7f484df7ca8ab4081560c92049ecc6683072a2f5 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h >@@ -0,0 +1,72 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLType.h" >+#include "WHLSLTypeArgument.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class TypeReference : public Type { >+public: >+ TypeReference(Lexer::Token&& origin, String&& name, TypeArguments&& typeArguments) >+ : m_origin(WTFMove(origin)) >+ , m_name(WTFMove(name)) >+ , m_typeArguments(WTFMove(typeArguments)) >+ { >+ } >+ >+ virtual ~TypeReference() = default; >+ >+ TypeReference(const TypeReference&) = delete; >+ TypeReference(TypeReference&&) = default; >+ >+ std::unique_ptr<Type> clone() const override >+ { >+ return std::make_unique<TypeReference>(Lexer::Token(m_origin), String(m_name), TypeArguments(m_typeArguments)); >+ } >+ >+private: >+ Lexer::Token m_origin; >+ String m_name; >+ TypeArguments m_typeArguments; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h >new file mode 100644 >index 0000000000000000000000000000000000000000..89b3003e8c67054338b5bc2a89e1f1062031a3c5 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class UnsignedIntegerLiteral : public Expression { >+public: >+ UnsignedIntegerLiteral(Lexer::Token&& origin, unsigned value) >+ : Expression(WTFMove(origin)) >+ , m_value(value) >+ { >+ } >+ >+ virtual ~UnsignedIntegerLiteral() = default; >+ >+ explicit UnsignedIntegerLiteral(const UnsignedIntegerLiteral&) = default; >+ UnsignedIntegerLiteral(UnsignedIntegerLiteral&&) = default; >+ >+ unsigned value() const { return m_value; } >+ >+private: >+ unsigned m_value; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLValue.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLValue.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6e0ea91fc1d011869f90d898067f27a051de82f9 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLValue.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLNode.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class Value : public Node { >+public: >+ Value() >+ { >+ } >+ >+ virtual ~Value() = default; >+ >+ explicit Value(const Value&) = default; >+ Value(Value&&) = default; >+ >+private: >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h >new file mode 100644 >index 0000000000000000000000000000000000000000..69f88c72c95d01ef387da84bcfdd7929e5edf978 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h >@@ -0,0 +1,79 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLQualifier.h" >+#include "WHLSLSemantic.h" >+#include "WHLSLType.h" >+#include "WHLSLValue.h" >+#include <wtf/Vector.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class VariableDeclaration : public Value { >+public: >+ VariableDeclaration(Lexer::Token&& origin, Qualifiers&& qualifiers, std::unique_ptr<AST::Type>&& type, String&& name, Optional<Semantic>&& semantic, std::unique_ptr<Expression>&& initializer) >+ : m_origin(WTFMove(origin)) >+ , m_qualifiers(WTFMove(qualifiers)) >+ , m_type(WTFMove(type)) >+ , m_name(WTFMove(name)) >+ , m_semantic(WTFMove(semantic)) >+ , m_initializer(WTFMove(initializer)) >+ { >+ } >+ >+ virtual ~VariableDeclaration() = default; >+ >+ VariableDeclaration(const VariableDeclaration&) = delete; >+ VariableDeclaration(VariableDeclaration&&) = default; >+ >+ Lexer::Token origin() const { return m_origin; } >+ >+private: >+ Lexer::Token m_origin; >+ Qualifiers m_qualifiers; >+ std::unique_ptr<AST::Type> m_type; >+ String m_name; >+ Optional<Semantic> m_semantic; >+ std::unique_ptr<Expression> m_initializer; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h >new file mode 100644 >index 0000000000000000000000000000000000000000..018bfc99ccb3eeefe140b355e5dd9ae6d4ba41ac >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+#include "WHLSLVariableDeclaration.h" >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class VariableDeclarationsStatement : public Statement { >+public: >+ VariableDeclarationsStatement(Lexer::Token&& origin, Vector<VariableDeclaration>&& variableDeclarations) >+ : Statement(WTFMove(origin)) >+ , m_variableDeclarations(WTFMove(variableDeclarations)) >+ { >+ } >+ >+ virtual ~VariableDeclarationsStatement() = default; >+ >+ VariableDeclarationsStatement(const VariableDeclarationsStatement&) = delete; >+ VariableDeclarationsStatement(VariableDeclarationsStatement&&) = default; >+ >+private: >+ Vector<VariableDeclaration>&& m_variableDeclarations; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8231a403af04368af66877217a684945b059bec0 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h >@@ -0,0 +1,85 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLAnonymousVariableDeclaration.h" >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLVariableDeclaration.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class VariableReference : public Expression { >+public: >+ VariableReference(Lexer::Token&& origin, String&& name) >+ : Expression(WTFMove(origin)) >+ , m_name(WTFMove(name)) >+ { >+ } >+ >+ virtual ~VariableReference() = default; >+ >+ VariableReference(const VariableReference&) = delete; >+ VariableReference(VariableReference&&) = default; >+ >+ static VariableReference wrap(VariableDeclaration& variableDeclaration) >+ { >+ VariableReference result(Lexer::Token(variableDeclaration.origin())); >+ result.m_variable = { &variableDeclaration }; >+ return result; >+ } >+ >+ static VariableReference wrap(AnonymousVariableDeclaration& anonymousVariableDeclaration) >+ { >+ VariableReference result(Lexer::Token(anonymousVariableDeclaration.origin())); >+ result.m_variable = { &anonymousVariableDeclaration }; >+ return result; >+ } >+ >+private: >+ VariableReference(Lexer::Token&& origin) >+ : Expression(WTFMove(origin)) >+ { >+ } >+ >+ String m_name; >+ Optional<Variant<VariableDeclaration*, AnonymousVariableDeclaration*>> m_variable; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h >new file mode 100644 >index 0000000000000000000000000000000000000000..795dfdd6b7f1017354576a09a0e1f8c15350f72b >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h >@@ -0,0 +1,65 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLExpression.h" >+#include "WHLSLLexer.h" >+#include "WHLSLStatement.h" >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+namespace AST { >+ >+class WhileLoop : public Statement { >+public: >+ WhileLoop(Lexer::Token&& origin, std::unique_ptr<Expression>&& conditional, std::unique_ptr<Statement>&& body) >+ : Statement(WTFMove(origin)) >+ , m_conditional(WTFMove(conditional)) >+ , m_body(WTFMove(body)) >+ { >+ } >+ >+ virtual ~WhileLoop() = default; >+ >+ WhileLoop(const WhileLoop&) = delete; >+ WhileLoop(WhileLoop&&) = default; >+ >+private: >+ std::unique_ptr<Expression> m_conditional; >+ std::unique_ptr<Statement> m_body; >+}; >+ >+} >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..016c692e2d879e592d07fa821e41a072922d4910 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WHLSLParser.h" >+ >+#if ENABLE(WEBGPU) >+ >+#include <wtf/text/StringBuilder.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h >new file mode 100644 >index 0000000000000000000000000000000000000000..71df434aa73c4c21524dc36e36876d6ef96f155d >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h >@@ -0,0 +1,114 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "WHLSLAnonymousVariableDeclaration.h" >+#include "WHLSLArrayReferenceType.h" >+#include "WHLSLArrayType.h" >+#include "WHLSLAssignmentExpression.h" >+#include "WHLSLBaseFunctionAttribute.h" >+#include "WHLSLBaseSemantic.h" >+#include "WHLSLBlock.h" >+#include "WHLSLBooleanLiteral.h" >+#include "WHLSLBreak.h" >+#include "WHLSLBuiltInSemantic.h" >+#include "WHLSLCallExpression.h" >+#include "WHLSLCommaExpression.h" >+#include "WHLSLConstantExpression.h" >+#include "WHLSLConstantExpressionEnumerationMemberReference.h" >+#include "WHLSLContinue.h" >+#include "WHLSLDereferenceExpression.h" >+#include "WHLSLDoWhileLoop.h" >+#include "WHLSLDotExpression.h" >+#include "WHLSLEffectfulExpressionStatement.h" >+#include "WHLSLEnumerationDefinition.h" >+#include "WHLSLEnumerationMember.h" >+#include "WHLSLExpression.h" >+#include "WHLSLFallthrough.h" >+#include "WHLSLFloatLiteral.h" >+#include "WHLSLForLoop.h" >+#include "WHLSLFunctionAttribute.h" >+#include "WHLSLFunctionDeclaration.h" >+#include "WHLSLFunctionDefinition.h" >+#include "WHLSLIfStatement.h" >+#include "WHLSLIndexExpression.h" >+#include "WHLSLIntegerLiteral.h" >+#include "WHLSLLexer.h" >+#include "WHLSLLogicalExpression.h" >+#include "WHLSLLogicalNotExpression.h" >+#include "WHLSLMakeArrayReferenceExpression.h" >+#include "WHLSLMakePointerExpression.h" >+#include "WHLSLNativeFunctionDeclaration.h" >+#include "WHLSLNativeTypeDeclaration.h" >+#include "WHLSLNode.h" >+#include "WHLSLNullLiteral.h" >+#include "WHLSLNumThreadsFunctionAttribute.h" >+#include "WHLSLParameter.h" >+#include "WHLSLPointerType.h" >+#include "WHLSLPropertyAccessExpression.h" >+#include "WHLSLQualifier.h" >+#include "WHLSLReadModifyWriteExpression.h" >+#include "WHLSLReferenceType.h" >+#include "WHLSLResourceSemantic.h" >+#include "WHLSLReturn.h" >+#include "WHLSLSemantic.h" >+#include "WHLSLSpecializationConstantSemantic.h" >+#include "WHLSLStageInOutSemantic.h" >+#include "WHLSLStatement.h" >+#include "WHLSLStructureDefinition.h" >+#include "WHLSLStructureElement.h" >+#include "WHLSLSwitchCase.h" >+#include "WHLSLSwitchStatement.h" >+#include "WHLSLTernaryExpression.h" >+#include "WHLSLTrap.h" >+#include "WHLSLType.h" >+#include "WHLSLTypeArgument.h" >+#include "WHLSLTypeDefinition.h" >+#include "WHLSLTypeReference.h" >+#include "WHLSLUnsignedIntegerLiteral.h" >+#include "WHLSLValue.h" >+#include "WHLSLVariableDeclaration.h" >+#include "WHLSLVariableDeclarationsStatement.h" >+#include "WHLSLVariableReference.h" >+#include "WHLSLWhileLoop.h" >+#include <wtf/Expected.h> >+#include <wtf/Optional.h> >+ >+namespace WebCore { >+ >+namespace WHLSL { >+ >+class Parser { >+ >+}; >+ >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index a8c473728aa887863f6744c761cd0ffa98bdda64..5438f4deab39ac553838408444ce516cfb311ef6 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -302,6 +302,7 @@ Modules/websockets/WorkerThreadableWebSocketChannel.cpp > > Modules/webgpu/DOMWindowWebGPU.cpp > Modules/webgpu/WHLSL/WHLSLLexer.cpp >+Modules/webgpu/WHLSL/WHLSLParser.cpp > Modules/webgpu/WebGPU.cpp > Modules/webgpu/WebGPUAdapter.cpp > Modules/webgpu/WebGPUBindGroupLayout.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 1df8d7e1301d7a00c169039d3228e67b0b2d109b..26a6cf7fb5f44006ebf606eab63160923c5d89f8 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -13211,6 +13211,76 @@ > C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontVariantBuilder.h; sourceTree = "<group>"; }; > C210E91121B4BD1000B7F83D /* WHLSLLexer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLLexer.cpp; sourceTree = "<group>"; }; > C210E91221B4BD1000B7F83D /* WHLSLLexer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLLexer.h; sourceTree = "<group>"; }; >+ C21BF6A621CD828E00227979 /* WHLSLTrap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLTrap.h; sourceTree = "<group>"; }; >+ C21BF6A721CD828F00227979 /* WHLSLFunctionDefinition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFunctionDefinition.h; sourceTree = "<group>"; }; >+ C21BF6A821CD829000227979 /* WHLSLContinue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLContinue.h; sourceTree = "<group>"; }; >+ C21BF6A921CD829000227979 /* WHLSLBooleanLiteral.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLBooleanLiteral.h; sourceTree = "<group>"; }; >+ C21BF6AA21CD829100227979 /* WHLSLIndexExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLIndexExpression.h; sourceTree = "<group>"; }; >+ C21BF6AB21CD829200227979 /* WHLSLIntegerLiteral.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLIntegerLiteral.h; sourceTree = "<group>"; }; >+ C21BF6AC21CD829300227979 /* WHLSLSemantic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLSemantic.h; sourceTree = "<group>"; }; >+ C21BF6AD21CD829400227979 /* WHLSLBaseSemantic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLBaseSemantic.h; sourceTree = "<group>"; }; >+ C21BF6AE21CD829500227979 /* WHLSLDoWhileLoop.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLDoWhileLoop.h; sourceTree = "<group>"; }; >+ C21BF6AF21CD829600227979 /* WHLSLValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLValue.h; sourceTree = "<group>"; }; >+ C21BF6B021CD829700227979 /* WHLSLFunctionDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFunctionDeclaration.h; sourceTree = "<group>"; }; >+ C21BF6B121CD829800227979 /* WHLSLStructureElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLStructureElement.h; sourceTree = "<group>"; }; >+ C21BF6B221CD829A00227979 /* WHLSLIfStatement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLIfStatement.h; sourceTree = "<group>"; }; >+ C21BF6B321CD829B00227979 /* WHLSLFallthrough.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFallthrough.h; sourceTree = "<group>"; }; >+ C21BF6B421CD829C00227979 /* WHLSLDereferenceExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLDereferenceExpression.h; sourceTree = "<group>"; }; >+ C21BF6B521CD829D00227979 /* WHLSLConstantExpressionEnumerationMemberReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLConstantExpressionEnumerationMemberReference.h; sourceTree = "<group>"; }; >+ C21BF6B621CD829E00227979 /* WHLSLReturn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLReturn.h; sourceTree = "<group>"; }; >+ C21BF6B721CD829F00227979 /* WHLSLWhileLoop.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLWhileLoop.h; sourceTree = "<group>"; }; >+ C21BF6B821CD82A000227979 /* WHLSLFunctionAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFunctionAttribute.h; sourceTree = "<group>"; }; >+ C21BF6B921CD82A100227979 /* WHLSLCommaExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLCommaExpression.h; sourceTree = "<group>"; }; >+ C21BF6BA21CD82A200227979 /* WHLSLNullLiteral.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLNullLiteral.h; sourceTree = "<group>"; }; >+ C21BF6BB21CD82A300227979 /* WHLSLResourceSemantic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLResourceSemantic.h; sourceTree = "<group>"; }; >+ C21BF6BC21CD82A400227979 /* WHLSLArrayType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLArrayType.h; sourceTree = "<group>"; }; >+ C21BF6BD21CD82A600227979 /* WHLSLBaseFunctionAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLBaseFunctionAttribute.h; sourceTree = "<group>"; }; >+ C21BF6BE21CD82A800227979 /* WHLSLQualifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLQualifier.h; sourceTree = "<group>"; }; >+ C21BF6BF21CD82A900227979 /* WHLSLExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLExpression.h; sourceTree = "<group>"; }; >+ C21BF6C021CD82AA00227979 /* WHLSLReferenceType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLReferenceType.h; sourceTree = "<group>"; }; >+ C21BF6C121CD82AB00227979 /* WHLSLStageInOutSemantic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLStageInOutSemantic.h; sourceTree = "<group>"; }; >+ C21BF6C221CD82AC00227979 /* WHLSLAnonymousVariableDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLAnonymousVariableDeclaration.h; sourceTree = "<group>"; }; >+ C21BF6C321CD82AD00227979 /* WHLSLVariableDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLVariableDeclaration.h; sourceTree = "<group>"; }; >+ C21BF6C421CD82AF00227979 /* WHLSLTypeArgument.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLTypeArgument.h; sourceTree = "<group>"; }; >+ C21BF6C521CD82B000227979 /* WHLSLStatement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLStatement.h; sourceTree = "<group>"; }; >+ C21BF6C621CD82B100227979 /* WHLSLVariableReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLVariableReference.h; sourceTree = "<group>"; }; >+ C21BF6C721CD82B200227979 /* WHLSLVariableDeclarationsStatement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLVariableDeclarationsStatement.h; sourceTree = "<group>"; }; >+ C21BF6C821CD82B300227979 /* WHLSLLogicalNotExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLLogicalNotExpression.h; sourceTree = "<group>"; }; >+ C21BF6C921CD82B400227979 /* WHLSLCallExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLCallExpression.h; sourceTree = "<group>"; }; >+ C21BF6CA21CD82B500227979 /* WHLSLParameter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLParameter.h; sourceTree = "<group>"; }; >+ C21BF6CB21CD82B600227979 /* WHLSLDotExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLDotExpression.h; sourceTree = "<group>"; }; >+ C21BF6CC21CD82B700227979 /* WHLSLSwitchCase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLSwitchCase.h; sourceTree = "<group>"; }; >+ C21BF6CD21CD82B800227979 /* WHLSLBreak.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLBreak.h; sourceTree = "<group>"; }; >+ C21BF6CE21CD82B900227979 /* WHLSLReadModifyWriteExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLReadModifyWriteExpression.h; sourceTree = "<group>"; }; >+ C21BF6CF21CD82BA00227979 /* WHLSLTernaryExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLTernaryExpression.h; sourceTree = "<group>"; }; >+ C21BF6D021CD82BC00227979 /* WHLSLType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLType.h; sourceTree = "<group>"; }; >+ C21BF6D121CD82BD00227979 /* WHLSLBlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLBlock.h; sourceTree = "<group>"; }; >+ C21BF6D221CD82BE00227979 /* WHLSLTypeReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLTypeReference.h; sourceTree = "<group>"; }; >+ C21BF6D321CD82BF00227979 /* WHLSLEnumerationDefinition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLEnumerationDefinition.h; sourceTree = "<group>"; }; >+ C21BF6D421CD82C000227979 /* WHLSLNumThreadsFunctionAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLNumThreadsFunctionAttribute.h; sourceTree = "<group>"; }; >+ C21BF6D521CD82C100227979 /* WHLSLBuiltInSemantic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLBuiltInSemantic.h; sourceTree = "<group>"; }; >+ C21BF6D621CD82C200227979 /* WHLSLNativeFunctionDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLNativeFunctionDeclaration.h; sourceTree = "<group>"; }; >+ C21BF6D721CD82C300227979 /* WHLSLNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLNode.h; sourceTree = "<group>"; }; >+ C21BF6D821CD82C400227979 /* WHLSLArrayReferenceType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLArrayReferenceType.h; sourceTree = "<group>"; }; >+ C21BF6D921CD82C500227979 /* WHLSLEnumerationMember.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLEnumerationMember.h; sourceTree = "<group>"; }; >+ C21BF6DA21CD82C600227979 /* WHLSLStructureDefinition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLStructureDefinition.h; sourceTree = "<group>"; }; >+ C21BF6DB21CD82C700227979 /* WHLSLEffectfulExpressionStatement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLEffectfulExpressionStatement.h; sourceTree = "<group>"; }; >+ C21BF6DC21CD82C800227979 /* WHLSLTypeDefinition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLTypeDefinition.h; sourceTree = "<group>"; }; >+ C21BF6DD21CD82C900227979 /* WHLSLNativeTypeDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLNativeTypeDeclaration.h; sourceTree = "<group>"; }; >+ C21BF6DE21CD82CB00227979 /* WHLSLUnsignedIntegerLiteral.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLUnsignedIntegerLiteral.h; sourceTree = "<group>"; }; >+ C21BF6DF21CD82CC00227979 /* WHLSLMakePointerExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLMakePointerExpression.h; sourceTree = "<group>"; }; >+ C21BF6E021CD82CD00227979 /* WHLSLMakeArrayReferenceExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLMakeArrayReferenceExpression.h; sourceTree = "<group>"; }; >+ C21BF6E121CD82CE00227979 /* WHLSLPropertyAccessExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLPropertyAccessExpression.h; sourceTree = "<group>"; }; >+ C21BF6E221CD82CF00227979 /* WHLSLPointerType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLPointerType.h; sourceTree = "<group>"; }; >+ C21BF6E321CD82D000227979 /* WHLSLAssignmentExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLAssignmentExpression.h; sourceTree = "<group>"; }; >+ C21BF6E421CD82D200227979 /* WHLSLSwitchStatement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLSwitchStatement.h; sourceTree = "<group>"; }; >+ C21BF6E521CD82D300227979 /* WHLSLLogicalExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLLogicalExpression.h; sourceTree = "<group>"; }; >+ C21BF6E621CD82D400227979 /* WHLSLConstantExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLConstantExpression.h; sourceTree = "<group>"; }; >+ C21BF6E721CD82D500227979 /* WHLSLForLoop.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLForLoop.h; sourceTree = "<group>"; }; >+ C21BF6E821CD82D700227979 /* WHLSLFloatLiteral.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFloatLiteral.h; sourceTree = "<group>"; }; >+ C21BF6E921CD82D800227979 /* WHLSLSpecializationConstantSemantic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLSpecializationConstantSemantic.h; sourceTree = "<group>"; }; >+ C21BF6EA21CD831300227979 /* WHLSLParser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLParser.cpp; sourceTree = "<group>"; }; >+ C21BF6EB21CD831400227979 /* WHLSLParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLParser.h; sourceTree = "<group>"; }; > C21DF2E71D9E4E9900F5B24C /* CSSFontVariationValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontVariationValue.cpp; sourceTree = "<group>"; }; > C21DF2E81D9E4E9900F5B24C /* CSSFontVariationValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontVariationValue.h; sourceTree = "<group>"; }; > C2458E611FE8979E00594759 /* FontCacheCoreText.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontCacheCoreText.h; sourceTree = "<group>"; }; >@@ -25229,12 +25299,90 @@ > C210E90D21B4BCA400B7F83D /* WHLSL */ = { > isa = PBXGroup; > children = ( >+ C21BF6A421CD826E00227979 /* AST */, > C210E91121B4BD1000B7F83D /* WHLSLLexer.cpp */, > C210E91221B4BD1000B7F83D /* WHLSLLexer.h */, >+ C21BF6EA21CD831300227979 /* WHLSLParser.cpp */, >+ C21BF6EB21CD831400227979 /* WHLSLParser.h */, > ); > path = WHLSL; > sourceTree = "<group>"; > }; >+ C21BF6A421CD826E00227979 /* AST */ = { >+ isa = PBXGroup; >+ children = ( >+ C21BF6C221CD82AC00227979 /* WHLSLAnonymousVariableDeclaration.h */, >+ C21BF6D821CD82C400227979 /* WHLSLArrayReferenceType.h */, >+ C21BF6BC21CD82A400227979 /* WHLSLArrayType.h */, >+ C21BF6E321CD82D000227979 /* WHLSLAssignmentExpression.h */, >+ C21BF6BD21CD82A600227979 /* WHLSLBaseFunctionAttribute.h */, >+ C21BF6AD21CD829400227979 /* WHLSLBaseSemantic.h */, >+ C21BF6D121CD82BD00227979 /* WHLSLBlock.h */, >+ C21BF6A921CD829000227979 /* WHLSLBooleanLiteral.h */, >+ C21BF6CD21CD82B800227979 /* WHLSLBreak.h */, >+ C21BF6D521CD82C100227979 /* WHLSLBuiltInSemantic.h */, >+ C21BF6C921CD82B400227979 /* WHLSLCallExpression.h */, >+ C21BF6B921CD82A100227979 /* WHLSLCommaExpression.h */, >+ C21BF6E621CD82D400227979 /* WHLSLConstantExpression.h */, >+ C21BF6B521CD829D00227979 /* WHLSLConstantExpressionEnumerationMemberReference.h */, >+ C21BF6A821CD829000227979 /* WHLSLContinue.h */, >+ C21BF6B421CD829C00227979 /* WHLSLDereferenceExpression.h */, >+ C21BF6CB21CD82B600227979 /* WHLSLDotExpression.h */, >+ C21BF6AE21CD829500227979 /* WHLSLDoWhileLoop.h */, >+ C21BF6DB21CD82C700227979 /* WHLSLEffectfulExpressionStatement.h */, >+ C21BF6D321CD82BF00227979 /* WHLSLEnumerationDefinition.h */, >+ C21BF6D921CD82C500227979 /* WHLSLEnumerationMember.h */, >+ C21BF6BF21CD82A900227979 /* WHLSLExpression.h */, >+ C21BF6B321CD829B00227979 /* WHLSLFallthrough.h */, >+ C21BF6E821CD82D700227979 /* WHLSLFloatLiteral.h */, >+ C21BF6E721CD82D500227979 /* WHLSLForLoop.h */, >+ C21BF6B821CD82A000227979 /* WHLSLFunctionAttribute.h */, >+ C21BF6B021CD829700227979 /* WHLSLFunctionDeclaration.h */, >+ C21BF6A721CD828F00227979 /* WHLSLFunctionDefinition.h */, >+ C21BF6B221CD829A00227979 /* WHLSLIfStatement.h */, >+ C21BF6AA21CD829100227979 /* WHLSLIndexExpression.h */, >+ C21BF6AB21CD829200227979 /* WHLSLIntegerLiteral.h */, >+ C21BF6E521CD82D300227979 /* WHLSLLogicalExpression.h */, >+ C21BF6C821CD82B300227979 /* WHLSLLogicalNotExpression.h */, >+ C21BF6E021CD82CD00227979 /* WHLSLMakeArrayReferenceExpression.h */, >+ C21BF6DF21CD82CC00227979 /* WHLSLMakePointerExpression.h */, >+ C21BF6D621CD82C200227979 /* WHLSLNativeFunctionDeclaration.h */, >+ C21BF6DD21CD82C900227979 /* WHLSLNativeTypeDeclaration.h */, >+ C21BF6D721CD82C300227979 /* WHLSLNode.h */, >+ C21BF6BA21CD82A200227979 /* WHLSLNullLiteral.h */, >+ C21BF6D421CD82C000227979 /* WHLSLNumThreadsFunctionAttribute.h */, >+ C21BF6CA21CD82B500227979 /* WHLSLParameter.h */, >+ C21BF6E221CD82CF00227979 /* WHLSLPointerType.h */, >+ C21BF6E121CD82CE00227979 /* WHLSLPropertyAccessExpression.h */, >+ C21BF6BE21CD82A800227979 /* WHLSLQualifier.h */, >+ C21BF6CE21CD82B900227979 /* WHLSLReadModifyWriteExpression.h */, >+ C21BF6C021CD82AA00227979 /* WHLSLReferenceType.h */, >+ C21BF6BB21CD82A300227979 /* WHLSLResourceSemantic.h */, >+ C21BF6B621CD829E00227979 /* WHLSLReturn.h */, >+ C21BF6AC21CD829300227979 /* WHLSLSemantic.h */, >+ C21BF6E921CD82D800227979 /* WHLSLSpecializationConstantSemantic.h */, >+ C21BF6C121CD82AB00227979 /* WHLSLStageInOutSemantic.h */, >+ C21BF6C521CD82B000227979 /* WHLSLStatement.h */, >+ C21BF6DA21CD82C600227979 /* WHLSLStructureDefinition.h */, >+ C21BF6B121CD829800227979 /* WHLSLStructureElement.h */, >+ C21BF6CC21CD82B700227979 /* WHLSLSwitchCase.h */, >+ C21BF6E421CD82D200227979 /* WHLSLSwitchStatement.h */, >+ C21BF6CF21CD82BA00227979 /* WHLSLTernaryExpression.h */, >+ C21BF6A621CD828E00227979 /* WHLSLTrap.h */, >+ C21BF6D021CD82BC00227979 /* WHLSLType.h */, >+ C21BF6C421CD82AF00227979 /* WHLSLTypeArgument.h */, >+ C21BF6DC21CD82C800227979 /* WHLSLTypeDefinition.h */, >+ C21BF6D221CD82BE00227979 /* WHLSLTypeReference.h */, >+ C21BF6DE21CD82CB00227979 /* WHLSLUnsignedIntegerLiteral.h */, >+ C21BF6AF21CD829600227979 /* WHLSLValue.h */, >+ C21BF6C321CD82AD00227979 /* WHLSLVariableDeclaration.h */, >+ C21BF6C721CD82B200227979 /* WHLSLVariableDeclarationsStatement.h */, >+ C21BF6C621CD82B100227979 /* WHLSLVariableReference.h */, >+ C21BF6B721CD829F00227979 /* WHLSLWhileLoop.h */, >+ ); >+ path = AST; >+ sourceTree = "<group>"; >+ }; > C96F5EBF1B5872260091EA9D /* mediasession */ = { > isa = PBXGroup; > children = (
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192991
:
357967
|
357972
|
357974
|
358721
|
358780
|
358820