Derivative functions can only run in fragment shaders. There are probably others like this. Same for built-in variables.
Barriers can only be used in compute shaders
When these functions are introduced in the standard library it would be nice if we could add the restriction there, e.g. native fragment float ddx(float) And then enforce that native functions with the fragment annotation can only be called from inside fragment shaders. I’d prefer to have a syntactic restriction like this than something that the interpreter/spec has to worry about.
<rdar://problem/44403005>
The built-in variables are handled in https://bugs.webkit.org/show_bug.cgi?id=189134
Created attachment 350512 [details] Patch
I'm not sure that additions to the grammar are a good idea. If we add new keywords here, it seems we should also be doing it in https://bugs.webkit.org/show_bug.cgi?id=189122, but I don't think a proliferation of these keywords are a good idea. It seems like the compiler could "just know" which functions have which properties.
Created attachment 350533 [details] Patch
Comment on attachment 350533 [details] Patch Rejecting attachment 350533 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 350533, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Logging in as commit-queue@webkit.org... Fetching: https://bugs.webkit.org/attachment.cgi?id=350533&action=edit Fetching: https://bugs.webkit.org/show_bug.cgi?id=189121&ctype=xml&excludefield=attachmentdata Processing 1 patch from 1 bug. Processing patch 350533 from bug 189121. Fetching: https://bugs.webkit.org/attachment.cgi?id=350533 Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Filip Pizlo']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Parsed 15 diffs from patch file(s). patching file Tools/ChangeLog Hunk #1 succeeded at 1 with fuzz 3. patching file Tools/WebGPUShadingLanguageRI/All.js patching file Tools/WebGPUShadingLanguageRI/CheckNativeFuncStages.js patching file Tools/WebGPUShadingLanguageRI/Intrinsics.js Hunk #1 succeeded at 715 (offset 4 lines). Hunk #2 succeeded at 822 (offset 4 lines). patching file Tools/WebGPUShadingLanguageRI/LateChecker.js Hunk #1 succeeded at 72 with fuzz 2 (offset 2 lines). patching file Tools/WebGPUShadingLanguageRI/NativeFunc.js patching file Tools/WebGPUShadingLanguageRI/Parse.js Hunk #1 FAILED at 1171. Hunk #2 succeeded at 1290 (offset 53 lines). Hunk #3 succeeded at 1300 (offset 55 lines). Hunk #4 succeeded at 1320 (offset 55 lines). 1 out of 4 hunks FAILED -- saving rejects to file Tools/WebGPUShadingLanguageRI/Parse.js.rej patching file Tools/WebGPUShadingLanguageRI/Prepare.js patching file Tools/WebGPUShadingLanguageRI/SPIRV.html patching file Tools/WebGPUShadingLanguageRI/StandardLibrary.js Hunk #4 succeeded at 1794 (offset 9 lines). Hunk #5 FAILED at 1905. Hunk #6 FAILED at 1915. 2 out of 6 hunks FAILED -- saving rejects to file Tools/WebGPUShadingLanguageRI/StandardLibrary.js.rej patching file Tools/WebGPUShadingLanguageRI/StatementCloner.js Hunk #1 succeeded at 46 (offset 3 lines). patching file Tools/WebGPUShadingLanguageRI/Test.html patching file Tools/WebGPUShadingLanguageRI/Test.js patching file Tools/WebGPUShadingLanguageRI/WSyntaxError.js patching file Tools/WebGPUShadingLanguageRI/index.html Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Filip Pizlo']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: https://webkit-queues.webkit.org/results/9338063
Committed r236455: <https://trac.webkit.org/changeset/236455>
Committed r236470: <https://trac.webkit.org/changeset/236470>
Migrated to https://github.com/gpuweb/WHLSL/issues/59