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

BringToFront and different message pumps
Client Side Port Detection
How can I use TTask.WaitForAny from the new threading library?
Is Spray allowing only one thread within the routing code?
How does one atomically use a set of handles?
Multithreading in Matlab
cannot read mp3 in the jar file. (getResourceAsStream and MediaPlayer)
Continuous Azure WebJob using System.Threading.Timer
Call a class member function at periodic time intervals in c++11
Async call never returns
How to get a multi-threaded dot() function?
Swift - GCD mutable array multiple threads issue “mutated while being enumerated”
Java 8 ForkJoinTask - main thread hangs even though child tasks complete successfully
executing a command on a variable used by multiple threads
Saas Architecture and design suggestion.. Any existing products that simplifies the design
Serial Dispatch Queue with Asynchronous Blocks

Categories

HOME
ms-access
ibm-bluemix
isabelle
server
cplex
spring-jdbc
youtube-api-v3
v8
binary-tree
umd
retrofit
acquia
django-imagekit
node-pdfkit
volttron
numeral.js
u-sql
mapserver
modelica
spring-tool-suite
usergrid
messages
decomposition
worldwind
openedx
lucene.net
karma-jasmine
jquery-ajaxq
intentfilter
mps
mmap
tibco-mdm
jndi
hammerspoon
microsoft-sync-framework
xacml
r-raster
tinymce-4
stormpath
nameservers
geopositioning
ghost4j
atl
main
leading-zero
elasticsearch-plugin
user-controls
ibpy
flashair
angular2-meteor
azure-application-gateway
winscp-net
dropbox-php
lowpass-filter
dtexec
memory-alignment
hittest
specrun
word-vba-mac
ado.net-entity-data-model
database-optimization
goose
ios8-today-widget
cartesian-product
lemon
clipperlib
skos
python-green
ng-animate
gadt
tablelayout
wp-query
mysql-error-1062
balanced-payments
viadeo
prettify
pyhdf
quantlib-swig
jsctypes
soundtouch
quartz-graphics
rabl
typoscript2
bitsharp
regsvr32
wse3.0
infobox
html-input
zend-translate
mirah
temporal-database
phonon
scripting-languages

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