Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 1551015

Browse files
[WHLSL] Assorted cleanup
https://bugs.webkit.org/show_bug.cgi?id=193389 Reviewed by Dean Jackson. This is a bunch of non-behavior-changing cleanup. - The compiler uses UniqueRef all over the place, and UniqueRef has an implicit operator T&. Therefore, we don't need to static_cast<T&> everywhere. - ConstantExpressionEnumerationMemberReference is the exact same thing as EnumerationMemberLiteral, so this patch deletes the longer-named class in favor of the shorter-named class. - Because of the header dependency tree, this patch moves EntryPointType into its own file so it can be used by files that FunctionDeclaration depends on. Same thing for AddressSpace. - EnumTypes have to have non-null base types. The parser will make sure this is always true. No new tests because there is no behavior change. * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h. * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h. * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::wrap): (WebCore::WHLSL::AST::EnumerationMemberLiteral::left const): (WebCore::WHLSL::AST::EnumerationMemberLiteral::right const): (WebCore::WHLSL::AST::EnumerationMemberLiteral::clone const): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition const): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember const): (WebCore::WHLSL::AST::EnumerationMemberLiteral::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: (WebCore::WHLSL::AST::Expression::type): (WebCore::WHLSL::AST::Expression::setType): (WebCore::WHLSL::AST::Expression::addressSpace const): (WebCore::WHLSL::AST::Expression::setAddressSpace): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: (WebCore::WHLSL::AST::Return::value): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: (WebCore::WHLSL::AST::StructureElement::type): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: (WebCore::WHLSL::AST::SwitchStatement::value): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::initializer): (WebCore::WHLSL::AST::VariableDeclaration::isAnonymous const): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: (WebCore::WHLSL::checkDuplicateFunctions): * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::commit): (WebCore::WHLSL::inferTypesForTypeArguments): (WebCore::WHLSL::inferTypesForCall): * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: (WebCore::WHLSL::NameResolver::visit): (WebCore::WHLSL::resolveNamesInTypes): (WebCore::WHLSL::resolveNamesInFunctions): * Modules/webgpu/WHLSL/WHLSLNameResolver.h: * Modules/webgpu/WHLSL/WHLSLParser.h: * Modules/webgpu/WHLSL/WHLSLProgram.h: (WebCore::WHLSL::Program::append): * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: (WebCore::WHLSL::synthesizeEnumerationFunctions): * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp: (WebCore::WHLSL::synthesizeStructureAccessors): * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: (WebCore::WHLSL::Visitor::visit): * Modules/webgpu/WHLSL/WHLSLVisitor.h: * WebCore.xcodeproj/project.pbxproj: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@239930 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3fe1674 commit 1551015

File tree

58 files changed

+537
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+537
-308
lines changed

Source/WebCore/ChangeLog

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,163 @@
1+
2019-01-14 Myles C. Maxfield <[email protected]>
2+
3+
[WHLSL] Assorted cleanup
4+
https://bugs.webkit.org/show_bug.cgi?id=193389
5+
6+
Reviewed by Dean Jackson.
7+
8+
This is a bunch of non-behavior-changing cleanup.
9+
10+
- The compiler uses UniqueRef all over the place, and UniqueRef has an implicit operator T&. Therefore,
11+
we don't need to static_cast<T&> everywhere.
12+
- ConstantExpressionEnumerationMemberReference is the exact same thing as EnumerationMemberLiteral, so
13+
this patch deletes the longer-named class in favor of the shorter-named class.
14+
- Because of the header dependency tree, this patch moves EntryPointType into its own file so it can be
15+
used by files that FunctionDeclaration depends on. Same thing for AddressSpace.
16+
- EnumTypes have to have non-null base types. The parser will make sure this is always true.
17+
18+
No new tests because there is no behavior change.
19+
20+
* Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h.
21+
* Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
22+
(WebCore::WHLSL::AST::ArrayType::type const):
23+
(WebCore::WHLSL::AST::ArrayType::type):
24+
* Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
25+
(WebCore::WHLSL::AST::AssignmentExpression::left):
26+
(WebCore::WHLSL::AST::AssignmentExpression::right):
27+
* Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h:
28+
* Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
29+
(WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
30+
* Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
31+
* Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
32+
(WebCore::WHLSL::AST::ConstantExpression::ConstantExpression):
33+
(WebCore::WHLSL::AST::ConstantExpression::clone const):
34+
(WebCore::WHLSL::AST::ConstantExpression::matches const):
35+
* Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Removed.
36+
* Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h:
37+
(WebCore::WHLSL::AST::DereferenceExpression::pointer):
38+
* Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h:
39+
(WebCore::WHLSL::AST::DoWhileLoop::body):
40+
(WebCore::WHLSL::AST::DoWhileLoop::conditional):
41+
* Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h:
42+
(WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression):
43+
* Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h.
44+
* Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
45+
(WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition):
46+
(WebCore::WHLSL::AST::EnumerationDefinition::type):
47+
* Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
48+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral):
49+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::wrap):
50+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::left const):
51+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::right const):
52+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::clone const):
53+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition):
54+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition const):
55+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember):
56+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember const):
57+
(WebCore::WHLSL::AST::EnumerationMemberLiteral::setEnumerationMember):
58+
* Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
59+
(WebCore::WHLSL::AST::Expression::type):
60+
(WebCore::WHLSL::AST::Expression::setType):
61+
(WebCore::WHLSL::AST::Expression::addressSpace const):
62+
(WebCore::WHLSL::AST::Expression::setAddressSpace):
63+
* Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp:
64+
(WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
65+
* Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
66+
(WebCore::WHLSL::AST::FloatLiteralType::preferredType):
67+
* Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:
68+
(WebCore::WHLSL::AST::ForLoop::condition):
69+
(WebCore::WHLSL::AST::ForLoop::increment):
70+
(WebCore::WHLSL::AST::ForLoop::body):
71+
* Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
72+
(WebCore::WHLSL::AST::FunctionDeclaration::type const):
73+
(WebCore::WHLSL::AST::FunctionDeclaration::type):
74+
* Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h:
75+
(WebCore::WHLSL::AST::IfStatement::conditional):
76+
(WebCore::WHLSL::AST::IfStatement::body):
77+
(WebCore::WHLSL::AST::IfStatement::elseBody):
78+
* Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
79+
(WebCore::WHLSL::AST::IndexExpression::indexExpression):
80+
* Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:
81+
(WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
82+
* Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
83+
(WebCore::WHLSL::AST::IntegerLiteralType::preferredType):
84+
* Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h:
85+
(WebCore::WHLSL::AST::LogicalExpression::left):
86+
(WebCore::WHLSL::AST::LogicalExpression::right):
87+
* Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h:
88+
(WebCore::WHLSL::AST::LogicalNotExpression::operand):
89+
* Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
90+
(WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue):
91+
* Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
92+
(WebCore::WHLSL::AST::MakePointerExpression::lValue):
93+
* Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
94+
(WebCore::WHLSL::AST::PropertyAccessExpression::base):
95+
* Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
96+
(WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue):
97+
(WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
98+
(WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
99+
* Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
100+
(WebCore::WHLSL::AST::ReferenceType::elementType const):
101+
(WebCore::WHLSL::AST::ReferenceType::elementType):
102+
* Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
103+
(WebCore::WHLSL::AST::ResolvableType::resolvedType const):
104+
(WebCore::WHLSL::AST::ResolvableType::resolvedType):
105+
* Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
106+
(WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
107+
(WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
108+
* Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
109+
* Modules/webgpu/WHLSL/AST/WHLSLReturn.h:
110+
(WebCore::WHLSL::AST::Return::value):
111+
* Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
112+
(WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
113+
* Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h:
114+
* Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
115+
(WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
116+
* Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h:
117+
* Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
118+
(WebCore::WHLSL::AST::StructureElement::type):
119+
* Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h:
120+
(WebCore::WHLSL::AST::SwitchStatement::value):
121+
* Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h:
122+
(WebCore::WHLSL::AST::TernaryExpression::predicate):
123+
(WebCore::WHLSL::AST::TernaryExpression::bodyExpression):
124+
(WebCore::WHLSL::AST::TernaryExpression::elseExpression):
125+
* Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
126+
(WebCore::WHLSL::AST::TypeDefinition::type):
127+
* Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:
128+
(WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
129+
* Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
130+
(WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType):
131+
* Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
132+
(WebCore::WHLSL::AST::VariableDeclaration::type):
133+
(WebCore::WHLSL::AST::VariableDeclaration::initializer):
134+
(WebCore::WHLSL::AST::VariableDeclaration::isAnonymous const):
135+
* Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h:
136+
(WebCore::WHLSL::AST::WhileLoop::conditional):
137+
(WebCore::WHLSL::AST::WhileLoop::body):
138+
* Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
139+
(WebCore::WHLSL::checkDuplicateFunctions):
140+
* Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
141+
(WebCore::WHLSL::commit):
142+
(WebCore::WHLSL::inferTypesForTypeArguments):
143+
(WebCore::WHLSL::inferTypesForCall):
144+
* Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
145+
(WebCore::WHLSL::NameResolver::visit):
146+
(WebCore::WHLSL::resolveNamesInTypes):
147+
(WebCore::WHLSL::resolveNamesInFunctions):
148+
* Modules/webgpu/WHLSL/WHLSLNameResolver.h:
149+
* Modules/webgpu/WHLSL/WHLSLParser.h:
150+
* Modules/webgpu/WHLSL/WHLSLProgram.h:
151+
(WebCore::WHLSL::Program::append):
152+
* Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
153+
(WebCore::WHLSL::synthesizeEnumerationFunctions):
154+
* Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
155+
(WebCore::WHLSL::synthesizeStructureAccessors):
156+
* Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
157+
(WebCore::WHLSL::Visitor::visit):
158+
* Modules/webgpu/WHLSL/WHLSLVisitor.h:
159+
* WebCore.xcodeproj/project.pbxproj:
160+
1161
2019-01-14 Zan Dobersek <[email protected]>
2162

3163
DOMCacheStorage: use-after-move in doSequentialMatch()
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (C) 2019 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#pragma once
27+
28+
#if ENABLE(WEBGPU)
29+
30+
#include <cstdint>
31+
32+
namespace WebCore {
33+
34+
namespace WHLSL {
35+
36+
namespace AST {
37+
38+
enum class AddressSpace : uint8_t {
39+
Constant,
40+
Device,
41+
Threadgroup,
42+
Thread
43+
};
44+
45+
}
46+
47+
}
48+
49+
}
50+
51+
#endif

Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayType.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ class ArrayType : public UnnamedType {
5555

5656
bool isArrayType() const override { return true; }
5757

58-
const UnnamedType& type() const { return static_cast<const UnnamedType&>(m_elementType); }
59-
UnnamedType& type() { return static_cast<UnnamedType&>(m_elementType); }
58+
const UnnamedType& type() const { return m_elementType; }
59+
UnnamedType& type() { return m_elementType; }
6060
unsigned numElements() const { return m_numElements; }
6161

6262
UniqueRef<UnnamedType> clone() const override

Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class AssignmentExpression : public Expression {
5353

5454
bool isAssignmentExpression() const override { return true; }
5555

56-
Expression& left() { return static_cast<Expression&>(m_left); }
57-
Expression& right() { return static_cast<Expression&>(m_right); }
56+
Expression& left() { return m_left; }
57+
Expression& right() { return m_right; }
5858

5959
private:
6060
UniqueRef<Expression> m_left;

Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727

2828
#if ENABLE(WEBGPU)
2929

30+
#include "WHLSLEntryPointType.h"
3031
#include "WHLSLLexer.h"
3132
#include "WHLSLNode.h"
33+
#include <wtf/Optional.h>
3234

3335
namespace WebCore {
3436

@@ -59,7 +61,7 @@ class BaseSemantic : public Node {
5961
Input,
6062
Output
6163
};
62-
virtual bool isAcceptableForShaderItemDirection(ShaderItemDirection, const FunctionDefinition&) const = 0;
64+
virtual bool isAcceptableForShaderItemDirection(ShaderItemDirection, const Optional<EntryPointType>&) const = 0;
6365

6466
private:
6567
Lexer::Token m_origin;

Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ bool BuiltInSemantic::isAcceptableType(const UnnamedType& unnamedType, const Int
7373
}
7474
}
7575

76-
bool BuiltInSemantic::isAcceptableForShaderItemDirection(ShaderItemDirection direction, const FunctionDefinition& functionDefinition) const
76+
bool BuiltInSemantic::isAcceptableForShaderItemDirection(ShaderItemDirection direction, const Optional<EntryPointType>& entryPointType) const
7777
{
78-
switch (*functionDefinition.entryPointType()) {
79-
case FunctionDeclaration::EntryPointType::Vertex:
78+
switch (*entryPointType) {
79+
case EntryPointType::Vertex:
8080
switch (direction) {
8181
case ShaderItemDirection::Input:
8282
switch (m_variable) {
@@ -95,7 +95,7 @@ bool BuiltInSemantic::isAcceptableForShaderItemDirection(ShaderItemDirection dir
9595
return false;
9696
}
9797
}
98-
case FunctionDeclaration::EntryPointType::Fragment:
98+
case EntryPointType::Fragment:
9999
switch (direction) {
100100
case ShaderItemDirection::Input:
101101
switch (m_variable) {
@@ -117,7 +117,7 @@ bool BuiltInSemantic::isAcceptableForShaderItemDirection(ShaderItemDirection dir
117117
return false;
118118
}
119119
}
120-
case FunctionDeclaration::EntryPointType::Compute:
120+
case EntryPointType::Compute:
121121
switch (direction) {
122122
case ShaderItemDirection::Input:
123123
switch (m_variable) {

Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class BuiltInSemantic : public BaseSemantic {
8181
}
8282

8383
bool isAcceptableType(const UnnamedType&, const Intrinsics&) const override;
84-
bool isAcceptableForShaderItemDirection(ShaderItemDirection, const FunctionDefinition&) const override;
84+
bool isAcceptableForShaderItemDirection(ShaderItemDirection, const Optional<EntryPointType>&) const override;
8585

8686
private:
8787
Variable m_variable;

Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#if ENABLE(WEBGPU)
2929

3030
#include "WHLSLBooleanLiteral.h"
31-
#include "WHLSLConstantExpressionEnumerationMemberReference.h"
31+
#include "WHLSLEnumerationMemberLiteral.h"
3232
#include "WHLSLFloatLiteral.h"
3333
#include "WHLSLIntegerLiteral.h"
3434
#include "WHLSLNullLiteral.h"
@@ -71,8 +71,8 @@ class ConstantExpression {
7171
{
7272
}
7373

74-
ConstantExpression(ConstantExpressionEnumerationMemberReference&& constantExpressionEnumerationMemberReference)
75-
: m_variant(WTFMove(constantExpressionEnumerationMemberReference))
74+
ConstantExpression(EnumerationMemberLiteral&& enumerationMemberLiteral)
75+
: m_variant(WTFMove(enumerationMemberLiteral))
7676
{
7777
}
7878

@@ -110,8 +110,8 @@ class ConstantExpression {
110110
return nullLiteral.clone();
111111
}, [&](const BooleanLiteral& booleanLiteral) -> ConstantExpression {
112112
return booleanLiteral.clone();
113-
}, [&](const ConstantExpressionEnumerationMemberReference& constantExpressionEnumerationMemberReference) -> ConstantExpression {
114-
return constantExpressionEnumerationMemberReference.clone();
113+
}, [&](const EnumerationMemberLiteral& enumerationMemberLiteral) -> ConstantExpression {
114+
return enumerationMemberLiteral.clone();
115115
}), m_variant);
116116
}
117117

@@ -133,10 +133,10 @@ class ConstantExpression {
133133
result = booleanLiteral.value() == otherBooleanLiteral.value();
134134
} else
135135
result = false;
136-
}, [&](const ConstantExpressionEnumerationMemberReference& constantExpressionEnumerationMemberReference) {
137-
if (WTF::holds_alternative<ConstantExpressionEnumerationMemberReference>(other.m_variant)) {
138-
const auto& otherMemberReference = WTF::get<ConstantExpressionEnumerationMemberReference>(other.m_variant);
139-
result = constantExpressionEnumerationMemberReference.enumerationMember() == otherMemberReference.enumerationMember();
136+
}, [&](const EnumerationMemberLiteral& enumerationMemberLiteral) {
137+
if (WTF::holds_alternative<EnumerationMemberLiteral>(other.m_variant)) {
138+
const auto& otherMemberReference = WTF::get<EnumerationMemberLiteral>(other.m_variant);
139+
result = enumerationMemberLiteral.enumerationMember() == otherMemberReference.enumerationMember();
140140
} else
141141
result = false;
142142
}));
@@ -154,7 +154,7 @@ class ConstantExpression {
154154
result = false;
155155
}, [&](const BooleanLiteral&) {
156156
result = false;
157-
}, [&](const ConstantExpressionEnumerationMemberReference&) {
157+
}, [&](const EnumerationMemberLiteral&) {
158158
result = false;
159159
}));
160160

@@ -169,7 +169,7 @@ class ConstantExpression {
169169
FloatLiteral,
170170
NullLiteral,
171171
BooleanLiteral,
172-
ConstantExpressionEnumerationMemberReference
172+
EnumerationMemberLiteral
173173
> m_variant;
174174
};
175175

0 commit comments

Comments
 (0)