Changeset 236992 in webkit
- Timestamp:
- Oct 9, 2018, 5:23:56 PM (8 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 7 edited
-
ChangeLog (modified) (1 diff)
-
WebGPUShadingLanguageRI/Checker.js (modified) (2 diffs)
-
WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Compiler.m (modified) (1 diff)
-
WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Default.whlsl (modified) (1 diff)
-
WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Julia.whlsl (modified) (1 diff)
-
WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Mandelbrot.whlsl (modified) (1 diff)
-
WebGPUShadingLanguageRI/Metal/WHLSL Tests/WHLSL Tests.xcodeproj/project.pbxproj (modified) (17 diffs)
-
WebGPUShadingLanguageRI/Metal/WhlslToMsl.html (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r236990 r236992 1 2018-10-09 Dean Jackson <dino@apple.com> 2 3 Update WHLSL to Metal tester with semantics 4 https://bugs.webkit.org/show_bug.cgi?id=190416 5 <rdar://problem/45145139> 6 7 Reviewed by Myles Maxfield. 8 9 A few small changes to the WHLSL to Metal tools: 10 - Make it compile by adding some missing JS files :) 11 - Add semantics to the default shader 12 - Add FIXMEs to the other shaders 13 - Create an in-browser test for the WHLSLToMetal codepath 14 - Fix typos in the semantics checker 15 16 * WebGPUShadingLanguageRI/Checker.js: 17 (Checker.prototype._checkSemantics.checkSemanticTypes): 18 (Checker.prototype._checkSemantics.checkSemanticForShaderType): 19 * WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Compiler.m: 20 * WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Default.whlsl: 21 * WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Julia.whlsl: 22 * WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Mandelbrot.whlsl: 23 * WebGPUShadingLanguageRI/Metal/WHLSL Tests/WHLSL Tests.xcodeproj/project.pbxproj: 24 * WebGPUShadingLanguageRI/Metal/WhlslToMsl.html: Added. 25 1 26 2018-10-09 Jer Noble <jer.noble@apple.com> 2 27 -
trunk/Tools/WebGPUShadingLanguageRI/Checker.js
r236635 r236992 178 178 for (let item of items) { 179 179 if (item.semantic && !item.semantic.isAcceptableType(item.type, program)) 180 throw new WTypeError(node.origin.originString, `Semantic ${item.semantic} is un nacceptable type ${item.type}`);180 throw new WTypeError(node.origin.originString, `Semantic ${item.semantic} is unacceptable type ${item.type}`); 181 181 } 182 182 } … … 187 187 for (let item of items) { 188 188 if (item.semantic && !item.semantic.isAcceptableForShaderType(direction, node.shaderType)) 189 throw new WTypeError(node.origin.originString, `Semantic ${item.semantic} is un nacceptable as an ${direction} of shader type ${node.shaderType}`);189 throw new WTypeError(node.origin.originString, `Semantic ${item.semantic} is unacceptable as an ${direction} of shader type ${node.shaderType}`); 190 190 } 191 191 } -
trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Compiler.m
r236472 r236992 76 76 JSValue *compileFunction = [self.context objectForKeyedSubscript:@"whlslToMsl"]; 77 77 if (compileFunction) { 78 JSValue * result = [compileFunction callWithArguments:@[whlslSource]];78 JSValue *result = [compileFunction callWithArguments:@[whlslSource]]; 79 79 if (result) { 80 80 if ([result hasProperty:@"_error"] && [result hasProperty:@"_metalShaderLanguageSource"] && [result hasProperty:@"_originalFunctionNameToMangledNames"]) { -
trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Default.whlsl
r236472 r236992 1 1 struct VertexInput { 2 float2 position ;3 float2 uv ;2 float2 position : attribute(0); 3 float2 uv : attribute(1); 4 4 } 5 5 6 6 struct VertexOutput { 7 float4 wsl_Position; 8 float4 color; 7 float4 position : SV_Position; 8 float4 color : attribute(0); 9 } 10 11 struct FragmentInput { 12 float4 color : attribute(0); 9 13 } 10 14 11 15 struct FragmentOutput { 12 float4 wsl_Color;16 float4 color : SV_Target0; 13 17 } 14 18 15 19 vertex VertexOutput vertexShader(VertexInput vertexInput) { 16 20 VertexOutput result; 17 result. wsl_Position = float4(vertexInput.position, 0., 1.);21 result.position = float4(vertexInput.position, 0., 1.); 18 22 result.color = float4(vertexInput.uv, 0.0, 1.0); 19 23 return result; 20 24 } 21 25 22 fragment FragmentOutput fragmentShader( VertexOutput stageIn) {26 fragment FragmentOutput fragmentShader(FragmentInput fragmentInput) { 23 27 FragmentOutput result; 24 result. wsl_Color = stageIn.color;28 result.color = fragmentInput.color; 25 29 return result; 26 30 } -
trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Julia.whlsl
r236472 r236992 1 // FIXME: This won't compile. Needs semantics. 2 1 3 struct VertexInput { 2 4 float2 position; -
trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Mandelbrot.whlsl
r236472 r236992 1 // FIXME: This won't compile. Needs semantics. 2 1 3 struct VertexInput { 2 4 float2 position; -
trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/WHLSL Tests.xcodeproj/project.pbxproj
r236628 r236992 8 8 9 9 /* Begin PBXBuildFile section */ 10 31F11709216BFE92009A36D5 /* FuncAttribute.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F116C4216BFE90009A36D5 /* FuncAttribute.js */; }; 11 31F1170A216BFE92009A36D5 /* BuiltInSemantic.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F116C5216BFE90009A36D5 /* BuiltInSemantic.js */; }; 12 31F11732216BFE93009A36D5 /* ResourceSemantic.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F11704216BFE90009A36D5 /* ResourceSemantic.js */; }; 13 31F11733216BFE93009A36D5 /* FuncNumThreadsAttribute.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F11705216BFE91009A36D5 /* FuncNumThreadsAttribute.js */; }; 14 31F11734216BFE93009A36D5 /* Semantic.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F11706216BFE91009A36D5 /* Semantic.js */; }; 15 31F11735216BFE93009A36D5 /* CheckNativeFuncStages.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F11707216BFE92009A36D5 /* CheckNativeFuncStages.js */; }; 16 31F11736216BFE93009A36D5 /* SpecializationConstantSemantic.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F11708216BFE92009A36D5 /* SpecializationConstantSemantic.js */; }; 17 31F11776216BFEEC009A36D5 /* StageInOutSemantic.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F11737216BFEEB009A36D5 /* StageInOutSemantic.js */; }; 18 31F1179F216BFF07009A36D5 /* MSLInsertTrapParameter.js in Resources */ = {isa = PBXBuildFile; fileRef = 31F1179E216BFF07009A36D5 /* MSLInsertTrapParameter.js */; }; 10 19 E906B04621139B7700AD1C5E /* Julia.whlsl in Resources */ = {isa = PBXBuildFile; fileRef = E906B04521139B7700AD1C5E /* Julia.whlsl */; }; 11 20 E921D6362138C02600775099 /* OperatorAnderIndexer.js in Resources */ = {isa = PBXBuildFile; fileRef = E921D6322138C02600775099 /* OperatorAnderIndexer.js */; }; … … 211 220 212 221 /* Begin PBXFileReference section */ 222 31F116C4216BFE90009A36D5 /* FuncAttribute.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = FuncAttribute.js; path = ../../../FuncAttribute.js; sourceTree = "<group>"; }; 223 31F116C5216BFE90009A36D5 /* BuiltInSemantic.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = BuiltInSemantic.js; path = ../../../BuiltInSemantic.js; sourceTree = "<group>"; }; 224 31F11704216BFE90009A36D5 /* ResourceSemantic.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = ResourceSemantic.js; path = ../../../ResourceSemantic.js; sourceTree = "<group>"; }; 225 31F11705216BFE91009A36D5 /* FuncNumThreadsAttribute.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = FuncNumThreadsAttribute.js; path = ../../../FuncNumThreadsAttribute.js; sourceTree = "<group>"; }; 226 31F11706216BFE91009A36D5 /* Semantic.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = Semantic.js; path = ../../../Semantic.js; sourceTree = "<group>"; }; 227 31F11707216BFE92009A36D5 /* CheckNativeFuncStages.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = CheckNativeFuncStages.js; path = ../../../CheckNativeFuncStages.js; sourceTree = "<group>"; }; 228 31F11708216BFE92009A36D5 /* SpecializationConstantSemantic.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = SpecializationConstantSemantic.js; path = ../../../SpecializationConstantSemantic.js; sourceTree = "<group>"; }; 229 31F11737216BFEEB009A36D5 /* StageInOutSemantic.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = StageInOutSemantic.js; path = ../../../StageInOutSemantic.js; sourceTree = "<group>"; }; 230 31F1179E216BFF07009A36D5 /* MSLInsertTrapParameter.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = MSLInsertTrapParameter.js; path = ../../MSLInsertTrapParameter.js; sourceTree = "<group>"; }; 213 231 E906B04521139B7700AD1C5E /* Julia.whlsl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Julia.whlsl; sourceTree = "<group>"; }; 214 232 E921D6322138C02600775099 /* OperatorAnderIndexer.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = OperatorAnderIndexer.js; path = ../../../OperatorAnderIndexer.js; sourceTree = "<group>"; }; … … 569 587 E921D6342138C02600775099 /* BuiltinMatrixGetter.js */, 570 588 E921D6352138C02600775099 /* BuiltinMatrixSetter.js */, 589 31F116C5216BFE90009A36D5 /* BuiltInSemantic.js */, 571 590 E941ACB92134A5BB00392BA9 /* BuiltinVectorGetter.js */, 572 591 E941ACBC2134A5BB00392BA9 /* BuiltinVectorSetter.js */, … … 578 597 E95569B620F56CD600F5CF34 /* CheckLiteralTypes.js */, 579 598 E95569B320F56CD600F5CF34 /* CheckLoops.js */, 599 31F11707216BFE92009A36D5 /* CheckNativeFuncStages.js */, 580 600 E94C06FA20F56CA300672992 /* CheckRecursion.js */, 581 601 E95569BB20F56CD600F5CF34 /* CheckRecursiveTypes.js */, … … 614 634 E9FCEB5A20F56D93009B3629 /* ForLoop.js */, 615 635 E9FCEB5520F56D92009B3629 /* Func.js */, 636 31F116C4216BFE90009A36D5 /* FuncAttribute.js */, 616 637 E95569E820F56D0500F5CF34 /* FuncDef.js */, 638 31F11705216BFE91009A36D5 /* FuncNumThreadsAttribute.js */, 617 639 E95569E920F56D0500F5CF34 /* FuncParameter.js */, 618 640 E95569E620F56D0500F5CF34 /* FunctionLikeBlock.js */, … … 644 666 E92789AB213F3364001EA73E /* MSLFunctionDefinition.js */, 645 667 E973E5C7213F3385005D79FC /* MSLFunctionForwardDeclaration.js */, 668 31F1179E216BFF07009A36D5 /* MSLInsertTrapParameter.js */, 646 669 E97ED7E1214B822900AD1140 /* MSLNameMangler.js */, 647 670 E97ED7E4214B822900AD1140 /* MSLNativeFunctionCall.js */, … … 678 701 E92D103620F56E4F00D776B2 /* ResolveProperties.js */, 679 702 E92D103720F56E4F00D776B2 /* ResolveTypeDefs.js */, 703 31F11704216BFE90009A36D5 /* ResourceSemantic.js */, 680 704 E92D103E20F56E6100D776B2 /* Return.js */, 681 705 E92D104020F56E6200D776B2 /* ReturnChecker.js */, … … 683 707 E92D104120F56E6200D776B2 /* Rewriter.js */, 684 708 E9D7CB9D214B82B800F1C918 /* Sampler.js */, 709 31F11706216BFE91009A36D5 /* Semantic.js */, 710 31F11708216BFE92009A36D5 /* SpecializationConstantSemantic.js */, 711 31F11737216BFEEB009A36D5 /* StageInOutSemantic.js */, 685 712 E92D103F20F56E6200D776B2 /* StandardLibrary.js */, 686 713 E92D104820F56E7300D776B2 /* StatementCloner.js */, … … 734 761 buildConfigurationList = E94C06EA20F56A4200672992 /* Build configuration list for PBXNativeTarget "WHLSL Tests" */; 735 762 buildPhases = ( 736 E925653C21234AA1001A89D9 /* ShellScript */,737 763 E94C06BC20F56A4000672992 /* Sources */, 738 764 E94C06BD20F56A4000672992 /* Frameworks */, … … 786 812 buildConfigurationList = E94C06BB20F56A4000672992 /* Build configuration list for PBXProject "WHLSL Tests" */; 787 813 compatibilityVersion = "Xcode 9.3"; 788 developmentRegion = en;814 developmentRegion = English; 789 815 hasScannedForEncodings = 0; 790 816 knownRegions = ( … … 823 849 E921D6382138C02600775099 /* BuiltinMatrixGetter.js in Resources */, 824 850 E921D6392138C02600775099 /* BuiltinMatrixSetter.js in Resources */, 851 31F1170A216BFE92009A36D5 /* BuiltInSemantic.js in Resources */, 825 852 E941ACCA2134A5BC00392BA9 /* BuiltinVectorGetter.js in Resources */, 826 853 E941ACCD2134A5BC00392BA9 /* BuiltinVectorSetter.js in Resources */, … … 832 859 E92D112420F7060E00D776B2 /* CheckLiteralTypes.js in Resources */, 833 860 E92D112520F7060E00D776B2 /* CheckLoops.js in Resources */, 861 31F11735216BFE93009A36D5 /* CheckNativeFuncStages.js in Resources */, 834 862 E92D112620F7060E00D776B2 /* CheckRecursion.js in Resources */, 835 863 E92D112720F7060E00D776B2 /* CheckRecursiveTypes.js in Resources */, … … 869 897 E92D114C20F7060E00D776B2 /* ForLoop.js in Resources */, 870 898 E92D114D20F7060E00D776B2 /* Func.js in Resources */, 899 31F11709216BFE92009A36D5 /* FuncAttribute.js in Resources */, 871 900 E92D114E20F7060E00D776B2 /* FuncDef.js in Resources */, 901 31F11733216BFE93009A36D5 /* FuncNumThreadsAttribute.js in Resources */, 872 902 E92D115020F7060E00D776B2 /* FuncParameter.js in Resources */, 873 903 E92D115120F7060E00D776B2 /* FunctionLikeBlock.js in Resources */, … … 902 932 E973E5DF213F341D005D79FC /* MSLFunctionDefinition.js in Resources */, 903 933 E973E5CE213F3385005D79FC /* MSLFunctionForwardDeclaration.js in Resources */, 934 31F1179F216BFF07009A36D5 /* MSLInsertTrapParameter.js in Resources */, 904 935 E9D7CBA8214B9E5F00F1C918 /* MSLNameMangler.js in Resources */, 905 936 E9D7CBA9214B9E5F00F1C918 /* MSLNativeFunctionCall.js in Resources */, … … 936 967 E92D118420F7060E00D776B2 /* ResolveProperties.js in Resources */, 937 968 E92D118520F7060E00D776B2 /* ResolveTypeDefs.js in Resources */, 969 31F11732216BFE93009A36D5 /* ResourceSemantic.js in Resources */, 938 970 E92D118620F7060E00D776B2 /* Return.js in Resources */, 939 971 E92D118720F7060E00D776B2 /* ReturnChecker.js in Resources */, … … 941 973 E92D118920F7060E00D776B2 /* Rewriter.js in Resources */, 942 974 E9D7CBA3214B82B800F1C918 /* Sampler.js in Resources */, 975 31F11734216BFE93009A36D5 /* Semantic.js in Resources */, 976 31F11736216BFE93009A36D5 /* SpecializationConstantSemantic.js in Resources */, 977 31F11776216BFEEC009A36D5 /* StageInOutSemantic.js in Resources */, 943 978 E92D118A20F7060E00D776B2 /* StandardLibrary.js in Resources */, 944 979 E92D118B20F7060E00D776B2 /* StatementCloner.js in Resources */, … … 992 1027 }; 993 1028 /* End PBXResourcesBuildPhase section */ 994 995 /* Begin PBXShellScriptBuildPhase section */996 E925653C21234AA1001A89D9 /* ShellScript */ = {997 isa = PBXShellScriptBuildPhase;998 buildActionMask = 2147483647;999 files = (1000 );1001 inputFileListPaths = (1002 );1003 inputPaths = (1004 );1005 outputFileListPaths = (1006 );1007 outputPaths = (1008 );1009 runOnlyForDeploymentPostprocessing = 0;1010 shellPath = /bin/sh;1011 shellScript = "# Type a script or drag a script file from your workspace to insert its path.\ncd \"$SRCROOT/..\"\ntsc\n";1012 };1013 /* End PBXShellScriptBuildPhase section */1014 1029 1015 1030 /* Begin PBXSourcesBuildPhase section */
Note:
See TracChangeset
for help on using the changeset viewer.