Skip to content

Fix DX11 shared textures#1782

Merged
tebjan merged 1 commit into
stride3d:masterfrom
arturoc:fix-dx11-shared-handles
Sep 17, 2023
Merged

Fix DX11 shared textures#1782
tebjan merged 1 commit into
stride3d:masterfrom
arturoc:fix-dx11-shared-handles

Conversation

@tebjan

@tebjan tebjan commented Sep 17, 2023

Copy link
Copy Markdown
Member

Re-do of #1759 as it was lost in a force push.

PR Details

Right now creating a texture from a native texture with D3D11_RESOURCE_MISC_SHARED_NTHANDLE will fail unless it is also D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX. This combination is recomended but not mandatory acording to the specification: https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_resource_misc_flag

Description

The PR changes the code that checks for shared handles from a switch/case to an if/else where the check is done for flags using a bitwise and instead of comparing the full flag to an specific value. Shared NT is checked first as Shared & SharedNT can be set at the same time.

Related Issue

#1758

Motivation and Context

Allows to use DX11 textures with an NT handle but no keyed mutex

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Right now creating a texture from a native texture with D3D11_RESOURCE_MISC_SHARED_NTHANDLE  will fail unless it is also D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX. This combination is recomended but not mandatory acording to the specification: https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_resource_misc_flag
@tebjan tebjan merged commit 6c5b7c8 into stride3d:master Sep 17, 2023
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