Repository navigation
Update DirectX-Headers to latest - #8431
Antonio Maiorano (amaiorano) wants to merge 3 commits into
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). |
Damyan Pepper (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?
Tex Riddell (@tex3d), Jesse Natalie (@jenatali), do you have any thoughts here?
|
|
||
| #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 |
Yes, I agree, and it's why I raised this concern above.
I think this is a good idea, and would cause the least friction - at least in the short term. If I understand correctly, you're saying that users of the DXC API would have to update their include path no matter what: either to
This would be a breaking change, no matter what, for all users of the DXC API; however, we provide an easy way out for non- If this is what you mean, and others agree with this, I could modify my PR to do this (add the copying of files needed to the CMake install target, add a comment at the top of WinAdapter.h explaining this, and updating the commit message as well). |
|
I was discussing this issue with Rafael, and it occured to me that another potential solution here would be to copy the DirectX-Headers includes directly into the DXC repo, and drop the submodule dependency altogether. Given that DXC has been pinned to is ~4.5 years old, and difficult to update (see above), I think copying the required files directly into the DXC repo is the simplest solution. This allows projects to both build DXC and depend on a more recent DirectX-Headers, as described in the original issue. This is also something we would like for Dawn/Chromium. What do you think? |
|
I'm not keen on checking in copies of files - I think we have some checked in already, and we should be working to reduce the number rather than increase them. We're also prioritizing #8994 which should ensure we keep submodules like DirectX-Headers up to date going forward. |
|
I maintain portacom, a Python COM binding that loads |
|
Damyan Pepper (@damyanp) and Chris B (@llvm-beanz), to support Dawn partners, Git dependencies are preferred over Nuget ones. Antonio's PR has DXC changes needed before we can do autorolls. Can we please merge it while we wait for #8994 to land? |
This comment was marked as off-topic.
This comment was marked as off-topic.
| static_cast<uint32_t>(byte_from_hexstr(&(str)[2])) << 16 | \ | ||
| static_cast<uint32_t>(byte_from_hexstr(&(str)[4])) << 8 | \ | ||
| byte_from_hexstr(&(str)[6]), \ |
There was a problem hiding this comment.
This seems to skip the first character of the string. Compare to the original version that does str, str+2, str+4 and str+6 - this version only does str.
There was a problem hiding this comment.
Yes, good catch. Turns out that CI didn't catch this because dxc and tests use the same macro, so the IIDs still match each other.
|
I started digging into this all a bit more and ended up with another attempt for it - #9149. I'll close this PR in preference to that one and we can see if we can use that to get a version ready that works for everyone. |
Hmm, I would have been happy to work with you on making this PR land, especially as I spent quite some time on it (before AI), and because the new PR looks quite similar to mine, including making it a breaking change for non-Windows (DXC's public headers now depend on DirectX-Headers), and doing what Tex suggested and I agreed to in shipping the DirectX-Headers files for DXC. |

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