⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 236992 in webkit


Ignore:
Timestamp:
Oct 9, 2018, 5:23:56 PM (8 years ago)
Author:
dino@apple.com
Message:

Update WHLSL to Metal tester with semantics
https://bugs.webkit.org/show_bug.cgi?id=190416
<rdar://problem/45145139>

Reviewed by Myles Maxfield.

A few small changes to the WHLSL to Metal tools:

  • Make it compile by adding some missing JS files :)
  • Add semantics to the default shader
  • Add FIXMEs to the other shaders
  • Create an in-browser test for the WHLSLToMetal codepath
  • Fix typos in the semantics checker
  • WebGPUShadingLanguageRI/Checker.js:

(Checker.prototype._checkSemantics.checkSemanticTypes):
(Checker.prototype._checkSemantics.checkSemanticForShaderType):

  • WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Compiler.m:
  • WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Default.whlsl:
  • WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Julia.whlsl:
  • WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Mandelbrot.whlsl:
  • WebGPUShadingLanguageRI/Metal/WHLSL Tests/WHLSL Tests.xcodeproj/project.pbxproj:
  • WebGPUShadingLanguageRI/Metal/WhlslToMsl.html: Added.
Location:
trunk/Tools
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r236990 r236992  
     12018-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
    1262018-10-09  Jer Noble  <jer.noble@apple.com>
    227
  • trunk/Tools/WebGPUShadingLanguageRI/Checker.js

    r236635 r236992  
    178178            for (let item of items) {
    179179                if (item.semantic && !item.semantic.isAcceptableType(item.type, program))
    180                     throw new WTypeError(node.origin.originString, `Semantic ${item.semantic} is unnacceptable type ${item.type}`);
     180                    throw new WTypeError(node.origin.originString, `Semantic ${item.semantic} is unacceptable type ${item.type}`);
    181181            }
    182182        }
     
    187187            for (let item of items) {
    188188                if (item.semantic && !item.semantic.isAcceptableForShaderType(direction, node.shaderType))
    189                     throw new WTypeError(node.origin.originString, `Semantic ${item.semantic} is unnacceptable 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}`);
    190190            }
    191191        }
  • trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Compiler.m

    r236472 r236992  
    7676    JSValue *compileFunction = [self.context objectForKeyedSubscript:@"whlslToMsl"];
    7777    if (compileFunction) {
    78         JSValue * result = [compileFunction callWithArguments:@[whlslSource]];
     78        JSValue *result = [compileFunction callWithArguments:@[whlslSource]];
    7979        if (result) {
    8080            if ([result hasProperty:@"_error"] && [result hasProperty:@"_metalShaderLanguageSource"] && [result hasProperty:@"_originalFunctionNameToMangledNames"]) {
  • trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Default.whlsl

    r236472 r236992  
    11struct VertexInput {
    2     float2 position;
    3     float2 uv;
     2    float2 position : attribute(0);
     3    float2 uv : attribute(1);
    44}
    55
    66struct VertexOutput {
    7     float4 wsl_Position;
    8     float4 color;
     7    float4 position : SV_Position;
     8    float4 color : attribute(0);
     9}
     10
     11struct FragmentInput {
     12    float4 color : attribute(0);
    913}
    1014
    1115struct FragmentOutput {
    12     float4 wsl_Color;
     16    float4 color : SV_Target0;
    1317}
    1418
    1519vertex VertexOutput vertexShader(VertexInput vertexInput) {
    1620    VertexOutput result;
    17     result.wsl_Position = float4(vertexInput.position, 0., 1.);
     21    result.position = float4(vertexInput.position, 0., 1.);
    1822    result.color = float4(vertexInput.uv, 0.0, 1.0);
    1923    return result;
    2024}
    2125
    22 fragment FragmentOutput fragmentShader(VertexOutput stageIn) {
     26fragment FragmentOutput fragmentShader(FragmentInput fragmentInput) {
    2327    FragmentOutput result;
    24     result.wsl_Color = stageIn.color;
     28    result.color = fragmentInput.color;
    2529    return result;
    2630}
  • trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Julia.whlsl

    r236472 r236992  
     1// FIXME: This won't compile. Needs semantics.
     2
    13struct VertexInput {
    24    float2 position;
  • trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/Core/Demo shaders/Mandelbrot.whlsl

    r236472 r236992  
     1// FIXME: This won't compile. Needs semantics.
     2
    13struct VertexInput {
    24    float2 position;
  • trunk/Tools/WebGPUShadingLanguageRI/Metal/WHLSL Tests/WHLSL Tests.xcodeproj/project.pbxproj

    r236628 r236992  
    88
    99/* 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 */; };
    1019                E906B04621139B7700AD1C5E /* Julia.whlsl in Resources */ = {isa = PBXBuildFile; fileRef = E906B04521139B7700AD1C5E /* Julia.whlsl */; };
    1120                E921D6362138C02600775099 /* OperatorAnderIndexer.js in Resources */ = {isa = PBXBuildFile; fileRef = E921D6322138C02600775099 /* OperatorAnderIndexer.js */; };
     
    211220
    212221/* 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>"; };
    213231                E906B04521139B7700AD1C5E /* Julia.whlsl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Julia.whlsl; sourceTree = "<group>"; };
    214232                E921D6322138C02600775099 /* OperatorAnderIndexer.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = OperatorAnderIndexer.js; path = ../../../OperatorAnderIndexer.js; sourceTree = "<group>"; };
     
    569587                                E921D6342138C02600775099 /* BuiltinMatrixGetter.js */,
    570588                                E921D6352138C02600775099 /* BuiltinMatrixSetter.js */,
     589                                31F116C5216BFE90009A36D5 /* BuiltInSemantic.js */,
    571590                                E941ACB92134A5BB00392BA9 /* BuiltinVectorGetter.js */,
    572591                                E941ACBC2134A5BB00392BA9 /* BuiltinVectorSetter.js */,
     
    578597                                E95569B620F56CD600F5CF34 /* CheckLiteralTypes.js */,
    579598                                E95569B320F56CD600F5CF34 /* CheckLoops.js */,
     599                                31F11707216BFE92009A36D5 /* CheckNativeFuncStages.js */,
    580600                                E94C06FA20F56CA300672992 /* CheckRecursion.js */,
    581601                                E95569BB20F56CD600F5CF34 /* CheckRecursiveTypes.js */,
     
    614634                                E9FCEB5A20F56D93009B3629 /* ForLoop.js */,
    615635                                E9FCEB5520F56D92009B3629 /* Func.js */,
     636                                31F116C4216BFE90009A36D5 /* FuncAttribute.js */,
    616637                                E95569E820F56D0500F5CF34 /* FuncDef.js */,
     638                                31F11705216BFE91009A36D5 /* FuncNumThreadsAttribute.js */,
    617639                                E95569E920F56D0500F5CF34 /* FuncParameter.js */,
    618640                                E95569E620F56D0500F5CF34 /* FunctionLikeBlock.js */,
     
    644666                                E92789AB213F3364001EA73E /* MSLFunctionDefinition.js */,
    645667                                E973E5C7213F3385005D79FC /* MSLFunctionForwardDeclaration.js */,
     668                                31F1179E216BFF07009A36D5 /* MSLInsertTrapParameter.js */,
    646669                                E97ED7E1214B822900AD1140 /* MSLNameMangler.js */,
    647670                                E97ED7E4214B822900AD1140 /* MSLNativeFunctionCall.js */,
     
    678701                                E92D103620F56E4F00D776B2 /* ResolveProperties.js */,
    679702                                E92D103720F56E4F00D776B2 /* ResolveTypeDefs.js */,
     703                                31F11704216BFE90009A36D5 /* ResourceSemantic.js */,
    680704                                E92D103E20F56E6100D776B2 /* Return.js */,
    681705                                E92D104020F56E6200D776B2 /* ReturnChecker.js */,
     
    683707                                E92D104120F56E6200D776B2 /* Rewriter.js */,
    684708                                E9D7CB9D214B82B800F1C918 /* Sampler.js */,
     709                                31F11706216BFE91009A36D5 /* Semantic.js */,
     710                                31F11708216BFE92009A36D5 /* SpecializationConstantSemantic.js */,
     711                                31F11737216BFEEB009A36D5 /* StageInOutSemantic.js */,
    685712                                E92D103F20F56E6200D776B2 /* StandardLibrary.js */,
    686713                                E92D104820F56E7300D776B2 /* StatementCloner.js */,
     
    734761                        buildConfigurationList = E94C06EA20F56A4200672992 /* Build configuration list for PBXNativeTarget "WHLSL Tests" */;
    735762                        buildPhases = (
    736                                 E925653C21234AA1001A89D9 /* ShellScript */,
    737763                                E94C06BC20F56A4000672992 /* Sources */,
    738764                                E94C06BD20F56A4000672992 /* Frameworks */,
     
    786812                        buildConfigurationList = E94C06BB20F56A4000672992 /* Build configuration list for PBXProject "WHLSL Tests" */;
    787813                        compatibilityVersion = "Xcode 9.3";
    788                         developmentRegion = en;
     814                        developmentRegion = English;
    789815                        hasScannedForEncodings = 0;
    790816                        knownRegions = (
     
    823849                                E921D6382138C02600775099 /* BuiltinMatrixGetter.js in Resources */,
    824850                                E921D6392138C02600775099 /* BuiltinMatrixSetter.js in Resources */,
     851                                31F1170A216BFE92009A36D5 /* BuiltInSemantic.js in Resources */,
    825852                                E941ACCA2134A5BC00392BA9 /* BuiltinVectorGetter.js in Resources */,
    826853                                E941ACCD2134A5BC00392BA9 /* BuiltinVectorSetter.js in Resources */,
     
    832859                                E92D112420F7060E00D776B2 /* CheckLiteralTypes.js in Resources */,
    833860                                E92D112520F7060E00D776B2 /* CheckLoops.js in Resources */,
     861                                31F11735216BFE93009A36D5 /* CheckNativeFuncStages.js in Resources */,
    834862                                E92D112620F7060E00D776B2 /* CheckRecursion.js in Resources */,
    835863                                E92D112720F7060E00D776B2 /* CheckRecursiveTypes.js in Resources */,
     
    869897                                E92D114C20F7060E00D776B2 /* ForLoop.js in Resources */,
    870898                                E92D114D20F7060E00D776B2 /* Func.js in Resources */,
     899                                31F11709216BFE92009A36D5 /* FuncAttribute.js in Resources */,
    871900                                E92D114E20F7060E00D776B2 /* FuncDef.js in Resources */,
     901                                31F11733216BFE93009A36D5 /* FuncNumThreadsAttribute.js in Resources */,
    872902                                E92D115020F7060E00D776B2 /* FuncParameter.js in Resources */,
    873903                                E92D115120F7060E00D776B2 /* FunctionLikeBlock.js in Resources */,
     
    902932                                E973E5DF213F341D005D79FC /* MSLFunctionDefinition.js in Resources */,
    903933                                E973E5CE213F3385005D79FC /* MSLFunctionForwardDeclaration.js in Resources */,
     934                                31F1179F216BFF07009A36D5 /* MSLInsertTrapParameter.js in Resources */,
    904935                                E9D7CBA8214B9E5F00F1C918 /* MSLNameMangler.js in Resources */,
    905936                                E9D7CBA9214B9E5F00F1C918 /* MSLNativeFunctionCall.js in Resources */,
     
    936967                                E92D118420F7060E00D776B2 /* ResolveProperties.js in Resources */,
    937968                                E92D118520F7060E00D776B2 /* ResolveTypeDefs.js in Resources */,
     969                                31F11732216BFE93009A36D5 /* ResourceSemantic.js in Resources */,
    938970                                E92D118620F7060E00D776B2 /* Return.js in Resources */,
    939971                                E92D118720F7060E00D776B2 /* ReturnChecker.js in Resources */,
     
    941973                                E92D118920F7060E00D776B2 /* Rewriter.js in Resources */,
    942974                                E9D7CBA3214B82B800F1C918 /* Sampler.js in Resources */,
     975                                31F11734216BFE93009A36D5 /* Semantic.js in Resources */,
     976                                31F11736216BFE93009A36D5 /* SpecializationConstantSemantic.js in Resources */,
     977                                31F11776216BFEEC009A36D5 /* StageInOutSemantic.js in Resources */,
    943978                                E92D118A20F7060E00D776B2 /* StandardLibrary.js in Resources */,
    944979                                E92D118B20F7060E00D776B2 /* StatementCloner.js in Resources */,
     
    9921027                };
    9931028/* 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 */
    10141029
    10151030/* Begin PBXSourcesBuildPhase section */
Note: See TracChangeset for help on using the changeset viewer.