Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove D3DCOMPILER_DLL constant #1317

Closed
kennykerr opened this issue Oct 17, 2022 · 10 comments
Closed

Remove D3DCOMPILER_DLL constant #1317

kennykerr opened this issue Oct 17, 2022 · 10 comments
Assignees
Labels
namespaces Feedback on namespace names or organization rust Critical for Rust adoption

Comments

@kennykerr
Copy link
Contributor

Just noticed the odd namespace placement of these similar constants. Is that intentional?

image

@mikebattista mikebattista added the namespaces Feedback on namespace names or organization label Oct 17, 2022
@mikebattista
Copy link
Collaborator

@damyanp which namespace should these all live in?

@damyanp
Copy link
Member

damyanp commented Oct 17, 2022

They should all be under the Direct3D.Fxc namespace.

@mikebattista
Copy link
Collaborator

So _A and _W are scraped from the headers while the unqualified version is manually defined and in the wrong namespace. Do we want this manual definition? Does it work correctly today if you pass it into an API that expects the _A version for example?

@damyanp
Copy link
Member

damyanp commented Oct 17, 2022

The values of these defines are only intended to be passed in to LoadLibrary. The UNICODE define picks the unsuffixed version:

// Current name of the DLL shipped in the same SDK as this header.
#define D3DCOMPILER_DLL_W L"d3dcompiler_47.dll"
#define D3DCOMPILER_DLL_A "d3dcompiler_47.dll"

// Current HLSL compiler version.
#define D3D_COMPILER_VERSION 47

#ifdef UNICODE
    #define D3DCOMPILER_DLL D3DCOMPILER_DLL_W 
#else
    #define D3DCOMPILER_DLL D3DCOMPILER_DLL_A
#endif

How have we been dealing with the other A/W suffixes? eg OutputDebugString/OutputDebugStringW/OutputDebugStringA in other places in the metadata? I expect we should follow whatever is done for these.

@mikebattista
Copy link
Collaborator

Windows.Win32.Graphics.Hlsl.Apis.D3DCOMPILER_DLL => Windows.Win32.Graphics.Direct3D.Fxc.Apis.D3DCOMPILER_DLL

@mikebattista
Copy link
Collaborator

Turns out the manual definition was in fact unnecessary and removing it allowed the constant to naturally be scraped and placed in the right namespace. This is how other similar constants are handled.

@kennykerr
Copy link
Contributor Author

The latest version has a new D3DCOMPILER_DLL constant. Just as we have no CreateFile function but instead have the actual CreateFileA and CreateFileW functions, it seems we should only have the D3DCOMPILER_DLL_A and D3DCOMPILER_DLL_W constants and not the redundant and #ifdef UNICODE-specific D3DCOMPILER_DLL.

@kennykerr kennykerr reopened this Nov 2, 2022
@mikebattista
Copy link
Collaborator

The constant existed previously, we just changed the namespace with this bug. We can remove it if it's unnecessary.

@mikebattista mikebattista changed the title D3DCOMPILER_DLL and friends Remove D3DCOMPILER_DLL constant Nov 2, 2022
@mikebattista mikebattista assigned mikebattista and unassigned damyanp Nov 2, 2022
@kennykerr
Copy link
Contributor Author

Yep, just catching up. 😋 I didn't think of the inconsistency of its existing at all until I saw them all in the same namespace.

@kennykerr kennykerr added the rust Critical for Rust adoption label Nov 2, 2022
@mikebattista
Copy link
Collaborator

Windows.Win32.Graphics.Direct3D.Fxc.Apis.D3DCOMPILER_DLL removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
namespaces Feedback on namespace names or organization rust Critical for Rust adoption
Projects
None yet
Development

No branches or pull requests

3 participants