Skip to content

Fix DX11 shared textures#1759

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

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

Conversation

@arturoc

@arturoc arturoc commented Sep 14, 2023

Copy link
Copy Markdown
Contributor

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
@Ethereal77

Copy link
Copy Markdown
Contributor

I'm in the process of replacing SharpDX with Silk in the PR #1715. I write here to remind myself (or others) this change must be ported to that PR or it will be lost when merged, as that PR is modifying a lot of the internals of Stride.Graphics when using the Direct3D APIs.

@tebjan

tebjan commented Sep 15, 2023

Copy link
Copy Markdown
Member

Good find, I'll merge this, looks sensible that one flag doesn't require the other one.

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.

4 participants