Open hekota opened 1 month ago
The difference between Clang and DXC in Case 3 should be documented in clang/docs/HLSL/ExpectedDifferences.rst
.
Entry point functions & ``static`` keyword
------------------------------------------
Marking a shader entry point function ``static`` will result in an error.
In DXC using ``static`` on an entry point function will cause the function
to have internal linkage and it will not be included in the final DXIL.
For shaders that specify the entry function name on the command line
(such as ``-E main``) the compilation will produce an error:
``error: cannot find entry function main``
For shader libraries with entry points marked with ``[shader("stage")]``
attribute the functions will simply not be included in the final DXIL
and no error or warning is reported.
Clang will always report an error if a shader entry point function is marked
static.
Clang should report an error if a shader entry point function is not found in the input or of it is marked
static
.Case 1: Entry point function is not included in the input: https://godbolt.org/z/Yocb78xTe
error: missing entry point definition
Case 2: Entry point in shader is marked static: https://godbolt.org/z/e9Wxb74Mq
error: cannot find entry function csmain
numthreads
attributeCase 3: Entry point in shader library is marked static: https://godbolt.org/z/sc1jnjvPT
numthreads
andshader
attributes