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 Vibe.D multi-threaded to handle concurrent requests?
In an operating system, who is responsible for thread cancellation?
What is the difference between spark.task.cpus and --executor-cores
I launch a asynchronous thread in storm bolt, but this slow the whole topology
How to get a flag or hook when CQ server get started?
What is the precise reason I got blocked on STM?
Reaction-Diffusion algorithm on Processing + Multithreading
Block Go routine in a shared library
Multithreading in Ada
Cursive behavior on blocked thread
Acquiring a lock on Google BigQuery Table Schema or rejecting schemas not backwards compatible
How to implement a FIFO queue whose element can only be read N times?
javaFX: Open a second stage within a task, wait for it to close, then continue on first stage.
Allocating and releasing memory in different threads in Delphi7
Is there a multithreading in Oracle PL/SQL?
Does a single call to ResetEvent reset the signaled event for all threads or just the calling thread? (WINAPI)

Categories

HOME
ibm-bluemix
twitter
amazon-ec2
server
include
webstorm
infragistics
c#-2.0
jpeg
pivotal-cloud-foundry
facebook-messenger-bot
session-variables
phaser
worldwind
foselasticabundle
pc
reverse-proxy
zapier
cloudhub
restful-authentication
claims-based-identity
rundeck
opennlp
selectedindexchanged
chromebook
strncpy
jspm
libuv
subdomains
srcset
microsoft-chart-controls
react-chartjs
.net-4.0
uisplitview
exuberant-ctags
http-get
calibre
vsts-build-task
google-api-nodejs-client
mpmediaquery
mapdb
catalog
dynamics-crm-2013
dism
broadcastreceiver
nand2tetris
nxlog
no-www
heightmap
reactive-cocoa-5
logfiles
komodoedit
errordocument
dandelion
blogengine.net
datastax-startup
directory-structure
dynamics-sl
eventkit
word-vba-mac
visual-c++-2008
passport-google-oauth
ctest
xml-attribute
impresspages
fputcsv
react-native-listview
blackberry-10
packagist
livequery
hsv
metaclass
sframe
tableau-online
service-accounts
bridge.net
rake-task
offloading
nstableviewcell
gadt
javafx-webengine
codeigniter-routing
internet-connection
flask-cors
responsive-slides
htmlcleaner
dotnetnuke-5
ora-00911
shellexecute
back-stack
orchardcms-1.7
tinn-r
simba
hamiltonian-cycle
twrequest
errai
spring-portlet-mvc
zpt
subgurim-maps
coercion
joyent
horizontal-accordion
android-sdk-2.1
xfbml
sudzc
digest-authentication
getresponsestream
ctp4
project-hosting
gacutil
grid-system
ajax-forms

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