Giter Site home page Giter Site logo

daktronics / d3d-9211 Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 8.0 84 KB

Direct3D 9 to 11 sharing demo

License: MIT License

CMake 1.08% Batchfile 0.32% C++ 97.44% C 1.16%
direct3d direct3d9 direct3d11 texture-sharing opensharedresource graphics graphics-programming

d3d-9211's Introduction

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.

d3d-9211's People

Contributors

wesselsga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

d3d-9211's Issues

1

1

OpenSharedResource will produce video memory leak?

If you use OpenSharedResource to get textures every time instead of caching them to textures_, you will see a continuous increase in video memory in the task manager, that is, a video memory leak occurs. Is this a bug in the directx library or a bug in the program that is not properly set?

1

1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.