It's tricky because C++ coders expect the errors to be returned synchronously.
But shader and pipeline compilation is asynchronous.
The API is designed that way because the calls to create a shader module, and later to create a pipeline are asynchronous. They occur on the "device timeline" which can be on another thread, in another process or on another machine. If these activities occurred synchronously, returning the error codes at call return time, then your application thread ("content timeline") would run in lockstep with the device timeline, leading to terrible performance.
To catch compilation errors, wrap the batch of calls with push-scope /pop-scope, and then wait on the future returned by the popscope.
That will wait for actions on the device timeline to complete, and return the error status results to your main thread.
It's tricky because C++ coders expect the errors to be returned synchronously.
But shader and pipeline compilation is asynchronous.
The API is designed that way because the calls to create a shader module, and later to create a pipeline are asynchronous. They occur on the "device timeline" which can be on another thread, in another process or on another machine. If these activities occurred synchronously, returning the error codes at call return time, then your application thread ("content timeline") would run in lockstep with the device timeline, leading to terrible performance.
To catch compilation errors, wrap the batch of calls with push-scope /pop-scope, and then wait on the future returned by the popscope.
That will wait for actions on the device timeline to complete, and return the error status results to your main thread.