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

How is a stack belonging to a thread different from a stack of a process
Multithreading (pthreads)
Why I receive Out of system resources when a thread invokes asynchron this method
Java EE and background threads
How to get the lowest cpu consumption when having an infinte loop in a thread
How to gain a lost connection to server without restarting the Server, when a listener thread dies
Delphi 7: How to implement multi-threading?
Clojure -way of building live-stream server — with promises, but is it the right way
How upload files to azure in background with Delphi and OmniThread?
Why should I explicitly make an operation atomic?
TThreadedStringList in delphi xe2
How to make a specific thread wait until other threads computes a value required for it in OpenCL
Can Lingo 11 work in parallel
Delphi thread best practices
How to debug pyqt signal/slot connections, probably threading issue
Sequencing Events Over Network (Networked Turn-Based Game) [closed]

Categories

HOME
maven
pdf
openmp
angular-material
layout
onedrive
kalman-filter
jgroups
applepay
elasticsearch-hadoop
izpack
collectd
task
zebra-printers
fatal-error
nas
css-animations
wkwebview
tapestry
tibco-mdm
shopware
pingfederate
phpfox
entitlements
neo4j-spatial
ejabberd-module
dbclient
nouislider
socialengine
javascriptcore
http-get
code-contracts
android-kernel
revolution-slider
jquery-bootgrid
multilingual
libvpx
sharefile
texmaker
executenonquery
menuitem
komodoedit
datastax-startup
alphabet
pillow
epson
titanium-android
sonarlint-vs
quartz-composer
root-framework
abcpdf9
visual-c++-2008
url-pattern
heidisql
httplistener
dstu2-fhir
django-debug-toolbar
simplewebrtc
qgraphicsview
hover-over
hexdump
bluegiga
responsive-images
mono-embedding
iiviewdeckcontroller
pick
cctv
ccss
tidy
blending
opcache
excel-2003
ember-app-kit
specification-pattern
dotnethighcharts
cufon
f#-powerpack
recent-documents
oncheckedchanged
user-friendly
compiler-specific

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