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

Mark DXGI_SWAP_CHAIN_DESC1::Flags as DXGI_SWAP_CHAIN_FLAG type #1583

Merged
merged 2 commits into from
May 31, 2023

Conversation

MarijnS95
Copy link
Contributor

This is currently a UINT followed by a comment stating the actual enumeration type that contains the possible flag bits.

@mikebattista
Copy link
Contributor

The types don't match here. You should use the [AssociatedEnum] pattern instead. See #1572.

EMITWINMD : error : Failed to emit DXGI_SWAP_CHAIN_DESC1 in C:\win32metadata\generation\WinSDK\obj\generated\obj\crossarch\common\Dxgi.modified.cs: DXGI_SWAP_CHAIN_DESC1.Flags was remapped to enum Windows.Win32.Graphics.Dxgi.DXGI_SWAP_CHAIN_FLAG (type int, size 4) 
 but the original field was of type UINT (size 4). Either don't use an enum or make sure the enum is of the same size and sign. [C:\win32metadata\generation\WinSDK\Windows.Win32.proj]

@MarijnS95
Copy link
Contributor Author

MarijnS95 commented May 24, 2023

Thanks for suggesting that @mikebattista - it looks like the change only landed 3 days ago while this PR is based on commits from ± a week ago because I got many errors when making this change on main with .\DoAll.ps1, perhaps I have to run it with -Clean after any big pull?

At least this got me the right value in ILSpy without errors there, but will try again after rebasing on main!

This is currently a `UINT` followed by a comment stating the actual
enumeration type that contains the possible flag bits.
@mikebattista
Copy link
Contributor

Yes a clean build would be a good idea if you're having issues. Also make sure you update the baseline per the instructions at the end of the build.

@MarijnS95
Copy link
Contributor Author

MarijnS95 commented May 24, 2023

👍 I'll give it a try the next time I boot into Windows...

(Changes pushed here are per request above, but not build-tested locally)

@MarijnS95
Copy link
Contributor Author

@mikebattista looks like it is working as expected:

Testing .winmd succeeded
*** Comparing .winmd to last release
Unknown differences found:
Windows.Win32.Graphics.Dxgi.DXGI_SWAP_CHAIN_DESC1.Flags :  => [AssociatedEnum(DXGI_SWAP_CHAIN_FLAG)]
Write-Error: C:\Users\Marijn\Code\win32metadata\scripts\TestWinmdBinary.ps1:24:1
Line |
  24 |  & "$PSScriptRoot\CompareBinToLastRelease.ps1" -SkipInstallTools
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | If all the differences are expected, please update the expected differences list: .\scripts\UpdateChangesSinceLastRelease.ps1 '<add a reason here>'

And according to IlSpy:

public struct DXGI_SWAP_CHAIN_DESC1
{
	// ...

	[AssociatedEnum("DXGI_SWAP_CHAIN_FLAG")]
	public uint Flags;
}

@mikebattista mikebattista merged commit 2ff7898 into microsoft:main May 31, 2023
@mikebattista
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants