Skip to content

Mark DXGI_SWAP_CHAIN_DESC1::Flags as DXGI_SWAP_CHAIN_FLAG type - #1583

Merged
Mike Battista (mikebattista) merged 2 commits into
microsoft:mainfrom
MarijnS95:swapchain-desc-flag-type
May 31, 2023
Merged

Mark DXGI_SWAP_CHAIN_DESC1::Flags as DXGI_SWAP_CHAIN_FLAG type#1583
Mike Battista (mikebattista) merged 2 commits into
microsoft:mainfrom
MarijnS95:swapchain-desc-flag-type

Conversation

@MarijnS95

Copy link
Copy Markdown
Contributor

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

@mikebattista

Copy link
Copy Markdown
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

Marijn Suijten (MarijnS95) commented May 24, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for suggesting that Mike Battista (@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
Copy Markdown
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

Marijn Suijten (MarijnS95) commented May 24, 2023

Copy link
Copy Markdown
Contributor Author

👍 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
Copy Markdown
Contributor Author

Mike Battista (@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
Mike Battista (mikebattista) merged commit 2ff7898 into microsoft:main May 31, 2023
@mikebattista

Copy link
Copy Markdown
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