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

Batch file Exception in thread “main” java.lang.UnsupportedClassVersionError: com/aionemu/c [duplicate]
ZeroMQ Pub/Sub drops messages only when subscribing to topics
unable to match thread tid and tid generated by pyramid.
How to keep only main thread left after for…loop is finished during using OpenMP?
How to pass an image to a function?
Paralelism for loop in Python
Kotlin: Blocking coroutines with non-blocking I/O
Lambda expressions, concurrency and static variables
Synchronisation for blocked threads
Data sync algorithm based on timing
Properties don't take effect until second execution
Alternative to Akka for handling tasks sequentially
C++:pthread status monitoring on Linux
which openmp schedule am I running?
Make processes run on a one-instruction-per-process policy
JMETER is very slow after a few hours

Categories

HOME
arduino-uno
deployment
netsuite
keras
single-sign-on
getelementsbytagname
google-oauth
binary-tree
survey
ojdbc
yum
networkx
applepay
awesome-wm
vifm
nano-server
midi
spring-xd
rascal
correlation
google-cloud-ml
jplayer
circular-dependency
n-gram
flask-wtforms
fatal-error
invantive-sql
oracle-coherence
excel-vba-mac
physics-engine
sylius
microsoft-sync-framework
vlsi
facebook-access-token
wpfdatagrid
info.plist
fopen
fifo
minitab
windowbuilder
vision
subdomains
file-rename
bpel
nouislider
nameservers
junit5
http-status-code-503
winrt-xaml-toolkit
grails-3.1
kendo-ui-grid
html5-fullscreen
jquery-bootgrid
multilingual
occlusion
ssjs
webdriver-manager
nand2tetris
http-redirect
scorm
qwt
filepicker
elgg
nativeapplication
android-cursor
color-profile
query-performance
topbeat
static-ip-address
bstr
gstreamer-0.10
lttng
angstrom-linux
flash-cs5
skype4py
ready-api
python-stackless
rvest
fadeout
lib.web.mvc
endeca-workbench
quicklisp
computer-algebra-systems
kcachegrind
sframe
php-ci
ios9.1
vstest.console.exe
device-orientation
csquery
offloading
codeigniter-url
didselectrowatindexpath
flexmojos
geos
ril
type-equivalence
browser-detection
jquery-knob
appconkit
spyware
blackberry-playbook
xfbml
cxxtest
asp.net-profiles
ti-dsp
xetex
windows-live-messenger

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