Update DirectX-Headers to latest#8431
Conversation
The version being used was from four years ago. Updating to upstream's main broke a lot of code because DirectX-Headers now has the equivalent of WinAdapter.h under `include/wsl` for non-Windows machines, and these collided with DXC's own definitions. I fixed this by including the relevant DirectX-Headers in WinAdapter.h, removed duplicate macros, and adapted some of the existing ones. Fixes microsoft#5079
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
I did a bit more digging to understand the root of what changed in In old DirectX-Headers:
In latest DirectX-Headers:
A concrete example of a build error we get when updating DirectX-Headers: Building If we comment out the include of d3d12shader.h in D3DReflection.h, then we get compile errors because of unknown enums: I thought of maybe "disabling" the ultimate inclusion of "basetsd.h" by defining the header guard, but unfortunately this file doesn't use a classic header guard, but uses #pragma once. When I delete the contents of the file locally just to test, I am able to compile D3DReflectionStrings.cpp. In fact, if I delete the contents of "basetsd.h", and "rpcndr.h", but make sure to So I'm not really seeing a way out of this that's much different from the change I've put up here. As I wrote in my previous comment, users of DXC on Linux/Mac would need |
Add root of DirectX-Headers/include to CMake include_directories, and only include 'wsl/winadapter.h' at the top of DXC's WinAdapter.h. This should make it easier for users of an installed DXC to add DirectX-Headers as a dep.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
damyanp
left a comment
There was a problem hiding this comment.
I've left a few questions. I think that the main thing we need to figure out is how do we convince ourselves that this change doesn't break anything? Is it enough that the build pipelines pass? Do we need to do some manual live testing on non-Windows systems?
|
|
||
| #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) | ||
| #define FAILED(hr) (((HRESULT)(hr)) < 0) | ||
| #define DXC_FAILED(hr) (((HRESULT)(hr)) < 0) |
There was a problem hiding this comment.
Does DXC_FAILED still need to exist?
There was a problem hiding this comment.
It's used in a few places. It could be removed and replaced with FAILED, but that should be done in a follow-up change, I think.
|
|
||
| #define E_ABORT (HRESULT)0x80004004 | ||
| #define E_ACCESSDENIED (HRESULT)0x80070005 | ||
| #define E_BOUNDS (HRESULT)0x8000000B |
There was a problem hiding this comment.
Presumably the defines removed here conflicted with ones in DirectX headers? Are the remaining ones still required?
There was a problem hiding this comment.
Yes and yes. Both E_BOUNDS and E_NOT_VALID_STATE are used in the DXC codebase, but are not defined in wsl/stubs/basetsd.h (DirectX-Includes).
|
This looks right to me. The
I don't have a great answer here but at least for now this seems okay? |
I suspect it may break projects that depend on an installed DXC on non-Windows as they would now need to also depend on DirectX-Headers (and add it to their include path). I think projects that use CMake I can at least make sure this new dep on DirectX-Headers is clearly stated in the commit comment, which may help downstream users of DXC. |
|
So by "use dxc" here, I think we mean people who are compiling and linking against the DXC libraries? This doesn't impact anyone who just installs a binary release of dxc, right?
Would also break people including it as a submodule?
Will this mean that the vcpkg maintainers will need to react to this change as well? |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Yes.
I think by this you mean using
Good question. What I'm going to do is test different scenarios on Linux:
As a side note, I tried building with gcc and got a bunch of warnings similar to those I got with Clang, so I'll add some pragmas to ignore them like I did for Clang. |
|
In the past, we have intended to include all the (non-std) headers required to use the API in our GitHub release package. With this change, as mentioned, you must separately get and include at least Dependencies on DirectX-Headers were originally meant only for the DXC execution tests. DirectX headers weren't meant to be required by users of the DXC API, and developers who acquire the API through the GitHub release package might not be happy with a new project dependency just for a new 12k header that supplies a few definitions that used to be independently declared. Maybe we could add this header to our GitHub release package to avoid any additional project dependencies when using the DXC API from that package. We could put it under another folder matching DirectX-Headers sub-path structure so it can easily be used as an include path instead of the full DirectX_headers, when minimal dependencies are desired. Otherwise, it seems excessive to add the whole DirectX-Headers project dependency just to include a 12k header. Alternatively, we could move all our DXC API headers to the |

The version being used was from four years ago. Updating to upstream's main broke a lot of code because DirectX-Headers now has the equivalent of WinAdapter.h under
include/wslfor non-Windows machines, and these collided with DXC's own definitions. I fixed this by including the relevant DirectX-Headers in WinAdapter.h, removed duplicate macros, and adapted some of the existing ones.Fixes #5079