Hiding kernel source or Offline compilation in Direct Compute
For example:
My goal is to hide the kernel source code in .hlsl file from others and build the kernel source into final binary in Direct Compute.
I looked at sample in below link: https://github.com/walbourn/directx-sdk-samples/tree/main/BasicCompute11
This sample only explains online compilation technique.
d3d works in a reasonably similar way compared to OpenCL.
D3DCompile/D3DCompileFromFile generates program binaries that can be stored (This bytecode works in a generic way across all platforms).
Note that D3DCompile uses FXC, if you on dx12 the newer compiler (DXC) does pretty much the same thing.
So you can store that bytecode and use device->CreateComputeShader, using that binary.
If you look at the sample, you need to split the CreateComputeShader from the compile part to the upload part.