multithreading


DX11 Updating Shared Textures


I have a shared DX11 texture that is being used with 2 different devices in separate threads.
Thread1 (operating on device 1): Called every frame and updates the shared texture
Thread2(operating on device2): Consumes the shared texture by copying it to another texture. Frequency is much lesser than thread 1.
According to MSDN "If a shared texture is updated on one device ID3D11DeviceContext::Flush must be called on that device."
However calling flush on thread1 every frame is very expensive and we see a massive performance hit. We can't flush device 1 on thread 2, because a device context is not thread safe.
Is there a way to efficiently make the shared texture update when threads 2 needs to consume it?
Thanks for your help! MSDN is not very helpful when dealing with shared textures.
emphasized text
In order to synchronize the access to the shared resource between two threads (or interprocess) you can use IDXGIKeyedMutex. It is described here in details: https://msdn.microsoft.com/en-us/library/windows/desktop/ee913554(v=vs.85).aspx#dxgi_1.1_synchronized_shared_surfaces
You can check the sample code provided as well although they show only resource sharing between two DX10 devices. It is the same for DX11 devices.
The essential part is to QueryInterface the shared texture for IDXGIResource first and then for IDXGIKeyedMutex. After that you use the mutex for synchronization by using AcquireSync and ReleaseSync functions.

Related Links

Is there an automatic parallel prolog implementation?
Multiple UI threads in Cocoa
Monotouch threading issue - update BTProgressHUD whilst downloading a file
how to write a future that wait for an event
TCP/IP causing WinForm slow response
Threads: When ones thread is running can you interact with the other?
How do user level threads (ULTs) and kernel level threads (KLTs) differ with regards to concurrent execution?
How does the recursive(reentrant) mutex works?
multithreaded IDirect3DDevice9::CreateDevice freeze
javafx runtime thread synchronization error?
Need sample code explaning Workmanager in Tomcat
Netty OrderedMemoryAwareThreadPoolExecutor not creating multiple threads
javafx, socket programming, and threads
System.threading.timer callbacks irregular
Synchronize Threads with WINAPI
Mapping User-level threads and Kernel-level threads

Categories

HOME
wso2
openstack
image-processing
json.net
grep
alfresco
read-eval-print-loop
gis
analysis
maven-3
youtube-api-v3
jgroups
alpha
ojdbc
google-translate
reveal.js
dax
php-7.1
apache-cayenne
windows-azure-storage
zebra-printers
msp430
carthage
facebook-page
reactive-cocoa
nhibernate-envers
google-cloud-speech
alpine
scriptcs
chromium-embedded
mmap
firebase-crash-reporting
numerical-methods
pepper
selectedindexchanged
internet-explorer-9
maxmind
webkitspeechrecognition
bluestacks
windows-dev-center
textmate
mozilla
host
jquery-bootgrid
scaffold
retina-display
space-complexity
occlusion
twitch
ssjs
eclipse-scout
ibpy
isbn
no-www
gpx
apple-news
parentheses
veracode
carrot
r-forge
python-cryptography
query-performance
synchronous
player
firebaseui
multiple-regression
simplewebrtc
ready-api
sdf
bluegiga
php-internals
wapiti
unity-networking
python-3.2
ruby-2.2
tarjans-algorithm
sframe
deis
sniffer
asp.net-web-api-odata
device-manager
uitouch
comexception
ftps
buster.js
qt-faststart
mylyn
plasma
simba
bitsharp
bluepill
word-processor
ocx
qtkit
nsdatecomponents
nsobject
rfc1123
actionview
android-sdk-2.1
gallio
infrastructure
revisions
routedevent
castle-monorail
iweb
port-number

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App