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

Run a multithreaded job in 1 slot?
Multi-threaded linear system solution in OpenBLAS
Can “mov eax,mem” occur with “lock inc mem” at the same time in multiprocessor?
mongodb map reduce on multicore server
Waiting screen in Lwuit J2ME
Thread aborted in parallel web test with MSTEST and Selenium
How to set number of PPL threads to one?
NIO Server : use a worker thread or not?
Delphi (Indy) Threadsafe classes
DBCP Stop Working with no Exception
“DebugInfo for CritSec does not point back to the critical section” when analysing deadlock
Cromis IPC Synchronization - Application stops responding
Waiting on a WebRequest on Windows Phone 7
If the main thread holds a critical section, will a function attempting to acquire the critical section block if it's also on the main thread?
Concurrency is not Parallelism? [closed]
Print Hello and World from different thread

Categories

HOME
clips
testng
keycloak
reflection
gremlin
google-api-php-client
spring-cloud-stream
elm
maven-3
infragistics
sqlite3
dxl
win32gui
ebean
fancybox
swagger-ui
cross-validation
awesome-wm
elasticsearch-hadoop
windows-10-universal
user-input
row
messages
quickfix
foselasticabundle
finite-automata
pugjs
emulator
bootstrap-tour
jndi
blazemeter
android-widget
numerical-methods
bootstrap-material-design
greendao
delicious-api
fabric8
atl
amazon-kinesis-kpl
mmenu
stacked
dosbox
theano.scan
webdriver-manager
user-controls
dism
android-tabhost
hp-ux
gulp-sourcemaps
nand2tetris
slick-3.0
websphere-mq-fte
btrace
flickr-api
apache-fop
rails-routing
integrity
tropo
directory-structure
nodebb
feeds
sybase-asa
akka-cluster
titanium-android
vmware-tools
paypal-express
plottable.js
bstr
player
lttng
skype4py
qcustomplot
bluemix-app-scan
asp.net5
t4mvc
jqgrid-formatter
ideamart
web-controls
device-orientation
system.reflection
offloading
asp.net-dynamic-data
xojo
navigationservice
funcunit
wp-query
rebol3
expected-exception
mysql-error-1062
tidy
easy-install
dataadapter
seed
mqx
sabredav
drools-planner
ocunit
google-email-migration
newtonscript
onsubmit
enter
gwt-ext
data-loss
heartbeat
icanhaz.js
filtered-index
preference
dbal
text-coloring

Resources

Encrypt Message