Skip to content

daktronics/d3d-9211

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Direct3D 9 to 11 (9211) Texture Sharing Demo

An Producer-Consumer based sample application where frames are generated by a Direct3D 9 producer, and rendered into a Direct3D 11 consumer (scene). This application utilizes Direct3DDevice9::CreateTexture and ID3D11Device::OpenSharedResource to share texture memory between Direct3D 9 and 11.

Build Instructions

  1. If you don't have it already - install CMake and Visual Studio 2017

    • VS 2017 Community Edition is fine - just make sure to install C/C++ development tools
  2. Run the gen_vs2017.bat script.

Note: if you're building for x86 you will need to modify gen_vs2017.bat to specify the correct generator for CMake

  1. Open the build/d3d-9211.sln solution in Visual Studio

  2. Build the ALL_BUILD project

  3. Run the d3d-9211.exe application

Usage

The scene dimensions can be specified as a command line argument: (--size=1920x1080 for example). By default it will choose a resolution that can fit on screen.

Screenshot

The Direct3D 9 producer will render the scene with transparency - the background color/pattern can be controlled using the context-menu within the window.

Background

Design

The application uses a queue of frames to synchronize texture access between D3D 9 and 11. The producer will render to offscreen shared textures, then place them on a queue for consumption. The consumer will read a shared texture from the queue and render it within a D3D11 scene. It will then place the texture back into a pool so the producer can re-use an allocated texture.

Design

The interaction with the queue and pool prevents a texture from being used by both D3D9 and 11 concurrently.