[WHLSL] Not all functions should be able to run in all shader stages
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2018 06:36:04 +0000 (06:36 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2018 06:36:04 +0000 (06:36 +0000)
commit9600829b73d7c0d4189d6fde3d6d1c9400527897
tree1ac8b3cc4f1af9eb2052eca2efeabbeb59e52f3a
parenta239b33d55d6ff4f55a337e465563642e469c939
[WHLSL] Not all functions should be able to run in all shader stages
https://bugs.webkit.org/show_bug.cgi?id=189121

Reviewed by Filip Pizlo.

ddx() and ddy() can only run in fragment shaders, and the barrier functions can only run in compute shaders.
ddx_coarse() & friends are currently implemented as just calling ddx(), so we only need to modify those functions
if/when we make them native.

The texture sampling functions that use implicit derivatives can run in any shader stage - they just use a LOD of
0. Therefore, those functions are unchanged.

* WebGPUShadingLanguageRI/All.js:
* WebGPUShadingLanguageRI/Intrinsics.js:
* WebGPUShadingLanguageRI/LateChecker.js:
(LateChecker.prototype._checkShaderType):
* WebGPUShadingLanguageRI/NativeFunc.js:
(NativeFunc):
(NativeFunc.prototype.get stage):
(NativeFunc.prototype.toDeclString):
* WebGPUShadingLanguageRI/Parse.js:
(parseFuncDecl):
(parseNativeFunc):
(parseNative):
* WebGPUShadingLanguageRI/Prepare.js:
(let.prepare):
* WebGPUShadingLanguageRI/SPIRV.html:
* WebGPUShadingLanguageRI/StandardLibrary.js:
(let.standardLibrary):
* WebGPUShadingLanguageRI/StatementCloner.js:
(StatementCloner.prototype.visitNativeFunc):
* WebGPUShadingLanguageRI/Test.html:
* WebGPUShadingLanguageRI/Test.js:
(tests.shaderStages):
* WebGPUShadingLanguageRI/WSyntaxError.js:
(WSyntaxError.prototype.toString):
(WSyntaxError):
* WebGPUShadingLanguageRI/index.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Tools/ChangeLog
Tools/WebGPUShadingLanguageRI/All.js
Tools/WebGPUShadingLanguageRI/CheckNativeFuncStages.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Intrinsics.js
Tools/WebGPUShadingLanguageRI/LateChecker.js
Tools/WebGPUShadingLanguageRI/NativeFunc.js
Tools/WebGPUShadingLanguageRI/Parse.js
Tools/WebGPUShadingLanguageRI/Prepare.js
Tools/WebGPUShadingLanguageRI/SPIRV.html
Tools/WebGPUShadingLanguageRI/StandardLibrary.js
Tools/WebGPUShadingLanguageRI/StatementCloner.js
Tools/WebGPUShadingLanguageRI/Test.html
Tools/WebGPUShadingLanguageRI/Test.js
Tools/WebGPUShadingLanguageRI/WSyntaxError.js
Tools/WebGPUShadingLanguageRI/index.html