Bug 190452

Summary: [WHSL -> MSL] Annotate semantics correctly in generated MSL
Product: WebKit Reporter: Dean Jackson <dino>
Component: New BugsAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch mmaxfield: review+

Description Dean Jackson 2018-10-10 16:54:59 PDT
[WHSL -> MSL] Annotate semantics correctly in generated MSL
Comment 1 Radar WebKit Bug Importer 2018-10-10 16:55:21 PDT
<rdar://problem/45178272>
Comment 2 Dean Jackson 2018-10-10 16:58:12 PDT
Created attachment 352000 [details]
Patch
Comment 3 Myles C. Maxfield 2018-10-10 17:02:34 PDT
Comment on attachment 352000 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=352000&action=review

> Tools/WebGPUShadingLanguageRI/Metal/MSLBackend.js:338
>              if (structTypeAttributes.isVertexAttribute)
> -                annotations.push(`attribute(${index++})`);
> -            if (structTypeAttributes.isVertexOutputOrFragmentInput && fieldName === "wsl_Position")
> +                annotations.push(`attribute(${field._semantic._index})`);
> +            if (structTypeAttributes.isVertexOutputOrFragmentInput && field._semantic._name === "SV_Position")
>                  annotations.push("position");
> -            if (structTypeAttributes.isFragmentOutput && fieldName === "wsl_Color")
> -                annotations.push("color(0)");
> +            if (structTypeAttributes.isFragmentOutput && field._semantic._name == "SV_Target")
> +                annotations.push(`color(${field._semantic._extraArguments[0]})`);

Eventually we're going to need this to get much more complicated, but this is a good start.
Comment 4 Dean Jackson 2018-10-10 18:10:44 PDT
Committed r237022: <https://trac.webkit.org/changeset/237022>