haikuwebkit/Source/WebCore/Modules/webgpu/WHLSL/WHLSLProgram.cpp

60 lines
1.9 KiB
C++
Raw Permalink Normal View History

[WHLSL] Implement parser AST nodes https://bugs.webkit.org/show_bug.cgi?id=192991 Reviewed by Alex Christensen. 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/WHLSLArrayReferenceType.h: Added. (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. (WebCore::WHLSL::AST::ArrayType::ArrayType): (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): (WebCore::WHLSL::AST::ArrayType::numElements const): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * 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): (WebCore::WHLSL::AST::Block::statements): * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): (WebCore::WHLSL::AST::BooleanLiteral::value const): (WebCore::WHLSL::AST::BooleanLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. (WebCore::WHLSL::AST::Break::Break): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added. (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const): (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): (WebCore::WHLSL::AST::BuiltInSemantic::variable const): (WebCore::WHLSL::AST::BuiltInSemantic::operator== const): (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. (WebCore::WHLSL::AST::CallExpression::CallExpression): (WebCore::WHLSL::AST::CallExpression::arguments): (WebCore::WHLSL::AST::CallExpression::name): (WebCore::WHLSL::AST::CallExpression::setCastData): (WebCore::WHLSL::AST::CallExpression::isCast): (WebCore::WHLSL::AST::CallExpression::castReturnType): (WebCore::WHLSL::AST::CallExpression::hasOverloads const): (WebCore::WHLSL::AST::CallExpression::overloads): (WebCore::WHLSL::AST::CallExpression::setOverloads): (WebCore::WHLSL::AST::CallExpression::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. (WebCore::WHLSL::AST::CommaExpression::CommaExpression): (WebCore::WHLSL::AST::CommaExpression::list): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): (WebCore::WHLSL::AST::ConstantExpression::visit): (WebCore::WHLSL::AST::ConstantExpression::visit const): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. (WebCore::WHLSL::AST::Continue::Continue): * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. (WebCore::WHLSL::AST::DotExpression::DotExpression): (WebCore::WHLSL::AST::DotExpression::fieldName): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): (WebCore::WHLSL::AST::EnumerationDefinition::add): (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): (WebCore::WHLSL::AST::EnumerationMember::origin const): (WebCore::WHLSL::AST::EnumerationMember::name): (WebCore::WHLSL::AST::EnumerationMember::value): (WebCore::WHLSL::AST::EnumerationMember::setValue): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added. (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. (WebCore::WHLSL::AST::Expression::Expression): (WebCore::WHLSL::AST::Expression::origin const): (WebCore::WHLSL::AST::Expression::isAssignmentExpression const): (WebCore::WHLSL::AST::Expression::isBooleanLiteral const): (WebCore::WHLSL::AST::Expression::isCallExpression const): (WebCore::WHLSL::AST::Expression::isCommaExpression const): (WebCore::WHLSL::AST::Expression::isDereferenceExpression const): (WebCore::WHLSL::AST::Expression::isDotExpression const): (WebCore::WHLSL::AST::Expression::isFloatLiteral const): (WebCore::WHLSL::AST::Expression::isIndexExpression const): (WebCore::WHLSL::AST::Expression::isIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isLogicalExpression const): (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const): (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const): (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const): (WebCore::WHLSL::AST::Expression::isTernaryExpression const): (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isVariableReference const): (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral 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::type): (WebCore::WHLSL::AST::FloatLiteral::value const): (WebCore::WHLSL::AST::FloatLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added. (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType): (WebCore::WHLSL::AST::FloatLiteralType::canResolve const): (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added. (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. (WebCore::WHLSL::AST::ForLoop::ForLoop): (WebCore::WHLSL::AST::ForLoop::~ForLoop): (WebCore::WHLSL::AST::ForLoop::initialization): (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const): (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const): (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock): (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const): (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): (WebCore::WHLSL::AST::FunctionDeclaration::name const): (WebCore::WHLSL::AST::FunctionDeclaration::isCast const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters): (WebCore::WHLSL::AST::FunctionDeclaration::semantic): (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): (WebCore::WHLSL::AST::FunctionDefinition::block): (WebCore::WHLSL::AST::FunctionDefinition::restricted const): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. (WebCore::WHLSL::AST::IfStatement::IfStatement): (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. (WebCore::WHLSL::AST::IndexExpression::IndexExpression): (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): (WebCore::WHLSL::AST::IntegerLiteral::type): (WebCore::WHLSL::AST::IntegerLiteral::value const): (WebCore::WHLSL::AST::IntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType): (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): (WebCore::WHLSL::AST::LogicalExpression::type const): (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added. (WebCore::WHLSL::AST::NamedType::NamedType): (WebCore::WHLSL::AST::NamedType::origin const): (WebCore::WHLSL::AST::NamedType::name): (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): (WebCore::WHLSL::AST::NamedType::unifyNode const): (WebCore::WHLSL::AST::NamedType::unifyNode): * 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): (WebCore::WHLSL::AST::NativeTypeDeclaration::name const): (WebCore::WHLSL::AST::NativeTypeDeclaration::name): (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. (WebCore::WHLSL::AST::NullLiteral::NullLiteral): (WebCore::WHLSL::AST::NullLiteral::type): (WebCore::WHLSL::AST::NullLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added. (WebCore::WHLSL::AST::NullLiteralType::canResolve const): (WebCore::WHLSL::AST::NullLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added. * 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/WHLSLPointerType.h: Added. (WebCore::WHLSL::AST::PointerType::PointerType): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. (WebCore::WHLSL::AST::ReferenceType::ReferenceType): (WebCore::WHLSL::AST::ReferenceType::addressSpace const): (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added. (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): (WebCore::WHLSL::AST::ResolvableType::resolve): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added. (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection 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): (WebCore::WHLSL::AST::ResourceSemantic::operator== const): (WebCore::WHLSL::AST::ResourceSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. (WebCore::WHLSL::AST::Return::Return): (WebCore::WHLSL::AST::Return::value): (WebCore::WHLSL::AST::Return::function): (WebCore::WHLSL::AST::Return::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added. (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const): (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): (WebCore::WHLSL::AST::StageInOutSemantic::index const): (WebCore::WHLSL::AST::StageInOutSemantic::operator== const): (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. (WebCore::WHLSL::AST::Statement::Statement): (WebCore::WHLSL::AST::Statement::isBlock const): (WebCore::WHLSL::AST::Statement::isBreak const): (WebCore::WHLSL::AST::Statement::isContinue const): (WebCore::WHLSL::AST::Statement::isDoWhileLoop const): (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const): (WebCore::WHLSL::AST::Statement::isFallthrough const): (WebCore::WHLSL::AST::Statement::isForLoop const): (WebCore::WHLSL::AST::Statement::isIfStatement const): (WebCore::WHLSL::AST::Statement::isReturn const): (WebCore::WHLSL::AST::Statement::isSwitchCase const): (WebCore::WHLSL::AST::Statement::isSwitchStatement const): (WebCore::WHLSL::AST::Statement::isTrap const): (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const): (WebCore::WHLSL::AST::Statement::isWhileLoop const): * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): (WebCore::WHLSL::AST::StructureDefinition::structureElements): * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. (WebCore::WHLSL::AST::StructureElement::StructureElement): (WebCore::WHLSL::AST::StructureElement::origin const): (WebCore::WHLSL::AST::StructureElement::type): (WebCore::WHLSL::AST::StructureElement::name): (WebCore::WHLSL::AST::StructureElement::semantic): * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. (WebCore::WHLSL::AST::SwitchCase::SwitchCase): (WebCore::WHLSL::AST::SwitchCase::value): (WebCore::WHLSL::AST::SwitchCase::block): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): (WebCore::WHLSL::AST::SwitchStatement::value): (WebCore::WHLSL::AST::SwitchStatement::switchCases): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. (WebCore::WHLSL::AST::Trap::Trap): * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. (WebCore::WHLSL::AST::Type::isNamedType const): (WebCore::WHLSL::AST::Type::isUnnamedType const): (WebCore::WHLSL::AST::Type::isResolvableType const): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added. (WebCore::WHLSL::AST::clone): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added. (WebCore::WHLSL::AST::TypeReference::wrap): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. (WebCore::WHLSL::AST::TypeReference::TypeReference): (WebCore::WHLSL::AST::TypeReference::name): (WebCore::WHLSL::AST::TypeReference::typeArguments): (WebCore::WHLSL::AST::TypeReference::resolvedType const): (WebCore::WHLSL::AST::TypeReference::setResolvedType): (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added. (WebCore::WHLSL::AST::UnnamedType::UnnamedType): (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): (WebCore::WHLSL::AST::UnnamedType::isPointerType const): (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): (WebCore::WHLSL::AST::UnnamedType::isArrayType const): (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): (WebCore::WHLSL::AST::UnnamedType::unifyNode const): (WebCore::WHLSL::AST::UnnamedType::unifyNode): (WebCore::WHLSL::AST::UnnamedType::origin const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * 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): (WebCore::WHLSL::AST::VariableDeclaration::name): (WebCore::WHLSL::AST::VariableDeclaration::type const): (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::semantic): (WebCore::WHLSL::AST::VariableDeclaration::initializer): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. (WebCore::WHLSL::AST::VariableReference::VariableReference): (WebCore::WHLSL::AST::VariableReference::wrap): (WebCore::WHLSL::AST::VariableReference::name): (WebCore::WHLSL::AST::VariableReference::variable): (WebCore::WHLSL::AST::VariableReference::setVariable): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. (WebCore::WHLSL::AST::WhileLoop::WhileLoop): (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. * Modules/webgpu/WHLSL/WHLSLParser.h: Added. * Modules/webgpu/WHLSL/WHLSLProgram.h: Added. (WebCore::WHLSL::Program::append): (WebCore::WHLSL::Program::nameContext): (WebCore::WHLSL::Program::intrinsics): (WebCore::WHLSL::Program::typeDefinitions): (WebCore::WHLSL::Program::structureDefinitions): (WebCore::WHLSL::Program::enumerationDefinitions): (WebCore::WHLSL::Program::functionDefinitions const): (WebCore::WHLSL::Program::functionDefinitions): (WebCore::WHLSL::Program::nativeFunctionDeclarations const): (WebCore::WHLSL::Program::nativeFunctionDeclarations): (WebCore::WHLSL::Program::nativeTypeDeclarations): Canonical link: https://commits.webkit.org/207830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 22:17:58 +00:00
/*
* Copyright (C) 2019 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"
[WHLSL] Remove getters/setters/anders https://bugs.webkit.org/show_bug.cgi?id=201008 Reviewed by Robin Morisset. Source/WebCore: This patch changes WHLSL in a significant way. This patch removes getters/setters/anders from the language. In our experience writing WHLSL shaders, these parts of the language went unused, and they added a lot of complexity to the implementation of the compiler. This patch now treats field accesses and array indexes as intrinsics inside the compiler. This patch removes all notions of named operators, anders, and indexed operators from the compiler and the standard library. The checker now intrinsically knows the return type for property accesses and indexed expressions based on what the base type is. To make this work in practice was difficult, since getters/setters/anders solved a lot of the difficult problems we had in generating metal code. For example, all swizzle operators were getters and setters, so assigning to a swizzle fell out naturally from implementing setters. However, during metal codegen, all we see is a dot expression with "xy" as a property. Our previous architecture of emitting Metal code using pointers which represent lvalues doesn't work because you can't take the address of a swizzle. For example, "auto* x = &vector.yz" is invalid metal code. So, this patch changes the entire metal code generator to emit WHLSL expressions as Metal expressions. To do this, I had to change a lot about how the compiler was implemented: - I changed the indexed accesses of matrices to return columns instead of rows. This allowed WHLSL code like `mat[0].xy = 42` to be compiled into the equivalent metal code of `mat[0].xy = 42`. - I changed the native function inliner to emit expressions instead of statements. - We also simplify the language by removing null and requiring all reference type variables to have an initializer. This means that null is no longer a valid value, which allows us to omit null checks inside the metal code generator. To make this work with array accesses, we now clamp accesses instead of returning null for OOB accesses. I've also filed one required bug as a followup. I didn't include it in this patch to make it easier to review along. Currently, there are two places in metal codegen where we evaluate effects twice. That will be fixed in: https://bugs.webkit.org/show_bug.cgi?id=201251 Tests: webgpu/whlsl/address-of-swizzle.html webgpu/whlsl/array-oob-alias.html webgpu/whlsl/matrix-index-assign.html webgpu/whlsl/matrix-index-order.html webgpu/whlsl/oob-access-2.html webgpu/whlsl/operator-syntax.html * Modules/webgpu/WHLSL/AST/WHLSLAST.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: (WebCore::WHLSL::AST::Expression::destroy): (WebCore::WHLSL::AST::Expression::destruct): (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunctionName const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: (WebCore::WHLSL::AST::Expression::copyTypeTo const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction): Deleted. (): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: (WebCore::WHLSL::AST::Type::destroy): (WebCore::WHLSL::AST::Type::destruct): (WebCore::WHLSL::AST::ResolvableType::canResolve const): (WebCore::WHLSL::AST::ResolvableType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLType.h: (WebCore::WHLSL::AST::Type::isIntegerLiteralType const): (WebCore::WHLSL::AST::Type::isNullLiteralType const): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: (WebCore::WHLSL::Metal::FunctionDefinitionWriter::HoistedVariableCollector::HoistedVariableCollector): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: (WebCore::WHLSL::Metal::metalCodePrologue): (WebCore::WHLSL::Metal::generateMetalCode): (WebCore::WHLSL::Metal::metalCodeProlog): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: (WebCore::WHLSL::Metal::inlineNativeFunction): (WebCore::WHLSL::Metal::vectorInnerType): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: (WebCore::WHLSL::Metal::writeNativeType): * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: (WebCore::WHLSL::ASTDumper::visit): * Modules/webgpu/WHLSL/WHLSLASTDumper.h: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: (WebCore::WHLSL::checkDuplicateFunctions): * Modules/webgpu/WHLSL/WHLSLChecker.cpp: (WebCore::WHLSL::resolveByInstantiation): (WebCore::WHLSL::checkOperatorOverload): (WebCore::WHLSL::Checker::wrappedUintType): (WebCore::WHLSL::Checker::normalizedTypeForFunctionKey): (WebCore::WHLSL::Checker::visit): (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::Checker::resolveFunction): (WebCore::WHLSL::Checker::assignConcreteType): (WebCore::WHLSL::resolveWithOperatorLength): Deleted. (WebCore::WHLSL::Checker::genericPointerType): Deleted. (WebCore::WHLSL::Checker::finishVisiting): Deleted. * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): (): Deleted. * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::commit): * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: (WebCore::WHLSL::Intrinsics::boolVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::uintVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::intVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::floatVectorTypeForSize const): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: (WebCore::WHLSL::Lexer::consumeTokenFromStream): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: (WebCore::WHLSL::Parser::parseConstantExpression): (WebCore::WHLSL::Parser::parseEnumerationMember): (WebCore::WHLSL::Parser::parseTerm): * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: (WebCore::WHLSL::prepareShared): * Modules/webgpu/WHLSL/WHLSLProgram.cpp: Added. (WebCore::WHLSL::Program::isValidVectorProperty): * Modules/webgpu/WHLSL/WHLSLProgram.h: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: (WebCore::WHLSL::resolveProperties): (WebCore::WHLSL::PropertyResolver::visit): Deleted. (WebCore::WHLSL::wrapAnderCallArgument): Deleted. (WebCore::WHLSL::anderCallArgument): Deleted. (WebCore::WHLSL::setterCall): Deleted. (WebCore::WHLSL::getterCall): Deleted. (WebCore::WHLSL::modify): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyRightValue): Deleted. (WebCore::WHLSL::LeftValueSimplifier::finishVisiting): Deleted. (WebCore::WHLSL::LeftValueSimplifier::visit): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyLeftValue): Deleted. * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: (WebCore::WHLSL::synthesizeEnumerationFunctions): * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: (WebCore::WHLSL::Visitor::visit): * Modules/webgpu/WHLSL/WHLSLVisitor.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * webgpu/whlsl/address-of-swizzle-expected.txt: Added. * webgpu/whlsl/address-of-swizzle.html: Added. * webgpu/whlsl/array-oob-alias-expected.txt: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt. * webgpu/whlsl/array-oob-alias.html: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null.html. * webgpu/whlsl/bad-ander-expected.txt: Removed. * webgpu/whlsl/bad-ander.html: Removed. * webgpu/whlsl/duplicate-types-should-not-produce-duplicate-ctors.html: * webgpu/whlsl/increment-setter.html: * webgpu/whlsl/index-ander-expected.txt: Removed. * webgpu/whlsl/index-ander.html: Removed. * webgpu/whlsl/index-setter-getter-expected.txt: Removed. * webgpu/whlsl/index-setter-getter.html: Removed. * webgpu/whlsl/make-array-reference.html: * webgpu/whlsl/matrix-index-assign-expected.txt: Added. * webgpu/whlsl/matrix-index-assign.html: Added. * webgpu/whlsl/matrix-index-order-expected.txt: Added. * webgpu/whlsl/matrix-index-order.html: Added. * webgpu/whlsl/matrix-memory-layout.html: * webgpu/whlsl/matrix.html: * webgpu/whlsl/null-arg-expected.txt: * webgpu/whlsl/null-arg.html: * webgpu/whlsl/null-dereference-expected.txt: Removed. * webgpu/whlsl/null-dereference.html: Removed. * webgpu/whlsl/oob-access-2-expected.txt: Added. * webgpu/whlsl/oob-access-2.html: Added. * webgpu/whlsl/oob-access.html: * webgpu/whlsl/operator-syntax-expected.txt: Added. * webgpu/whlsl/operator-syntax.html: Added. * webgpu/whlsl/operator-vector-assign.html: * webgpu/whlsl/operator-vector-load.html: * webgpu/whlsl/override-subscript-expected.txt: Removed. * webgpu/whlsl/override-subscript.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander.html: Removed. * webgpu/whlsl/propertyresolver/getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue.html: Removed. * webgpu/whlsl/setter-spec-tests.html: * webgpu/whlsl/simple-getter-setter-expected.txt: * webgpu/whlsl/simple-getter-setter.html: * webgpu/whlsl/structure-field-access-on-null-expected.txt: Removed. * webgpu/whlsl/structure-field-access-on-null.html: Removed. * webgpu/whlsl/test-harness-test.html: Canonical link: https://commits.webkit.org/215020@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-31 00:13:42 +00:00
#include "WHLSLProgram.h"
[WHLSL] Implement parser AST nodes https://bugs.webkit.org/show_bug.cgi?id=192991 Reviewed by Alex Christensen. 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/WHLSLArrayReferenceType.h: Added. (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. (WebCore::WHLSL::AST::ArrayType::ArrayType): (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): (WebCore::WHLSL::AST::ArrayType::numElements const): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * 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): (WebCore::WHLSL::AST::Block::statements): * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): (WebCore::WHLSL::AST::BooleanLiteral::value const): (WebCore::WHLSL::AST::BooleanLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. (WebCore::WHLSL::AST::Break::Break): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added. (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const): (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): (WebCore::WHLSL::AST::BuiltInSemantic::variable const): (WebCore::WHLSL::AST::BuiltInSemantic::operator== const): (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. (WebCore::WHLSL::AST::CallExpression::CallExpression): (WebCore::WHLSL::AST::CallExpression::arguments): (WebCore::WHLSL::AST::CallExpression::name): (WebCore::WHLSL::AST::CallExpression::setCastData): (WebCore::WHLSL::AST::CallExpression::isCast): (WebCore::WHLSL::AST::CallExpression::castReturnType): (WebCore::WHLSL::AST::CallExpression::hasOverloads const): (WebCore::WHLSL::AST::CallExpression::overloads): (WebCore::WHLSL::AST::CallExpression::setOverloads): (WebCore::WHLSL::AST::CallExpression::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. (WebCore::WHLSL::AST::CommaExpression::CommaExpression): (WebCore::WHLSL::AST::CommaExpression::list): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): (WebCore::WHLSL::AST::ConstantExpression::visit): (WebCore::WHLSL::AST::ConstantExpression::visit const): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. (WebCore::WHLSL::AST::Continue::Continue): * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. (WebCore::WHLSL::AST::DotExpression::DotExpression): (WebCore::WHLSL::AST::DotExpression::fieldName): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): (WebCore::WHLSL::AST::EnumerationDefinition::add): (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): (WebCore::WHLSL::AST::EnumerationMember::origin const): (WebCore::WHLSL::AST::EnumerationMember::name): (WebCore::WHLSL::AST::EnumerationMember::value): (WebCore::WHLSL::AST::EnumerationMember::setValue): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added. (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. (WebCore::WHLSL::AST::Expression::Expression): (WebCore::WHLSL::AST::Expression::origin const): (WebCore::WHLSL::AST::Expression::isAssignmentExpression const): (WebCore::WHLSL::AST::Expression::isBooleanLiteral const): (WebCore::WHLSL::AST::Expression::isCallExpression const): (WebCore::WHLSL::AST::Expression::isCommaExpression const): (WebCore::WHLSL::AST::Expression::isDereferenceExpression const): (WebCore::WHLSL::AST::Expression::isDotExpression const): (WebCore::WHLSL::AST::Expression::isFloatLiteral const): (WebCore::WHLSL::AST::Expression::isIndexExpression const): (WebCore::WHLSL::AST::Expression::isIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isLogicalExpression const): (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const): (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const): (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const): (WebCore::WHLSL::AST::Expression::isTernaryExpression const): (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isVariableReference const): (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral 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::type): (WebCore::WHLSL::AST::FloatLiteral::value const): (WebCore::WHLSL::AST::FloatLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added. (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType): (WebCore::WHLSL::AST::FloatLiteralType::canResolve const): (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added. (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. (WebCore::WHLSL::AST::ForLoop::ForLoop): (WebCore::WHLSL::AST::ForLoop::~ForLoop): (WebCore::WHLSL::AST::ForLoop::initialization): (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const): (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const): (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock): (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const): (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): (WebCore::WHLSL::AST::FunctionDeclaration::name const): (WebCore::WHLSL::AST::FunctionDeclaration::isCast const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters): (WebCore::WHLSL::AST::FunctionDeclaration::semantic): (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): (WebCore::WHLSL::AST::FunctionDefinition::block): (WebCore::WHLSL::AST::FunctionDefinition::restricted const): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. (WebCore::WHLSL::AST::IfStatement::IfStatement): (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. (WebCore::WHLSL::AST::IndexExpression::IndexExpression): (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): (WebCore::WHLSL::AST::IntegerLiteral::type): (WebCore::WHLSL::AST::IntegerLiteral::value const): (WebCore::WHLSL::AST::IntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType): (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): (WebCore::WHLSL::AST::LogicalExpression::type const): (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added. (WebCore::WHLSL::AST::NamedType::NamedType): (WebCore::WHLSL::AST::NamedType::origin const): (WebCore::WHLSL::AST::NamedType::name): (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): (WebCore::WHLSL::AST::NamedType::unifyNode const): (WebCore::WHLSL::AST::NamedType::unifyNode): * 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): (WebCore::WHLSL::AST::NativeTypeDeclaration::name const): (WebCore::WHLSL::AST::NativeTypeDeclaration::name): (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. (WebCore::WHLSL::AST::NullLiteral::NullLiteral): (WebCore::WHLSL::AST::NullLiteral::type): (WebCore::WHLSL::AST::NullLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added. (WebCore::WHLSL::AST::NullLiteralType::canResolve const): (WebCore::WHLSL::AST::NullLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added. * 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/WHLSLPointerType.h: Added. (WebCore::WHLSL::AST::PointerType::PointerType): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. (WebCore::WHLSL::AST::ReferenceType::ReferenceType): (WebCore::WHLSL::AST::ReferenceType::addressSpace const): (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added. (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): (WebCore::WHLSL::AST::ResolvableType::resolve): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added. (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection 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): (WebCore::WHLSL::AST::ResourceSemantic::operator== const): (WebCore::WHLSL::AST::ResourceSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. (WebCore::WHLSL::AST::Return::Return): (WebCore::WHLSL::AST::Return::value): (WebCore::WHLSL::AST::Return::function): (WebCore::WHLSL::AST::Return::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added. (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const): (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): (WebCore::WHLSL::AST::StageInOutSemantic::index const): (WebCore::WHLSL::AST::StageInOutSemantic::operator== const): (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. (WebCore::WHLSL::AST::Statement::Statement): (WebCore::WHLSL::AST::Statement::isBlock const): (WebCore::WHLSL::AST::Statement::isBreak const): (WebCore::WHLSL::AST::Statement::isContinue const): (WebCore::WHLSL::AST::Statement::isDoWhileLoop const): (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const): (WebCore::WHLSL::AST::Statement::isFallthrough const): (WebCore::WHLSL::AST::Statement::isForLoop const): (WebCore::WHLSL::AST::Statement::isIfStatement const): (WebCore::WHLSL::AST::Statement::isReturn const): (WebCore::WHLSL::AST::Statement::isSwitchCase const): (WebCore::WHLSL::AST::Statement::isSwitchStatement const): (WebCore::WHLSL::AST::Statement::isTrap const): (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const): (WebCore::WHLSL::AST::Statement::isWhileLoop const): * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): (WebCore::WHLSL::AST::StructureDefinition::structureElements): * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. (WebCore::WHLSL::AST::StructureElement::StructureElement): (WebCore::WHLSL::AST::StructureElement::origin const): (WebCore::WHLSL::AST::StructureElement::type): (WebCore::WHLSL::AST::StructureElement::name): (WebCore::WHLSL::AST::StructureElement::semantic): * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. (WebCore::WHLSL::AST::SwitchCase::SwitchCase): (WebCore::WHLSL::AST::SwitchCase::value): (WebCore::WHLSL::AST::SwitchCase::block): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): (WebCore::WHLSL::AST::SwitchStatement::value): (WebCore::WHLSL::AST::SwitchStatement::switchCases): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. (WebCore::WHLSL::AST::Trap::Trap): * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. (WebCore::WHLSL::AST::Type::isNamedType const): (WebCore::WHLSL::AST::Type::isUnnamedType const): (WebCore::WHLSL::AST::Type::isResolvableType const): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added. (WebCore::WHLSL::AST::clone): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added. (WebCore::WHLSL::AST::TypeReference::wrap): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. (WebCore::WHLSL::AST::TypeReference::TypeReference): (WebCore::WHLSL::AST::TypeReference::name): (WebCore::WHLSL::AST::TypeReference::typeArguments): (WebCore::WHLSL::AST::TypeReference::resolvedType const): (WebCore::WHLSL::AST::TypeReference::setResolvedType): (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added. (WebCore::WHLSL::AST::UnnamedType::UnnamedType): (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): (WebCore::WHLSL::AST::UnnamedType::isPointerType const): (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): (WebCore::WHLSL::AST::UnnamedType::isArrayType const): (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): (WebCore::WHLSL::AST::UnnamedType::unifyNode const): (WebCore::WHLSL::AST::UnnamedType::unifyNode): (WebCore::WHLSL::AST::UnnamedType::origin const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * 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): (WebCore::WHLSL::AST::VariableDeclaration::name): (WebCore::WHLSL::AST::VariableDeclaration::type const): (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::semantic): (WebCore::WHLSL::AST::VariableDeclaration::initializer): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. (WebCore::WHLSL::AST::VariableReference::VariableReference): (WebCore::WHLSL::AST::VariableReference::wrap): (WebCore::WHLSL::AST::VariableReference::name): (WebCore::WHLSL::AST::VariableReference::variable): (WebCore::WHLSL::AST::VariableReference::setVariable): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. (WebCore::WHLSL::AST::WhileLoop::WhileLoop): (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. * Modules/webgpu/WHLSL/WHLSLParser.h: Added. * Modules/webgpu/WHLSL/WHLSLProgram.h: Added. (WebCore::WHLSL::Program::append): (WebCore::WHLSL::Program::nameContext): (WebCore::WHLSL::Program::intrinsics): (WebCore::WHLSL::Program::typeDefinitions): (WebCore::WHLSL::Program::structureDefinitions): (WebCore::WHLSL::Program::enumerationDefinitions): (WebCore::WHLSL::Program::functionDefinitions const): (WebCore::WHLSL::Program::functionDefinitions): (WebCore::WHLSL::Program::nativeFunctionDeclarations const): (WebCore::WHLSL::Program::nativeFunctionDeclarations): (WebCore::WHLSL::Program::nativeTypeDeclarations): Canonical link: https://commits.webkit.org/207830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 22:17:58 +00:00
[WebGPU] Add ENABLE(WHLSL_COMPILER) guard https://bugs.webkit.org/show_bug.cgi?id=216713 Reviewed by Myles C. Maxfield. Source/WebCore: Replaces the ENABLE(WEBGPU) guards in the Modules/webgpu/WHLSL with ENABLE(WHLSL_COMPILER) since not all ports need a WHLSL compiler to support WebGPU. * Modules/webgpu/WHLSL/AST/WHLSLAST.h: * Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h: * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h: * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h: * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLBlock.h: * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: * Modules/webgpu/WHLSL/AST/WHLSLDefaultDelete.h: * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h: * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h: * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: * Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h: * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLNameSpace.h: * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h: * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h: * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: * Modules/webgpu/WHLSL/AST/WHLSLReplaceWith.h: * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLStatement.cpp: * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLStatementList.h: * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLType.h: * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: * Modules/webgpu/WHLSL/AST/WHLSLUnnamedTypeHash.h: * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h: * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLMangledNames.h: * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h: * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h: * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: * Modules/webgpu/WHLSL/WHLSLASTDumper.h: * Modules/webgpu/WHLSL/WHLSLBuildStandardLibraryFunctionMap.py: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.h: * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.cpp: * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.h: * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp: * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.h: * Modules/webgpu/WHLSL/WHLSLChecker.cpp: * Modules/webgpu/WHLSL/WHLSLChecker.h: * Modules/webgpu/WHLSL/WHLSLCodeLocation.h: * Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp: * Modules/webgpu/WHLSL/WHLSLComputeDimensions.h: * Modules/webgpu/WHLSL/WHLSLError.h: * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.h: * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp: * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h: * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.h: * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: * Modules/webgpu/WHLSL/WHLSLInferTypes.h: * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp: * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLLexer.h: * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.h: * Modules/webgpu/WHLSL/WHLSLNameContext.cpp: * Modules/webgpu/WHLSL/WHLSLNameContext.h: * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: * Modules/webgpu/WHLSL/WHLSLNameResolver.h: * Modules/webgpu/WHLSL/WHLSLParser.cpp: * Modules/webgpu/WHLSL/WHLSLParser.h: * Modules/webgpu/WHLSL/WHLSLParsingMode.h: * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h: * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: * Modules/webgpu/WHLSL/WHLSLPrepare.h: * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp: * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.h: * Modules/webgpu/WHLSL/WHLSLProgram.cpp: * Modules/webgpu/WHLSL/WHLSLProgram.h: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.h: * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.h: * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp: * Modules/webgpu/WHLSL/WHLSLRecursionChecker.h: * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.h: * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp: * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.h: * Modules/webgpu/WHLSL/WHLSLResolvingType.h: * Modules/webgpu/WHLSL/WHLSLScopedSetAdder.h: * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp: * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.h: * Modules/webgpu/WHLSL/WHLSLStandardLibraryFunctionMap.h: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h: * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp: * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.h: * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.h: * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.h: * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: * Modules/webgpu/WHLSL/WHLSLVisitor.h: Source/WTF: Adds a default for ENABLE_WHLSL_COMPILER on Cocoa platforms. * wtf/PlatformEnable.h: * wtf/PlatformEnableCocoa.h: Canonical link: https://commits.webkit.org/229524@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267288 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-18 22:54:26 +00:00
#if ENABLE(WHLSL_COMPILER)
[WHLSL] Implement parser AST nodes https://bugs.webkit.org/show_bug.cgi?id=192991 Reviewed by Alex Christensen. 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/WHLSLArrayReferenceType.h: Added. (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. (WebCore::WHLSL::AST::ArrayType::ArrayType): (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): (WebCore::WHLSL::AST::ArrayType::numElements const): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * 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): (WebCore::WHLSL::AST::Block::statements): * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): (WebCore::WHLSL::AST::BooleanLiteral::value const): (WebCore::WHLSL::AST::BooleanLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. (WebCore::WHLSL::AST::Break::Break): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added. (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const): (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): (WebCore::WHLSL::AST::BuiltInSemantic::variable const): (WebCore::WHLSL::AST::BuiltInSemantic::operator== const): (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. (WebCore::WHLSL::AST::CallExpression::CallExpression): (WebCore::WHLSL::AST::CallExpression::arguments): (WebCore::WHLSL::AST::CallExpression::name): (WebCore::WHLSL::AST::CallExpression::setCastData): (WebCore::WHLSL::AST::CallExpression::isCast): (WebCore::WHLSL::AST::CallExpression::castReturnType): (WebCore::WHLSL::AST::CallExpression::hasOverloads const): (WebCore::WHLSL::AST::CallExpression::overloads): (WebCore::WHLSL::AST::CallExpression::setOverloads): (WebCore::WHLSL::AST::CallExpression::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. (WebCore::WHLSL::AST::CommaExpression::CommaExpression): (WebCore::WHLSL::AST::CommaExpression::list): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): (WebCore::WHLSL::AST::ConstantExpression::visit): (WebCore::WHLSL::AST::ConstantExpression::visit const): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. (WebCore::WHLSL::AST::Continue::Continue): * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. (WebCore::WHLSL::AST::DotExpression::DotExpression): (WebCore::WHLSL::AST::DotExpression::fieldName): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): (WebCore::WHLSL::AST::EnumerationDefinition::add): (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): (WebCore::WHLSL::AST::EnumerationMember::origin const): (WebCore::WHLSL::AST::EnumerationMember::name): (WebCore::WHLSL::AST::EnumerationMember::value): (WebCore::WHLSL::AST::EnumerationMember::setValue): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added. (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. (WebCore::WHLSL::AST::Expression::Expression): (WebCore::WHLSL::AST::Expression::origin const): (WebCore::WHLSL::AST::Expression::isAssignmentExpression const): (WebCore::WHLSL::AST::Expression::isBooleanLiteral const): (WebCore::WHLSL::AST::Expression::isCallExpression const): (WebCore::WHLSL::AST::Expression::isCommaExpression const): (WebCore::WHLSL::AST::Expression::isDereferenceExpression const): (WebCore::WHLSL::AST::Expression::isDotExpression const): (WebCore::WHLSL::AST::Expression::isFloatLiteral const): (WebCore::WHLSL::AST::Expression::isIndexExpression const): (WebCore::WHLSL::AST::Expression::isIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isLogicalExpression const): (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const): (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const): (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const): (WebCore::WHLSL::AST::Expression::isTernaryExpression const): (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isVariableReference const): (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral 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::type): (WebCore::WHLSL::AST::FloatLiteral::value const): (WebCore::WHLSL::AST::FloatLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added. (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType): (WebCore::WHLSL::AST::FloatLiteralType::canResolve const): (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added. (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. (WebCore::WHLSL::AST::ForLoop::ForLoop): (WebCore::WHLSL::AST::ForLoop::~ForLoop): (WebCore::WHLSL::AST::ForLoop::initialization): (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const): (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const): (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock): (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const): (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): (WebCore::WHLSL::AST::FunctionDeclaration::name const): (WebCore::WHLSL::AST::FunctionDeclaration::isCast const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters): (WebCore::WHLSL::AST::FunctionDeclaration::semantic): (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): (WebCore::WHLSL::AST::FunctionDefinition::block): (WebCore::WHLSL::AST::FunctionDefinition::restricted const): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. (WebCore::WHLSL::AST::IfStatement::IfStatement): (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. (WebCore::WHLSL::AST::IndexExpression::IndexExpression): (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): (WebCore::WHLSL::AST::IntegerLiteral::type): (WebCore::WHLSL::AST::IntegerLiteral::value const): (WebCore::WHLSL::AST::IntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType): (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): (WebCore::WHLSL::AST::LogicalExpression::type const): (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added. (WebCore::WHLSL::AST::NamedType::NamedType): (WebCore::WHLSL::AST::NamedType::origin const): (WebCore::WHLSL::AST::NamedType::name): (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): (WebCore::WHLSL::AST::NamedType::unifyNode const): (WebCore::WHLSL::AST::NamedType::unifyNode): * 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): (WebCore::WHLSL::AST::NativeTypeDeclaration::name const): (WebCore::WHLSL::AST::NativeTypeDeclaration::name): (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. (WebCore::WHLSL::AST::NullLiteral::NullLiteral): (WebCore::WHLSL::AST::NullLiteral::type): (WebCore::WHLSL::AST::NullLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added. (WebCore::WHLSL::AST::NullLiteralType::canResolve const): (WebCore::WHLSL::AST::NullLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added. * 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/WHLSLPointerType.h: Added. (WebCore::WHLSL::AST::PointerType::PointerType): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. (WebCore::WHLSL::AST::ReferenceType::ReferenceType): (WebCore::WHLSL::AST::ReferenceType::addressSpace const): (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added. (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): (WebCore::WHLSL::AST::ResolvableType::resolve): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added. (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection 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): (WebCore::WHLSL::AST::ResourceSemantic::operator== const): (WebCore::WHLSL::AST::ResourceSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. (WebCore::WHLSL::AST::Return::Return): (WebCore::WHLSL::AST::Return::value): (WebCore::WHLSL::AST::Return::function): (WebCore::WHLSL::AST::Return::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added. (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const): (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): (WebCore::WHLSL::AST::StageInOutSemantic::index const): (WebCore::WHLSL::AST::StageInOutSemantic::operator== const): (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. (WebCore::WHLSL::AST::Statement::Statement): (WebCore::WHLSL::AST::Statement::isBlock const): (WebCore::WHLSL::AST::Statement::isBreak const): (WebCore::WHLSL::AST::Statement::isContinue const): (WebCore::WHLSL::AST::Statement::isDoWhileLoop const): (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const): (WebCore::WHLSL::AST::Statement::isFallthrough const): (WebCore::WHLSL::AST::Statement::isForLoop const): (WebCore::WHLSL::AST::Statement::isIfStatement const): (WebCore::WHLSL::AST::Statement::isReturn const): (WebCore::WHLSL::AST::Statement::isSwitchCase const): (WebCore::WHLSL::AST::Statement::isSwitchStatement const): (WebCore::WHLSL::AST::Statement::isTrap const): (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const): (WebCore::WHLSL::AST::Statement::isWhileLoop const): * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): (WebCore::WHLSL::AST::StructureDefinition::structureElements): * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. (WebCore::WHLSL::AST::StructureElement::StructureElement): (WebCore::WHLSL::AST::StructureElement::origin const): (WebCore::WHLSL::AST::StructureElement::type): (WebCore::WHLSL::AST::StructureElement::name): (WebCore::WHLSL::AST::StructureElement::semantic): * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. (WebCore::WHLSL::AST::SwitchCase::SwitchCase): (WebCore::WHLSL::AST::SwitchCase::value): (WebCore::WHLSL::AST::SwitchCase::block): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): (WebCore::WHLSL::AST::SwitchStatement::value): (WebCore::WHLSL::AST::SwitchStatement::switchCases): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. (WebCore::WHLSL::AST::Trap::Trap): * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. (WebCore::WHLSL::AST::Type::isNamedType const): (WebCore::WHLSL::AST::Type::isUnnamedType const): (WebCore::WHLSL::AST::Type::isResolvableType const): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added. (WebCore::WHLSL::AST::clone): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added. (WebCore::WHLSL::AST::TypeReference::wrap): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. (WebCore::WHLSL::AST::TypeReference::TypeReference): (WebCore::WHLSL::AST::TypeReference::name): (WebCore::WHLSL::AST::TypeReference::typeArguments): (WebCore::WHLSL::AST::TypeReference::resolvedType const): (WebCore::WHLSL::AST::TypeReference::setResolvedType): (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added. (WebCore::WHLSL::AST::UnnamedType::UnnamedType): (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): (WebCore::WHLSL::AST::UnnamedType::isPointerType const): (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): (WebCore::WHLSL::AST::UnnamedType::isArrayType const): (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): (WebCore::WHLSL::AST::UnnamedType::unifyNode const): (WebCore::WHLSL::AST::UnnamedType::unifyNode): (WebCore::WHLSL::AST::UnnamedType::origin const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * 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): (WebCore::WHLSL::AST::VariableDeclaration::name): (WebCore::WHLSL::AST::VariableDeclaration::type const): (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::semantic): (WebCore::WHLSL::AST::VariableDeclaration::initializer): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. (WebCore::WHLSL::AST::VariableReference::VariableReference): (WebCore::WHLSL::AST::VariableReference::wrap): (WebCore::WHLSL::AST::VariableReference::name): (WebCore::WHLSL::AST::VariableReference::variable): (WebCore::WHLSL::AST::VariableReference::setVariable): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. (WebCore::WHLSL::AST::WhileLoop::WhileLoop): (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. * Modules/webgpu/WHLSL/WHLSLParser.h: Added. * Modules/webgpu/WHLSL/WHLSLProgram.h: Added. (WebCore::WHLSL::Program::append): (WebCore::WHLSL::Program::nameContext): (WebCore::WHLSL::Program::intrinsics): (WebCore::WHLSL::Program::typeDefinitions): (WebCore::WHLSL::Program::structureDefinitions): (WebCore::WHLSL::Program::enumerationDefinitions): (WebCore::WHLSL::Program::functionDefinitions const): (WebCore::WHLSL::Program::functionDefinitions): (WebCore::WHLSL::Program::nativeFunctionDeclarations const): (WebCore::WHLSL::Program::nativeFunctionDeclarations): (WebCore::WHLSL::Program::nativeTypeDeclarations): Canonical link: https://commits.webkit.org/207830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 22:17:58 +00:00
namespace WebCore {
namespace WHLSL {
[WHLSL] Remove getters/setters/anders https://bugs.webkit.org/show_bug.cgi?id=201008 Reviewed by Robin Morisset. Source/WebCore: This patch changes WHLSL in a significant way. This patch removes getters/setters/anders from the language. In our experience writing WHLSL shaders, these parts of the language went unused, and they added a lot of complexity to the implementation of the compiler. This patch now treats field accesses and array indexes as intrinsics inside the compiler. This patch removes all notions of named operators, anders, and indexed operators from the compiler and the standard library. The checker now intrinsically knows the return type for property accesses and indexed expressions based on what the base type is. To make this work in practice was difficult, since getters/setters/anders solved a lot of the difficult problems we had in generating metal code. For example, all swizzle operators were getters and setters, so assigning to a swizzle fell out naturally from implementing setters. However, during metal codegen, all we see is a dot expression with "xy" as a property. Our previous architecture of emitting Metal code using pointers which represent lvalues doesn't work because you can't take the address of a swizzle. For example, "auto* x = &vector.yz" is invalid metal code. So, this patch changes the entire metal code generator to emit WHLSL expressions as Metal expressions. To do this, I had to change a lot about how the compiler was implemented: - I changed the indexed accesses of matrices to return columns instead of rows. This allowed WHLSL code like `mat[0].xy = 42` to be compiled into the equivalent metal code of `mat[0].xy = 42`. - I changed the native function inliner to emit expressions instead of statements. - We also simplify the language by removing null and requiring all reference type variables to have an initializer. This means that null is no longer a valid value, which allows us to omit null checks inside the metal code generator. To make this work with array accesses, we now clamp accesses instead of returning null for OOB accesses. I've also filed one required bug as a followup. I didn't include it in this patch to make it easier to review along. Currently, there are two places in metal codegen where we evaluate effects twice. That will be fixed in: https://bugs.webkit.org/show_bug.cgi?id=201251 Tests: webgpu/whlsl/address-of-swizzle.html webgpu/whlsl/array-oob-alias.html webgpu/whlsl/matrix-index-assign.html webgpu/whlsl/matrix-index-order.html webgpu/whlsl/oob-access-2.html webgpu/whlsl/operator-syntax.html * Modules/webgpu/WHLSL/AST/WHLSLAST.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: (WebCore::WHLSL::AST::Expression::destroy): (WebCore::WHLSL::AST::Expression::destruct): (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunctionName const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: (WebCore::WHLSL::AST::Expression::copyTypeTo const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction): Deleted. (): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: (WebCore::WHLSL::AST::Type::destroy): (WebCore::WHLSL::AST::Type::destruct): (WebCore::WHLSL::AST::ResolvableType::canResolve const): (WebCore::WHLSL::AST::ResolvableType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLType.h: (WebCore::WHLSL::AST::Type::isIntegerLiteralType const): (WebCore::WHLSL::AST::Type::isNullLiteralType const): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: (WebCore::WHLSL::Metal::FunctionDefinitionWriter::HoistedVariableCollector::HoistedVariableCollector): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: (WebCore::WHLSL::Metal::metalCodePrologue): (WebCore::WHLSL::Metal::generateMetalCode): (WebCore::WHLSL::Metal::metalCodeProlog): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: (WebCore::WHLSL::Metal::inlineNativeFunction): (WebCore::WHLSL::Metal::vectorInnerType): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: (WebCore::WHLSL::Metal::writeNativeType): * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: (WebCore::WHLSL::ASTDumper::visit): * Modules/webgpu/WHLSL/WHLSLASTDumper.h: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: (WebCore::WHLSL::checkDuplicateFunctions): * Modules/webgpu/WHLSL/WHLSLChecker.cpp: (WebCore::WHLSL::resolveByInstantiation): (WebCore::WHLSL::checkOperatorOverload): (WebCore::WHLSL::Checker::wrappedUintType): (WebCore::WHLSL::Checker::normalizedTypeForFunctionKey): (WebCore::WHLSL::Checker::visit): (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::Checker::resolveFunction): (WebCore::WHLSL::Checker::assignConcreteType): (WebCore::WHLSL::resolveWithOperatorLength): Deleted. (WebCore::WHLSL::Checker::genericPointerType): Deleted. (WebCore::WHLSL::Checker::finishVisiting): Deleted. * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): (): Deleted. * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::commit): * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: (WebCore::WHLSL::Intrinsics::boolVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::uintVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::intVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::floatVectorTypeForSize const): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: (WebCore::WHLSL::Lexer::consumeTokenFromStream): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: (WebCore::WHLSL::Parser::parseConstantExpression): (WebCore::WHLSL::Parser::parseEnumerationMember): (WebCore::WHLSL::Parser::parseTerm): * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: (WebCore::WHLSL::prepareShared): * Modules/webgpu/WHLSL/WHLSLProgram.cpp: Added. (WebCore::WHLSL::Program::isValidVectorProperty): * Modules/webgpu/WHLSL/WHLSLProgram.h: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: (WebCore::WHLSL::resolveProperties): (WebCore::WHLSL::PropertyResolver::visit): Deleted. (WebCore::WHLSL::wrapAnderCallArgument): Deleted. (WebCore::WHLSL::anderCallArgument): Deleted. (WebCore::WHLSL::setterCall): Deleted. (WebCore::WHLSL::getterCall): Deleted. (WebCore::WHLSL::modify): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyRightValue): Deleted. (WebCore::WHLSL::LeftValueSimplifier::finishVisiting): Deleted. (WebCore::WHLSL::LeftValueSimplifier::visit): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyLeftValue): Deleted. * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: (WebCore::WHLSL::synthesizeEnumerationFunctions): * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: (WebCore::WHLSL::Visitor::visit): * Modules/webgpu/WHLSL/WHLSLVisitor.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * webgpu/whlsl/address-of-swizzle-expected.txt: Added. * webgpu/whlsl/address-of-swizzle.html: Added. * webgpu/whlsl/array-oob-alias-expected.txt: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt. * webgpu/whlsl/array-oob-alias.html: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null.html. * webgpu/whlsl/bad-ander-expected.txt: Removed. * webgpu/whlsl/bad-ander.html: Removed. * webgpu/whlsl/duplicate-types-should-not-produce-duplicate-ctors.html: * webgpu/whlsl/increment-setter.html: * webgpu/whlsl/index-ander-expected.txt: Removed. * webgpu/whlsl/index-ander.html: Removed. * webgpu/whlsl/index-setter-getter-expected.txt: Removed. * webgpu/whlsl/index-setter-getter.html: Removed. * webgpu/whlsl/make-array-reference.html: * webgpu/whlsl/matrix-index-assign-expected.txt: Added. * webgpu/whlsl/matrix-index-assign.html: Added. * webgpu/whlsl/matrix-index-order-expected.txt: Added. * webgpu/whlsl/matrix-index-order.html: Added. * webgpu/whlsl/matrix-memory-layout.html: * webgpu/whlsl/matrix.html: * webgpu/whlsl/null-arg-expected.txt: * webgpu/whlsl/null-arg.html: * webgpu/whlsl/null-dereference-expected.txt: Removed. * webgpu/whlsl/null-dereference.html: Removed. * webgpu/whlsl/oob-access-2-expected.txt: Added. * webgpu/whlsl/oob-access-2.html: Added. * webgpu/whlsl/oob-access.html: * webgpu/whlsl/operator-syntax-expected.txt: Added. * webgpu/whlsl/operator-syntax.html: Added. * webgpu/whlsl/operator-vector-assign.html: * webgpu/whlsl/operator-vector-load.html: * webgpu/whlsl/override-subscript-expected.txt: Removed. * webgpu/whlsl/override-subscript.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander.html: Removed. * webgpu/whlsl/propertyresolver/getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue.html: Removed. * webgpu/whlsl/setter-spec-tests.html: * webgpu/whlsl/simple-getter-setter-expected.txt: * webgpu/whlsl/simple-getter-setter.html: * webgpu/whlsl/structure-field-access-on-null-expected.txt: Removed. * webgpu/whlsl/structure-field-access-on-null.html: Removed. * webgpu/whlsl/test-harness-test.html: Canonical link: https://commits.webkit.org/215020@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-31 00:13:42 +00:00
bool Program::isValidVectorProperty(String property)
[WHLSL] Implement parser AST nodes https://bugs.webkit.org/show_bug.cgi?id=192991 Reviewed by Alex Christensen. 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/WHLSLArrayReferenceType.h: Added. (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. (WebCore::WHLSL::AST::ArrayType::ArrayType): (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): (WebCore::WHLSL::AST::ArrayType::numElements const): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * 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): (WebCore::WHLSL::AST::Block::statements): * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): (WebCore::WHLSL::AST::BooleanLiteral::value const): (WebCore::WHLSL::AST::BooleanLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. (WebCore::WHLSL::AST::Break::Break): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added. (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const): (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): (WebCore::WHLSL::AST::BuiltInSemantic::variable const): (WebCore::WHLSL::AST::BuiltInSemantic::operator== const): (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. (WebCore::WHLSL::AST::CallExpression::CallExpression): (WebCore::WHLSL::AST::CallExpression::arguments): (WebCore::WHLSL::AST::CallExpression::name): (WebCore::WHLSL::AST::CallExpression::setCastData): (WebCore::WHLSL::AST::CallExpression::isCast): (WebCore::WHLSL::AST::CallExpression::castReturnType): (WebCore::WHLSL::AST::CallExpression::hasOverloads const): (WebCore::WHLSL::AST::CallExpression::overloads): (WebCore::WHLSL::AST::CallExpression::setOverloads): (WebCore::WHLSL::AST::CallExpression::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. (WebCore::WHLSL::AST::CommaExpression::CommaExpression): (WebCore::WHLSL::AST::CommaExpression::list): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): (WebCore::WHLSL::AST::ConstantExpression::visit): (WebCore::WHLSL::AST::ConstantExpression::visit const): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. (WebCore::WHLSL::AST::Continue::Continue): * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. (WebCore::WHLSL::AST::DotExpression::DotExpression): (WebCore::WHLSL::AST::DotExpression::fieldName): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): (WebCore::WHLSL::AST::EnumerationDefinition::add): (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): (WebCore::WHLSL::AST::EnumerationMember::origin const): (WebCore::WHLSL::AST::EnumerationMember::name): (WebCore::WHLSL::AST::EnumerationMember::value): (WebCore::WHLSL::AST::EnumerationMember::setValue): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added. (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. (WebCore::WHLSL::AST::Expression::Expression): (WebCore::WHLSL::AST::Expression::origin const): (WebCore::WHLSL::AST::Expression::isAssignmentExpression const): (WebCore::WHLSL::AST::Expression::isBooleanLiteral const): (WebCore::WHLSL::AST::Expression::isCallExpression const): (WebCore::WHLSL::AST::Expression::isCommaExpression const): (WebCore::WHLSL::AST::Expression::isDereferenceExpression const): (WebCore::WHLSL::AST::Expression::isDotExpression const): (WebCore::WHLSL::AST::Expression::isFloatLiteral const): (WebCore::WHLSL::AST::Expression::isIndexExpression const): (WebCore::WHLSL::AST::Expression::isIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isLogicalExpression const): (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const): (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const): (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const): (WebCore::WHLSL::AST::Expression::isTernaryExpression const): (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isVariableReference const): (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral 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::type): (WebCore::WHLSL::AST::FloatLiteral::value const): (WebCore::WHLSL::AST::FloatLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added. (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType): (WebCore::WHLSL::AST::FloatLiteralType::canResolve const): (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added. (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. (WebCore::WHLSL::AST::ForLoop::ForLoop): (WebCore::WHLSL::AST::ForLoop::~ForLoop): (WebCore::WHLSL::AST::ForLoop::initialization): (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const): (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const): (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock): (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const): (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): (WebCore::WHLSL::AST::FunctionDeclaration::name const): (WebCore::WHLSL::AST::FunctionDeclaration::isCast const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters): (WebCore::WHLSL::AST::FunctionDeclaration::semantic): (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): (WebCore::WHLSL::AST::FunctionDefinition::block): (WebCore::WHLSL::AST::FunctionDefinition::restricted const): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. (WebCore::WHLSL::AST::IfStatement::IfStatement): (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. (WebCore::WHLSL::AST::IndexExpression::IndexExpression): (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): (WebCore::WHLSL::AST::IntegerLiteral::type): (WebCore::WHLSL::AST::IntegerLiteral::value const): (WebCore::WHLSL::AST::IntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType): (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): (WebCore::WHLSL::AST::LogicalExpression::type const): (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added. (WebCore::WHLSL::AST::NamedType::NamedType): (WebCore::WHLSL::AST::NamedType::origin const): (WebCore::WHLSL::AST::NamedType::name): (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): (WebCore::WHLSL::AST::NamedType::unifyNode const): (WebCore::WHLSL::AST::NamedType::unifyNode): * 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): (WebCore::WHLSL::AST::NativeTypeDeclaration::name const): (WebCore::WHLSL::AST::NativeTypeDeclaration::name): (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. (WebCore::WHLSL::AST::NullLiteral::NullLiteral): (WebCore::WHLSL::AST::NullLiteral::type): (WebCore::WHLSL::AST::NullLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added. (WebCore::WHLSL::AST::NullLiteralType::canResolve const): (WebCore::WHLSL::AST::NullLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added. * 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/WHLSLPointerType.h: Added. (WebCore::WHLSL::AST::PointerType::PointerType): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. (WebCore::WHLSL::AST::ReferenceType::ReferenceType): (WebCore::WHLSL::AST::ReferenceType::addressSpace const): (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added. (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): (WebCore::WHLSL::AST::ResolvableType::resolve): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added. (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection 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): (WebCore::WHLSL::AST::ResourceSemantic::operator== const): (WebCore::WHLSL::AST::ResourceSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. (WebCore::WHLSL::AST::Return::Return): (WebCore::WHLSL::AST::Return::value): (WebCore::WHLSL::AST::Return::function): (WebCore::WHLSL::AST::Return::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added. (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const): (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): (WebCore::WHLSL::AST::StageInOutSemantic::index const): (WebCore::WHLSL::AST::StageInOutSemantic::operator== const): (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. (WebCore::WHLSL::AST::Statement::Statement): (WebCore::WHLSL::AST::Statement::isBlock const): (WebCore::WHLSL::AST::Statement::isBreak const): (WebCore::WHLSL::AST::Statement::isContinue const): (WebCore::WHLSL::AST::Statement::isDoWhileLoop const): (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const): (WebCore::WHLSL::AST::Statement::isFallthrough const): (WebCore::WHLSL::AST::Statement::isForLoop const): (WebCore::WHLSL::AST::Statement::isIfStatement const): (WebCore::WHLSL::AST::Statement::isReturn const): (WebCore::WHLSL::AST::Statement::isSwitchCase const): (WebCore::WHLSL::AST::Statement::isSwitchStatement const): (WebCore::WHLSL::AST::Statement::isTrap const): (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const): (WebCore::WHLSL::AST::Statement::isWhileLoop const): * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): (WebCore::WHLSL::AST::StructureDefinition::structureElements): * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. (WebCore::WHLSL::AST::StructureElement::StructureElement): (WebCore::WHLSL::AST::StructureElement::origin const): (WebCore::WHLSL::AST::StructureElement::type): (WebCore::WHLSL::AST::StructureElement::name): (WebCore::WHLSL::AST::StructureElement::semantic): * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. (WebCore::WHLSL::AST::SwitchCase::SwitchCase): (WebCore::WHLSL::AST::SwitchCase::value): (WebCore::WHLSL::AST::SwitchCase::block): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): (WebCore::WHLSL::AST::SwitchStatement::value): (WebCore::WHLSL::AST::SwitchStatement::switchCases): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. (WebCore::WHLSL::AST::Trap::Trap): * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. (WebCore::WHLSL::AST::Type::isNamedType const): (WebCore::WHLSL::AST::Type::isUnnamedType const): (WebCore::WHLSL::AST::Type::isResolvableType const): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added. (WebCore::WHLSL::AST::clone): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added. (WebCore::WHLSL::AST::TypeReference::wrap): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. (WebCore::WHLSL::AST::TypeReference::TypeReference): (WebCore::WHLSL::AST::TypeReference::name): (WebCore::WHLSL::AST::TypeReference::typeArguments): (WebCore::WHLSL::AST::TypeReference::resolvedType const): (WebCore::WHLSL::AST::TypeReference::setResolvedType): (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added. (WebCore::WHLSL::AST::UnnamedType::UnnamedType): (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): (WebCore::WHLSL::AST::UnnamedType::isPointerType const): (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): (WebCore::WHLSL::AST::UnnamedType::isArrayType const): (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): (WebCore::WHLSL::AST::UnnamedType::unifyNode const): (WebCore::WHLSL::AST::UnnamedType::unifyNode): (WebCore::WHLSL::AST::UnnamedType::origin const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * 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): (WebCore::WHLSL::AST::VariableDeclaration::name): (WebCore::WHLSL::AST::VariableDeclaration::type const): (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::semantic): (WebCore::WHLSL::AST::VariableDeclaration::initializer): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. (WebCore::WHLSL::AST::VariableReference::VariableReference): (WebCore::WHLSL::AST::VariableReference::wrap): (WebCore::WHLSL::AST::VariableReference::name): (WebCore::WHLSL::AST::VariableReference::variable): (WebCore::WHLSL::AST::VariableReference::setVariable): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. (WebCore::WHLSL::AST::WhileLoop::WhileLoop): (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. * Modules/webgpu/WHLSL/WHLSLParser.h: Added. * Modules/webgpu/WHLSL/WHLSLProgram.h: Added. (WebCore::WHLSL::Program::append): (WebCore::WHLSL::Program::nameContext): (WebCore::WHLSL::Program::intrinsics): (WebCore::WHLSL::Program::typeDefinitions): (WebCore::WHLSL::Program::structureDefinitions): (WebCore::WHLSL::Program::enumerationDefinitions): (WebCore::WHLSL::Program::functionDefinitions const): (WebCore::WHLSL::Program::functionDefinitions): (WebCore::WHLSL::Program::nativeFunctionDeclarations const): (WebCore::WHLSL::Program::nativeFunctionDeclarations): (WebCore::WHLSL::Program::nativeTypeDeclarations): Canonical link: https://commits.webkit.org/207830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 22:17:58 +00:00
{
[WHLSL] Remove getters/setters/anders https://bugs.webkit.org/show_bug.cgi?id=201008 Reviewed by Robin Morisset. Source/WebCore: This patch changes WHLSL in a significant way. This patch removes getters/setters/anders from the language. In our experience writing WHLSL shaders, these parts of the language went unused, and they added a lot of complexity to the implementation of the compiler. This patch now treats field accesses and array indexes as intrinsics inside the compiler. This patch removes all notions of named operators, anders, and indexed operators from the compiler and the standard library. The checker now intrinsically knows the return type for property accesses and indexed expressions based on what the base type is. To make this work in practice was difficult, since getters/setters/anders solved a lot of the difficult problems we had in generating metal code. For example, all swizzle operators were getters and setters, so assigning to a swizzle fell out naturally from implementing setters. However, during metal codegen, all we see is a dot expression with "xy" as a property. Our previous architecture of emitting Metal code using pointers which represent lvalues doesn't work because you can't take the address of a swizzle. For example, "auto* x = &vector.yz" is invalid metal code. So, this patch changes the entire metal code generator to emit WHLSL expressions as Metal expressions. To do this, I had to change a lot about how the compiler was implemented: - I changed the indexed accesses of matrices to return columns instead of rows. This allowed WHLSL code like `mat[0].xy = 42` to be compiled into the equivalent metal code of `mat[0].xy = 42`. - I changed the native function inliner to emit expressions instead of statements. - We also simplify the language by removing null and requiring all reference type variables to have an initializer. This means that null is no longer a valid value, which allows us to omit null checks inside the metal code generator. To make this work with array accesses, we now clamp accesses instead of returning null for OOB accesses. I've also filed one required bug as a followup. I didn't include it in this patch to make it easier to review along. Currently, there are two places in metal codegen where we evaluate effects twice. That will be fixed in: https://bugs.webkit.org/show_bug.cgi?id=201251 Tests: webgpu/whlsl/address-of-swizzle.html webgpu/whlsl/array-oob-alias.html webgpu/whlsl/matrix-index-assign.html webgpu/whlsl/matrix-index-order.html webgpu/whlsl/oob-access-2.html webgpu/whlsl/operator-syntax.html * Modules/webgpu/WHLSL/AST/WHLSLAST.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: (WebCore::WHLSL::AST::Expression::destroy): (WebCore::WHLSL::AST::Expression::destruct): (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunctionName const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: (WebCore::WHLSL::AST::Expression::copyTypeTo const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction): Deleted. (): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: (WebCore::WHLSL::AST::Type::destroy): (WebCore::WHLSL::AST::Type::destruct): (WebCore::WHLSL::AST::ResolvableType::canResolve const): (WebCore::WHLSL::AST::ResolvableType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLType.h: (WebCore::WHLSL::AST::Type::isIntegerLiteralType const): (WebCore::WHLSL::AST::Type::isNullLiteralType const): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: (WebCore::WHLSL::Metal::FunctionDefinitionWriter::HoistedVariableCollector::HoistedVariableCollector): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: (WebCore::WHLSL::Metal::metalCodePrologue): (WebCore::WHLSL::Metal::generateMetalCode): (WebCore::WHLSL::Metal::metalCodeProlog): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: (WebCore::WHLSL::Metal::inlineNativeFunction): (WebCore::WHLSL::Metal::vectorInnerType): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: (WebCore::WHLSL::Metal::writeNativeType): * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: (WebCore::WHLSL::ASTDumper::visit): * Modules/webgpu/WHLSL/WHLSLASTDumper.h: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: (WebCore::WHLSL::checkDuplicateFunctions): * Modules/webgpu/WHLSL/WHLSLChecker.cpp: (WebCore::WHLSL::resolveByInstantiation): (WebCore::WHLSL::checkOperatorOverload): (WebCore::WHLSL::Checker::wrappedUintType): (WebCore::WHLSL::Checker::normalizedTypeForFunctionKey): (WebCore::WHLSL::Checker::visit): (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::Checker::resolveFunction): (WebCore::WHLSL::Checker::assignConcreteType): (WebCore::WHLSL::resolveWithOperatorLength): Deleted. (WebCore::WHLSL::Checker::genericPointerType): Deleted. (WebCore::WHLSL::Checker::finishVisiting): Deleted. * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): (): Deleted. * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::commit): * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: (WebCore::WHLSL::Intrinsics::boolVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::uintVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::intVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::floatVectorTypeForSize const): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: (WebCore::WHLSL::Lexer::consumeTokenFromStream): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: (WebCore::WHLSL::Parser::parseConstantExpression): (WebCore::WHLSL::Parser::parseEnumerationMember): (WebCore::WHLSL::Parser::parseTerm): * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: (WebCore::WHLSL::prepareShared): * Modules/webgpu/WHLSL/WHLSLProgram.cpp: Added. (WebCore::WHLSL::Program::isValidVectorProperty): * Modules/webgpu/WHLSL/WHLSLProgram.h: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: (WebCore::WHLSL::resolveProperties): (WebCore::WHLSL::PropertyResolver::visit): Deleted. (WebCore::WHLSL::wrapAnderCallArgument): Deleted. (WebCore::WHLSL::anderCallArgument): Deleted. (WebCore::WHLSL::setterCall): Deleted. (WebCore::WHLSL::getterCall): Deleted. (WebCore::WHLSL::modify): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyRightValue): Deleted. (WebCore::WHLSL::LeftValueSimplifier::finishVisiting): Deleted. (WebCore::WHLSL::LeftValueSimplifier::visit): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyLeftValue): Deleted. * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: (WebCore::WHLSL::synthesizeEnumerationFunctions): * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: (WebCore::WHLSL::Visitor::visit): * Modules/webgpu/WHLSL/WHLSLVisitor.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * webgpu/whlsl/address-of-swizzle-expected.txt: Added. * webgpu/whlsl/address-of-swizzle.html: Added. * webgpu/whlsl/array-oob-alias-expected.txt: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt. * webgpu/whlsl/array-oob-alias.html: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null.html. * webgpu/whlsl/bad-ander-expected.txt: Removed. * webgpu/whlsl/bad-ander.html: Removed. * webgpu/whlsl/duplicate-types-should-not-produce-duplicate-ctors.html: * webgpu/whlsl/increment-setter.html: * webgpu/whlsl/index-ander-expected.txt: Removed. * webgpu/whlsl/index-ander.html: Removed. * webgpu/whlsl/index-setter-getter-expected.txt: Removed. * webgpu/whlsl/index-setter-getter.html: Removed. * webgpu/whlsl/make-array-reference.html: * webgpu/whlsl/matrix-index-assign-expected.txt: Added. * webgpu/whlsl/matrix-index-assign.html: Added. * webgpu/whlsl/matrix-index-order-expected.txt: Added. * webgpu/whlsl/matrix-index-order.html: Added. * webgpu/whlsl/matrix-memory-layout.html: * webgpu/whlsl/matrix.html: * webgpu/whlsl/null-arg-expected.txt: * webgpu/whlsl/null-arg.html: * webgpu/whlsl/null-dereference-expected.txt: Removed. * webgpu/whlsl/null-dereference.html: Removed. * webgpu/whlsl/oob-access-2-expected.txt: Added. * webgpu/whlsl/oob-access-2.html: Added. * webgpu/whlsl/oob-access.html: * webgpu/whlsl/operator-syntax-expected.txt: Added. * webgpu/whlsl/operator-syntax.html: Added. * webgpu/whlsl/operator-vector-assign.html: * webgpu/whlsl/operator-vector-load.html: * webgpu/whlsl/override-subscript-expected.txt: Removed. * webgpu/whlsl/override-subscript.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander.html: Removed. * webgpu/whlsl/propertyresolver/getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue.html: Removed. * webgpu/whlsl/setter-spec-tests.html: * webgpu/whlsl/simple-getter-setter-expected.txt: * webgpu/whlsl/simple-getter-setter.html: * webgpu/whlsl/structure-field-access-on-null-expected.txt: Removed. * webgpu/whlsl/structure-field-access-on-null.html: Removed. * webgpu/whlsl/test-harness-test.html: Canonical link: https://commits.webkit.org/215020@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-31 00:13:42 +00:00
if (property.length() < 1 || property.length() > 4)
[WHLSL] Implement parser AST nodes https://bugs.webkit.org/show_bug.cgi?id=192991 Reviewed by Alex Christensen. 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/WHLSLArrayReferenceType.h: Added. (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. (WebCore::WHLSL::AST::ArrayType::ArrayType): (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): (WebCore::WHLSL::AST::ArrayType::numElements const): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * 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): (WebCore::WHLSL::AST::Block::statements): * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): (WebCore::WHLSL::AST::BooleanLiteral::value const): (WebCore::WHLSL::AST::BooleanLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. (WebCore::WHLSL::AST::Break::Break): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added. (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const): (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): (WebCore::WHLSL::AST::BuiltInSemantic::variable const): (WebCore::WHLSL::AST::BuiltInSemantic::operator== const): (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. (WebCore::WHLSL::AST::CallExpression::CallExpression): (WebCore::WHLSL::AST::CallExpression::arguments): (WebCore::WHLSL::AST::CallExpression::name): (WebCore::WHLSL::AST::CallExpression::setCastData): (WebCore::WHLSL::AST::CallExpression::isCast): (WebCore::WHLSL::AST::CallExpression::castReturnType): (WebCore::WHLSL::AST::CallExpression::hasOverloads const): (WebCore::WHLSL::AST::CallExpression::overloads): (WebCore::WHLSL::AST::CallExpression::setOverloads): (WebCore::WHLSL::AST::CallExpression::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. (WebCore::WHLSL::AST::CommaExpression::CommaExpression): (WebCore::WHLSL::AST::CommaExpression::list): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): (WebCore::WHLSL::AST::ConstantExpression::visit): (WebCore::WHLSL::AST::ConstantExpression::visit const): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. (WebCore::WHLSL::AST::Continue::Continue): * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. (WebCore::WHLSL::AST::DotExpression::DotExpression): (WebCore::WHLSL::AST::DotExpression::fieldName): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): (WebCore::WHLSL::AST::EnumerationDefinition::add): (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): (WebCore::WHLSL::AST::EnumerationMember::origin const): (WebCore::WHLSL::AST::EnumerationMember::name): (WebCore::WHLSL::AST::EnumerationMember::value): (WebCore::WHLSL::AST::EnumerationMember::setValue): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added. (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. (WebCore::WHLSL::AST::Expression::Expression): (WebCore::WHLSL::AST::Expression::origin const): (WebCore::WHLSL::AST::Expression::isAssignmentExpression const): (WebCore::WHLSL::AST::Expression::isBooleanLiteral const): (WebCore::WHLSL::AST::Expression::isCallExpression const): (WebCore::WHLSL::AST::Expression::isCommaExpression const): (WebCore::WHLSL::AST::Expression::isDereferenceExpression const): (WebCore::WHLSL::AST::Expression::isDotExpression const): (WebCore::WHLSL::AST::Expression::isFloatLiteral const): (WebCore::WHLSL::AST::Expression::isIndexExpression const): (WebCore::WHLSL::AST::Expression::isIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isLogicalExpression const): (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const): (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const): (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const): (WebCore::WHLSL::AST::Expression::isTernaryExpression const): (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isVariableReference const): (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral 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::type): (WebCore::WHLSL::AST::FloatLiteral::value const): (WebCore::WHLSL::AST::FloatLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added. (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType): (WebCore::WHLSL::AST::FloatLiteralType::canResolve const): (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added. (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. (WebCore::WHLSL::AST::ForLoop::ForLoop): (WebCore::WHLSL::AST::ForLoop::~ForLoop): (WebCore::WHLSL::AST::ForLoop::initialization): (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const): (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const): (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock): (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const): (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): (WebCore::WHLSL::AST::FunctionDeclaration::name const): (WebCore::WHLSL::AST::FunctionDeclaration::isCast const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters): (WebCore::WHLSL::AST::FunctionDeclaration::semantic): (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): (WebCore::WHLSL::AST::FunctionDefinition::block): (WebCore::WHLSL::AST::FunctionDefinition::restricted const): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. (WebCore::WHLSL::AST::IfStatement::IfStatement): (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. (WebCore::WHLSL::AST::IndexExpression::IndexExpression): (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): (WebCore::WHLSL::AST::IntegerLiteral::type): (WebCore::WHLSL::AST::IntegerLiteral::value const): (WebCore::WHLSL::AST::IntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType): (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): (WebCore::WHLSL::AST::LogicalExpression::type const): (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added. (WebCore::WHLSL::AST::NamedType::NamedType): (WebCore::WHLSL::AST::NamedType::origin const): (WebCore::WHLSL::AST::NamedType::name): (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): (WebCore::WHLSL::AST::NamedType::unifyNode const): (WebCore::WHLSL::AST::NamedType::unifyNode): * 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): (WebCore::WHLSL::AST::NativeTypeDeclaration::name const): (WebCore::WHLSL::AST::NativeTypeDeclaration::name): (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. (WebCore::WHLSL::AST::NullLiteral::NullLiteral): (WebCore::WHLSL::AST::NullLiteral::type): (WebCore::WHLSL::AST::NullLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added. (WebCore::WHLSL::AST::NullLiteralType::canResolve const): (WebCore::WHLSL::AST::NullLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added. * 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/WHLSLPointerType.h: Added. (WebCore::WHLSL::AST::PointerType::PointerType): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. (WebCore::WHLSL::AST::ReferenceType::ReferenceType): (WebCore::WHLSL::AST::ReferenceType::addressSpace const): (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added. (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): (WebCore::WHLSL::AST::ResolvableType::resolve): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added. (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection 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): (WebCore::WHLSL::AST::ResourceSemantic::operator== const): (WebCore::WHLSL::AST::ResourceSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. (WebCore::WHLSL::AST::Return::Return): (WebCore::WHLSL::AST::Return::value): (WebCore::WHLSL::AST::Return::function): (WebCore::WHLSL::AST::Return::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added. (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const): (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): (WebCore::WHLSL::AST::StageInOutSemantic::index const): (WebCore::WHLSL::AST::StageInOutSemantic::operator== const): (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. (WebCore::WHLSL::AST::Statement::Statement): (WebCore::WHLSL::AST::Statement::isBlock const): (WebCore::WHLSL::AST::Statement::isBreak const): (WebCore::WHLSL::AST::Statement::isContinue const): (WebCore::WHLSL::AST::Statement::isDoWhileLoop const): (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const): (WebCore::WHLSL::AST::Statement::isFallthrough const): (WebCore::WHLSL::AST::Statement::isForLoop const): (WebCore::WHLSL::AST::Statement::isIfStatement const): (WebCore::WHLSL::AST::Statement::isReturn const): (WebCore::WHLSL::AST::Statement::isSwitchCase const): (WebCore::WHLSL::AST::Statement::isSwitchStatement const): (WebCore::WHLSL::AST::Statement::isTrap const): (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const): (WebCore::WHLSL::AST::Statement::isWhileLoop const): * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): (WebCore::WHLSL::AST::StructureDefinition::structureElements): * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. (WebCore::WHLSL::AST::StructureElement::StructureElement): (WebCore::WHLSL::AST::StructureElement::origin const): (WebCore::WHLSL::AST::StructureElement::type): (WebCore::WHLSL::AST::StructureElement::name): (WebCore::WHLSL::AST::StructureElement::semantic): * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. (WebCore::WHLSL::AST::SwitchCase::SwitchCase): (WebCore::WHLSL::AST::SwitchCase::value): (WebCore::WHLSL::AST::SwitchCase::block): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): (WebCore::WHLSL::AST::SwitchStatement::value): (WebCore::WHLSL::AST::SwitchStatement::switchCases): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. (WebCore::WHLSL::AST::Trap::Trap): * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. (WebCore::WHLSL::AST::Type::isNamedType const): (WebCore::WHLSL::AST::Type::isUnnamedType const): (WebCore::WHLSL::AST::Type::isResolvableType const): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added. (WebCore::WHLSL::AST::clone): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added. (WebCore::WHLSL::AST::TypeReference::wrap): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. (WebCore::WHLSL::AST::TypeReference::TypeReference): (WebCore::WHLSL::AST::TypeReference::name): (WebCore::WHLSL::AST::TypeReference::typeArguments): (WebCore::WHLSL::AST::TypeReference::resolvedType const): (WebCore::WHLSL::AST::TypeReference::setResolvedType): (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added. (WebCore::WHLSL::AST::UnnamedType::UnnamedType): (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): (WebCore::WHLSL::AST::UnnamedType::isPointerType const): (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): (WebCore::WHLSL::AST::UnnamedType::isArrayType const): (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): (WebCore::WHLSL::AST::UnnamedType::unifyNode const): (WebCore::WHLSL::AST::UnnamedType::unifyNode): (WebCore::WHLSL::AST::UnnamedType::origin const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * 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): (WebCore::WHLSL::AST::VariableDeclaration::name): (WebCore::WHLSL::AST::VariableDeclaration::type const): (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::semantic): (WebCore::WHLSL::AST::VariableDeclaration::initializer): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. (WebCore::WHLSL::AST::VariableReference::VariableReference): (WebCore::WHLSL::AST::VariableReference::wrap): (WebCore::WHLSL::AST::VariableReference::name): (WebCore::WHLSL::AST::VariableReference::variable): (WebCore::WHLSL::AST::VariableReference::setVariable): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. (WebCore::WHLSL::AST::WhileLoop::WhileLoop): (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. * Modules/webgpu/WHLSL/WHLSLParser.h: Added. * Modules/webgpu/WHLSL/WHLSLProgram.h: Added. (WebCore::WHLSL::Program::append): (WebCore::WHLSL::Program::nameContext): (WebCore::WHLSL::Program::intrinsics): (WebCore::WHLSL::Program::typeDefinitions): (WebCore::WHLSL::Program::structureDefinitions): (WebCore::WHLSL::Program::enumerationDefinitions): (WebCore::WHLSL::Program::functionDefinitions const): (WebCore::WHLSL::Program::functionDefinitions): (WebCore::WHLSL::Program::nativeFunctionDeclarations const): (WebCore::WHLSL::Program::nativeFunctionDeclarations): (WebCore::WHLSL::Program::nativeTypeDeclarations): Canonical link: https://commits.webkit.org/207830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 22:17:58 +00:00
return false;
[WHLSL] Remove getters/setters/anders https://bugs.webkit.org/show_bug.cgi?id=201008 Reviewed by Robin Morisset. Source/WebCore: This patch changes WHLSL in a significant way. This patch removes getters/setters/anders from the language. In our experience writing WHLSL shaders, these parts of the language went unused, and they added a lot of complexity to the implementation of the compiler. This patch now treats field accesses and array indexes as intrinsics inside the compiler. This patch removes all notions of named operators, anders, and indexed operators from the compiler and the standard library. The checker now intrinsically knows the return type for property accesses and indexed expressions based on what the base type is. To make this work in practice was difficult, since getters/setters/anders solved a lot of the difficult problems we had in generating metal code. For example, all swizzle operators were getters and setters, so assigning to a swizzle fell out naturally from implementing setters. However, during metal codegen, all we see is a dot expression with "xy" as a property. Our previous architecture of emitting Metal code using pointers which represent lvalues doesn't work because you can't take the address of a swizzle. For example, "auto* x = &vector.yz" is invalid metal code. So, this patch changes the entire metal code generator to emit WHLSL expressions as Metal expressions. To do this, I had to change a lot about how the compiler was implemented: - I changed the indexed accesses of matrices to return columns instead of rows. This allowed WHLSL code like `mat[0].xy = 42` to be compiled into the equivalent metal code of `mat[0].xy = 42`. - I changed the native function inliner to emit expressions instead of statements. - We also simplify the language by removing null and requiring all reference type variables to have an initializer. This means that null is no longer a valid value, which allows us to omit null checks inside the metal code generator. To make this work with array accesses, we now clamp accesses instead of returning null for OOB accesses. I've also filed one required bug as a followup. I didn't include it in this patch to make it easier to review along. Currently, there are two places in metal codegen where we evaluate effects twice. That will be fixed in: https://bugs.webkit.org/show_bug.cgi?id=201251 Tests: webgpu/whlsl/address-of-swizzle.html webgpu/whlsl/array-oob-alias.html webgpu/whlsl/matrix-index-assign.html webgpu/whlsl/matrix-index-order.html webgpu/whlsl/oob-access-2.html webgpu/whlsl/operator-syntax.html * Modules/webgpu/WHLSL/AST/WHLSLAST.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: (WebCore::WHLSL::AST::Expression::destroy): (WebCore::WHLSL::AST::Expression::destruct): (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunctionName const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: (WebCore::WHLSL::AST::Expression::copyTypeTo const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction): Deleted. (): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: (WebCore::WHLSL::AST::Type::destroy): (WebCore::WHLSL::AST::Type::destruct): (WebCore::WHLSL::AST::ResolvableType::canResolve const): (WebCore::WHLSL::AST::ResolvableType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLType.h: (WebCore::WHLSL::AST::Type::isIntegerLiteralType const): (WebCore::WHLSL::AST::Type::isNullLiteralType const): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: (WebCore::WHLSL::Metal::FunctionDefinitionWriter::HoistedVariableCollector::HoistedVariableCollector): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: (WebCore::WHLSL::Metal::metalCodePrologue): (WebCore::WHLSL::Metal::generateMetalCode): (WebCore::WHLSL::Metal::metalCodeProlog): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: (WebCore::WHLSL::Metal::inlineNativeFunction): (WebCore::WHLSL::Metal::vectorInnerType): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: (WebCore::WHLSL::Metal::writeNativeType): * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: (WebCore::WHLSL::ASTDumper::visit): * Modules/webgpu/WHLSL/WHLSLASTDumper.h: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: (WebCore::WHLSL::checkDuplicateFunctions): * Modules/webgpu/WHLSL/WHLSLChecker.cpp: (WebCore::WHLSL::resolveByInstantiation): (WebCore::WHLSL::checkOperatorOverload): (WebCore::WHLSL::Checker::wrappedUintType): (WebCore::WHLSL::Checker::normalizedTypeForFunctionKey): (WebCore::WHLSL::Checker::visit): (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::Checker::resolveFunction): (WebCore::WHLSL::Checker::assignConcreteType): (WebCore::WHLSL::resolveWithOperatorLength): Deleted. (WebCore::WHLSL::Checker::genericPointerType): Deleted. (WebCore::WHLSL::Checker::finishVisiting): Deleted. * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): (): Deleted. * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::commit): * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: (WebCore::WHLSL::Intrinsics::boolVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::uintVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::intVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::floatVectorTypeForSize const): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: (WebCore::WHLSL::Lexer::consumeTokenFromStream): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: (WebCore::WHLSL::Parser::parseConstantExpression): (WebCore::WHLSL::Parser::parseEnumerationMember): (WebCore::WHLSL::Parser::parseTerm): * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: (WebCore::WHLSL::prepareShared): * Modules/webgpu/WHLSL/WHLSLProgram.cpp: Added. (WebCore::WHLSL::Program::isValidVectorProperty): * Modules/webgpu/WHLSL/WHLSLProgram.h: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: (WebCore::WHLSL::resolveProperties): (WebCore::WHLSL::PropertyResolver::visit): Deleted. (WebCore::WHLSL::wrapAnderCallArgument): Deleted. (WebCore::WHLSL::anderCallArgument): Deleted. (WebCore::WHLSL::setterCall): Deleted. (WebCore::WHLSL::getterCall): Deleted. (WebCore::WHLSL::modify): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyRightValue): Deleted. (WebCore::WHLSL::LeftValueSimplifier::finishVisiting): Deleted. (WebCore::WHLSL::LeftValueSimplifier::visit): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyLeftValue): Deleted. * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: (WebCore::WHLSL::synthesizeEnumerationFunctions): * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: (WebCore::WHLSL::Visitor::visit): * Modules/webgpu/WHLSL/WHLSLVisitor.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * webgpu/whlsl/address-of-swizzle-expected.txt: Added. * webgpu/whlsl/address-of-swizzle.html: Added. * webgpu/whlsl/array-oob-alias-expected.txt: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt. * webgpu/whlsl/array-oob-alias.html: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null.html. * webgpu/whlsl/bad-ander-expected.txt: Removed. * webgpu/whlsl/bad-ander.html: Removed. * webgpu/whlsl/duplicate-types-should-not-produce-duplicate-ctors.html: * webgpu/whlsl/increment-setter.html: * webgpu/whlsl/index-ander-expected.txt: Removed. * webgpu/whlsl/index-ander.html: Removed. * webgpu/whlsl/index-setter-getter-expected.txt: Removed. * webgpu/whlsl/index-setter-getter.html: Removed. * webgpu/whlsl/make-array-reference.html: * webgpu/whlsl/matrix-index-assign-expected.txt: Added. * webgpu/whlsl/matrix-index-assign.html: Added. * webgpu/whlsl/matrix-index-order-expected.txt: Added. * webgpu/whlsl/matrix-index-order.html: Added. * webgpu/whlsl/matrix-memory-layout.html: * webgpu/whlsl/matrix.html: * webgpu/whlsl/null-arg-expected.txt: * webgpu/whlsl/null-arg.html: * webgpu/whlsl/null-dereference-expected.txt: Removed. * webgpu/whlsl/null-dereference.html: Removed. * webgpu/whlsl/oob-access-2-expected.txt: Added. * webgpu/whlsl/oob-access-2.html: Added. * webgpu/whlsl/oob-access.html: * webgpu/whlsl/operator-syntax-expected.txt: Added. * webgpu/whlsl/operator-syntax.html: Added. * webgpu/whlsl/operator-vector-assign.html: * webgpu/whlsl/operator-vector-load.html: * webgpu/whlsl/override-subscript-expected.txt: Removed. * webgpu/whlsl/override-subscript.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander.html: Removed. * webgpu/whlsl/propertyresolver/getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue.html: Removed. * webgpu/whlsl/setter-spec-tests.html: * webgpu/whlsl/simple-getter-setter-expected.txt: * webgpu/whlsl/simple-getter-setter.html: * webgpu/whlsl/structure-field-access-on-null-expected.txt: Removed. * webgpu/whlsl/structure-field-access-on-null.html: Removed. * webgpu/whlsl/test-harness-test.html: Canonical link: https://commits.webkit.org/215020@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-31 00:13:42 +00:00
for (size_t i = 0; i < property.length(); ++i) {
switch (property[i]) {
case 'x':
case 'y':
case 'z':
case 'w':
break;
default:
return false;
}
}
[WHLSL] Implement parser AST nodes https://bugs.webkit.org/show_bug.cgi?id=192991 Reviewed by Alex Christensen. 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/WHLSLArrayReferenceType.h: Added. (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. (WebCore::WHLSL::AST::ArrayType::ArrayType): (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): (WebCore::WHLSL::AST::ArrayType::numElements const): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * 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): (WebCore::WHLSL::AST::Block::statements): * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): (WebCore::WHLSL::AST::BooleanLiteral::value const): (WebCore::WHLSL::AST::BooleanLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. (WebCore::WHLSL::AST::Break::Break): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added. (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const): (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): (WebCore::WHLSL::AST::BuiltInSemantic::variable const): (WebCore::WHLSL::AST::BuiltInSemantic::operator== const): (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. (WebCore::WHLSL::AST::CallExpression::CallExpression): (WebCore::WHLSL::AST::CallExpression::arguments): (WebCore::WHLSL::AST::CallExpression::name): (WebCore::WHLSL::AST::CallExpression::setCastData): (WebCore::WHLSL::AST::CallExpression::isCast): (WebCore::WHLSL::AST::CallExpression::castReturnType): (WebCore::WHLSL::AST::CallExpression::hasOverloads const): (WebCore::WHLSL::AST::CallExpression::overloads): (WebCore::WHLSL::AST::CallExpression::setOverloads): (WebCore::WHLSL::AST::CallExpression::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. (WebCore::WHLSL::AST::CommaExpression::CommaExpression): (WebCore::WHLSL::AST::CommaExpression::list): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): (WebCore::WHLSL::AST::ConstantExpression::visit): (WebCore::WHLSL::AST::ConstantExpression::visit const): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. (WebCore::WHLSL::AST::Continue::Continue): * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. (WebCore::WHLSL::AST::DotExpression::DotExpression): (WebCore::WHLSL::AST::DotExpression::fieldName): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): (WebCore::WHLSL::AST::EnumerationDefinition::add): (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): (WebCore::WHLSL::AST::EnumerationMember::origin const): (WebCore::WHLSL::AST::EnumerationMember::name): (WebCore::WHLSL::AST::EnumerationMember::value): (WebCore::WHLSL::AST::EnumerationMember::setValue): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added. (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. (WebCore::WHLSL::AST::Expression::Expression): (WebCore::WHLSL::AST::Expression::origin const): (WebCore::WHLSL::AST::Expression::isAssignmentExpression const): (WebCore::WHLSL::AST::Expression::isBooleanLiteral const): (WebCore::WHLSL::AST::Expression::isCallExpression const): (WebCore::WHLSL::AST::Expression::isCommaExpression const): (WebCore::WHLSL::AST::Expression::isDereferenceExpression const): (WebCore::WHLSL::AST::Expression::isDotExpression const): (WebCore::WHLSL::AST::Expression::isFloatLiteral const): (WebCore::WHLSL::AST::Expression::isIndexExpression const): (WebCore::WHLSL::AST::Expression::isIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isLogicalExpression const): (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const): (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const): (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const): (WebCore::WHLSL::AST::Expression::isTernaryExpression const): (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isVariableReference const): (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral 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::type): (WebCore::WHLSL::AST::FloatLiteral::value const): (WebCore::WHLSL::AST::FloatLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added. (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType): (WebCore::WHLSL::AST::FloatLiteralType::canResolve const): (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added. (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. (WebCore::WHLSL::AST::ForLoop::ForLoop): (WebCore::WHLSL::AST::ForLoop::~ForLoop): (WebCore::WHLSL::AST::ForLoop::initialization): (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const): (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const): (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock): (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const): (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): (WebCore::WHLSL::AST::FunctionDeclaration::name const): (WebCore::WHLSL::AST::FunctionDeclaration::isCast const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters): (WebCore::WHLSL::AST::FunctionDeclaration::semantic): (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): (WebCore::WHLSL::AST::FunctionDefinition::block): (WebCore::WHLSL::AST::FunctionDefinition::restricted const): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. (WebCore::WHLSL::AST::IfStatement::IfStatement): (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. (WebCore::WHLSL::AST::IndexExpression::IndexExpression): (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): (WebCore::WHLSL::AST::IntegerLiteral::type): (WebCore::WHLSL::AST::IntegerLiteral::value const): (WebCore::WHLSL::AST::IntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType): (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): (WebCore::WHLSL::AST::LogicalExpression::type const): (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added. (WebCore::WHLSL::AST::NamedType::NamedType): (WebCore::WHLSL::AST::NamedType::origin const): (WebCore::WHLSL::AST::NamedType::name): (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): (WebCore::WHLSL::AST::NamedType::unifyNode const): (WebCore::WHLSL::AST::NamedType::unifyNode): * 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): (WebCore::WHLSL::AST::NativeTypeDeclaration::name const): (WebCore::WHLSL::AST::NativeTypeDeclaration::name): (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. (WebCore::WHLSL::AST::NullLiteral::NullLiteral): (WebCore::WHLSL::AST::NullLiteral::type): (WebCore::WHLSL::AST::NullLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added. (WebCore::WHLSL::AST::NullLiteralType::canResolve const): (WebCore::WHLSL::AST::NullLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added. * 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/WHLSLPointerType.h: Added. (WebCore::WHLSL::AST::PointerType::PointerType): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. (WebCore::WHLSL::AST::ReferenceType::ReferenceType): (WebCore::WHLSL::AST::ReferenceType::addressSpace const): (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added. (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): (WebCore::WHLSL::AST::ResolvableType::resolve): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added. (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection 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): (WebCore::WHLSL::AST::ResourceSemantic::operator== const): (WebCore::WHLSL::AST::ResourceSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. (WebCore::WHLSL::AST::Return::Return): (WebCore::WHLSL::AST::Return::value): (WebCore::WHLSL::AST::Return::function): (WebCore::WHLSL::AST::Return::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added. (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const): (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): (WebCore::WHLSL::AST::StageInOutSemantic::index const): (WebCore::WHLSL::AST::StageInOutSemantic::operator== const): (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. (WebCore::WHLSL::AST::Statement::Statement): (WebCore::WHLSL::AST::Statement::isBlock const): (WebCore::WHLSL::AST::Statement::isBreak const): (WebCore::WHLSL::AST::Statement::isContinue const): (WebCore::WHLSL::AST::Statement::isDoWhileLoop const): (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const): (WebCore::WHLSL::AST::Statement::isFallthrough const): (WebCore::WHLSL::AST::Statement::isForLoop const): (WebCore::WHLSL::AST::Statement::isIfStatement const): (WebCore::WHLSL::AST::Statement::isReturn const): (WebCore::WHLSL::AST::Statement::isSwitchCase const): (WebCore::WHLSL::AST::Statement::isSwitchStatement const): (WebCore::WHLSL::AST::Statement::isTrap const): (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const): (WebCore::WHLSL::AST::Statement::isWhileLoop const): * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): (WebCore::WHLSL::AST::StructureDefinition::structureElements): * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. (WebCore::WHLSL::AST::StructureElement::StructureElement): (WebCore::WHLSL::AST::StructureElement::origin const): (WebCore::WHLSL::AST::StructureElement::type): (WebCore::WHLSL::AST::StructureElement::name): (WebCore::WHLSL::AST::StructureElement::semantic): * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. (WebCore::WHLSL::AST::SwitchCase::SwitchCase): (WebCore::WHLSL::AST::SwitchCase::value): (WebCore::WHLSL::AST::SwitchCase::block): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): (WebCore::WHLSL::AST::SwitchStatement::value): (WebCore::WHLSL::AST::SwitchStatement::switchCases): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. (WebCore::WHLSL::AST::Trap::Trap): * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. (WebCore::WHLSL::AST::Type::isNamedType const): (WebCore::WHLSL::AST::Type::isUnnamedType const): (WebCore::WHLSL::AST::Type::isResolvableType const): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added. (WebCore::WHLSL::AST::clone): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added. (WebCore::WHLSL::AST::TypeReference::wrap): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. (WebCore::WHLSL::AST::TypeReference::TypeReference): (WebCore::WHLSL::AST::TypeReference::name): (WebCore::WHLSL::AST::TypeReference::typeArguments): (WebCore::WHLSL::AST::TypeReference::resolvedType const): (WebCore::WHLSL::AST::TypeReference::setResolvedType): (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added. (WebCore::WHLSL::AST::UnnamedType::UnnamedType): (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): (WebCore::WHLSL::AST::UnnamedType::isPointerType const): (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): (WebCore::WHLSL::AST::UnnamedType::isArrayType const): (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): (WebCore::WHLSL::AST::UnnamedType::unifyNode const): (WebCore::WHLSL::AST::UnnamedType::unifyNode): (WebCore::WHLSL::AST::UnnamedType::origin const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * 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): (WebCore::WHLSL::AST::VariableDeclaration::name): (WebCore::WHLSL::AST::VariableDeclaration::type const): (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::semantic): (WebCore::WHLSL::AST::VariableDeclaration::initializer): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. (WebCore::WHLSL::AST::VariableReference::VariableReference): (WebCore::WHLSL::AST::VariableReference::wrap): (WebCore::WHLSL::AST::VariableReference::name): (WebCore::WHLSL::AST::VariableReference::variable): (WebCore::WHLSL::AST::VariableReference::setVariable): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. (WebCore::WHLSL::AST::WhileLoop::WhileLoop): (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. * Modules/webgpu/WHLSL/WHLSLParser.h: Added. * Modules/webgpu/WHLSL/WHLSLProgram.h: Added. (WebCore::WHLSL::Program::append): (WebCore::WHLSL::Program::nameContext): (WebCore::WHLSL::Program::intrinsics): (WebCore::WHLSL::Program::typeDefinitions): (WebCore::WHLSL::Program::structureDefinitions): (WebCore::WHLSL::Program::enumerationDefinitions): (WebCore::WHLSL::Program::functionDefinitions const): (WebCore::WHLSL::Program::functionDefinitions): (WebCore::WHLSL::Program::nativeFunctionDeclarations const): (WebCore::WHLSL::Program::nativeFunctionDeclarations): (WebCore::WHLSL::Program::nativeTypeDeclarations): Canonical link: https://commits.webkit.org/207830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 22:17:58 +00:00
[WHLSL] Remove getters/setters/anders https://bugs.webkit.org/show_bug.cgi?id=201008 Reviewed by Robin Morisset. Source/WebCore: This patch changes WHLSL in a significant way. This patch removes getters/setters/anders from the language. In our experience writing WHLSL shaders, these parts of the language went unused, and they added a lot of complexity to the implementation of the compiler. This patch now treats field accesses and array indexes as intrinsics inside the compiler. This patch removes all notions of named operators, anders, and indexed operators from the compiler and the standard library. The checker now intrinsically knows the return type for property accesses and indexed expressions based on what the base type is. To make this work in practice was difficult, since getters/setters/anders solved a lot of the difficult problems we had in generating metal code. For example, all swizzle operators were getters and setters, so assigning to a swizzle fell out naturally from implementing setters. However, during metal codegen, all we see is a dot expression with "xy" as a property. Our previous architecture of emitting Metal code using pointers which represent lvalues doesn't work because you can't take the address of a swizzle. For example, "auto* x = &vector.yz" is invalid metal code. So, this patch changes the entire metal code generator to emit WHLSL expressions as Metal expressions. To do this, I had to change a lot about how the compiler was implemented: - I changed the indexed accesses of matrices to return columns instead of rows. This allowed WHLSL code like `mat[0].xy = 42` to be compiled into the equivalent metal code of `mat[0].xy = 42`. - I changed the native function inliner to emit expressions instead of statements. - We also simplify the language by removing null and requiring all reference type variables to have an initializer. This means that null is no longer a valid value, which allows us to omit null checks inside the metal code generator. To make this work with array accesses, we now clamp accesses instead of returning null for OOB accesses. I've also filed one required bug as a followup. I didn't include it in this patch to make it easier to review along. Currently, there are two places in metal codegen where we evaluate effects twice. That will be fixed in: https://bugs.webkit.org/show_bug.cgi?id=201251 Tests: webgpu/whlsl/address-of-swizzle.html webgpu/whlsl/array-oob-alias.html webgpu/whlsl/matrix-index-assign.html webgpu/whlsl/matrix-index-order.html webgpu/whlsl/oob-access-2.html webgpu/whlsl/operator-syntax.html * Modules/webgpu/WHLSL/AST/WHLSLAST.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: (WebCore::WHLSL::AST::Expression::destroy): (WebCore::WHLSL::AST::Expression::destruct): (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunctionName const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: (WebCore::WHLSL::AST::Expression::copyTypeTo const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction): Deleted. (): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: (WebCore::WHLSL::AST::Type::destroy): (WebCore::WHLSL::AST::Type::destruct): (WebCore::WHLSL::AST::ResolvableType::canResolve const): (WebCore::WHLSL::AST::ResolvableType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLType.h: (WebCore::WHLSL::AST::Type::isIntegerLiteralType const): (WebCore::WHLSL::AST::Type::isNullLiteralType const): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: (WebCore::WHLSL::Metal::FunctionDefinitionWriter::HoistedVariableCollector::HoistedVariableCollector): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: (WebCore::WHLSL::Metal::metalCodePrologue): (WebCore::WHLSL::Metal::generateMetalCode): (WebCore::WHLSL::Metal::metalCodeProlog): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: (WebCore::WHLSL::Metal::inlineNativeFunction): (WebCore::WHLSL::Metal::vectorInnerType): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: (WebCore::WHLSL::Metal::writeNativeType): * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: (WebCore::WHLSL::ASTDumper::visit): * Modules/webgpu/WHLSL/WHLSLASTDumper.h: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: (WebCore::WHLSL::checkDuplicateFunctions): * Modules/webgpu/WHLSL/WHLSLChecker.cpp: (WebCore::WHLSL::resolveByInstantiation): (WebCore::WHLSL::checkOperatorOverload): (WebCore::WHLSL::Checker::wrappedUintType): (WebCore::WHLSL::Checker::normalizedTypeForFunctionKey): (WebCore::WHLSL::Checker::visit): (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::Checker::resolveFunction): (WebCore::WHLSL::Checker::assignConcreteType): (WebCore::WHLSL::resolveWithOperatorLength): Deleted. (WebCore::WHLSL::Checker::genericPointerType): Deleted. (WebCore::WHLSL::Checker::finishVisiting): Deleted. * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): (): Deleted. * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::commit): * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: (WebCore::WHLSL::Intrinsics::boolVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::uintVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::intVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::floatVectorTypeForSize const): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: (WebCore::WHLSL::Lexer::consumeTokenFromStream): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: (WebCore::WHLSL::Parser::parseConstantExpression): (WebCore::WHLSL::Parser::parseEnumerationMember): (WebCore::WHLSL::Parser::parseTerm): * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: (WebCore::WHLSL::prepareShared): * Modules/webgpu/WHLSL/WHLSLProgram.cpp: Added. (WebCore::WHLSL::Program::isValidVectorProperty): * Modules/webgpu/WHLSL/WHLSLProgram.h: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: (WebCore::WHLSL::resolveProperties): (WebCore::WHLSL::PropertyResolver::visit): Deleted. (WebCore::WHLSL::wrapAnderCallArgument): Deleted. (WebCore::WHLSL::anderCallArgument): Deleted. (WebCore::WHLSL::setterCall): Deleted. (WebCore::WHLSL::getterCall): Deleted. (WebCore::WHLSL::modify): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyRightValue): Deleted. (WebCore::WHLSL::LeftValueSimplifier::finishVisiting): Deleted. (WebCore::WHLSL::LeftValueSimplifier::visit): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyLeftValue): Deleted. * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: (WebCore::WHLSL::synthesizeEnumerationFunctions): * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: (WebCore::WHLSL::Visitor::visit): * Modules/webgpu/WHLSL/WHLSLVisitor.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * webgpu/whlsl/address-of-swizzle-expected.txt: Added. * webgpu/whlsl/address-of-swizzle.html: Added. * webgpu/whlsl/array-oob-alias-expected.txt: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt. * webgpu/whlsl/array-oob-alias.html: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null.html. * webgpu/whlsl/bad-ander-expected.txt: Removed. * webgpu/whlsl/bad-ander.html: Removed. * webgpu/whlsl/duplicate-types-should-not-produce-duplicate-ctors.html: * webgpu/whlsl/increment-setter.html: * webgpu/whlsl/index-ander-expected.txt: Removed. * webgpu/whlsl/index-ander.html: Removed. * webgpu/whlsl/index-setter-getter-expected.txt: Removed. * webgpu/whlsl/index-setter-getter.html: Removed. * webgpu/whlsl/make-array-reference.html: * webgpu/whlsl/matrix-index-assign-expected.txt: Added. * webgpu/whlsl/matrix-index-assign.html: Added. * webgpu/whlsl/matrix-index-order-expected.txt: Added. * webgpu/whlsl/matrix-index-order.html: Added. * webgpu/whlsl/matrix-memory-layout.html: * webgpu/whlsl/matrix.html: * webgpu/whlsl/null-arg-expected.txt: * webgpu/whlsl/null-arg.html: * webgpu/whlsl/null-dereference-expected.txt: Removed. * webgpu/whlsl/null-dereference.html: Removed. * webgpu/whlsl/oob-access-2-expected.txt: Added. * webgpu/whlsl/oob-access-2.html: Added. * webgpu/whlsl/oob-access.html: * webgpu/whlsl/operator-syntax-expected.txt: Added. * webgpu/whlsl/operator-syntax.html: Added. * webgpu/whlsl/operator-vector-assign.html: * webgpu/whlsl/operator-vector-load.html: * webgpu/whlsl/override-subscript-expected.txt: Removed. * webgpu/whlsl/override-subscript.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander.html: Removed. * webgpu/whlsl/propertyresolver/getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue.html: Removed. * webgpu/whlsl/setter-spec-tests.html: * webgpu/whlsl/simple-getter-setter-expected.txt: * webgpu/whlsl/simple-getter-setter.html: * webgpu/whlsl/structure-field-access-on-null-expected.txt: Removed. * webgpu/whlsl/structure-field-access-on-null.html: Removed. * webgpu/whlsl/test-harness-test.html: Canonical link: https://commits.webkit.org/215020@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-31 00:13:42 +00:00
return true;
[WHLSL] Implement parser AST nodes https://bugs.webkit.org/show_bug.cgi?id=192991 Reviewed by Alex Christensen. 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/WHLSLArrayReferenceType.h: Added. (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. (WebCore::WHLSL::AST::ArrayType::ArrayType): (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): (WebCore::WHLSL::AST::ArrayType::numElements const): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * 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): (WebCore::WHLSL::AST::Block::statements): * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): (WebCore::WHLSL::AST::BooleanLiteral::value const): (WebCore::WHLSL::AST::BooleanLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. (WebCore::WHLSL::AST::Break::Break): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added. (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const): (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): (WebCore::WHLSL::AST::BuiltInSemantic::variable const): (WebCore::WHLSL::AST::BuiltInSemantic::operator== const): (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. (WebCore::WHLSL::AST::CallExpression::CallExpression): (WebCore::WHLSL::AST::CallExpression::arguments): (WebCore::WHLSL::AST::CallExpression::name): (WebCore::WHLSL::AST::CallExpression::setCastData): (WebCore::WHLSL::AST::CallExpression::isCast): (WebCore::WHLSL::AST::CallExpression::castReturnType): (WebCore::WHLSL::AST::CallExpression::hasOverloads const): (WebCore::WHLSL::AST::CallExpression::overloads): (WebCore::WHLSL::AST::CallExpression::setOverloads): (WebCore::WHLSL::AST::CallExpression::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. (WebCore::WHLSL::AST::CommaExpression::CommaExpression): (WebCore::WHLSL::AST::CommaExpression::list): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): (WebCore::WHLSL::AST::ConstantExpression::visit): (WebCore::WHLSL::AST::ConstantExpression::visit const): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. (WebCore::WHLSL::AST::Continue::Continue): * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. (WebCore::WHLSL::AST::DotExpression::DotExpression): (WebCore::WHLSL::AST::DotExpression::fieldName): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): (WebCore::WHLSL::AST::EnumerationDefinition::add): (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): (WebCore::WHLSL::AST::EnumerationMember::origin const): (WebCore::WHLSL::AST::EnumerationMember::name): (WebCore::WHLSL::AST::EnumerationMember::value): (WebCore::WHLSL::AST::EnumerationMember::setValue): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added. (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. (WebCore::WHLSL::AST::Expression::Expression): (WebCore::WHLSL::AST::Expression::origin const): (WebCore::WHLSL::AST::Expression::isAssignmentExpression const): (WebCore::WHLSL::AST::Expression::isBooleanLiteral const): (WebCore::WHLSL::AST::Expression::isCallExpression const): (WebCore::WHLSL::AST::Expression::isCommaExpression const): (WebCore::WHLSL::AST::Expression::isDereferenceExpression const): (WebCore::WHLSL::AST::Expression::isDotExpression const): (WebCore::WHLSL::AST::Expression::isFloatLiteral const): (WebCore::WHLSL::AST::Expression::isIndexExpression const): (WebCore::WHLSL::AST::Expression::isIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isLogicalExpression const): (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const): (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const): (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const): (WebCore::WHLSL::AST::Expression::isTernaryExpression const): (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isVariableReference const): (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral 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::type): (WebCore::WHLSL::AST::FloatLiteral::value const): (WebCore::WHLSL::AST::FloatLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added. (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType): (WebCore::WHLSL::AST::FloatLiteralType::canResolve const): (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added. (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. (WebCore::WHLSL::AST::ForLoop::ForLoop): (WebCore::WHLSL::AST::ForLoop::~ForLoop): (WebCore::WHLSL::AST::ForLoop::initialization): (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const): (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const): (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock): (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const): (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): (WebCore::WHLSL::AST::FunctionDeclaration::name const): (WebCore::WHLSL::AST::FunctionDeclaration::isCast const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters): (WebCore::WHLSL::AST::FunctionDeclaration::semantic): (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): (WebCore::WHLSL::AST::FunctionDefinition::block): (WebCore::WHLSL::AST::FunctionDefinition::restricted const): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. (WebCore::WHLSL::AST::IfStatement::IfStatement): (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. (WebCore::WHLSL::AST::IndexExpression::IndexExpression): (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): (WebCore::WHLSL::AST::IntegerLiteral::type): (WebCore::WHLSL::AST::IntegerLiteral::value const): (WebCore::WHLSL::AST::IntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType): (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): (WebCore::WHLSL::AST::LogicalExpression::type const): (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added. (WebCore::WHLSL::AST::NamedType::NamedType): (WebCore::WHLSL::AST::NamedType::origin const): (WebCore::WHLSL::AST::NamedType::name): (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): (WebCore::WHLSL::AST::NamedType::unifyNode const): (WebCore::WHLSL::AST::NamedType::unifyNode): * 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): (WebCore::WHLSL::AST::NativeTypeDeclaration::name const): (WebCore::WHLSL::AST::NativeTypeDeclaration::name): (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. (WebCore::WHLSL::AST::NullLiteral::NullLiteral): (WebCore::WHLSL::AST::NullLiteral::type): (WebCore::WHLSL::AST::NullLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added. (WebCore::WHLSL::AST::NullLiteralType::canResolve const): (WebCore::WHLSL::AST::NullLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added. * 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/WHLSLPointerType.h: Added. (WebCore::WHLSL::AST::PointerType::PointerType): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. (WebCore::WHLSL::AST::ReferenceType::ReferenceType): (WebCore::WHLSL::AST::ReferenceType::addressSpace const): (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added. (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): (WebCore::WHLSL::AST::ResolvableType::resolve): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added. (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection 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): (WebCore::WHLSL::AST::ResourceSemantic::operator== const): (WebCore::WHLSL::AST::ResourceSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. (WebCore::WHLSL::AST::Return::Return): (WebCore::WHLSL::AST::Return::value): (WebCore::WHLSL::AST::Return::function): (WebCore::WHLSL::AST::Return::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added. (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const): (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): (WebCore::WHLSL::AST::StageInOutSemantic::index const): (WebCore::WHLSL::AST::StageInOutSemantic::operator== const): (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. (WebCore::WHLSL::AST::Statement::Statement): (WebCore::WHLSL::AST::Statement::isBlock const): (WebCore::WHLSL::AST::Statement::isBreak const): (WebCore::WHLSL::AST::Statement::isContinue const): (WebCore::WHLSL::AST::Statement::isDoWhileLoop const): (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const): (WebCore::WHLSL::AST::Statement::isFallthrough const): (WebCore::WHLSL::AST::Statement::isForLoop const): (WebCore::WHLSL::AST::Statement::isIfStatement const): (WebCore::WHLSL::AST::Statement::isReturn const): (WebCore::WHLSL::AST::Statement::isSwitchCase const): (WebCore::WHLSL::AST::Statement::isSwitchStatement const): (WebCore::WHLSL::AST::Statement::isTrap const): (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const): (WebCore::WHLSL::AST::Statement::isWhileLoop const): * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): (WebCore::WHLSL::AST::StructureDefinition::structureElements): * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. (WebCore::WHLSL::AST::StructureElement::StructureElement): (WebCore::WHLSL::AST::StructureElement::origin const): (WebCore::WHLSL::AST::StructureElement::type): (WebCore::WHLSL::AST::StructureElement::name): (WebCore::WHLSL::AST::StructureElement::semantic): * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. (WebCore::WHLSL::AST::SwitchCase::SwitchCase): (WebCore::WHLSL::AST::SwitchCase::value): (WebCore::WHLSL::AST::SwitchCase::block): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): (WebCore::WHLSL::AST::SwitchStatement::value): (WebCore::WHLSL::AST::SwitchStatement::switchCases): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. (WebCore::WHLSL::AST::Trap::Trap): * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. (WebCore::WHLSL::AST::Type::isNamedType const): (WebCore::WHLSL::AST::Type::isUnnamedType const): (WebCore::WHLSL::AST::Type::isResolvableType const): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added. (WebCore::WHLSL::AST::clone): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added. (WebCore::WHLSL::AST::TypeReference::wrap): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. (WebCore::WHLSL::AST::TypeReference::TypeReference): (WebCore::WHLSL::AST::TypeReference::name): (WebCore::WHLSL::AST::TypeReference::typeArguments): (WebCore::WHLSL::AST::TypeReference::resolvedType const): (WebCore::WHLSL::AST::TypeReference::setResolvedType): (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added. (WebCore::WHLSL::AST::UnnamedType::UnnamedType): (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): (WebCore::WHLSL::AST::UnnamedType::isPointerType const): (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): (WebCore::WHLSL::AST::UnnamedType::isArrayType const): (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): (WebCore::WHLSL::AST::UnnamedType::unifyNode const): (WebCore::WHLSL::AST::UnnamedType::unifyNode): (WebCore::WHLSL::AST::UnnamedType::origin const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * 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): (WebCore::WHLSL::AST::VariableDeclaration::name): (WebCore::WHLSL::AST::VariableDeclaration::type const): (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::semantic): (WebCore::WHLSL::AST::VariableDeclaration::initializer): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. (WebCore::WHLSL::AST::VariableReference::VariableReference): (WebCore::WHLSL::AST::VariableReference::wrap): (WebCore::WHLSL::AST::VariableReference::name): (WebCore::WHLSL::AST::VariableReference::variable): (WebCore::WHLSL::AST::VariableReference::setVariable): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. (WebCore::WHLSL::AST::WhileLoop::WhileLoop): (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. * Modules/webgpu/WHLSL/WHLSLParser.h: Added. * Modules/webgpu/WHLSL/WHLSLProgram.h: Added. (WebCore::WHLSL::Program::append): (WebCore::WHLSL::Program::nameContext): (WebCore::WHLSL::Program::intrinsics): (WebCore::WHLSL::Program::typeDefinitions): (WebCore::WHLSL::Program::structureDefinitions): (WebCore::WHLSL::Program::enumerationDefinitions): (WebCore::WHLSL::Program::functionDefinitions const): (WebCore::WHLSL::Program::functionDefinitions): (WebCore::WHLSL::Program::nativeFunctionDeclarations const): (WebCore::WHLSL::Program::nativeFunctionDeclarations): (WebCore::WHLSL::Program::nativeTypeDeclarations): Canonical link: https://commits.webkit.org/207830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 22:17:58 +00:00
}
[WHLSL] Remove getters/setters/anders https://bugs.webkit.org/show_bug.cgi?id=201008 Reviewed by Robin Morisset. Source/WebCore: This patch changes WHLSL in a significant way. This patch removes getters/setters/anders from the language. In our experience writing WHLSL shaders, these parts of the language went unused, and they added a lot of complexity to the implementation of the compiler. This patch now treats field accesses and array indexes as intrinsics inside the compiler. This patch removes all notions of named operators, anders, and indexed operators from the compiler and the standard library. The checker now intrinsically knows the return type for property accesses and indexed expressions based on what the base type is. To make this work in practice was difficult, since getters/setters/anders solved a lot of the difficult problems we had in generating metal code. For example, all swizzle operators were getters and setters, so assigning to a swizzle fell out naturally from implementing setters. However, during metal codegen, all we see is a dot expression with "xy" as a property. Our previous architecture of emitting Metal code using pointers which represent lvalues doesn't work because you can't take the address of a swizzle. For example, "auto* x = &vector.yz" is invalid metal code. So, this patch changes the entire metal code generator to emit WHLSL expressions as Metal expressions. To do this, I had to change a lot about how the compiler was implemented: - I changed the indexed accesses of matrices to return columns instead of rows. This allowed WHLSL code like `mat[0].xy = 42` to be compiled into the equivalent metal code of `mat[0].xy = 42`. - I changed the native function inliner to emit expressions instead of statements. - We also simplify the language by removing null and requiring all reference type variables to have an initializer. This means that null is no longer a valid value, which allows us to omit null checks inside the metal code generator. To make this work with array accesses, we now clamp accesses instead of returning null for OOB accesses. I've also filed one required bug as a followup. I didn't include it in this patch to make it easier to review along. Currently, there are two places in metal codegen where we evaluate effects twice. That will be fixed in: https://bugs.webkit.org/show_bug.cgi?id=201251 Tests: webgpu/whlsl/address-of-swizzle.html webgpu/whlsl/array-oob-alias.html webgpu/whlsl/matrix-index-assign.html webgpu/whlsl/matrix-index-order.html webgpu/whlsl/oob-access-2.html webgpu/whlsl/operator-syntax.html * Modules/webgpu/WHLSL/AST/WHLSLAST.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: (WebCore::WHLSL::AST::Expression::destroy): (WebCore::WHLSL::AST::Expression::destruct): (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunctionName const): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunctionName const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: (WebCore::WHLSL::AST::Expression::copyTypeTo const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Removed. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Removed. * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction): Deleted. (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction): Deleted. (): Deleted. * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: (WebCore::WHLSL::AST::Type::destroy): (WebCore::WHLSL::AST::Type::destruct): (WebCore::WHLSL::AST::ResolvableType::canResolve const): (WebCore::WHLSL::AST::ResolvableType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLType.h: (WebCore::WHLSL::AST::Type::isIntegerLiteralType const): (WebCore::WHLSL::AST::Type::isNullLiteralType const): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: (WebCore::WHLSL::Metal::FunctionDefinitionWriter::HoistedVariableCollector::HoistedVariableCollector): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString): (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability): Deleted. (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: (WebCore::WHLSL::Metal::metalCodePrologue): (WebCore::WHLSL::Metal::generateMetalCode): (WebCore::WHLSL::Metal::metalCodeProlog): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: (WebCore::WHLSL::Metal::inlineNativeFunction): (WebCore::WHLSL::Metal::vectorInnerType): Deleted. * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: (WebCore::WHLSL::Metal::writeNativeType): * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: (WebCore::WHLSL::ASTDumper::visit): * Modules/webgpu/WHLSL/WHLSLASTDumper.h: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: (WebCore::WHLSL::checkDuplicateFunctions): * Modules/webgpu/WHLSL/WHLSLChecker.cpp: (WebCore::WHLSL::resolveByInstantiation): (WebCore::WHLSL::checkOperatorOverload): (WebCore::WHLSL::Checker::wrappedUintType): (WebCore::WHLSL::Checker::normalizedTypeForFunctionKey): (WebCore::WHLSL::Checker::visit): (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::Checker::resolveFunction): (WebCore::WHLSL::Checker::assignConcreteType): (WebCore::WHLSL::resolveWithOperatorLength): Deleted. (WebCore::WHLSL::Checker::genericPointerType): Deleted. (WebCore::WHLSL::Checker::finishVisiting): Deleted. * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): (): Deleted. * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matchAndCommit): (WebCore::WHLSL::commit): * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: (WebCore::WHLSL::Intrinsics::boolVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::uintVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::intVectorTypeForSize const): (WebCore::WHLSL::Intrinsics::floatVectorTypeForSize const): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: (WebCore::WHLSL::Lexer::consumeTokenFromStream): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: (WebCore::WHLSL::Parser::parseConstantExpression): (WebCore::WHLSL::Parser::parseEnumerationMember): (WebCore::WHLSL::Parser::parseTerm): * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: (WebCore::WHLSL::prepareShared): * Modules/webgpu/WHLSL/WHLSLProgram.cpp: Added. (WebCore::WHLSL::Program::isValidVectorProperty): * Modules/webgpu/WHLSL/WHLSLProgram.h: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: (WebCore::WHLSL::resolveProperties): (WebCore::WHLSL::PropertyResolver::visit): Deleted. (WebCore::WHLSL::wrapAnderCallArgument): Deleted. (WebCore::WHLSL::anderCallArgument): Deleted. (WebCore::WHLSL::setterCall): Deleted. (WebCore::WHLSL::getterCall): Deleted. (WebCore::WHLSL::modify): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyRightValue): Deleted. (WebCore::WHLSL::LeftValueSimplifier::finishVisiting): Deleted. (WebCore::WHLSL::LeftValueSimplifier::visit): Deleted. (WebCore::WHLSL::PropertyResolver::simplifyLeftValue): Deleted. * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Removed. * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: (WebCore::WHLSL::synthesizeEnumerationFunctions): * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: (WebCore::WHLSL::Visitor::visit): * Modules/webgpu/WHLSL/WHLSLVisitor.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * webgpu/whlsl/address-of-swizzle-expected.txt: Added. * webgpu/whlsl/address-of-swizzle.html: Added. * webgpu/whlsl/array-oob-alias-expected.txt: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt. * webgpu/whlsl/array-oob-alias.html: Copied from LayoutTests/webgpu/whlsl/structure-field-access-on-null.html. * webgpu/whlsl/bad-ander-expected.txt: Removed. * webgpu/whlsl/bad-ander.html: Removed. * webgpu/whlsl/duplicate-types-should-not-produce-duplicate-ctors.html: * webgpu/whlsl/increment-setter.html: * webgpu/whlsl/index-ander-expected.txt: Removed. * webgpu/whlsl/index-ander.html: Removed. * webgpu/whlsl/index-setter-getter-expected.txt: Removed. * webgpu/whlsl/index-setter-getter.html: Removed. * webgpu/whlsl/make-array-reference.html: * webgpu/whlsl/matrix-index-assign-expected.txt: Added. * webgpu/whlsl/matrix-index-assign.html: Added. * webgpu/whlsl/matrix-index-order-expected.txt: Added. * webgpu/whlsl/matrix-index-order.html: Added. * webgpu/whlsl/matrix-memory-layout.html: * webgpu/whlsl/matrix.html: * webgpu/whlsl/null-arg-expected.txt: * webgpu/whlsl/null-arg.html: * webgpu/whlsl/null-dereference-expected.txt: Removed. * webgpu/whlsl/null-dereference.html: Removed. * webgpu/whlsl/oob-access-2-expected.txt: Added. * webgpu/whlsl/oob-access-2.html: Added. * webgpu/whlsl/oob-access.html: * webgpu/whlsl/operator-syntax-expected.txt: Added. * webgpu/whlsl/operator-syntax.html: Added. * webgpu/whlsl/operator-vector-assign.html: * webgpu/whlsl/operator-vector-load.html: * webgpu/whlsl/override-subscript-expected.txt: Removed. * webgpu/whlsl/override-subscript.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/ander.html: Removed. * webgpu/whlsl/propertyresolver/getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-ander.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-getter.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/indexer-setter.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-3-levels.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-abstract-lvalue.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue-expected.html: Removed. * webgpu/whlsl/propertyresolver/setter-lvalue.html: Removed. * webgpu/whlsl/setter-spec-tests.html: * webgpu/whlsl/simple-getter-setter-expected.txt: * webgpu/whlsl/simple-getter-setter.html: * webgpu/whlsl/structure-field-access-on-null-expected.txt: Removed. * webgpu/whlsl/structure-field-access-on-null.html: Removed. * webgpu/whlsl/test-harness-test.html: Canonical link: https://commits.webkit.org/215020@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-31 00:13:42 +00:00
} // namespace WHLSL
} // namespace WebCore
[WHLSL] Implement parser AST nodes https://bugs.webkit.org/show_bug.cgi?id=192991 Reviewed by Alex Christensen. 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/WHLSLArrayReferenceType.h: Added. (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType): * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added. (WebCore::WHLSL::AST::ArrayType::ArrayType): (WebCore::WHLSL::AST::ArrayType::type const): (WebCore::WHLSL::AST::ArrayType::type): (WebCore::WHLSL::AST::ArrayType::numElements const): * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added. (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): (WebCore::WHLSL::AST::AssignmentExpression::left): (WebCore::WHLSL::AST::AssignmentExpression::right): * 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): (WebCore::WHLSL::AST::Block::statements): * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added. (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): (WebCore::WHLSL::AST::BooleanLiteral::value const): (WebCore::WHLSL::AST::BooleanLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added. (WebCore::WHLSL::AST::Break::Break): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added. (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const): (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added. (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic): (WebCore::WHLSL::AST::BuiltInSemantic::variable const): (WebCore::WHLSL::AST::BuiltInSemantic::operator== const): (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added. (WebCore::WHLSL::AST::CallExpression::CallExpression): (WebCore::WHLSL::AST::CallExpression::arguments): (WebCore::WHLSL::AST::CallExpression::name): (WebCore::WHLSL::AST::CallExpression::setCastData): (WebCore::WHLSL::AST::CallExpression::isCast): (WebCore::WHLSL::AST::CallExpression::castReturnType): (WebCore::WHLSL::AST::CallExpression::hasOverloads const): (WebCore::WHLSL::AST::CallExpression::overloads): (WebCore::WHLSL::AST::CallExpression::setOverloads): (WebCore::WHLSL::AST::CallExpression::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added. (WebCore::WHLSL::AST::CommaExpression::CommaExpression): (WebCore::WHLSL::AST::CommaExpression::list): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added. (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): (WebCore::WHLSL::AST::ConstantExpression::visit): (WebCore::WHLSL::AST::ConstantExpression::visit const): (WebCore::WHLSL::AST::ConstantExpression::clone const): (WebCore::WHLSL::AST::ConstantExpression::matches const): * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added. (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const): (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added. (WebCore::WHLSL::AST::Continue::Continue): * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added. (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): (WebCore::WHLSL::AST::DereferenceExpression::pointer): * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added. (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): (WebCore::WHLSL::AST::DoWhileLoop::body): (WebCore::WHLSL::AST::DoWhileLoop::conditional): * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added. (WebCore::WHLSL::AST::DotExpression::DotExpression): (WebCore::WHLSL::AST::DotExpression::fieldName): * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added. (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added. (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): (WebCore::WHLSL::AST::EnumerationDefinition::type): (WebCore::WHLSL::AST::EnumerationDefinition::add): (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added. (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember): (WebCore::WHLSL::AST::EnumerationMember::origin const): (WebCore::WHLSL::AST::EnumerationMember::name): (WebCore::WHLSL::AST::EnumerationMember::value): (WebCore::WHLSL::AST::EnumerationMember::setValue): * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added. (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added. (WebCore::WHLSL::AST::Expression::Expression): (WebCore::WHLSL::AST::Expression::origin const): (WebCore::WHLSL::AST::Expression::isAssignmentExpression const): (WebCore::WHLSL::AST::Expression::isBooleanLiteral const): (WebCore::WHLSL::AST::Expression::isCallExpression const): (WebCore::WHLSL::AST::Expression::isCommaExpression const): (WebCore::WHLSL::AST::Expression::isDereferenceExpression const): (WebCore::WHLSL::AST::Expression::isDotExpression const): (WebCore::WHLSL::AST::Expression::isFloatLiteral const): (WebCore::WHLSL::AST::Expression::isIndexExpression const): (WebCore::WHLSL::AST::Expression::isIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isLogicalExpression const): (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const): (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const): (WebCore::WHLSL::AST::Expression::isMakePointerExpression const): (WebCore::WHLSL::AST::Expression::isNullLiteral const): (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const): (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const): (WebCore::WHLSL::AST::Expression::isTernaryExpression const): (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const): (WebCore::WHLSL::AST::Expression::isVariableReference const): (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral 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::type): (WebCore::WHLSL::AST::FloatLiteral::value const): (WebCore::WHLSL::AST::FloatLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added. (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType): (WebCore::WHLSL::AST::FloatLiteralType::canResolve const): (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added. (WebCore::WHLSL::AST::FloatLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added. (WebCore::WHLSL::AST::ForLoop::ForLoop): (WebCore::WHLSL::AST::ForLoop::~ForLoop): (WebCore::WHLSL::AST::ForLoop::initialization): (WebCore::WHLSL::AST::ForLoop::condition): (WebCore::WHLSL::AST::ForLoop::increment): (WebCore::WHLSL::AST::ForLoop::body): * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added. (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration): (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const): (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const): (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock): (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const): (WebCore::WHLSL::AST::FunctionDeclaration::type const): (WebCore::WHLSL::AST::FunctionDeclaration::type): (WebCore::WHLSL::AST::FunctionDeclaration::name const): (WebCore::WHLSL::AST::FunctionDeclaration::isCast const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters const): (WebCore::WHLSL::AST::FunctionDeclaration::parameters): (WebCore::WHLSL::AST::FunctionDeclaration::semantic): (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const): * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added. (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition): (WebCore::WHLSL::AST::FunctionDefinition::block): (WebCore::WHLSL::AST::FunctionDefinition::restricted const): * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added. (WebCore::WHLSL::AST::IfStatement::IfStatement): (WebCore::WHLSL::AST::IfStatement::conditional): (WebCore::WHLSL::AST::IfStatement::body): (WebCore::WHLSL::AST::IfStatement::elseBody): * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added. (WebCore::WHLSL::AST::IndexExpression::IndexExpression): (WebCore::WHLSL::AST::IndexExpression::indexExpression): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added. (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): (WebCore::WHLSL::AST::IntegerLiteral::type): (WebCore::WHLSL::AST::IntegerLiteral::value const): (WebCore::WHLSL::AST::IntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType): (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added. (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): (WebCore::WHLSL::AST::LogicalExpression::type const): (WebCore::WHLSL::AST::LogicalExpression::left): (WebCore::WHLSL::AST::LogicalExpression::right): * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added. (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): (WebCore::WHLSL::AST::LogicalNotExpression::operand): * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added. (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added. (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): (WebCore::WHLSL::AST::MakePointerExpression::lValue): * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added. (WebCore::WHLSL::AST::NamedType::NamedType): (WebCore::WHLSL::AST::NamedType::origin const): (WebCore::WHLSL::AST::NamedType::name): (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): (WebCore::WHLSL::AST::NamedType::unifyNode const): (WebCore::WHLSL::AST::NamedType::unifyNode): * 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): (WebCore::WHLSL::AST::NativeTypeDeclaration::name const): (WebCore::WHLSL::AST::NativeTypeDeclaration::name): (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added. (WebCore::WHLSL::AST::NullLiteral::NullLiteral): (WebCore::WHLSL::AST::NullLiteral::type): (WebCore::WHLSL::AST::NullLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added. (WebCore::WHLSL::AST::NullLiteralType::canResolve const): (WebCore::WHLSL::AST::NullLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added. * 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/WHLSLPointerType.h: Added. (WebCore::WHLSL::AST::PointerType::PointerType): * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added. (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): (WebCore::WHLSL::AST::PropertyAccessExpression::base): * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added. (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added. (WebCore::WHLSL::AST::ReferenceType::ReferenceType): (WebCore::WHLSL::AST::ReferenceType::addressSpace const): (WebCore::WHLSL::AST::ReferenceType::elementType const): (WebCore::WHLSL::AST::ReferenceType::elementType): * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added. (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType const): (WebCore::WHLSL::AST::ResolvableType::resolvedType): (WebCore::WHLSL::AST::ResolvableType::resolve): * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added. (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const): (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection 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): (WebCore::WHLSL::AST::ResourceSemantic::operator== const): (WebCore::WHLSL::AST::ResourceSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added. (WebCore::WHLSL::AST::Return::Return): (WebCore::WHLSL::AST::Return::value): (WebCore::WHLSL::AST::Return::function): (WebCore::WHLSL::AST::Return::setFunction): * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added. (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const): (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added. (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const): (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const): * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added. (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic): (WebCore::WHLSL::AST::StageInOutSemantic::index const): (WebCore::WHLSL::AST::StageInOutSemantic::operator== const): (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const): * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added. (WebCore::WHLSL::AST::Statement::Statement): (WebCore::WHLSL::AST::Statement::isBlock const): (WebCore::WHLSL::AST::Statement::isBreak const): (WebCore::WHLSL::AST::Statement::isContinue const): (WebCore::WHLSL::AST::Statement::isDoWhileLoop const): (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const): (WebCore::WHLSL::AST::Statement::isFallthrough const): (WebCore::WHLSL::AST::Statement::isForLoop const): (WebCore::WHLSL::AST::Statement::isIfStatement const): (WebCore::WHLSL::AST::Statement::isReturn const): (WebCore::WHLSL::AST::Statement::isSwitchCase const): (WebCore::WHLSL::AST::Statement::isSwitchStatement const): (WebCore::WHLSL::AST::Statement::isTrap const): (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const): (WebCore::WHLSL::AST::Statement::isWhileLoop const): * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added. (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): (WebCore::WHLSL::AST::StructureDefinition::structureElements): * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added. (WebCore::WHLSL::AST::StructureElement::StructureElement): (WebCore::WHLSL::AST::StructureElement::origin const): (WebCore::WHLSL::AST::StructureElement::type): (WebCore::WHLSL::AST::StructureElement::name): (WebCore::WHLSL::AST::StructureElement::semantic): * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added. (WebCore::WHLSL::AST::SwitchCase::SwitchCase): (WebCore::WHLSL::AST::SwitchCase::value): (WebCore::WHLSL::AST::SwitchCase::block): * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added. (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): (WebCore::WHLSL::AST::SwitchStatement::value): (WebCore::WHLSL::AST::SwitchStatement::switchCases): * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added. (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): (WebCore::WHLSL::AST::TernaryExpression::predicate): (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): (WebCore::WHLSL::AST::TernaryExpression::elseExpression): * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added. (WebCore::WHLSL::AST::Trap::Trap): * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added. (WebCore::WHLSL::AST::Type::isNamedType const): (WebCore::WHLSL::AST::Type::isUnnamedType const): (WebCore::WHLSL::AST::Type::isResolvableType const): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added. (WebCore::WHLSL::AST::clone): * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added. * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added. (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): (WebCore::WHLSL::AST::TypeDefinition::type): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added. (WebCore::WHLSL::AST::TypeReference::wrap): * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added. (WebCore::WHLSL::AST::TypeReference::TypeReference): (WebCore::WHLSL::AST::TypeReference::name): (WebCore::WHLSL::AST::TypeReference::typeArguments): (WebCore::WHLSL::AST::TypeReference::resolvedType const): (WebCore::WHLSL::AST::TypeReference::setResolvedType): (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const): * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added. (WebCore::WHLSL::AST::UnnamedType::UnnamedType): (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): (WebCore::WHLSL::AST::UnnamedType::isPointerType const): (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): (WebCore::WHLSL::AST::UnnamedType::isArrayType const): (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): (WebCore::WHLSL::AST::UnnamedType::unifyNode const): (WebCore::WHLSL::AST::UnnamedType::unifyNode): (WebCore::WHLSL::AST::UnnamedType::origin const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const): (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const): * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added. (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): * 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): (WebCore::WHLSL::AST::VariableDeclaration::name): (WebCore::WHLSL::AST::VariableDeclaration::type const): (WebCore::WHLSL::AST::VariableDeclaration::type): (WebCore::WHLSL::AST::VariableDeclaration::semantic): (WebCore::WHLSL::AST::VariableDeclaration::initializer): * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added. (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added. (WebCore::WHLSL::AST::VariableReference::VariableReference): (WebCore::WHLSL::AST::VariableReference::wrap): (WebCore::WHLSL::AST::VariableReference::name): (WebCore::WHLSL::AST::VariableReference::variable): (WebCore::WHLSL::AST::VariableReference::setVariable): * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added. (WebCore::WHLSL::AST::WhileLoop::WhileLoop): (WebCore::WHLSL::AST::WhileLoop::conditional): (WebCore::WHLSL::AST::WhileLoop::body): * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added. * Modules/webgpu/WHLSL/WHLSLParser.h: Added. * Modules/webgpu/WHLSL/WHLSLProgram.h: Added. (WebCore::WHLSL::Program::append): (WebCore::WHLSL::Program::nameContext): (WebCore::WHLSL::Program::intrinsics): (WebCore::WHLSL::Program::typeDefinitions): (WebCore::WHLSL::Program::structureDefinitions): (WebCore::WHLSL::Program::enumerationDefinitions): (WebCore::WHLSL::Program::functionDefinitions const): (WebCore::WHLSL::Program::functionDefinitions): (WebCore::WHLSL::Program::nativeFunctionDeclarations const): (WebCore::WHLSL::Program::nativeFunctionDeclarations): (WebCore::WHLSL::Program::nativeTypeDeclarations): Canonical link: https://commits.webkit.org/207830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 22:17:58 +00:00
[WebGPU] Add ENABLE(WHLSL_COMPILER) guard https://bugs.webkit.org/show_bug.cgi?id=216713 Reviewed by Myles C. Maxfield. Source/WebCore: Replaces the ENABLE(WEBGPU) guards in the Modules/webgpu/WHLSL with ENABLE(WHLSL_COMPILER) since not all ports need a WHLSL compiler to support WebGPU. * Modules/webgpu/WHLSL/AST/WHLSLAST.h: * Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h: * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h: * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h: * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLBlock.h: * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: * Modules/webgpu/WHLSL/AST/WHLSLDefaultDelete.h: * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h: * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h: * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: * Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h: * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLNameSpace.h: * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h: * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h: * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: * Modules/webgpu/WHLSL/AST/WHLSLReplaceWith.h: * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: * Modules/webgpu/WHLSL/AST/WHLSLStatement.cpp: * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLStatementList.h: * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLType.h: * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: * Modules/webgpu/WHLSL/AST/WHLSLUnnamedTypeHash.h: * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h: * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLMangledNames.h: * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.h: * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h: * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp: * Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h: * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: * Modules/webgpu/WHLSL/WHLSLASTDumper.h: * Modules/webgpu/WHLSL/WHLSLBuildStandardLibraryFunctionMap.py: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.h: * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.cpp: * Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.h: * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp: * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.h: * Modules/webgpu/WHLSL/WHLSLChecker.cpp: * Modules/webgpu/WHLSL/WHLSLChecker.h: * Modules/webgpu/WHLSL/WHLSLCodeLocation.h: * Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp: * Modules/webgpu/WHLSL/WHLSLComputeDimensions.h: * Modules/webgpu/WHLSL/WHLSLError.h: * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.h: * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp: * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h: * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.h: * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: * Modules/webgpu/WHLSL/WHLSLInferTypes.h: * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp: * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: * Modules/webgpu/WHLSL/WHLSLLexer.cpp: * Modules/webgpu/WHLSL/WHLSLLexer.h: * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.h: * Modules/webgpu/WHLSL/WHLSLNameContext.cpp: * Modules/webgpu/WHLSL/WHLSLNameContext.h: * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: * Modules/webgpu/WHLSL/WHLSLNameResolver.h: * Modules/webgpu/WHLSL/WHLSLParser.cpp: * Modules/webgpu/WHLSL/WHLSLParser.h: * Modules/webgpu/WHLSL/WHLSLParsingMode.h: * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h: * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: * Modules/webgpu/WHLSL/WHLSLPrepare.h: * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp: * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.h: * Modules/webgpu/WHLSL/WHLSLProgram.cpp: * Modules/webgpu/WHLSL/WHLSLProgram.h: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: * Modules/webgpu/WHLSL/WHLSLPropertyResolver.h: * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.h: * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp: * Modules/webgpu/WHLSL/WHLSLRecursionChecker.h: * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp: * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.h: * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp: * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.h: * Modules/webgpu/WHLSL/WHLSLResolvingType.h: * Modules/webgpu/WHLSL/WHLSLScopedSetAdder.h: * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp: * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.h: * Modules/webgpu/WHLSL/WHLSLStandardLibraryFunctionMap.h: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h: * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp: * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.h: * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.h: * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.h: * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: * Modules/webgpu/WHLSL/WHLSLVisitor.h: Source/WTF: Adds a default for ENABLE_WHLSL_COMPILER on Cocoa platforms. * wtf/PlatformEnable.h: * wtf/PlatformEnableCocoa.h: Canonical link: https://commits.webkit.org/229524@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267288 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-18 22:54:26 +00:00
#endif // ENABLE(WHLSL_COMPILER)