Showing preview only (285K chars total). Download the full file or copy to clipboard to get everything.
Repository: Microsoft/WPFDXInterop
Branch: master
Commit: 83527f8df97d
Files: 54
Total size: 267.6 KB
Directory structure:
gitextract_7_bjs1s0/
├── .gitignore
├── LICENSE
├── README.md
├── SECURITY.md
├── samples/
│ └── D3D11Image/
│ ├── D3D11Visualization/
│ │ ├── D3DVisualization.cpp
│ │ ├── D3DVisualization.fx
│ │ ├── D3DVisualization.h
│ │ ├── D3DVisualization.rc
│ │ ├── D3DVisualization.vcxproj
│ │ ├── D3DVisualization.vcxproj.filters
│ │ ├── D3DVisualization_dxsdk.vcxproj
│ │ ├── D3DVisualization_dxsdk.vcxproj.filters
│ │ ├── D3DVisualization_winsdk.vcxproj
│ │ ├── D3DVisualization_winsdk.vcxproj.filters
│ │ ├── DX11Utils.cpp
│ │ ├── DX11Utils.h
│ │ ├── OrbitCamera.cpp
│ │ ├── OrbitCamera.h
│ │ └── Resource.h
│ ├── WpfD3D11Interop/
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── Properties/
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── WpfD3D11Interop.csproj
│ │ ├── app.config
│ │ └── packages.config
│ ├── WpfD3D11Interop_dxsdk.sln
│ └── WpfD3D11Interop_winsdk.sln
├── scripts/
│ ├── BuildNuGetPackage.cmd
│ └── Microsoft.Wpf.Interop.DirectX.nuspec
└── src/
├── Microsoft.Wpf.Interop.DirectX/
│ ├── AssemblyInfo.cpp
│ ├── D3D11Image.cpp
│ ├── D3D11Image.h
│ ├── Microsoft.Wpf.Interop.DirectX_dxsdk.vcxproj
│ ├── Microsoft.Wpf.Interop.DirectX_winsdk.vcxproj
│ ├── Stdafx.cpp
│ ├── Stdafx.h
│ ├── SurfaceDevice10.cpp
│ ├── SurfaceDevice11.cpp
│ ├── SurfaceDevice9.cpp
│ ├── SurfaceQueue.cpp
│ ├── SurfaceQueue.h
│ ├── SurfaceQueue.inl
│ ├── SurfaceQueueImpl.h
│ ├── SurfaceQueueInteropHelper.cpp
│ ├── SurfaceQueueInteropHelper.h
│ └── version.rc
├── Microsoft.Wpf.Interop.DirectX_dxsdk.sln
└── Microsoft.Wpf.Interop.DirectX_winsdk.sln
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Created by https://www.gitignore.io/api/visualstudio
### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2015 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# **WPF DirectX Extensions**
WPF DirectX Extensions allow you to easily host DirectX 10 and DirectX 11 content in WPF applications.
Getting Started
-------------------
**Where to get it**
- NuGet package
- [x86](https://www.nuget.org/packages/Microsoft.Wpf.Interop.DirectX-x86/0.9.0-beta-22856)
- [x64](https://www.nuget.org/packages/Microsoft.Wpf.Interop.DirectX-x64/0.9.0-beta-22856)
- [Source Code](https://github.com/Microsoft/WPFDXInterop)
**Resources**
- [Documentation](https://github.com/Microsoft/WPFDXInterop/wiki)
- [Samples](/samples)
**More Info**
- [Report a bug or ask a question](https://github.com/Microsoft/WPFDXInterop/issues)
- [License](http://opensource.org/licenses/MIT)
Code Example
------------
***XAML***
```
<Window x:Class="WpfApplication5.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication5"
mc:Ignorable="d"
xmlns:DXExtensions="clr-namespace:Microsoft.Wpf.Interop.DirectX;assembly=Microsoft.Wpf.Interop.DirectX"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Image>
<Image.Source>
<DXExtensions:D3D11Image x:Name="InteropImage"/>
</Image.Source>
</Image>
</Grid>
</Window>
```
***C#***
The C# portions of interfacing with a native component that generates the DX visualization is not concise enough to host as an example. We would recommend that you look at sample code [here](https://github.com/Microsoft/WPFDXInterop/blob/master/samples/D3D11Image/WpfD3D11Interop/MainWindow.xaml.cs) to get a detailed understanding of the code required
Using WPF DirectX Extensions
-------------------
The [documentation](https://github.com/Microsoft/WPFDXInterop/wiki) explains how to install Visual Studio, add the WPF DirectX Extension NuGet package to your project, and get started using the API.
Building WPF DirectX Extensions from Source
------------------------------
**What You Need**
- [Visual Studio 2015](https://www.visualstudio.com/features/wpf-vs)
- [DirectX SDK](http://www.microsoft.com/en-us/download/details.aspx?id=6812)
- [Windows SDK](https://dev.windows.com/en-us/downloads/windows-10-sdk)
**Build and Create WPF DirectX Extensions NuGet**
- [Clone the Repository](https://github.com/Microsoft/WPFDXInterop)
- Open Microsoft.Wpf.Interop.DirectX_winsdk or Microsoft.Wpf.Interop.DirectX_dxsdk solution from [Source](/src) in Visual Studio
- Change Build Configuration to Release and build for x86 and x64
- Run BuildNuGetPackage in [scripts](/scripts) to create nuget packages
================================================
FILE: SECURITY.md
================================================
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization.cpp
================================================
//------------------------------------------------------------------------------
// <copyright file="D3DVisualization.cpp" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
#include "D3DVisualization.h"
#ifndef DIRECTX_SDK
using namespace DirectX;
using namespace DirectX::PackedVector;
#endif
// Global Variables
CCube * pApplication; // Application class
//--------------------------------------------------------------------------------------
// Structures
//--------------------------------------------------------------------------------------
struct SimpleVertex
{
XMFLOAT3 Pos;
XMFLOAT4 Color;
};
struct ConstantBuffer
{
XMMATRIX mWorld;
XMMATRIX mView;
XMMATRIX mProjection;
};
BOOL WINAPI DllMain(HINSTANCE hInstance,DWORD fwdReason, LPVOID lpvReserved)
{
return TRUE;
}
/// <summary>
/// Init global class instance
/// </summary>
extern HRESULT __cdecl Init()
{
pApplication = new CCube();
HRESULT hr = S_OK;
if ( FAILED( hr = pApplication->InitDevice() ) )
{
return hr;
}
return hr;
}
/// <summary>
/// Cleanup global class instance
/// </summary>
extern void __cdecl Cleanup()
{
delete pApplication;
pApplication = NULL;
}
/// <summary>
/// Render for global class instance
/// </summary>
extern HRESULT __cdecl Render(void * pResource, bool isNewSurface)
{
if ( NULL == pApplication )
{
return E_FAIL;
}
return pApplication->Render(pResource, isNewSurface);
}
/// <summary>
/// Sets the Radius value of the camera
/// </summary>
extern HRESULT _cdecl SetCameraRadius(float r)
{
if ( NULL == pApplication )
{
return E_FAIL;
}
pApplication->GetCamera()->SetRadius(r);
return 0;
}
/// <summary>
/// Sets the Theta value of the camera
/// Theta represents the angle (in radians) of the camera around the
/// center in the x-y plane
/// </summary>
extern HRESULT _cdecl SetCameraTheta(float theta)
{
if ( NULL == pApplication )
{
return E_FAIL;
}
pApplication->GetCamera()->SetTheta(theta);
return 0;
}
/// <summary>
/// Sets the Phi value of the camera
/// Phi represents angle (in radians) of the camera around the center
/// in the y-z plane (over the top and below the scene)
/// </summary>
extern HRESULT _cdecl SetCameraPhi(float phi)
{
if ( NULL == pApplication )
{
return E_FAIL;
}
pApplication->GetCamera()->SetPhi(phi);
return 0;
}
/// <summary>
/// Constructor
/// </summary>
CCube::CCube()
{
m_Height = 0;
m_Width = 0;
m_hInst = NULL;
m_featureLevel = D3D_FEATURE_LEVEL_11_0;
m_pd3dDevice = NULL;
m_pImmediateContext = NULL;
m_pVertexLayout = NULL;
m_pVertexBuffer = NULL;
m_pVertexShader = NULL;
m_pPixelShader = NULL;
}
/// <summary>
/// Destructor
/// </summary>
CCube::~CCube()
{
if (m_pImmediateContext)
{
m_pImmediateContext->ClearState();
}
SAFE_RELEASE(m_pIndexBuffer);
SAFE_RELEASE(m_pPixelShader);
SAFE_RELEASE(m_pVertexBuffer);
SAFE_RELEASE(m_pVertexLayout);
SAFE_RELEASE(m_pVertexShader);
SAFE_RELEASE(m_pImmediateContext);
SAFE_RELEASE(m_pd3dDevice);
}
/// <summary>
/// Compile and set layout for shaders
/// </summary>
/// <returns>S_OK for success, or failure code</returns>
HRESULT CCube::LoadShaders()
{
HRESULT hr = S_OK;
// Compile the pixel shader
ID3DBlob* pPSBlob = NULL;
hr = CompileShaderFromFile(L"D3DVisualization.fx", "PS", "ps_4_0", &pPSBlob);
if (FAILED(hr))
{
MessageBox(NULL,
L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK);
return hr;
}
// Create the pixel shader
hr = m_pd3dDevice->CreatePixelShader(pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), NULL, &m_pPixelShader);
pPSBlob->Release();
if (FAILED(hr))
return hr;
// Compile the vertex shader
ID3DBlob* pVSBlob = NULL;
hr = CompileShaderFromFile(L"D3DVisualization.fx", "VS", "vs_4_0", &pVSBlob);
if (FAILED(hr))
{
MessageBox(NULL,
L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK);
return hr;
}
// Create the vertex shader
hr = m_pd3dDevice->CreateVertexShader(pVSBlob->GetBufferPointer(), pVSBlob->GetBufferSize(), NULL, &m_pVertexShader);
if (FAILED(hr))
{
pVSBlob->Release();
return hr;
}
// Define the input layout
D3D11_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
UINT numElements = ARRAYSIZE(layout);
// Create the input layout
hr = m_pd3dDevice->CreateInputLayout(layout, numElements, pVSBlob->GetBufferPointer(),
pVSBlob->GetBufferSize(), &m_pVertexLayout);
pVSBlob->Release();
if (FAILED(hr))
return hr;
// Set the input layout
m_pImmediateContext->IASetInputLayout(m_pVertexLayout);
return hr;
}
/// <summary>
/// Create Direct3D device
/// </summary>
/// <returns>S_OK for success, or failure code</returns>
HRESULT CCube::InitDevice()
{
HRESULT hr = S_OK;
UINT createDeviceFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
D3D_DRIVER_TYPE driverTypes[] =
{
D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_WARP,
D3D_DRIVER_TYPE_REFERENCE,
};
UINT numDriverTypes = ARRAYSIZE(driverTypes);
// DX10 or 11 devices are suitable
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
};
UINT numFeatureLevels = ARRAYSIZE(featureLevels);
for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; ++driverTypeIndex)
{
hr = D3D11CreateDevice(NULL, driverTypes[driverTypeIndex], NULL, createDeviceFlags, featureLevels, numFeatureLevels,
D3D11_SDK_VERSION, &m_pd3dDevice, &m_featureLevel, &m_pImmediateContext);
if ( SUCCEEDED(hr) )
{
m_driverType = driverTypes[driverTypeIndex];
break;
}
}
if ( FAILED(hr) )
{
MessageBox(NULL, L"Could not create a Direct3D 10 or 11 device.", L"Error", MB_ICONHAND | MB_OK);
return hr;
}
hr = LoadShaders();
if ( FAILED(hr) )
{
MessageBox(NULL, L"Could not load shaders.", L"Error", MB_ICONHAND | MB_OK);
return hr;
}
// Create vertex buffer
SimpleVertex vertices[] =
{
{ XMFLOAT3(-1.0f, 1.0f, -1.0f), XMFLOAT4(0.0f, 0.0f, 1.0f, 0.5f) },
{ XMFLOAT3(1.0f, 1.0f, -1.0f), XMFLOAT4(0.0f, 1.0f, 0.0f, 0.5f) },
{ XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT4(0.0f, 1.0f, 1.0f, 0.5f) },
{ XMFLOAT3(-1.0f, 1.0f, 1.0f), XMFLOAT4(1.0f, 0.0f, 0.0f, 0.5f) },
{ XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT4(1.0f, 0.0f, 1.0f, 0.5f) },
{ XMFLOAT3(1.0f, -1.0f, -1.0f), XMFLOAT4(1.0f, 1.0f, 0.0f, 0.5f) },
{ XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT4(1.0f, 1.0f, 1.0f, 0.5f) },
{ XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT4(0.0f, 0.0f, 0.0f, 0.5f) },
};
D3D11_BUFFER_DESC bd;
ZeroMemory(&bd, sizeof(bd));
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof(SimpleVertex)* 8;
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
D3D11_SUBRESOURCE_DATA InitData;
ZeroMemory(&InitData, sizeof(InitData));
InitData.pSysMem = vertices;
hr = m_pd3dDevice->CreateBuffer(&bd, &InitData, &m_pVertexBuffer);
if (FAILED(hr))
return hr;
// Set vertex buffer
UINT stride = sizeof(SimpleVertex);
UINT offset = 0;
m_pImmediateContext->IASetVertexBuffers(0, 1, &m_pVertexBuffer, &stride, &offset);
// Create index buffer
WORD indices[] =
{
3, 1, 0,
2, 1, 3,
0, 5, 4,
1, 5, 0,
3, 4, 7,
0, 4, 3,
1, 6, 5,
2, 6, 1,
2, 7, 6,
3, 7, 2,
6, 4, 5,
7, 4, 6,
};
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof(WORD)* 36; // 36 vertices needed for 12 triangles in a triangle list
bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
bd.CPUAccessFlags = 0;
InitData.pSysMem = indices;
hr = m_pd3dDevice->CreateBuffer(&bd, &InitData, &m_pIndexBuffer);
if (FAILED(hr))
return hr;
// Set index buffer
m_pImmediateContext->IASetIndexBuffer(m_pIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
// Set primitive topology
m_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
// Create the constant buffer
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof(ConstantBuffer);
bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
bd.CPUAccessFlags = 0;
hr = m_pd3dDevice->CreateBuffer(&bd, NULL, &m_pConstantBuffer);
if (FAILED(hr))
return hr;
// Initialize the world matrix
m_World = XMMatrixIdentity();
// Initialize the view matrix
XMVECTOR Eye = XMVectorSet(0.0f, 1.0f, -5.0f, 0.0f);
XMVECTOR At = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
XMVECTOR Up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
m_View = XMMatrixLookAtLH(Eye, At, Up);
return S_OK;
}
void CCube::SetUpViewport()
{
// Setup the viewport
D3D11_VIEWPORT vp;
vp.Width = (float)m_Width;
vp.Height = (float)m_Height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
m_pImmediateContext->RSSetViewports(1, &vp);
// Initialize the projection matrix
m_Projection = XMMatrixPerspectiveFovLH(XM_PIDIV4, m_Width / (FLOAT)m_Height, 0.01f, 100.0f);
}
/// <summary>
/// Initializes RenderTarget
/// </summary>
/// <returns>S_OK for success, or failure code</returns>
HRESULT CCube::InitRenderTarget(void * pResource)
{
HRESULT hr = S_OK;
IUnknown *pUnk = (IUnknown*)pResource;
IDXGIResource * pDXGIResource;
hr = pUnk->QueryInterface(__uuidof(IDXGIResource), (void**)&pDXGIResource);
if (FAILED(hr))
{
return hr;
}
HANDLE sharedHandle;
hr = pDXGIResource->GetSharedHandle(&sharedHandle);
if (FAILED(hr))
{
return hr;
}
pDXGIResource->Release();
IUnknown * tempResource11;
hr = m_pd3dDevice->OpenSharedResource(sharedHandle, __uuidof(ID3D11Resource), (void**)(&tempResource11));
if (FAILED(hr))
{
return hr;
}
ID3D11Texture2D * pOutputResource;
hr = tempResource11->QueryInterface(__uuidof(ID3D11Texture2D), (void**)(&pOutputResource));
if (FAILED(hr))
{
return hr;
}
tempResource11->Release();
D3D11_RENDER_TARGET_VIEW_DESC rtDesc;
rtDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
rtDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtDesc.Texture2D.MipSlice = 0;
hr = m_pd3dDevice->CreateRenderTargetView(pOutputResource, &rtDesc, &m_pRenderTargetView);
if (FAILED(hr))
{
return hr;
}
D3D11_TEXTURE2D_DESC outputResourceDesc;
pOutputResource->GetDesc(&outputResourceDesc);
if ( outputResourceDesc.Width != m_Width || outputResourceDesc.Height != m_Height )
{
m_Width = outputResourceDesc.Width;
m_Height = outputResourceDesc.Height;
SetUpViewport();
}
m_pImmediateContext->OMSetRenderTargets(1, &m_pRenderTargetView, NULL);
if ( NULL != pOutputResource )
{
pOutputResource->Release();
}
return hr;
}
/// <summary>
/// Renders a frame
/// </summary>
/// <returns>S_OK for success, or failure code</returns>
HRESULT CCube::Render(void * pResource, bool isNewSurface)
{
HRESULT hr = S_OK;
// If we've gotten a new Surface, need to initialize the renderTarget.
// One of the times that this happens is on a resize.
if ( isNewSurface )
{
m_pImmediateContext->OMSetRenderTargets(0, NULL, NULL);
hr = InitRenderTarget(pResource);
if (FAILED(hr))
{
return hr;
}
}
// Update our time
static float t = 0.0f;
if (m_driverType == D3D_DRIVER_TYPE_REFERENCE)
{
t += (float)XM_PI * 0.0125f;
}
else
{
static DWORD dwTimeStart = 0;
DWORD dwTimeCur = GetTickCount();
if (dwTimeStart == 0)
dwTimeStart = dwTimeCur;
t = (dwTimeCur - dwTimeStart) / 1000.0f;
}
//
// Animate the cube
//
m_World = XMMatrixRotationX(t) * XMMatrixRotationY(t);
// Clear the back buffer
static float ClearColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
m_pImmediateContext->ClearRenderTargetView(m_pRenderTargetView, ClearColor);
// Update the view matrix
m_camera.Update();
XMMATRIX viewProjection = XMMatrixMultiply(m_camera.View, m_Projection);
ConstantBuffer cb;
cb.mWorld = XMMatrixTranspose(m_World);
cb.mView = XMMatrixTranspose(m_View);
cb.mProjection = XMMatrixTranspose(viewProjection);
m_pImmediateContext->UpdateSubresource(m_pConstantBuffer, 0, NULL, &cb, 0, 0);
// Renders a triangle
m_pImmediateContext->VSSetShader(m_pVertexShader, NULL, 0);
m_pImmediateContext->VSSetConstantBuffers(0, 1, &m_pConstantBuffer);
m_pImmediateContext->PSSetShader(m_pPixelShader, NULL, 0);
m_pImmediateContext->DrawIndexed(36, 0, 0); // 36 vertices needed for 12 triangles in a triangle list
if ( NULL != m_pImmediateContext )
{
m_pImmediateContext->Flush();
}
return 0;
}
/// <summary>
/// Method for retreiving the camera
/// </summary>
/// <returns>Pointer to the camera</returns>
CCamera* CCube::GetCamera()
{
return &m_camera;
}
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization.fx
================================================
//--------------------------------------------------------------------------------------
// File: D3DVisualization.fx
// Originally from DirectX SDK - Tutorial 4 sample
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
// Constant Buffer Variables
//--------------------------------------------------------------------------------------
cbuffer ConstantBuffer : register(b0)
{
matrix World;
matrix View;
matrix Projection;
}
//--------------------------------------------------------------------------------------
struct VS_OUTPUT
{
float4 Pos : SV_POSITION;
float4 Color : COLOR0;
};
//--------------------------------------------------------------------------------------
// Vertex Shader
//--------------------------------------------------------------------------------------
VS_OUTPUT VS(float4 Pos : POSITION, float4 Color : COLOR)
{
VS_OUTPUT output = (VS_OUTPUT)0;
output.Pos = mul(Pos, World);
output.Pos = mul(output.Pos, View);
output.Pos = mul(output.Pos, Projection);
output.Color = Color;
return output;
}
//--------------------------------------------------------------------------------------
// Pixel Shader
//--------------------------------------------------------------------------------------
float4 PS(VS_OUTPUT input) : SV_Target
{
return input.Color;
}
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization.h
================================================
//------------------------------------------------------------------------------
// <copyright file="D3DVizualization.h" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
#pragma once
#include <windows.h>
#include <d3d11.h>
#ifdef DIRECTX_SDK // requires DirectX SDK June 2010
#include <xnamath.h>
#define DirectX_NS // DirectX SDK requires a blank namespace for several types
#else // Windows SDK
#include <DirectXMath.h>
#include <DirectXPackedVector.h>
#define DirectX_NS DirectX // Windows SDK requires a DirectX namespace for several types
#endif
#include "OrbitCamera.h"
#include "DX11Utils.h"
#include "resource.h"
extern "C" {
__declspec(dllexport) HRESULT __cdecl Init();
}
extern "C" {
__declspec(dllexport) void __cdecl Cleanup();
}
extern "C" {
__declspec(dllexport) HRESULT __cdecl Render(void * pResource, bool isNewSurface);
}
extern "C" {
__declspec(dllexport) HRESULT __cdecl SetCameraRadius(float r);
}
extern "C" {
__declspec(dllexport) HRESULT __cdecl SetCameraTheta(float theta);
}
extern "C" {
__declspec(dllexport) HRESULT __cdecl SetCameraPhi(float phi);
}
class CCube
{
public:
/// <summary>
/// Constructor
/// </summary>
CCube();
/// <summary>
/// Destructor
/// </summary>
~CCube();
/// <summary>
/// Create Direct3D device and swap chain
/// </summary>
/// <returns>S_OK for success, or failure code</returns>
HRESULT InitDevice();
/// <summary>
/// Renders a frame
/// </summary>
/// <returns>S_OK for success, or failure code</returns>
HRESULT Render(void * pResource, bool isNewSurface);
/// <summary>
/// Method for retrieving the camera
/// </summary>
/// <returns>Pointer to the camera</returns>
CCamera* GetCamera();
// Special function definitions to ensure alignment between c# and c++
void* operator new(size_t size)
{
return _aligned_malloc(size, 16);
}
void operator delete(void *p)
{
_aligned_free(p);
}
private:
HRESULT InitRenderTarget(void * pResource);
void SetUpViewport();
// 3d camera
CCamera m_camera;
HINSTANCE m_hInst;
D3D_DRIVER_TYPE m_driverType;
D3D_FEATURE_LEVEL m_featureLevel;
ID3D11Device* m_pd3dDevice;
ID3D11DeviceContext* m_pImmediateContext;
IDXGISwapChain* m_pSwapChain = NULL;
ID3D11RenderTargetView* m_pRenderTargetView = NULL;
ID3D11InputLayout* m_pVertexLayout;
ID3D11Buffer* m_pVertexBuffer;
ID3D11Buffer* m_pIndexBuffer = NULL;
ID3D11Buffer* m_pConstantBuffer = NULL;
DirectX_NS::XMMATRIX m_World;
DirectX_NS::XMMATRIX m_View;
DirectX_NS::XMMATRIX m_Projection;
ID3D11VertexShader* m_pVertexShader;
ID3D11PixelShader* m_pPixelShader;
// Initial window resolution
UINT m_Width;
UINT m_Height;
/// <summary>
/// Compile and set layout for shaders
/// </summary>
/// <returns>S_OK for success, or failure code</returns>
HRESULT LoadShaders();
};
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization.rc
================================================
//------------------------------------------------------------------------------
// <copyright file="D3DVisualization.rc" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
//Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="D3DVisualization.h" />
<ClInclude Include="DX11Utils.h" />
<ClInclude Include="OrbitCamera.h" />
<ClInclude Include="Resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="D3DVisualization.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="D3DVisualization.cpp" />
<ClCompile Include="DX11Utils.cpp" />
<ClCompile Include="OrbitCamera.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="D3DVisualization.fx">
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</EntryPointName>
<FileType>Document</FileType>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</Text>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}</ProjectGuid>
<RootNamespace>D3DVisualization</RootNamespace>
<TargetName>D3DVisualization</TargetName>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x86\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x64\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x86\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x64\$(Configuration)\""</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="D3DVisualization.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DX11Utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="OrbitCamera.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="D3DVisualization.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="DX11Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="OrbitCamera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="D3DVisualization.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="D3DVisualization.fx" />
</ItemGroup>
</Project>
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization_dxsdk.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="D3DVisualization.h" />
<ClInclude Include="DX11Utils.h" />
<ClInclude Include="OrbitCamera.h" />
<ClInclude Include="Resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="D3DVisualization.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="D3DVisualization.cpp" />
<ClCompile Include="DX11Utils.cpp" />
<ClCompile Include="OrbitCamera.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="D3DVisualization.fx">
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</EntryPointName>
<FileType>Document</FileType>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</Text>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}</ProjectGuid>
<RootNamespace>D3DVisualization</RootNamespace>
<TargetName>D3DVisualization</TargetName>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x86\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DIRECTX_SDK;WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x64\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x86\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x64\$(Configuration)\""</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization_dxsdk.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="D3DVisualization.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DX11Utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="OrbitCamera.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="D3DVisualization.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="DX11Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="OrbitCamera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="D3DVisualization.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="D3DVisualization.fx" />
</ItemGroup>
</Project>
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization_winsdk.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="D3DVisualization.h" />
<ClInclude Include="DX11Utils.h" />
<ClInclude Include="OrbitCamera.h" />
<ClInclude Include="Resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="D3DVisualization.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="D3DVisualization.cpp" />
<ClCompile Include="DX11Utils.cpp" />
<ClCompile Include="OrbitCamera.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="D3DVisualization.fx">
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</EntryPointName>
<FileType>Document</FileType>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</Text>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}</ProjectGuid>
<RootNamespace>D3DVisualization</RootNamespace>
<TargetName>D3DVisualization</TargetName>
<TargetExt>.dll</TargetExt>
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.dll</TargetExt>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64</LibraryPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x86\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x64\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x86\$(Configuration)\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy d3dvisualization.fx "$(SolutionDir)x64\$(Configuration)\""</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization_winsdk.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="D3DVisualization.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DX11Utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="OrbitCamera.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="D3DVisualization.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="DX11Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="OrbitCamera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="D3DVisualization.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="D3DVisualization.fx" />
</ItemGroup>
</Project>
================================================
FILE: samples/D3D11Image/D3D11Visualization/DX11Utils.cpp
================================================
//------------------------------------------------------------------------------
// <copyright file="DX11Utils.cpp" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
#include "DX11Utils.h"
#ifdef DIRECTX_SDK // requires DirectX SDK June 2010
#include <d3dx11.h>
#else // Windows SDK
#include <d3d11.h>
#include <D3Dcompiler.h>
#endif
/// <summary>
/// Helper for compiling shaders with D3DX11
/// </summary>
/// <param name="szFileName">full path to shader to compile</param>
/// <param name="szEntryPoint">entry point of shader</param>
/// <param name="szShaderModel">shader model to compile for</param>
/// <param name="ppBlobOut">holds result of compilation</param>
/// <returns>S_OK for success, or failure code</returns>
HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3D10Blob** ppBlobOut)
{
HRESULT hr = S_OK;
ID3D10Blob* pErrorBlob = NULL;
#ifdef DIRECTX_SDK // requires DirectX SDK June 2010
hr = D3DX11CompileFromFileW( szFileName, NULL, NULL, szEntryPoint, szShaderModel,
0, 0, NULL, ppBlobOut, &pErrorBlob, NULL );
#else // Windows SDK
hr = D3DCompileFromFile(szFileName, NULL, NULL, szEntryPoint, szShaderModel,
0, 0, ppBlobOut, &pErrorBlob);
#endif
if ( FAILED(hr) )
{
if (NULL != pErrorBlob)
{
OutputDebugStringA( (char*)pErrorBlob->GetBufferPointer() );
}
}
SAFE_RELEASE(pErrorBlob);
return hr;
}
================================================
FILE: samples/D3D11Image/D3D11Visualization/DX11Utils.h
================================================
//------------------------------------------------------------------------------
// <copyright file="DX11Utils.h" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
#pragma once
#include <windows.h>
#include <d3d11.h>
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } }
#endif
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } }
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } }
#endif
/// <summary>
/// Helper for compiling shaders with D3DX11
/// </summary>
/// <param name="szFileName">full path to shader to compile</param>
/// <param name="szEntryPoint">entry point of shader</param>
/// <param name="szShaderModel">shader model to compile for</param>
/// <param name="ppBlobOut">holds result of compilation</param>
/// <returns>S_OK for success, or failure code</returns>
HRESULT CompileShaderFromFile( WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3D10Blob** ppBlobOut );
================================================
FILE: samples/D3D11Image/D3D11Visualization/OrbitCamera.cpp
================================================
//------------------------------------------------------------------------------
// <copyright file="OrbitCamera.cpp" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
#include "OrbitCamera.h"
#ifndef DIRECTX_SDK // Windows SDK
using namespace DirectX;
using namespace DirectX::PackedVector;
#endif
/// <summary>
/// Constructor
/// </summary>
CCamera::CCamera()
{
Reset();
}
/// <summary>
/// Move camera into position
/// </summary>
int CCamera::UpdatePosition()
{
m_eye = XMVectorSet(r * sinf(theta) * cosf(phi), r * sinf(phi), -r * cosf(theta) * cosf(phi), 0.0F);
return 0;
}
/// <summary>
/// Reset the camera state to initial values
/// </summary>
void CCamera::Reset()
{
View = XMMatrixIdentity();
m_eye = XMVectorSet(0.f, 0.f, -0.3f, 0.f);
m_at = XMVectorSet(0.f, 0.f, 1.0f, 0.f);
m_up = XMVectorSet(0.f, 1.f, 0.f, 0.f);
}
/// <summary>
/// Update the view matrix
/// </summary>
void CCamera::Update()
{
View = XMMatrixLookAtLH(m_eye + m_at, m_at, m_up);
}
/// <summary>
/// Sets the center depth of the rendered image
/// </summary>
void CCamera::SetCenterDepth(float depth)
{
m_at = XMVectorSet(0.0f, 0.0f, depth, 0.0f);
}
/// <summary>
/// Sets the R value of the camera from the depth center
/// R value represents the distance of the camera from the players
/// </summary>
void CCamera::SetRadius(float r)
{
this->r = r;
UpdatePosition();
}
/// <summary>
/// Sets the Theta value of the camera from around the depth center
/// Theta represents the angle (in radians) of the camera around the
/// center in the x-y plane (circling around players)
/// </summary>
void CCamera::SetTheta(float theta)
{
this->theta = theta;
UpdatePosition();
}
/// <summary>
/// Sets the Phi value of the camera
/// Phi represents angle (in radians) of the camera around the center
/// in the y-z plane (over the top and below players)
/// </summary>
void CCamera::SetPhi(float phi)
{
this->phi = phi;
UpdatePosition();
}
================================================
FILE: samples/D3D11Image/D3D11Visualization/OrbitCamera.h
================================================
//------------------------------------------------------------------------------
// <copyright file="OrbitCamera.h" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
#pragma once
#include <windows.h>
#ifdef DIRECTX_SDK // requires DirectX SDK June 2010
#include <xnamath.h>
#define DirectX_NS // DirectX SDK requires a blank namespace for several types
#else // Windows SDK
#include <DirectXMath.h>
#include <DirectXPackedVector.h>
#define DirectX_NS DirectX // Windows SDK requires a DirectX namespace for several types
#endif
class CCamera
{
public:
DirectX_NS::XMMATRIX View;
/// <summary>
/// Constructor
/// </summary>
CCamera();
/// <summary>
/// Reset the camera state to initial values
/// </summary>
void Reset();
/// <summary>
/// Update the view matrix
/// </summary>
void Update();
/// <summary>
/// Move camera into position
/// </summary>
int UpdatePosition();
/// <summary>
/// Sets the R value of the camera.
/// R value represents the distance of the camera from the center
/// </summary>
void SetRadius(float r);
/// <summary>
/// Sets the Theta value of the camera from around the depth center
/// Theta represents the angle (in radians) of the camera around the
/// center in the x-y plane (circling around players)
/// </summary>
void SetTheta(float theta);
/// <summary>
/// Sets the Phi value of the camera
/// Phi represents angle (in radians) of the camera around the center
/// in the y-z plane (over the top and below players)
/// </summary>
void SetPhi(float phi);
/// <summary>
/// Get the camera's up vector
/// </summary>
/// <returns>camera's up vector</returns>
DirectX_NS::XMVECTOR GetUp() { return m_up; }
/// <summary>
/// Get the camera's position vector
/// </summary>
/// <returns>camera's position vector</returns>
DirectX_NS::XMVECTOR GetEye() { return m_eye; }
/// <summary>
/// Sets the center depth of the rendered image
/// </summary>
void SetCenterDepth(float depth);
private:
float r;
float theta;
float phi;
DirectX_NS::XMVECTOR m_eye;
DirectX_NS::XMVECTOR m_at;
DirectX_NS::XMVECTOR m_up;
};
================================================
FILE: samples/D3D11Image/D3D11Visualization/Resource.h
================================================
//------------------------------------------------------------------------------
// <copyright file="resource.h" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Depth-D3D.rc
//
#define IDS_APP_TITLE 103
#define IDI_APP 107
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 130
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/App.xaml
================================================
<Application x:Class="Microsoft.Samples.Wpf.D3D11Interop.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/App.xaml.cs
================================================
namespace Microsoft.Samples.Wpf.D3D11Interop
{
using System.Windows;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/MainWindow.xaml
================================================
<Window x:Class="Microsoft.Samples.Wpf.D3D11Interop.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="clr-namespace:Microsoft.Wpf.Interop.DirectX;assembly=Microsoft.Wpf.Interop.DirectX"
Title="WPF D3D11 Interop" Height="540" Width="900" Closing="Window_Closing">
<Window.Resources>
<SolidColorBrush x:Key="MediumGreyBrush" Color="#ff4e4e4e"/>
<SolidColorBrush x:Key="KinectPurpleBrush" Color="#ff52318f"/>
<Style TargetType="{x:Type CheckBox}" x:Key="SquareCheckBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<Grid>
<StackPanel Orientation="Horizontal" Background="Transparent">
<Grid x:Name="SquareCheckBoxChecked">
<Image x:Name="CheckedNormal" Source="Images\Checkbox_checked.png" Stretch="None" HorizontalAlignment="Center"/>
</Grid>
<Grid x:Name="SquareCheckBoxUnchecked" Visibility="Collapsed">
<Image x:Name="UncheckedNormal" Source="Images\Checkbox_unchecked.png" Stretch="None" HorizontalAlignment="Center"/>
</Grid>
<TextBlock x:Name="SquareCheckBoxText" Text="Recreate Surface on Resize" TextAlignment="Left" VerticalAlignment="Center" FontSize="15" Margin="9,0,0,0"/>
</StackPanel>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="false">
<Setter Property="Visibility" Value="Collapsed" TargetName="SquareCheckBoxChecked"/>
<Setter Property="Visibility" Value="Visible" TargetName="SquareCheckBoxUnchecked"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type RadioButton}" x:Key="KinectRadioButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid>
<Grid x:Name="KinectRadioButtonOnSet" HorizontalAlignment="Left">
<Image Source="Images\radiobutton_on.png" Stretch="None"/>
</Grid>
<Grid x:Name="KinectRadioButtonOnUnset" HorizontalAlignment="Left" Visibility="Collapsed">
<Image Source="Images\radiobutton_off.png" Stretch="None"/>
</Grid>
<TextBlock x:Name="KinectRadioButton" Text="{TemplateBinding Content}" TextAlignment="Left" VerticalAlignment="Center" FontSize="15" Margin="25,0,0,0"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="false">
<Setter Property="Visibility" Value="Collapsed" TargetName="KinectRadioButtonOnSet"/>
<Setter Property="Visibility" Value="Visible" TargetName="KinectRadioButtonOnUnset"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Create a slider background like the standard one-->
<LinearGradientBrush x:Key="HorizontalSliderTrackNormalBorder" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFAEB1AF" Offset="0.1"/>
<GradientStop Color="White" Offset=".9"/>
</LinearGradientBrush>
<Style x:Key="KinectSlider"
TargetType="{x:Type Slider}">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Slider}">
<Grid>
<Border Background="#FFE7EAEA" BorderBrush="{StaticResource HorizontalSliderTrackNormalBorder}" BorderThickness="1" CornerRadius="1" Margin="5,0" Height="4.0" Grid.Row="1"/>
<Track Visibility="Visible" x:Name="PART_Track">
<Track.Thumb>
<Thumb>
<Thumb.Template>
<ControlTemplate>
<Image Source="Images/Slider.png"/>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid Margin="10,0,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="62" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="250" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="1" ClipToBounds="True">
<Border Name="ControlHostElement"
BorderBrush="{StaticResource KinectPurpleBrush}"
BorderThickness="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid x:Name="host" Cursor="None">
<Rectangle Grid.Column="0" Fill="Black"/>
<Image Name ="Backdrop" Source="Images\Background.jpg"/>
<Image Stretch="Fill" Name="ImageHost" >
<Image.Source>
<dx:D3D11Image x:Name="InteropImage" />
</Image.Source>
</Image>
</Grid>
</Border>
<Canvas x:Name="MagCurserToggle2">
<Ellipse x:Name="MagEllipse" Visibility="Hidden">
<Ellipse.Fill>
<VisualBrush x:Name="MagBrush" ViewboxUnits="Absolute"
Visual="{Binding ElementName=ControlHostElement}"/>
</Ellipse.Fill>
</Ellipse>
</Canvas>
<Canvas x:Name="MagCurserToggle1" Cursor="None">
<Image Name ="MagImage" Source="Images\MagnifyingGlass.png" Visibility="Hidden"/>
</Canvas>
</Grid>
<Rectangle Grid.Column="1" Fill="{StaticResource MediumGreyBrush}" Margin="10,0,0,0"/>
<StackPanel Grid.Column="1">
<Grid Margin="20,10,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="*"/>
<RowDefinition Height="15"/>
<RowDefinition Height="25"/>
<RowDefinition Height="15"/>
<RowDefinition Height="25"/>
<RowDefinition Height="50"/>
<RowDefinition Height="35"/>
<RowDefinition Height="25"/>
<RowDefinition Height="15"/>
<RowDefinition Height="25"/>
<RowDefinition Height="15"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Magnifier" HorizontalAlignment="Left" FontSize="20" FontFamily="Segeo UI" Foreground="White"/>
<RadioButton Grid.Row="1" x:Name="MagBox" Style="{StaticResource KinectRadioButton}" IsChecked="True" FontSize="12" FontFamily="Segeo UI" Foreground="White" Content="On"/>
<RadioButton Grid.Row="1" x:Name="MagBox2" Style="{StaticResource KinectRadioButton}" IsChecked="False" FontSize="12" FontFamily="Segeo UI" Foreground="White" Content="Off" Margin="60,0"/>
<Label Grid.Row="3" HorizontalAlignment="Left" Content="_Size" VerticalAlignment="Center" FontSize="12" FontFamily="Segeo UI" Foreground="White" Target="{Binding ElementName=Size}"/>
<Slider Grid.Row="3" x:Name="Size" Style="{StaticResource KinectSlider}" Minimum="30" Maximum="300" Value="100" ValueChanged="Size_ValueChanged" Margin="50,0,30,0" FontSize="12" FontFamily="Segeo UI" Foreground="White"/>
<Label Grid.Row="5" HorizontalAlignment="Left" Content="_Scale" VerticalAlignment="Center" FontSize="12" FontFamily="Segeo UI" Foreground="White" Target="{Binding ElementName=Scale}"/>
<Slider Grid.Row="5" x:Name="Scale" Style="{StaticResource KinectSlider}" Minimum="1" Value="2" Maximum="5" ValueChanged="Scale_ValueChanged" Margin="50,0,30,0"/>
<TextBlock Grid.Row="7" Text="Camera Position" HorizontalAlignment="Left" FontSize="20" FontFamily="Segeo UI" Foreground="White"/>
<Label Grid.Row="8" Content="_Radius" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="Segeo UI" Foreground="White" Target="{Binding ElementName=RadiusSlider}"/>
<Slider Grid.Row="8" x:Name="RadiusSlider" Style="{StaticResource KinectSlider}" ValueChanged="Radius_ValueChanged" Minimum=".1" Value="2" Maximum="5" Margin="50,0,30,0" DataContext="{Binding}" />
<Label Grid.Row="10" Content="_Theta" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="Segeo UI" Foreground="White" Target="{Binding ElementName=ThetaSlider}"/>
<Slider Grid.Row="10" x:Name="ThetaSlider" Style="{StaticResource KinectSlider}" ValueChanged="Theta_ValueChanged" Minimum="-180" Maximum="180" Value="0" Margin="50,0,30,0"/>
<Label Grid.Row="12" Content="_Phi" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="Segeo UI" Foreground="White" Target="{Binding ElementName=PhiSlider}"/>
<Slider Grid.Row="12" x:Name="PhiSlider" Style="{StaticResource KinectSlider}" ValueChanged="Phi_ValueChanged" Minimum="-89.9" Maximum="89.9" Value="0" Margin="50,0,30,0"/>
</Grid>
</StackPanel>
</Grid>
<TextBlock Text="WPF D3D11 Interop" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,0,17" FontSize="14" Foreground="{StaticResource MediumGreyBrush}" FontFamily="Segoe UI"/>
</Grid>
</Window>
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/MainWindow.xaml.cs
================================================
namespace Microsoft.Samples.Wpf.D3D11Interop
{
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
// Magnifier Image Settings
private const double MagImageScale = 1.25; // Scale of image to magnified ellipse
private const double MagImageOffset = 0.12; // Offset of magnified ellipse within image
// Unit conversion
private const float DegreesToRadians = (float)Math.PI / 180;
// State Management
private bool magnify = true;
TimeSpan lastRender;
bool lastVisible;
// Magnifier Settings (filled by default slider vlaues)
private double magSize;
private double magScale;
public MainWindow()
{
this.InitializeComponent();
this.host.Loaded += new RoutedEventHandler(this.Host_Loaded);
this.host.SizeChanged += new SizeChangedEventHandler(this.Host_SizeChanged);
}
private static bool Init()
{
bool initSucceeded = NativeMethods.InvokeWithDllProtection(() => NativeMethods.Init()) >= 0;
if (!initSucceeded)
{
MessageBox.Show("Failed to initialize.", "WPF D3D Interop", MessageBoxButton.OK, MessageBoxImage.Error);
if (Application.Current != null)
{
Application.Current.Shutdown();
}
}
return initSucceeded;
}
private static void Cleanup()
{
NativeMethods.InvokeWithDllProtection(NativeMethods.Cleanup);
}
private static int Render(IntPtr resourcePointer, bool isNewSurface)
{
return NativeMethods.InvokeWithDllProtection(() => NativeMethods.Render(resourcePointer, isNewSurface));
}
private static int SetCameraRadius(float radius)
{
return NativeMethods.InvokeWithDllProtection(() => NativeMethods.SetCameraRadius(radius));
}
private static int SetCameraTheta(float theta)
{
return NativeMethods.InvokeWithDllProtection(() => NativeMethods.SetCameraTheta(theta));
}
private static int SetCameraPhi(float phi)
{
return NativeMethods.InvokeWithDllProtection(() => NativeMethods.SetCameraPhi(phi));
}
#region Callbacks
private void Host_Loaded(object sender, RoutedEventArgs e)
{
Init();
this.InitializeRendering();
// Setup the Magnifier Size
MagEllipse.Height = this.magSize;
MagEllipse.Width = this.magSize;
Scale.Value = this.magScale;
// Add mouse over event
host.MouseMove += this.MagElement_MouseMove;
ImageHost.MouseMove += this.MagElement_MouseMove;
MagEllipse.MouseMove += this.MagElement_MouseMove;
MagImage.MouseMove += this.MagElement_MouseMove;
host.MouseLeave += this.MagElement_MouseLeave;
MagEllipse.MouseLeave += this.MagElement_MouseLeave;
ImageHost.MouseLeave += this.MagElement_MouseLeave;
MagImage.MouseLeave += this.MagElement_MouseLeave;
MagBox.Checked += this.MagBox_Checked;
MagBox.Unchecked += this.MagBox_Unchecked;
}
private void Host_SizeChanged(object sender, SizeChangedEventArgs e)
{
double dpiScale = 1.0; // default value for 96 dpi
// determine DPI
// (as of .NET 4.6.1, this returns the DPI of the primary monitor, if you have several different DPIs)
var hwndTarget = PresentationSource.FromVisual(this).CompositionTarget as HwndTarget;
if (hwndTarget != null)
{
dpiScale = hwndTarget.TransformToDevice.M11;
}
int surfWidth = (int)(host.ActualWidth < 0 ? 0 : Math.Ceiling(host.ActualWidth * dpiScale));
int surfHeight = (int)(host.ActualHeight < 0 ? 0 : Math.Ceiling(host.ActualHeight * dpiScale));
// Notify the D3D11Image of the pixel size desired for the DirectX rendering.
// The D3DRendering component will determine the size of the new surface it is given, at that point.
InteropImage.SetPixelSize(surfWidth, surfHeight);
// Stop rendering if the D3DImage isn't visible - currently just if width or height is 0
// TODO: more optimizations possible (scrolled off screen, etc...)
bool isVisible = (surfWidth != 0 && surfHeight != 0);
if (lastVisible != isVisible)
{
lastVisible = isVisible;
if (lastVisible)
{
CompositionTarget.Rendering += CompositionTarget_Rendering;
}
else
{
CompositionTarget.Rendering -= CompositionTarget_Rendering;
}
}
}
private void Scale_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
this.magScale = e.NewValue;
}
private void Size_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
this.magSize = e.NewValue;
// Setup the Magnifier Size
this.MagEllipse.Height = this.magSize;
this.MagEllipse.Width = this.magSize;
}
private void MagBox_Checked(object sender, RoutedEventArgs e)
{
this.magnify = true;
MagCurserToggle1.Cursor = System.Windows.Input.Cursors.None;
MagCurserToggle2.Cursor = System.Windows.Input.Cursors.None;
host.Cursor = System.Windows.Input.Cursors.None;
}
private void MagBox_Unchecked(object sender, RoutedEventArgs e)
{
this.magnify = false;
MagCurserToggle1.Cursor = System.Windows.Input.Cursors.Arrow;
MagCurserToggle2.Cursor = System.Windows.Input.Cursors.Arrow;
host.Cursor = System.Windows.Input.Cursors.Arrow;
}
private void MagElement_MouseMove(object sender, MouseEventArgs e)
{
if (this.magnify)
{
Point point = Mouse.GetPosition(host);
if (!(point.X < 0 || point.Y < 0 || point.X > host.ActualWidth || point.Y > host.ActualHeight))
{
// Draw the Magnified ellipse on top of image
System.Windows.Controls.Canvas.SetTop(this.MagEllipse, point.Y - (this.magSize / 2));
System.Windows.Controls.Canvas.SetLeft(this.MagEllipse, point.X - (this.magSize / 2));
// Set the magnifier image on top of magnified ellipse
System.Windows.Controls.Canvas.SetTop(this.MagImage, point.Y - (this.magSize * (.5 + MagImageOffset)));
System.Windows.Controls.Canvas.SetLeft(this.MagImage, point.X - (this.magSize * (.5 + MagImageOffset)));
MagImage.Width = this.magSize * MagImageScale;
MagEllipse.Visibility = System.Windows.Visibility.Visible;
MagImage.Visibility = System.Windows.Visibility.Visible;
double magViewboxSize = this.magSize / this.magScale;
MagBrush.Viewbox = new Rect(point.X - (.5 * magViewboxSize), point.Y - (.5 * magViewboxSize), magViewboxSize, magViewboxSize);
}
else
{
MagEllipse.Visibility = Visibility.Hidden;
MagImage.Visibility = Visibility.Hidden;
}
}
}
private void MagElement_MouseLeave(object sender, MouseEventArgs e)
{
MagEllipse.Visibility = Visibility.Hidden;
MagImage.Visibility = Visibility.Hidden;
}
private void Radius_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
SetCameraRadius((float)e.NewValue);
}
private void Theta_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
SetCameraTheta((float)e.NewValue * DegreesToRadians);
}
private void Phi_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
SetCameraPhi((float)e.NewValue * DegreesToRadians);
}
#endregion Callbacks
#region Helpers
private void InitializeRendering()
{
InteropImage.WindowOwner = (new System.Windows.Interop.WindowInteropHelper(this)).Handle;
InteropImage.OnRender = this.DoRender;
// Set up camera
SetCameraRadius((float)RadiusSlider.Value);
SetCameraPhi((float)PhiSlider.Value * DegreesToRadians);
SetCameraTheta((float)ThetaSlider.Value * DegreesToRadians);
// Start rendering now!
InteropImage.RequestRender();
}
void CompositionTarget_Rendering(object sender, EventArgs e)
{
RenderingEventArgs args = (RenderingEventArgs)e;
// It's possible for Rendering to call back twice in the same frame
// so only render when we haven't already rendered in this frame.
if (this.lastRender != args.RenderingTime)
{
InteropImage.RequestRender();
this.lastRender = args.RenderingTime;
}
}
private void UninitializeRendering()
{
Cleanup();
CompositionTarget.Rendering -= this.CompositionTarget_Rendering;
}
#endregion Helpers
private void DoRender(IntPtr surface, bool isNewSurface)
{
Render(surface, isNewSurface);
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.UninitializeRendering();
host.MouseMove -= this.MagElement_MouseMove;
ImageHost.MouseMove -= this.MagElement_MouseMove;
MagEllipse.MouseMove -= this.MagElement_MouseMove;
MagImage.MouseMove -= this.MagElement_MouseMove;
host.MouseLeave -= this.MagElement_MouseLeave;
MagEllipse.MouseLeave -= this.MagElement_MouseLeave;
ImageHost.MouseLeave -= this.MagElement_MouseLeave;
MagImage.MouseLeave -= this.MagElement_MouseLeave;
MagBox.Checked -= this.MagBox_Checked;
MagBox.Unchecked -= this.MagBox_Unchecked;
}
private static class NativeMethods
{
/// <summary>
/// Variable used to track whether the missing dependency dialog has been displayed,
/// used to prevent multiple notifications of the same failure.
/// </summary>
private static bool errorHasDisplayed;
[DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int Init();
[DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void Cleanup();
[DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int Render(IntPtr resourcePointer, bool isNewSurface);
[DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int SetCameraRadius(float radius);
[DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int SetCameraTheta(float theta);
[DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int SetCameraPhi(float phi);
/// <summary>
/// Method used to invoke an Action that will catch DllNotFoundExceptions and display a warning dialog.
/// </summary>
/// <param name="action">The Action to invoke.</param>
public static void InvokeWithDllProtection(Action action)
{
InvokeWithDllProtection(
() =>
{
action.Invoke();
return 0;
});
}
/// <summary>
/// Method used to invoke A Func that will catch DllNotFoundExceptions and display a warning dialog.
/// </summary>
/// <param name="func">The Func to invoke.</param>
/// <returns>The return value of func, or default(T) if a DllNotFoundException was caught.</returns>
/// <typeparam name="T">The return type of the func.</typeparam>
public static T InvokeWithDllProtection<T>(Func<T> func)
{
try
{
return func.Invoke();
}
catch (DllNotFoundException e)
{
if (!errorHasDisplayed)
{
MessageBox.Show("This sample requires:\nManual build of the D3DVisualization project, which requires installation of Windows 10 SDK or DirectX SDK.\n" +
"Installation of the DirectX runtime on non-build machines.\n\n"+
"Detailed exception message: " + e.Message, "WPF D3D11 Interop",
MessageBoxButton.OK, MessageBoxImage.Error);
errorHasDisplayed = true;
if (Application.Current != null)
{
Application.Current.Shutdown();
}
}
}
return default(T);
}
}
}
}
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/Properties/AssemblyInfo.cs
================================================
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Wpf D3D11 Interop Sample")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// In order to begin building localizable applications, set
// <UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
// inside a <PropertyGroup>. For example, if you are using US english
// in your source files, set the <UICulture> to en-US. Then uncomment
// the NeutralResourceLanguage attribute below. Update the "en-US" in
// the line below to match the UICulture setting in the project file.
////[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, // where theme specific resource dictionaries are located
// (used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly // where the generic resource dictionary is located
// (used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: CLSCompliant(true)]
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/Properties/Resources.Designer.cs
================================================
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Samples.Wpf.D3D11Interop.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("D3D11ImageSample.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/Properties/Resources.resx
================================================
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/Properties/Settings.Designer.cs
================================================
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Samples.Wpf.D3D11Interop.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/Properties/Settings.settings
================================================
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/WpfD3D11Interop.csproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{19855A82-A7EC-4E95-B0C4-B1A2356732B7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Samples.Wpf.D3D11Interop</RootNamespace>
<AssemblyName>WpfD3D11Interop</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>..\x86\Debug\</OutputPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<UseVSHostingProcess>false</UseVSHostingProcess>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>..\x86\Release\</OutputPath>
<DebugType>pdbonly</DebugType>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\x64\Debug\</OutputPath>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>..\x64\Release\</OutputPath>
<DebugType>pdbonly</DebugType>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Wpf.Interop.DirectX">
<HintPath>..\packages\Microsoft.Wpf.Interop.DirectX-x64.0.9.0-beta-22856\lib\net45\Microsoft.Wpf.Interop.DirectX.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Checkbox_checked.png" />
<Resource Include="Images\Checkbox_unchecked.png" />
<Resource Include="Images\MagnifyingGlass.PNG" />
<Resource Include="Images\background.jpg" />
<Resource Include="Images\radiobutton_off.png" />
<Resource Include="Images\radiobutton_on.png" />
<Resource Include="Images\Slider.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/app.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
================================================
FILE: samples/D3D11Image/WpfD3D11Interop/packages.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Wpf.Interop.DirectX-x64" version="0.9.0-beta-22856" targetFramework="net45" />
</packages>
================================================
FILE: samples/D3D11Image/WpfD3D11Interop_dxsdk.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfD3D11Interop", "WpfD3D11Interop\WpfD3D11Interop.csproj", "{19855A82-A7EC-4E95-B0C4-B1A2356732B7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3DVisualization_dxsdk", "D3D11Visualization\D3DVisualization_dxsdk.vcxproj", "{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Debug|x64.ActiveCfg = Debug|x64
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Debug|x64.Build.0 = Debug|x64
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Debug|x86.ActiveCfg = Debug|Win32
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Debug|x86.Build.0 = Debug|Win32
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Release|x64.ActiveCfg = Release|x64
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Release|x64.Build.0 = Release|x64
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Release|x86.ActiveCfg = Release|Win32
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Release|x86.Build.0 = Release|Win32
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Debug|x64.ActiveCfg = Debug|x64
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Debug|x64.Build.0 = Debug|x64
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Debug|x86.ActiveCfg = Debug|Win32
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Debug|x86.Build.0 = Debug|Win32
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Release|x64.ActiveCfg = Release|x64
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Release|x64.Build.0 = Release|x64
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Release|x86.ActiveCfg = Release|Win32
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Release|x86.Build.0 = Release|Win32
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x64.ActiveCfg = Debug|x64
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x64.Build.0 = Debug|x64
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x86.ActiveCfg = Debug|Win32
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x86.Build.0 = Debug|Win32
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x64.ActiveCfg = Release|x64
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x64.Build.0 = Release|x64
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x86.ActiveCfg = Release|Win32
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: samples/D3D11Image/WpfD3D11Interop_winsdk.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfD3D11Interop", "WpfD3D11Interop\WpfD3D11Interop.csproj", "{19855A82-A7EC-4E95-B0C4-B1A2356732B7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3DVisualization_winsdk", "D3D11Visualization\D3DVisualization_winsdk.vcxproj", "{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Debug|x64.ActiveCfg = Debug|x64
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Debug|x64.Build.0 = Debug|x64
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Debug|x86.ActiveCfg = Debug|Win32
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Debug|x86.Build.0 = Debug|Win32
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Release|x64.ActiveCfg = Release|x64
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Release|x64.Build.0 = Release|x64
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Release|x86.ActiveCfg = Release|Win32
{19855A82-A7EC-4E95-B0C4-B1A2356732B7}.Release|x86.Build.0 = Release|Win32
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Debug|x64.ActiveCfg = Debug|x64
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Debug|x64.Build.0 = Debug|x64
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Debug|x86.ActiveCfg = Debug|Win32
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Debug|x86.Build.0 = Debug|Win32
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Release|x64.ActiveCfg = Release|x64
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Release|x64.Build.0 = Release|x64
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Release|x86.ActiveCfg = Release|Win32
{3FEB553A-62BD-42E1-9A70-0CD3E45929D0}.Release|x86.Build.0 = Release|Win32
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x64.ActiveCfg = Debug|x64
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x64.Build.0 = Debug|x64
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x86.ActiveCfg = Debug|Win32
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x86.Build.0 = Debug|Win32
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x64.ActiveCfg = Release|x64
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x64.Build.0 = Release|x64
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x86.ActiveCfg = Release|Win32
{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: scripts/BuildNuGetPackage.cmd
================================================
nuget.exe pack Microsoft.Wpf.Interop.DirectX.nuspec -Version 0.9.0-beta-99999 -Properties ArchitecturePublicName=x64;NuGetBinaries=..\src\x64\release -symbols
nuget.exe pack Microsoft.Wpf.Interop.DirectX.nuspec -Version 0.9.0-beta-99999 -Properties ArchitecturePublicName=x86;NuGetBinaries=..\src\release -symbols
================================================
FILE: scripts/Microsoft.Wpf.Interop.DirectX.nuspec
================================================
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Microsoft.Wpf.Interop.DirectX-$ArchitecturePublicName$</id>
<title>Microsoft.Wpf.Interop.DirectX-$ArchitecturePublicName$</title>
<version>$version$</version>
<authors>Microsoft</authors>
<owners>Microsoft, NugetWPF</owners>
<copyright>© Microsoft Corporation. All rights reserved</copyright>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>https://github.com/Microsoft/WPFDXInterop/blob/master/LICENSE</licenseUrl>
<summary>Microsoft.Wpf.Interop.DirectX provides a new implementation of D3DImage that enables you to seamlessly interop with DirectX 10 or 11 content in your WPF application.</summary>
<projectUrl>https://github.com/Microsoft/WPFDXInterop </projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=532657</iconUrl>
<tags>WPF DirectX D3DImage D3D11Image DirectX11 DirectX10</tags>
<description>
Microsoft.Wpf.Interop.DirectX.D3D11Image is a version of D3DImage that supports DirectX 11 or DirectX 10. For more information, check out the project here: https://github.com/Microsoft/WPFDXInterop
</description>
</metadata>
<files>
<file src="$NuGetBinaries$\Microsoft.Wpf.Interop.DirectX.dll" target="lib\net45\Microsoft.Wpf.Interop.DirectX.dll" />
<file src="$NuGetBinaries$\Microsoft.Wpf.Interop.DirectX.pdb" target="lib\net45\Microsoft.Wpf.Interop.DirectX.pdb" />
</files>
</package>
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/AssemblyInfo.cpp
================================================
// Copyright (c) Microsoft Corporation. All rights reserved.
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/D3D11Image.cpp
================================================
#include "D3D11Image.h"
namespace Microsoft {
namespace Wpf {
namespace Interop {
namespace DirectX {
static D3D11Image::D3D11Image()
{
OnRenderProperty = DependencyProperty::Register("OnRender",
Action<IntPtr, bool>::typeid,
D3D11Image::typeid,
gcnew UIPropertyMetadata(nullptr, gcnew PropertyChangedCallback(&RenderChanged)));
WindowOwnerProperty = DependencyProperty::Register("WindowOwner",
IntPtr::typeid,
D3D11Image::typeid,
gcnew UIPropertyMetadata(IntPtr::Zero, gcnew PropertyChangedCallback(&HWNDOwnerChanged)));
}
D3D11Image::D3D11Image()
{
}
D3D11Image::~D3D11Image()
{
if (this->Helper != nullptr)
{
this->Helper->~SurfaceQueueInteropHelper();
this->Helper = nullptr;
}
}
Freezable^ D3D11Image::CreateInstanceCore()
{
return gcnew D3D11Image();
}
void D3D11Image::HWNDOwnerChanged(DependencyObject^ sender, DependencyPropertyChangedEventArgs args)
{
D3D11Image^ image = dynamic_cast<D3D11Image^>(sender);
if (image != nullptr)
{
if (image->Helper != nullptr)
{
image->Helper->HWND = static_cast<IntPtr>(args.NewValue);
}
}
}
void D3D11Image::RenderChanged(DependencyObject^ sender, DependencyPropertyChangedEventArgs args)
{
D3D11Image^ image = dynamic_cast<D3D11Image^>(sender);
if (image != nullptr)
{
if (image->Helper != nullptr)
{
image->Helper->RenderD2D = static_cast<Action<IntPtr, bool>^>(args.NewValue);
}
}
}
void D3D11Image::EnsureHelper()
{
if (this->Helper == nullptr)
{
this->Helper = gcnew SurfaceQueueInteropHelper();
this->Helper->HWND = this->WindowOwner;
this->Helper->D3DImage = this;
this->Helper->RenderD2D = this->OnRender;
}
}
void D3D11Image::RequestRender()
{
this->EnsureHelper();
// Don't bother with a call if there's no callback registered.
if (nullptr != this->OnRender)
{
this->Helper->RequestRenderD2D();
}
}
void D3D11Image::SetPixelSize(int pixelWidth, int pixelHeight)
{
this->EnsureHelper();
this->Helper->SetPixelSize(static_cast<UInt32>(pixelWidth), static_cast<UInt32>(pixelHeight));
}
}
}
}
}
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/D3D11Image.h
================================================
// SurfaceQueueInteropHelper.h
#pragma once
#include "SurfaceQueueInteropHelper.h"
using namespace System;
using namespace System::Windows;
using namespace System::Windows::Interop;
using namespace Microsoft::Windows::Media;
namespace Microsoft {
namespace Wpf {
namespace Interop {
namespace DirectX {
/// A System.Windows.Media.ImageSource which displays a user provided DirectX 10 or 11 surface.
public ref class D3D11Image :
public D3DImage
{
private:
static void RenderChanged(DependencyObject^ sender, DependencyPropertyChangedEventArgs args);
static void HWNDOwnerChanged(DependencyObject^ sender, DependencyPropertyChangedEventArgs args);
void EnsureHelper();
static D3D11Image();
internal:
SurfaceQueueInteropHelper^ Helper;
protected:
Freezable^ CreateInstanceCore() override;
public:
D3D11Image();
~D3D11Image();
static DependencyProperty^ OnRenderProperty;
static DependencyProperty^ WindowOwnerProperty;
/// The OnRender action delegate will fire and pass the surface to the application that the DirectX rendering component should
/// render into.
property Action<IntPtr, bool>^ OnRender
{
Action<IntPtr, bool>^ get()
{
return static_cast<Action<IntPtr, bool>^>(GetValue(OnRenderProperty));
}
void set(Action<IntPtr, bool>^ value)
{
SetValue(OnRenderProperty, value);
}
}
/// The window handle (HWND) of the Window which hosts the D3D11Image (used during DirectX surface creation).
property IntPtr WindowOwner
{
IntPtr get()
{
return static_cast<IntPtr>(GetValue(WindowOwnerProperty));
}
void set(IntPtr value)
{
SetValue(WindowOwnerProperty, value);
}
}
/// The RequestRender method signals that the D3D11Image should get the DirectX rendering code to render a new frame to the provided surface.
/// Typically the user of the D3D11Image calls this every time the CompositionTarget.Rendering event fires.
void RequestRender();
/// The application hosting the D3D11Image should ensure that the PixelSize is the number of pixels that the D3D11Image is
/// being displayed in.
void SetPixelSize(int pixelWidth, int pixelHeight);
};
}
}
}
}
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_dxsdk.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AssemblyInfo.cpp" />
<ClCompile Include="Stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="SurfaceQueueInteropHelper.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Stdafx.h" />
<ClInclude Include="SurfaceQueueInteropHelper.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="SurfaceQueue.h" />
<ClInclude Include="SurfaceQueueImpl.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SurfaceDevice10.cpp" />
<ClCompile Include="SurfaceDevice11.cpp" />
<ClCompile Include="SurfaceDevice9.cpp" />
<ClCompile Include="SurfaceQueue.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="SurfaceQueue.inl" />
</ItemGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<TargetName>Microsoft.Wpf.Interop.DirectX</TargetName>
<RootNamespace>Microsoft.Wpf.Interop.DirectX</RootNamespace>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DIRECTX_SDK;WIN32;_DEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
dxgi.lib;d3d9.lib;d3dx9d.lib;d3d10_1.lib;d3dx10d.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x86;..\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DIRECTX_SDK;_DEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
dxgi.lib;d3d9.lib;d3dx9d.lib;d3d10_1.lib;d3dx10d.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x64;..\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DIRECTX_SDK;WIN32;NDEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Async</ExceptionHandling>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
dxgi.lib;d3d9.lib;d3dx9d.lib;d3d10_1.lib;d3dx10d.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x86;..\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DIRECTX_SDK;NDEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Async</ExceptionHandling>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
dxgi.lib;d3d9.lib;d3dx9d.lib;d3d10_1.lib;d3dx10d.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x64;..\x64\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_winsdk.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AssemblyInfo.cpp" />
<ClCompile Include="D3D11Image.cpp" />
<ClCompile Include="Stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="SurfaceQueueInteropHelper.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="D3D11Image.h" />
<ClInclude Include="Stdafx.h" />
<ClInclude Include="SurfaceQueueInteropHelper.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="SurfaceQueue.h" />
<ClInclude Include="SurfaceQueueImpl.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SurfaceDevice10.cpp" />
<ClCompile Include="SurfaceDevice11.cpp" />
<ClCompile Include="SurfaceDevice9.cpp" />
<ClCompile Include="SurfaceQueue.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="SurfaceQueue.inl" />
</ItemGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<TargetName>Microsoft.Wpf.Interop.DirectX</TargetName>
<RootNamespace>Microsoft.Wpf.Interop.DirectX</RootNamespace>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<ProjectName>Microsoft.Wpf.Interop.DirectX_winsdk</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<LibraryPath>$(LibraryPath)</LibraryPath>
<IncludePath>$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<LibraryPath>$(LibraryPath)</LibraryPath>
<IncludePath>$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
dxgi.lib;d3d9.lib;d3d10_1.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>..\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DebugInformationFormat>
</DebugInformationFormat>
<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
dxgi.lib;d3d9.lib;d3d10_1.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Async</ExceptionHandling>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
dxgi.lib;d3d9.lib;d3d10_1.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>..\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Async</ExceptionHandling>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
dxgi.lib;d3d9.lib;d3d10_1.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<FixedBaseAddress>false</FixedBaseAddress>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/Stdafx.cpp
================================================
// stdafx.cpp : source file that includes just the standard includes
// SurfaceQueueInteropHelper.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/Stdafx.h
================================================
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
// Windows Header Files:
#include <windows.h>
// C RunTime Header Files
#include <stdlib.h>
#include <stdio.h>
#include "SurfaceQueue.h"
#if DIRECTX_SDK
#include <d3dx9.h>
#else
#include "d3d9.h"
#endif
#include <D3D10_1.h>
//#include <d3dx10.h>
#define IFC(x) { hr = (x); if (FAILED(hr)) { goto Cleanup; }}
#define ReleaseInterface(x) { if (NULL != x) { x->Release(); x = NULL; }}
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice10.cpp
================================================
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#include "SurfaceQueueImpl.h"
//-----------------------------------------------------------------------------
// Implementation of D3D10 Device Wrapper. This is a simple wrapper around the
// public D3D10 APIs that are necessary for the shared surface queue. See
// the comments in SharedSurfaceQueue.h to descriptions of these functions.
//-----------------------------------------------------------------------------
CSurfaceQueueDeviceD3D10::CSurfaceQueueDeviceD3D10(ID3D10Device* pD3D10Device) :
m_pDevice(pD3D10Device)
{
ASSERT(m_pDevice);
if (NULL != m_pDevice)
{
m_pDevice->AddRef();
}
}
CSurfaceQueueDeviceD3D10::~CSurfaceQueueDeviceD3D10()
{
m_pDevice->Release();
}
HRESULT CSurfaceQueueDeviceD3D10::CreateSharedSurface(
UINT Width, UINT Height,
DXGI_FORMAT format,
IUnknown** ppUnknown,
HANDLE* pHandle)
{
ASSERT(m_pDevice);
ASSERT(ppUnknown);
ASSERT(pHandle);
if (NULL == m_pDevice || NULL == ppUnknown || NULL == pHandle)
{
return E_FAIL;
}
HRESULT hr;
ID3D10Texture2D** ppTexture = (ID3D10Texture2D**)ppUnknown;
D3D10_TEXTURE2D_DESC Desc;
Desc.Width = Width;
Desc.Height = Height;
Desc.MipLevels = 1;
Desc.ArraySize = 1;
Desc.Format = format;
Desc.SampleDesc.Count = 1;
Desc.SampleDesc.Quality = 0;
Desc.Usage = D3D10_USAGE_DEFAULT;
Desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
Desc.CPUAccessFlags = 0;
Desc.MiscFlags = D3D10_RESOURCE_MISC_SHARED;
hr = m_pDevice->CreateTexture2D(&Desc, NULL, ppTexture);
if (SUCCEEDED(hr))
{
if (FAILED( GetSharedHandle(*ppUnknown, pHandle)))
{
(*ppTexture)->Release();
(*ppTexture) = NULL;
}
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D10::OpenSurface(
HANDLE hSharedHandle,
void** ppSurface,
UINT,
UINT,
DXGI_FORMAT)
{
return m_pDevice->OpenSharedResource(hSharedHandle, __uuidof(ID3D10Texture2D), ppSurface);
}
HRESULT CSurfaceQueueDeviceD3D10::GetSharedHandle(IUnknown* pUnknown, HANDLE* pHandle)
{
ASSERT(pUnknown);
ASSERT(pHandle);
if (NULL == pUnknown || NULL == pHandle)
{
return E_FAIL;
}
HRESULT hr = S_OK;
*pHandle = NULL;
IDXGIResource* pSurface;
if (FAILED(hr = pUnknown->QueryInterface(__uuidof(IDXGIResource), (void**)&pSurface)))
{
return hr;
}
hr = pSurface->GetSharedHandle(pHandle);
pSurface->Release();
return hr;
}
HRESULT CSurfaceQueueDeviceD3D10::CreateCopyResource(DXGI_FORMAT format, UINT width, UINT height, IUnknown** ppRes)
{
ASSERT(ppRes);
ASSERT(m_pDevice);
if (NULL == ppRes || NULL == m_pDevice)
{
return E_FAIL;
}
D3D10_TEXTURE2D_DESC Desc;
Desc.Width = width;
Desc.Height = height;
Desc.MipLevels = 1;
Desc.ArraySize = 1;
Desc.Format = format;
Desc.SampleDesc.Count = 1;
Desc.SampleDesc.Quality = 0;
Desc.Usage = D3D10_USAGE_STAGING;
Desc.BindFlags = 0;
Desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ;
Desc.MiscFlags = 0;
return m_pDevice->CreateTexture2D(&Desc, NULL, reinterpret_cast<ID3D10Texture2D**>(ppRes));
}
HRESULT CSurfaceQueueDeviceD3D10::CopySurface(IUnknown* pDst, IUnknown* pSrc, UINT width, UINT height)
{
HRESULT hr;
D3D10_BOX UnitBox = {0, 0, 0, width, height, 1};
ID3D10Resource* pSrcRes = NULL;
ID3D10Resource* pDstRes = NULL;
if (FAILED(hr = pDst->QueryInterface(__uuidof(ID3D10Resource), (void**)&pDstRes)))
{
goto end;
}
if (FAILED(hr = pSrc->QueryInterface(__uuidof(ID3D10Resource), (void**)&pSrcRes)))
{
goto end;
}
m_pDevice->CopySubresourceRegion(
pDstRes,
0,
0, 0, 0, //(x, y, z)
pSrcRes,
0,
&UnitBox);
end:
if (pSrcRes)
{
pSrcRes->Release();
}
if (pDstRes)
{
pDstRes->Release();
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D10::LockSurface(IUnknown* pSurface, DWORD flags)
{
ASSERT(pSurface);
if (NULL == pSurface)
{
return E_FAIL;
}
HRESULT hr = S_OK;
ID3D10Texture2D* pTex2D = NULL;
DWORD d3d10flags = 0;
D3D10_MAPPED_TEXTURE2D region;
if (flags & SURFACE_QUEUE_FLAG_DO_NOT_WAIT)
{
flags |= D3D10_MAP_FLAG_DO_NOT_WAIT;
}
if (FAILED(hr = pSurface->QueryInterface(__uuidof(ID3D10Texture2D), (void**)&pTex2D)))
{
goto end;
}
hr = pTex2D->Map(0, D3D10_MAP_READ, d3d10flags, ®ion);
end:
if (pTex2D)
{
pTex2D->Release();
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D10::UnlockSurface(IUnknown* pSurface)
{
ASSERT(pSurface);
if (NULL == pSurface)
{
return E_FAIL;
}
HRESULT hr = S_OK;
ID3D10Texture2D* pTex2D = NULL;
if (FAILED(hr = pSurface->QueryInterface(__uuidof(ID3D10Texture2D), (void**)&pTex2D)))
{
return hr;
}
pTex2D->Unmap(0);
pTex2D->Release();
return hr;
}
BOOL CSurfaceQueueDeviceD3D10::ValidateREFIID(REFIID id)
{
return (id == __uuidof(ID3D10Texture2D)) ||
(id == __uuidof(IDXGISurface));
}
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice11.cpp
================================================
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#include "SurfaceQueueImpl.h"
//-----------------------------------------------------------------------------
// Implementation of D3D11 Device Wrapper. This is a simple wrapper around the
// public D3D11 APIs that are necessary for the shared surface queue. See
// the comments in SharedSurfaceQueue.h to descriptions of these functions.
//-----------------------------------------------------------------------------
CSurfaceQueueDeviceD3D11::CSurfaceQueueDeviceD3D11(ID3D11Device* pD3D11Device) :
m_pDevice(pD3D11Device)
{
ASSERT(m_pDevice);
if (NULL != m_pDevice)
{
m_pDevice->AddRef();
}
}
CSurfaceQueueDeviceD3D11::~CSurfaceQueueDeviceD3D11()
{
m_pDevice->Release();
}
HRESULT CSurfaceQueueDeviceD3D11::CreateSharedSurface(
UINT Width, UINT Height,
DXGI_FORMAT format,
IUnknown** ppUnknown,
HANDLE* pHandle)
{
ASSERT(m_pDevice);
ASSERT(ppUnknown);
ASSERT(pHandle);
if(NULL == m_pDevice || NULL == ppUnknown || NULL == pHandle)
{
return E_FAIL;
}
HRESULT hr;
ID3D11Texture2D** ppTexture = (ID3D11Texture2D**)ppUnknown;
D3D11_TEXTURE2D_DESC Desc;
Desc.Width = Width;
Desc.Height = Height;
Desc.MipLevels = 1;
Desc.ArraySize = 1;
Desc.Format = format;
Desc.SampleDesc.Count = 1;
Desc.SampleDesc.Quality = 0;
Desc.Usage = D3D11_USAGE_DEFAULT;
Desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
Desc.CPUAccessFlags = 0;
Desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
hr = m_pDevice->CreateTexture2D(&Desc, NULL, ppTexture);
if (SUCCEEDED(hr))
{
if (FAILED( GetSharedHandle(*ppUnknown, pHandle)))
{
(*ppTexture)->Release();
(*ppTexture) = NULL;
}
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D11::OpenSurface(
HANDLE hSharedHandle,
void** ppSurface,
UINT,
UINT,
DXGI_FORMAT)
{
return m_pDevice->OpenSharedResource(hSharedHandle, __uuidof(ID3D11Texture2D), ppSurface);
}
HRESULT CSurfaceQueueDeviceD3D11::GetSharedHandle(IUnknown* pUnknown, HANDLE* pHandle)
{
ASSERT(pUnknown);
ASSERT(pHandle);
if(NULL == pUnknown || NULL == pHandle)
{
return E_FAIL;
}
HRESULT hr = S_OK;
*pHandle = NULL;
IDXGIResource* pSurface;
if (FAILED(hr = pUnknown->QueryInterface(__uuidof(IDXGIResource), (void**)&pSurface)))
{
return hr;
}
hr = pSurface->GetSharedHandle(pHandle);
pSurface->Release();
return hr;
}
HRESULT CSurfaceQueueDeviceD3D11::CreateCopyResource(DXGI_FORMAT format, UINT width, UINT height, IUnknown** ppRes)
{
ASSERT(ppRes);
ASSERT(m_pDevice);
if(NULL == ppRes || NULL == m_pDevice)
{
return E_FAIL;
}
D3D11_TEXTURE2D_DESC Desc;
Desc.Width = width;
Desc.Height = height;
Desc.MipLevels = 1;
Desc.ArraySize = 1;
Desc.Format = format;
Desc.SampleDesc.Count = 1;
Desc.SampleDesc.Quality = 0;
Desc.Usage = D3D11_USAGE_STAGING;
Desc.BindFlags = 0;
Desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
Desc.MiscFlags = 0;
return m_pDevice->CreateTexture2D(&Desc, NULL, reinterpret_cast<ID3D11Texture2D**>(ppRes));
}
HRESULT CSurfaceQueueDeviceD3D11::CopySurface(IUnknown* pDst, IUnknown* pSrc, UINT width, UINT height)
{
HRESULT hr;
D3D11_BOX UnitBox = {0, 0, 0, width, height, 1};
ID3D11DeviceContext* pContext = NULL;
ID3D11Resource* pSrcRes = NULL;
ID3D11Resource* pDstRes = NULL;
m_pDevice->GetImmediateContext(&pContext);
ASSERT(pContext);
if (FAILED(hr = pDst->QueryInterface(__uuidof(ID3D11Resource), (void**)&pDstRes)))
{
goto end;
}
if (FAILED(hr = pSrc->QueryInterface(__uuidof(ID3D11Resource), (void**)&pSrcRes)))
{
goto end;
}
pContext->CopySubresourceRegion(
pDstRes,
0,
0, 0, 0, //(x, y, z)
pSrcRes,
0,
&UnitBox);
end:
if (pSrcRes)
{
pSrcRes->Release();
}
if (pDstRes)
{
pDstRes->Release();
}
if (pContext)
{
pContext->Release();
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D11::LockSurface(IUnknown* pSurface, DWORD flags)
{
ASSERT(pSurface);
if(NULL == pSurface)
{
return E_FAIL;
}
HRESULT hr = S_OK;
D3D11_MAPPED_SUBRESOURCE region;
ID3D11Resource* pResource = NULL;
ID3D11DeviceContext* pContext = NULL;
DWORD d3d11flags = 0;
m_pDevice->GetImmediateContext(&pContext);
ASSERT(pContext);
if (flags & SURFACE_QUEUE_FLAG_DO_NOT_WAIT)
{
d3d11flags |= D3D11_MAP_FLAG_DO_NOT_WAIT;
}
if (FAILED(hr = pSurface->QueryInterface(__uuidof(ID3D11Resource), (void**)&pResource)))
{
goto end;
}
hr = pContext->Map(pResource, 0, D3D11_MAP_READ, d3d11flags, ®ion);
end:
if (pResource)
{
pResource->Release();
}
if (pContext)
{
pContext->Release();
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D11::UnlockSurface(IUnknown* pSurface)
{
ASSERT(pSurface);
if(NULL == pSurface)
{
return E_FAIL;
}
HRESULT hr = S_OK;
ID3D11DeviceContext* pContext = NULL;
ID3D11Resource* pResource = NULL;
m_pDevice->GetImmediateContext(&pContext);
ASSERT(pContext);
if (FAILED(hr = pSurface->QueryInterface(__uuidof(ID3D11Resource), (void**)&pResource)))
{
goto end;
}
pContext->Unmap(pResource, 0);
end:
if (pResource)
{
pResource->Release();
}
if (pContext)
{
pContext->Release();
}
return hr;
}
BOOL CSurfaceQueueDeviceD3D11::ValidateREFIID(REFIID id)
{
return (id == __uuidof(ID3D11Texture2D)) ||
(id == __uuidof(IDXGISurface));
}
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice9.cpp
================================================
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#include "SurfaceQueueImpl.h"
//-----------------------------------------------------------------------------
// Implementation of D3D9 Device Wrapper. This is a simple wrapper around the
// public D3D9Ex APIs that are necessary for the shared surface queue. See
// the comments in SharedSurfaceQueue.h to descriptions of these functions.
//-----------------------------------------------------------------------------
//
// D3D9Ex does not have an API to get shared handles. We replicate that functionality
// using setprivatedata.
//
static GUID SharedHandleGuid = {0x91facf2d, 0xe464, 0x4495, 0x84, 0xa6, 0x37, 0xbe, 0xd3, 0x56, 0x8d, 0xa3};
//
// This function will convert from DXGI formats (d3d10/d3d11) to D3D9 formats.
// Most formtas are not cross api shareable and for those the function will
// return D3DFMT_UNKNOWN.
//
D3DFORMAT DXGIToCrossAPID3D9Format(DXGI_FORMAT Format)
{
switch (Format)
{
case DXGI_FORMAT_B8G8R8A8_UNORM:
return D3DFMT_A8R8G8B8;
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
return D3DFMT_A8R8G8B8;
case DXGI_FORMAT_B8G8R8X8_UNORM:
return D3DFMT_X8R8G8B8;
case DXGI_FORMAT_R8G8B8A8_UNORM:
return D3DFMT_A8B8G8R8;
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
return D3DFMT_A8B8G8R8;
case DXGI_FORMAT_R10G10B10A2_UNORM:
return D3DFMT_A2B10G10R10;
case DXGI_FORMAT_R16G16B16A16_FLOAT:
return D3DFMT_A16B16G16R16F;
default:
return D3DFMT_UNKNOWN;
};
}
CSurfaceQueueDeviceD3D9::CSurfaceQueueDeviceD3D9(IDirect3DDevice9Ex* pD3D9Device) :
m_pDevice(pD3D9Device)
{
ASSERT(m_pDevice);
if(NULL != m_pDevice)
{
m_pDevice->AddRef();
}
}
CSurfaceQueueDeviceD3D9::~CSurfaceQueueDeviceD3D9()
{
m_pDevice->Release();
}
HRESULT CSurfaceQueueDeviceD3D9::CreateSharedSurface(
UINT Width, UINT Height,
DXGI_FORMAT Format,
IUnknown** ppTexture,
HANDLE* pHandle)
{
ASSERT(m_pDevice);
if(NULL == m_pDevice)
{
return E_FAIL;
}
D3DFORMAT D3D9Format;
if ((D3D9Format = DXGIToCrossAPID3D9Format(Format)) == D3DFMT_UNKNOWN)
{
return E_INVALIDARG;
}
HRESULT hr;
*pHandle = NULL;
hr = m_pDevice->CreateTexture(Width, Height, 1,
D3DUSAGE_RENDERTARGET,
D3D9Format,
D3DPOOL_DEFAULT,
(IDirect3DTexture9**)ppTexture,
pHandle);
return hr;
}
HRESULT CSurfaceQueueDeviceD3D9::OpenSurface(
HANDLE hSharedHandle,
void** ppUnknown,
UINT Width,
UINT Height,
DXGI_FORMAT Format)
{
D3DFORMAT D3D9Format;
// If the format is not cross api shareable the utility function will return
// D3DFMT_UNKNOWN
if ((D3D9Format = DXGIToCrossAPID3D9Format(Format)) == D3DFMT_UNKNOWN)
{
return E_INVALIDARG;
}
HRESULT hr = S_OK;
IDirect3DTexture9** ppTexture = (IDirect3DTexture9**)ppUnknown;
hr = m_pDevice->CreateTexture(Width, Height, 1,
D3DUSAGE_RENDERTARGET,
D3D9Format,
D3DPOOL_DEFAULT,
ppTexture,
&hSharedHandle);
if (SUCCEEDED(hr))
{
// Store the shared handle
hr = (*ppTexture)->SetPrivateData(SharedHandleGuid, &hSharedHandle, sizeof(HANDLE), 0);
if (FAILED(hr))
{
(*ppTexture)->Release();
*ppTexture = NULL;
}
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D9::GetSharedHandle(IUnknown* pUnknown, HANDLE* pHandle)
{
ASSERT(pUnknown);
ASSERT(pHandle);
if(NULL == pUnknown || NULL == pHandle)
{
return E_FAIL;
}
HRESULT hr = S_OK;
*pHandle = NULL;
IDirect3DTexture9* pTexture;
if (FAILED(hr = pUnknown->QueryInterface(__uuidof(IDirect3DTexture9), (void**)&pTexture)))
{
return hr;
}
DWORD size = sizeof(HANDLE);
hr = pTexture->GetPrivateData(SharedHandleGuid, pHandle, &size);
pTexture->Release();
return hr;
}
HRESULT CSurfaceQueueDeviceD3D9::CreateCopyResource(DXGI_FORMAT Format, UINT width, UINT height, IUnknown** ppRes)
{
D3DFORMAT D3D9Format;
if ((D3D9Format = DXGIToCrossAPID3D9Format(Format)) == D3DFMT_UNKNOWN)
{
return E_INVALIDARG;
}
return m_pDevice->CreateRenderTarget(
width, height,
D3D9Format,
D3DMULTISAMPLE_NONE,
0,
TRUE,
(IDirect3DSurface9**)ppRes,
NULL
);
}
HRESULT CSurfaceQueueDeviceD3D9::CopySurface(IUnknown* pDst, IUnknown* pSrc, UINT width, UINT height)
{
ASSERT(pDst);
ASSERT(pSrc);
ASSERT(m_pDevice);
if(NULL == pDst || NULL == pSrc || NULL == m_pDevice)
{
return E_FAIL;
}
HRESULT hr = S_OK;
IDirect3DSurface9* pSrcSurf = NULL;
IDirect3DSurface9* pDstSurf = NULL;
IDirect3DTexture9* pSrcTex = NULL;
RECT rect = {(long)0, (long)0, (long)width, (long)height };
// The source should be a IDirect3DTexture9. We need to QI for it and then get the
// top most surface from it.
if (FAILED(hr = pSrc->QueryInterface(__uuidof(IDirect3DTexture9), (void**)&pSrcTex)))
{
goto end;
}
if (FAILED(hr = pSrcTex->GetSurfaceLevel(0, &pSrcSurf)))
{
goto end;
}
// The dst is a IDirect3DSurface9 so we can simply QI for it.
if (FAILED(hr = pDst->QueryInterface(__uuidof(IDirect3DSurface9), (void**)&pDstSurf)))
{
goto end;
}
hr = m_pDevice->StretchRect(pSrcSurf, &rect, pDstSurf, &rect, D3DTEXF_NONE);
end:
if (pSrcTex)
{
pSrcTex->Release();
}
if (pSrcSurf)
{
pSrcSurf->Release();
}
if (pDstSurf)
{
pDstSurf->Release();
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D9::LockSurface(IUnknown* pSurface, DWORD flags)
{
ASSERT(pSurface);
if(NULL == pSurface)
{
return E_FAIL;
}
HRESULT hr = S_OK;
IDirect3DSurface9* pSurf = NULL;
DWORD d3d9flags = D3DLOCK_READONLY;
D3DLOCKED_RECT region;
if (flags & SURFACE_QUEUE_FLAG_DO_NOT_WAIT)
{
d3d9flags |= D3DLOCK_DONOTWAIT;
}
if (FAILED(hr = pSurface->QueryInterface(__uuidof(IDirect3DSurface9), (void**)&pSurf)))
{
goto end;
}
hr = pSurf->LockRect(®ion, NULL, d3d9flags);
end:
if (pSurf)
{
pSurf->Release();
}
if (hr == D3DERR_WASSTILLDRAWING)
{
hr = DXGI_ERROR_WAS_STILL_DRAWING;
}
return hr;
}
HRESULT CSurfaceQueueDeviceD3D9::UnlockSurface(IUnknown* pSurface)
{
ASSERT(pSurface);
if(NULL == pSurface)
{
return E_FAIL;
}
HRESULT hr = S_OK;
IDirect3DSurface9* pSurf = NULL;
if (FAILED(hr = pSurface->QueryInterface(__uuidof(IDirect3DSurface9), (void**)&pSurf)))
{
goto end;
}
hr = pSurf->UnlockRect();
end:
if (pSurf)
{
pSurf->Release();
}
return hr;
}
BOOL CSurfaceQueueDeviceD3D9::ValidateREFIID(REFIID id)
{
return id == __uuidof(IDirect3DTexture9);
}
================================================
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceQueue.cpp
================================================
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#include <new>
#include "SurfaceQueue.inl"
//
// Notes about the synchronization: It's important for this library
// to be reasonably parallel; it should be possible to have simultaneously
// enqueues/dequeues. It is undesirable for a thread to grab the queue
// lock while it calls into a blocking or very time consuming DirectX API.
//
// The single threaded flag will disable the synchronization constructs.
//
// There are 4 synchronization primitives used in this library.
// 1) Critical Section in CSurfaceProducer/CSurfaceConsumer that protects
// simultaneous access to their apis (Enqueue&Flush/Dequeue). The public
// functions from those objects are not designed to be multithreaded. It
// is not designed to support, for example, simultaneous Enqueues to the same
// queue. This lock guarantees that the Queue can not have simultaneous Enqueues
// and Flushes. There are a few CSurfaceQueue member variables that are shared
// ONLY between Enqueue and Flush and do not need to be protected in CSurfaceQueue.
// 2) A Semaphore to control waiting when the Queue is empty. The semaphore is
// released on Enqueue/Flush and is waited on in Dequeue.
// 3) A SlimReaderWriter lock protecting the CSurfaceQueue object. All of the
// high frequency calls grab shared locks (Enqueue/Flush/Dequeue) to allow
// parallel access to the queue. The low frequency state changes
// (i.e. OpenProducer) will grab an exclusive lock.
// 4) A critical section protecting the underlying circular queue. Both Enqueue
// and dequeue will contend for this lock but the duration the lock is held
// is kept to a minimum.
//
//-----------------------------------------------------------------------------
// Helper Functions
//-----------------------------------------------------------------------------
HRESULT CreateDeviceWrapper(IUnknown* pUnknown, ISurfaceQueueDevice** ppDevice)
{
IDirect3DDevice9Ex* pD3D9Device;
ID3D10Device* pD3D10Device;
ID3D11Device* pD3D11Device;
HRESULT hr = S_OK;
*ppDevice = NULL;
if (SUCCEEDED(pUnknown->QueryInterface(__uuidof(IDirect3DDevice9Ex), (void**)&pD3D9Device)))
{
pD3D9Device->Release();
*ppDevice = new QUEUE_NOTHROW_SPECIFIER CSurfaceQueueDeviceD3D9(pD3D9Device);
}
else if (SUCCEEDED(pUnknown->QueryInterface(__uuidof(ID3D10Device), (void**)&pD3D10Device)))
{
pD3D10Device->Release();
*ppDevice = new QUEUE_NOTHROW_SPECIFIER CSurfaceQueueDeviceD3D10(pD3D10Device);
}
else if (SUCCEEDED(pUnknown->QueryInterface(__uuidof(ID3D11Device), (void**)&pD3D11Device)))
{
pD3D11Device->Release();
*ppDevice = new QUEUE_NOTHROW_SPECIFIER CSurfaceQueueDeviceD3D11(pD3D11Device);
}
else
{
hr = E_INVALIDARG;
}
if (SUCCEEDED(hr) && *ppDevice == NULL)
{
hr = E_OUTOFMEMORY;
}
return hr;
};
//-----------------------------------------------------------------------------
// SharedSurfaceObject Implementation
//-----------------------------------------------------------------------------
SharedSurfaceObject::SharedSurfaceObject(UINT Width, UINT Height, DXGI_FORMAT Format)
{
hSharedHandle = NULL;
state = SHARED_SURFACE_STATE_UNINITIALIZED;
queue = NULL;
width = Width;
height = Height;
format = Format;
pSurface = NULL;
}
SharedSurfaceObject::~SharedSurfaceObject()
{
// Release the reference to the created surface
if (pSurface)
{
pSurface->Release();
}
}
//-----------------------------------------------------------------------------
// CreateSurfaceQueue
//-----------------------------------------------------------------------------
HRESULT WINAPI CreateSurfaceQueue(
SURFACE_QUEUE_DESC* pDesc,
IUnknown* pDevice,
ISurfaceQueue** ppQueue)
{
HRESULT hr = E_FAIL;
if (ppQueue == NULL)
{
return E_INVALIDARG;
}
*ppQueue = NULL;
if (pDesc == NULL)
{
return E_INVALIDARG;
}
if (pDevice == NULL)
{
return E_INVALIDARG;
}
if (pDesc->NumSurfaces == 0)
{
return E_INVALIDARG;
}
if (pDesc->Width == 0 || pDesc->Height == 0)
{
return E_INVALIDARG;
}
if (pDesc->Flags != 0 && pDesc->Flags != SURFACE_QUEUE_FLAG_SINGLE_THREADED)
{
return E_INVALIDARG;
}
CSurfaceQueue* pSurfaceQueue = new QUEUE_NOTHROW_SPECIFIER CSurfaceQueue();
if (!pSurfaceQueue)
{
hr = E_OUTOFMEMORY;
goto end;
}
hr = pSurfaceQueue->Initialize(pDesc, pDevice, pSurfaceQueue);
if (FAILED(hr))
{
goto end;
}
hr = pSurfaceQueue->QueryInterface(__uuidof(ISurfaceQueue), (void**)ppQueue);
end:
if (FAILED(hr))
{
if (pSurfaceQueue)
{
delete pSurfaceQueue;
}
*ppQueue = NULL;
}
return hr;
}
//-----------------------------------------------------------------------------
// CSurfaceConsumer implementation
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
CSurfaceConsumer:: CSurfaceConsumer(BOOL IsMultithreaded) :
m_RefCount(0),
m_IsMultithreaded(IsMultithreaded),
m_pQueue(NULL),
m_pDevice(NULL)
{
if (m_IsMultithreaded)
{
InitializeCriticalSection(&m_lock);
}
}
//-----------------------------------------------------------------------------
CSurfaceConsumer::~CSurfaceConsumer()
{
if (m_pQueue)
{
m_pQueue->RemoveConsumer();
m_pQueue->Release();
}
if (m_pDevice)
{
delete m_pDevice;
}
if (m_IsMultithreaded)
{
DeleteCriticalSection(&m_lock);
}
}
//-----------------------------------------------------------------------------
HRESULT CSurfaceConsumer::Initialize(IUnknown* pDevice)
{
ASSERT(pDevice);
ASSERT(m_pDevice == NULL);
HRESULT hr;
hr = CreateDeviceWrapper(pDevice, &m_pDevice);
if (FAILED(hr))
{
if (m_pDevice)
{
delete m_pDevice;
m_pDevice = NULL;
}
}
return hr;
}
//-----------------------------------------------------------------------------
void CSurfaceConsumer::SetQueue(CSurfaceQueue* queue)
{
ASSERT(!m_pQueue && queue);
if (NULL != m_pQueue || NULL == queue)
{
return;
}
m_pQueue = queue;
m_pQueue->AddRef();
}
//-----------------------------------------------------------------------------
HRESULT CSurfaceConsumer::Dequeue(
REFIID id,
IUnknown** ppSurface,
void* pBuffer,
UINT* BufferSize,
DWORD dwTimeout)
{
ASSERT(m_pQueue);
if (NULL == m_pQueue)
{
return E_FAIL;
}
HRESULT hr = S_OK;
if (m_IsMultithreaded)
{
EnterCriticalSection(&m_lock);
}
// Validate that REFIID is correct for a surface from this device
if (!m_pDevice->ValidateREFIID(id))
{
hr = E_INVALIDARG;
goto end;
}
if (ppSurface == NULL)
{
hr = E_INVALIDARG;
goto end;
}
*ppSurface = NULL;
// Forward to queue
hr = m_pQueue->Dequeue(ppSurface, pBuffer, BufferSize, dwTimeout);
end:
if (m_IsMultithreaded)
{
LeaveCriticalSection(&m_lock);
}
return hr;
}
//-----------------------------------------------------------------------------
// CSurfaceProducer implementation
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
CSurfaceProducer:: CSurfaceProducer(BOOL IsMultithreaded) :
m_RefCount(0),
m_IsMultithreaded(IsMultithreaded),
m_pQueue(NULL),
m_pDevice(NULL),
m_nStagingResources(0),
m_pStagingResources(NULL),
m_uiStagingResourceHeight(0),
m_uiStagingResourceWidth(0),
m_iCurrentResource(0)
{
if (m_IsMultithreaded)
{
InitializeCriticalSection(&m_lock);
}
}
//-----------------------------------------------------------------------------
CSurfaceProducer::~CSurfaceProducer()
{
if (m_pQueue)
{
m_pQueue->RemoveProducer();
m_pQueue->Release();
}
if (m_pStagingResources)
{
for (UINT i = 0; i < m_nStagingResources; i++)
{
if (m_pStagingResources[i])
{
m_pStagingResources[i]->Release();
}
}
delete[] m_pStagingResources;
}
if (m_pDevice)
{
delete m_pDevice;
}
if (m_IsMultithreaded)
{
DeleteCriticalSection(&m_lock);
}
}
//-----------------------------------------------------------------------------
void CSurfaceProducer::SetQueue(CSurfaceQueue* queue)
{
ASSERT(!m_pQueue && queue);
if (NULL != m_pQueue || NULL == queue)
{
return;
}
m_pQueue = queue;
m_pQueue->AddRef();
}
//-----------------------------------------------------------------------------
HRESULT CSurfaceProducer::Initialize(IUnknown* pDevice, UINT uNumSurfaces, SURFACE_QUEUE_DESC* queueDesc)
{
ASSERT(pDevice);
ASSERT(!m_pStagingResources && m_nStagingResources == 0)
HRESULT hr = S_OK;
hr = CreateDeviceWrapper(pDevice, &m_pDevice);
if (FAILED(hr))
{
goto end;
}
m_pStagingResources = new QUEUE_NOTHROW_SPECIFIER IUnknown*[uNumSurfaces];
if (!m_pStagingResources)
{
hr = E_OUTOFMEMORY;
goto end;
}
ZeroMemory(m_pStagingResources, sizeof(IUnknown*) * uNumSurfaces);
m_nStagingResources = uNumSurfaces;
// Determine the size of the staging resource in case the queue surface is less than SHARED_SURFACE_COPY_SIZE
m_uiStagingResourceWidth = min(queueDesc->Width, SHARED_SURFACE_COPY_SIZE);
m_uiStagingResourceHeight = min(queueDesc->Height, SHARED_SURFACE_COPY_SIZE);
// Create the staging resources
for (UINT i = 0; i < m_nStagingResources; i++)
{
if (FAILED(hr = m_pDevice->CreateCopyResource(queueDesc->Format, m_uiStagingResourceWidth,
m_uiStagingResourceHeight, &(m_pStagingResources[i]))))
{
goto end;
}
}
end:
if (FAILED(hr))
{
if (m_pStagingResources)
{
for (UINT i = 0; i < m_nStagingResources; i++)
{
if (m_pStagingResources[i])
{
m_pStagingResources[i]->Release();
}
}
delete[] m_pStagingResources;
m_pStagingResources = NULL;
m_nStagingResources = 0;
}
if (m_pDevice)
{
delete m_pDevice;
m_pDevice = NULL;
}
}
return hr;
}
//-----------------------------------------------------------------------------
HRESULT CSurfaceProducer::Enqueue(
IUnknown* pSurface,
void* pBuffer,
UINT BufferSize,
DWORD Flags )
{
//
// This function essentially does simple error checking and then
// forwards the call to the queue object. The SurfaceProducer
// maintains a circular buffer of staging resources to use and will
// pass the next availible one to the queue.
//
ASSERT(m_pQueue);
if (NULL == m_pQueue)
{
return E_FAIL;
}
if (m_IsMultithreaded)
{
EnterCriticalSection(&m_lock);
}
HRESULT hr;
if (m_pDevice == NULL)
{
hr = E_INVALIDARG;
goto end;
}
if (!pSurface)
{
hr = E_INVALIDARG;
goto end;
}
if (Flags && Flags != SURFACE_QUEUE_FLAG_DO_NOT_WAIT)
{
hr = E_INVALIDARG;
goto end;
}
// Forward call to queue
hr = m_pQueue->Enqueue(
pSurface,
pBuffer,
BufferSize,
Flags,
m_pStagingResources[m_iCurrentResource],
m_uiStagingResourceWidth,
m_uiStagingResourceHeight
);
if (hr == DXGI_ERROR_WAS_STILL_DRAWING)
{
//
// Increment the staging resource only if the current one is still
// being used. This only happens if the function returns with
// DXGI_ERROR_WAS_STILL_DRAWING indicating that a future flush
// will still need the resource
//
// We do not need to worry about wrapping around and reusing staging
// surfaces that are currently in use. The design of the queue makes
// it invalid to enqueue when the queue is already full. If the user
// does that, the queue will fail the call with E_INVALIDARG.
m_iCurrentResource = (m_iCurrentResource + 1) % m_nStagingResources;
}
end:
if (m_IsMultithreaded)
{
LeaveCriticalSection(&m_lock);
}
return hr;
}
//-----------------------------------------------------------------------------
HRESULT CSurfaceProducer::Flush(
DWORD Flags,
UINT* NumSurfaces )
{
ASSERT(m_pQueue);
if (NULL == m_pQueue)
{
return E_FAIL;
}
if (m_IsMultithreaded)
{
EnterCriticalSection(&m_lock);
}
HRESULT hr;
if (m_pDevice == NULL)
{
hr = E_INVALIDARG;
goto end;
}
if (Flags && Flags != SURFACE_QUEUE_FLAG_DO_NOT_WAIT)
{
hr = E_INVALIDARG;
goto end;
}
// Forward call to queue
hr = m_pQueue->Flush(Flags, NumSurfaces);
end:
if (m_IsMultithreaded)
{
LeaveCriticalSection(&m_lock);
}
return hr;
}
//-----------------------------------------------------------------------------
// CSurfaceQueue implementation
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
CSurfaceQueue:: CSurfaceQueue()
:
m_RefCount(0),
m_IsMultithreaded(TRUE),
m_hSemaphore(NULL),
m_pRootQueue(NULL),
m_NumQueuesInNetwork(0),
m_pConsumer(NULL),
m_pProducer(NULL),
m_pCreator(NULL),
m_SurfaceQueue(NULL),
m_QueueHead(0),
m_QueueSize(0),
m_ConsumerSurfaces(NULL),
m_CreatedSurfaces(NULL),
m_iEnqueuedHead(0),
m_nEnqueuedSurfaces(0)
{
}
//-----------------------------------------------------------------------------
CSurfaceQueue::~CSurfaceQueue()
{
Destroy();
}
//-----------------------------------------------------------------------------
void CSurfaceQueue::Destroy()
{
RemoveQueueFromNetwork();
// The ref counting should guarantee that the root queue object
// is the last to be deleted
if (m_pRootQueue != this)
{
m_pRootQueue->Release();
}
else
{
ASSERT(m_NumQueuesInNetwork == 0);
}
// The root queue will destroy the creating device
if (m_pCreator)
{
delete m_pCreator;
m_pCreator = NULL;
}
// Release all opened surfaces
if (m_ConsumerSurfaces)
{
for (UINT i = 0; i < m_Desc.NumSurfaces; i++)
{
if (m_ConsumerSurfaces[i].pSurface)
{
m_ConsumerSurfaces[i].pSurface->Release();
}
}
delete[] m_ConsumerSurfaces;
m_ConsumerSurfaces = NULL;
}
// Clean up the allocated meta data buffers
if (m_SurfaceQueue)
{
for (UINT i = 0; i < m_Desc.NumSurfaces; i++)
{
if (m_SurfaceQueue[i].pMetaData)
{
delete[] m_SurfaceQueue[i].pMetaData;
}
}
delete[] m_SurfaceQueue;
m_SurfaceQueue = NULL;
}
// The root queue object created the surfaces. All other queue
// objects only have a reference.
if (m_CreatedSurfaces)
{
for (UINT i = 0; i < m_Desc.NumSurfaces; i++)
{
if (m_pRootQueue == this && m_CreatedSurfaces[i])
{
delete m_CreatedSurfaces[i];
}
m_CreatedSurfaces[i] = NULL;
}
delete[] m_CreatedSurfaces;
m_CreatedSurfaces = NULL;
}
m_pConsumer = NULL;
m_pProducer = NULL;
if (m_IsMultithreaded)
{
if (m_hSemaphore)
{
CloseHandle(m_hSemaphore);
m_hSemaphore = NULL;
}
DeleteCriticalSection(&m_QueueLock);
}
else
{
m_nFlushedSurfaces = 0;
}
}
//-----------------------------------------------------------------------------
ISurfaceQueueDevice* CSurfaceQueue::GetCreatorDevice()
{
return m_pRootQueue->m_pCreator;
}
//---------------
gitextract_7_bjs1s0/
├── .gitignore
├── LICENSE
├── README.md
├── SECURITY.md
├── samples/
│ └── D3D11Image/
│ ├── D3D11Visualization/
│ │ ├── D3DVisualization.cpp
│ │ ├── D3DVisualization.fx
│ │ ├── D3DVisualization.h
│ │ ├── D3DVisualization.rc
│ │ ├── D3DVisualization.vcxproj
│ │ ├── D3DVisualization.vcxproj.filters
│ │ ├── D3DVisualization_dxsdk.vcxproj
│ │ ├── D3DVisualization_dxsdk.vcxproj.filters
│ │ ├── D3DVisualization_winsdk.vcxproj
│ │ ├── D3DVisualization_winsdk.vcxproj.filters
│ │ ├── DX11Utils.cpp
│ │ ├── DX11Utils.h
│ │ ├── OrbitCamera.cpp
│ │ ├── OrbitCamera.h
│ │ └── Resource.h
│ ├── WpfD3D11Interop/
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── Properties/
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── WpfD3D11Interop.csproj
│ │ ├── app.config
│ │ └── packages.config
│ ├── WpfD3D11Interop_dxsdk.sln
│ └── WpfD3D11Interop_winsdk.sln
├── scripts/
│ ├── BuildNuGetPackage.cmd
│ └── Microsoft.Wpf.Interop.DirectX.nuspec
└── src/
├── Microsoft.Wpf.Interop.DirectX/
│ ├── AssemblyInfo.cpp
│ ├── D3D11Image.cpp
│ ├── D3D11Image.h
│ ├── Microsoft.Wpf.Interop.DirectX_dxsdk.vcxproj
│ ├── Microsoft.Wpf.Interop.DirectX_winsdk.vcxproj
│ ├── Stdafx.cpp
│ ├── Stdafx.h
│ ├── SurfaceDevice10.cpp
│ ├── SurfaceDevice11.cpp
│ ├── SurfaceDevice9.cpp
│ ├── SurfaceQueue.cpp
│ ├── SurfaceQueue.h
│ ├── SurfaceQueue.inl
│ ├── SurfaceQueueImpl.h
│ ├── SurfaceQueueInteropHelper.cpp
│ ├── SurfaceQueueInteropHelper.h
│ └── version.rc
├── Microsoft.Wpf.Interop.DirectX_dxsdk.sln
└── Microsoft.Wpf.Interop.DirectX_winsdk.sln
SYMBOL INDEX (136 symbols across 18 files)
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization.cpp
type SimpleVertex (line 20) | struct SimpleVertex
type ConstantBuffer (line 26) | struct ConstantBuffer
function BOOL (line 33) | BOOL WINAPI DllMain(HINSTANCE hInstance,DWORD fwdReason, LPVOID lpvReser...
function HRESULT (line 41) | extern HRESULT __cdecl Init()
function Cleanup (line 58) | extern void __cdecl Cleanup()
function HRESULT (line 67) | extern HRESULT __cdecl Render(void * pResource, bool isNewSurface)
function HRESULT (line 80) | extern HRESULT _cdecl SetCameraRadius(float r)
function HRESULT (line 96) | extern HRESULT _cdecl SetCameraTheta(float theta)
function HRESULT (line 112) | extern HRESULT _cdecl SetCameraPhi(float phi)
function HRESULT (line 165) | HRESULT CCube::LoadShaders()
function HRESULT (line 228) | HRESULT CCube::InitDevice()
function HRESULT (line 384) | HRESULT CCube::InitRenderTarget(void * pResource)
function HRESULT (line 456) | HRESULT CCube::Render(void * pResource, bool isNewSurface)
function CCamera (line 525) | CCamera* CCube::GetCamera()
FILE: samples/D3D11Image/D3D11Visualization/D3DVisualization.h
function class (line 50) | class CCube
FILE: samples/D3D11Image/D3D11Visualization/DX11Utils.cpp
function HRESULT (line 24) | HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LP...
FILE: samples/D3D11Image/D3D11Visualization/OrbitCamera.h
function class (line 21) | class CCamera
FILE: samples/D3D11Image/WpfD3D11Interop/App.xaml.cs
class App (line 8) | public partial class App : Application
FILE: samples/D3D11Image/WpfD3D11Interop/MainWindow.xaml.cs
class MainWindow (line 13) | public partial class MainWindow : Window
method MainWindow (line 31) | public MainWindow()
method Init (line 38) | private static bool Init()
method Cleanup (line 56) | private static void Cleanup()
method Render (line 61) | private static int Render(IntPtr resourcePointer, bool isNewSurface)
method SetCameraRadius (line 66) | private static int SetCameraRadius(float radius)
method SetCameraTheta (line 71) | private static int SetCameraTheta(float theta)
method SetCameraPhi (line 76) | private static int SetCameraPhi(float phi)
method Host_Loaded (line 82) | private void Host_Loaded(object sender, RoutedEventArgs e)
method Host_SizeChanged (line 107) | private void Host_SizeChanged(object sender, SizeChangedEventArgs e)
method Scale_ValueChanged (line 143) | private void Scale_ValueChanged(object sender, RoutedPropertyChangedEv...
method Size_ValueChanged (line 148) | private void Size_ValueChanged(object sender, RoutedPropertyChangedEve...
method MagBox_Checked (line 157) | private void MagBox_Checked(object sender, RoutedEventArgs e)
method MagBox_Unchecked (line 166) | private void MagBox_Unchecked(object sender, RoutedEventArgs e)
method MagElement_MouseMove (line 175) | private void MagElement_MouseMove(object sender, MouseEventArgs e)
method MagElement_MouseLeave (line 206) | private void MagElement_MouseLeave(object sender, MouseEventArgs e)
method Radius_ValueChanged (line 212) | private void Radius_ValueChanged(object sender, RoutedPropertyChangedE...
method Theta_ValueChanged (line 217) | private void Theta_ValueChanged(object sender, RoutedPropertyChangedEv...
method Phi_ValueChanged (line 222) | private void Phi_ValueChanged(object sender, RoutedPropertyChangedEven...
method InitializeRendering (line 229) | private void InitializeRendering()
method CompositionTarget_Rendering (line 243) | void CompositionTarget_Rendering(object sender, EventArgs e)
method UninitializeRendering (line 256) | private void UninitializeRendering()
method DoRender (line 264) | private void DoRender(IntPtr surface, bool isNewSurface)
method Window_Closing (line 269) | private void Window_Closing(object sender, System.ComponentModel.Cance...
class NativeMethods (line 287) | private static class NativeMethods
method Init (line 295) | [DllImport("D3DVisualization.dll", CallingConvention = CallingConven...
method Cleanup (line 298) | [DllImport("D3DVisualization.dll", CallingConvention = CallingConven...
method Render (line 301) | [DllImport("D3DVisualization.dll", CallingConvention = CallingConven...
method SetCameraRadius (line 304) | [DllImport("D3DVisualization.dll", CallingConvention = CallingConven...
method SetCameraTheta (line 307) | [DllImport("D3DVisualization.dll", CallingConvention = CallingConven...
method SetCameraPhi (line 310) | [DllImport("D3DVisualization.dll", CallingConvention = CallingConven...
method InvokeWithDllProtection (line 317) | public static void InvokeWithDllProtection(Action action)
method InvokeWithDllProtection (line 333) | public static T InvokeWithDllProtection<T>(Func<T> func)
FILE: samples/D3D11Image/WpfD3D11Interop/Properties/Resources.Designer.cs
class Resources (line 22) | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resource...
method Resources (line 31) | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Mic...
FILE: samples/D3D11Image/WpfD3D11Interop/Properties/Settings.Designer.cs
class Settings (line 14) | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
FILE: src/Microsoft.Wpf.Interop.DirectX/D3D11Image.cpp
type Microsoft (line 3) | namespace Microsoft {
type Wpf (line 4) | namespace Wpf {
type Interop (line 5) | namespace Interop {
type DirectX (line 6) | namespace DirectX {
FILE: src/Microsoft.Wpf.Interop.DirectX/D3D11Image.h
function namespace (line 13) | namespace Microsoft {
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice10.cpp
function HRESULT (line 30) | HRESULT CSurfaceQueueDeviceD3D10::CreateSharedSurface(
function HRESULT (line 76) | HRESULT CSurfaceQueueDeviceD3D10::OpenSurface(
function HRESULT (line 86) | HRESULT CSurfaceQueueDeviceD3D10::GetSharedHandle(IUnknown* pUnknown, HA...
function HRESULT (line 112) | HRESULT CSurfaceQueueDeviceD3D10::CreateCopyResource(DXGI_FORMAT format,...
function HRESULT (line 138) | HRESULT CSurfaceQueueDeviceD3D10::CopySurface(IUnknown* pDst, IUnknown* ...
function HRESULT (line 177) | HRESULT CSurfaceQueueDeviceD3D10::LockSurface(IUnknown* pSurface, DWORD ...
function HRESULT (line 211) | HRESULT CSurfaceQueueDeviceD3D10::UnlockSurface(IUnknown* pSurface)
function BOOL (line 234) | BOOL CSurfaceQueueDeviceD3D10::ValidateREFIID(REFIID id)
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice11.cpp
function HRESULT (line 30) | HRESULT CSurfaceQueueDeviceD3D11::CreateSharedSurface(
function HRESULT (line 76) | HRESULT CSurfaceQueueDeviceD3D11::OpenSurface(
function HRESULT (line 86) | HRESULT CSurfaceQueueDeviceD3D11::GetSharedHandle(IUnknown* pUnknown, HA...
function HRESULT (line 112) | HRESULT CSurfaceQueueDeviceD3D11::CreateCopyResource(DXGI_FORMAT format,...
function HRESULT (line 138) | HRESULT CSurfaceQueueDeviceD3D11::CopySurface(IUnknown* pDst, IUnknown* ...
function HRESULT (line 185) | HRESULT CSurfaceQueueDeviceD3D11::LockSurface(IUnknown* pSurface, DWORD ...
function HRESULT (line 228) | HRESULT CSurfaceQueueDeviceD3D11::UnlockSurface(IUnknown* pSurface)
function BOOL (line 264) | BOOL CSurfaceQueueDeviceD3D11::ValidateREFIID(REFIID id)
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice9.cpp
function D3DFORMAT (line 27) | D3DFORMAT DXGIToCrossAPID3D9Format(DXGI_FORMAT Format)
function HRESULT (line 66) | HRESULT CSurfaceQueueDeviceD3D9::CreateSharedSurface(
function HRESULT (line 99) | HRESULT CSurfaceQueueDeviceD3D9::OpenSurface(
function HRESULT (line 140) | HRESULT CSurfaceQueueDeviceD3D9::GetSharedHandle(IUnknown* pUnknown, HAN...
function HRESULT (line 168) | HRESULT CSurfaceQueueDeviceD3D9::CreateCopyResource(DXGI_FORMAT Format, ...
function HRESULT (line 189) | HRESULT CSurfaceQueueDeviceD3D9::CopySurface(IUnknown* pDst, IUnknown* p...
function HRESULT (line 240) | HRESULT CSurfaceQueueDeviceD3D9::LockSurface(IUnknown* pSurface, DWORD f...
function HRESULT (line 279) | HRESULT CSurfaceQueueDeviceD3D9::UnlockSurface(IUnknown* pSurface)
function BOOL (line 306) | BOOL CSurfaceQueueDeviceD3D9::ValidateREFIID(REFIID id)
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceQueue.cpp
function HRESULT (line 41) | HRESULT CreateDeviceWrapper(IUnknown* pUnknown, ISurfaceQueueDevice** pp...
function HRESULT (line 106) | HRESULT WINAPI CreateSurfaceQueue(
function HRESULT (line 209) | HRESULT CSurfaceConsumer::Initialize(IUnknown* pDevice)
function HRESULT (line 244) | HRESULT CSurfaceConsumer::Dequeue(
function HRESULT (line 360) | HRESULT CSurfaceProducer::Initialize(IUnknown* pDevice, UINT uNumSurface...
function HRESULT (line 423) | HRESULT CSurfaceProducer::Enqueue(
function HRESULT (line 501) | HRESULT CSurfaceProducer::Flush(
function ISurfaceQueueDevice (line 660) | ISurfaceQueueDevice* CSurfaceQueue::GetCreatorDevice()
function UINT (line 666) | UINT CSurfaceQueue::GetNumQueuesInNetwork()
function UINT (line 673) | UINT CSurfaceQueue::AddQueueToNetwork()
function UINT (line 686) | UINT CSurfaceQueue::RemoveQueueFromNetwork()
function SharedSurfaceObject (line 700) | SharedSurfaceObject* CSurfaceQueue::GetSurfaceObjectFromHandle(HANDLE ha...
function IUnknown (line 731) | IUnknown* CSurfaceQueue::GetOpenedSurface(const SharedSurfaceObject* pOb...
function HRESULT (line 761) | HRESULT CSurfaceQueue::AllocateMetaDataBuffers()
function HRESULT (line 779) | HRESULT CSurfaceQueue::CreateSurfaces()
function HRESULT (line 835) | HRESULT CSurfaceQueue::Initialize(SURFACE_QUEUE_DESC* pDesc,
function HRESULT (line 956) | HRESULT CSurfaceQueue::OpenConsumer(
function HRESULT (line 1078) | HRESULT CSurfaceQueue::OpenProducer(
function HRESULT (line 1193) | HRESULT CSurfaceQueue::Clone(
function HRESULT (line 1261) | HRESULT CSurfaceQueue::Enqueue(
function HRESULT (line 1440) | HRESULT CSurfaceQueue::Dequeue(
function HRESULT (line 1592) | HRESULT CSurfaceQueue::Flush(
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceQueue.h
type interface (line 58) | typedef interface ISurfaceProducer
type interface (line 64) | typedef interface ISurfaceConsumer
type interface (line 70) | typedef interface ISurfaceQueue
type SURFACE_QUEUE_DESC (line 87) | typedef struct SURFACE_QUEUE_DESC
type SURFACE_QUEUE_CLONE_DESC (line 97) | typedef struct SURFACE_QUEUE_CLONE_DESC
type SURFACE_QUEUE_FLAG (line 103) | typedef
type ISurfaceProducerVtbl (line 143) | typedef struct ISurfaceProducerVtbl
function interface (line 174) | interface ISurfaceProducer
type ISurfaceConsumerVtbl (line 237) | typedef struct ISurfaceConsumerVtbl
function interface (line 264) | interface ISurfaceConsumer
type ISurfaceQueueVtbl (line 329) | typedef struct ISurfaceQueueVtbl
function interface (line 363) | interface ISurfaceQueue
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueImpl.h
function class (line 59) | class ISurfaceQueueDevice
function class (line 98) | class CSurfaceQueueDeviceD3D9 : public ISurfaceQueueDevice
function class (line 122) | class CSurfaceQueueDeviceD3D10 : public ISurfaceQueueDevice
function class (line 146) | class CSurfaceQueueDeviceD3D11 : public ISurfaceQueueDevice
type SharedSurfaceState (line 169) | enum SharedSurfaceState
type SharedSurfaceObject (line 179) | struct SharedSurfaceObject
function class (line 200) | class CSurfaceConsumer : public ISurfaceConsumer
function class (line 244) | class CSurfaceProducer : public ISurfaceProducer
function class (line 302) | class CSurfaceQueue : public ISurfaceQueue
type SharedSurfaceOpenedMapping (line 380) | struct SharedSurfaceOpenedMapping
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueInteropHelper.cpp
type Microsoft (line 15) | namespace Microsoft {
type Windows (line 16) | namespace Windows {
type Media (line 17) | namespace Media {
function HRESULT (line 18) | HRESULT SurfaceQueueInteropHelper::InitD3D10()
function HRESULT (line 67) | HRESULT SurfaceQueueInteropHelper::InitD3D9()
function HRESULT (line 139) | HRESULT SurfaceQueueInteropHelper::InitD3D()
function HRESULT (line 160) | HRESULT SurfaceQueueInteropHelper::InitSurfaces()
FILE: src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueInteropHelper.h
function namespace (line 11) | namespace Microsoft {
Condensed preview — 54 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (289K chars).
[
{
"path": ".gitignore",
"chars": 3485,
"preview": "# Created by https://www.gitignore.io/api/visualstudio\n\n### VisualStudio ###\n## Ignore Visual Studio temporary files, bu"
},
{
"path": "LICENSE",
"chars": 1077,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2015 Microsoft\n\nPermission is hereby granted, free of charge, to any person obtaini"
},
{
"path": "README.md",
"chars": 2843,
"preview": "# **WPF DirectX Extensions**\nWPF DirectX Extensions allow you to easily host DirectX 10 and DirectX 11 content in WPF ap"
},
{
"path": "SECURITY.md",
"chars": 2757,
"preview": "<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->\n\n## Security\n\nMicrosoft takes the security of our software products an"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization.cpp",
"chars": 13287,
"preview": "//------------------------------------------------------------------------------\n// <copyright file=\"D3DVisualization.c"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization.fx",
"chars": 1519,
"preview": "//--------------------------------------------------------------------------------------\n// File: D3DVisualization.fx\n//"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization.h",
"chars": 3702,
"preview": "//------------------------------------------------------------------------------\n// <copyright file=\"D3DVizualization.h"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization.rc",
"chars": 1690,
"preview": "//------------------------------------------------------------------------------\n// <copyright file=\"D3DVisualization.rc"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization.vcxproj",
"chars": 10399,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.micros"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization.vcxproj.filters",
"chars": 1745,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization_dxsdk.vcxproj",
"chars": 10411,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.micros"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization_dxsdk.vcxproj.filters",
"chars": 1745,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization_winsdk.vcxproj",
"chars": 10344,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.micros"
},
{
"path": "samples/D3D11Image/D3D11Visualization/D3DVisualization_winsdk.vcxproj.filters",
"chars": 1745,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "samples/D3D11Image/D3D11Visualization/DX11Utils.cpp",
"chars": 1611,
"preview": "//------------------------------------------------------------------------------\n// <copyright file=\"DX11Utils.cpp\" com"
},
{
"path": "samples/D3D11Image/D3D11Visualization/DX11Utils.h",
"chars": 1164,
"preview": "//------------------------------------------------------------------------------\n// <copyright file=\"DX11Utils.h\" compa"
},
{
"path": "samples/D3D11Image/D3D11Visualization/OrbitCamera.cpp",
"chars": 2158,
"preview": "//------------------------------------------------------------------------------\n// <copyright file=\"OrbitCamera.cpp\" c"
},
{
"path": "samples/D3D11Image/D3D11Visualization/OrbitCamera.h",
"chars": 2461,
"preview": "//------------------------------------------------------------------------------\n// <copyright file=\"OrbitCamera.h\" com"
},
{
"path": "samples/D3D11Image/D3D11Visualization/Resource.h",
"chars": 824,
"preview": "//------------------------------------------------------------------------------\n// <copyright file=\"resource.h\" compan"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/App.xaml",
"chars": 335,
"preview": "<Application x:Class=\"Microsoft.Samples.Wpf.D3D11Interop.App\"\n xmlns=\"http://schemas.microsoft.com/winfx/20"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/App.xaml.cs",
"chars": 208,
"preview": "namespace Microsoft.Samples.Wpf.D3D11Interop\n{\n using System.Windows;\n\n /// <summary>\n /// Interaction logic f"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/MainWindow.xaml",
"chars": 11191,
"preview": "<Window x:Class=\"Microsoft.Samples.Wpf.D3D11Interop.MainWindow\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/MainWindow.xaml.cs",
"chars": 14242,
"preview": "namespace Microsoft.Samples.Wpf.D3D11Interop\n{\n using System;\n using System.Runtime.InteropServices;\n using Sy"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/Properties/AssemblyInfo.cs",
"chars": 1637,
"preview": "using System;\nusing System.Reflection;\nusing System.Resources;\nusing System.Runtime.InteropServices;\nusing System.Windo"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/Properties/Resources.Designer.cs",
"chars": 2813,
"preview": "//------------------------------------------------------------------------------\n// <auto-generated>\n// This code w"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/Properties/Resources.resx",
"chars": 5494,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n <!-- \n Microsoft ResX Schema \n \n Version 2.0\n \n The prim"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/Properties/Settings.Designer.cs",
"chars": 1089,
"preview": "//------------------------------------------------------------------------------\n// <auto-generated>\n// This code w"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/Properties/Settings.settings",
"chars": 193,
"preview": "<?xml version='1.0' encoding='utf-8'?>\n<SettingsFile xmlns=\"uri:settings\" CurrentProfile=\"(Default)\">\n <Profiles>\n "
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/WpfD3D11Interop.csproj",
"chars": 5377,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microso"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/app.config",
"chars": 158,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n<startup><supportedRuntime version=\"v4.0\" sku=\".NETFramework,Vers"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop/packages.config",
"chars": 166,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n <package id=\"Microsoft.Wpf.Interop.DirectX-x64\" version=\"0.9.0-beta"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop_dxsdk.sln",
"chars": 2679,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.23107.0\nMini"
},
{
"path": "samples/D3D11Image/WpfD3D11Interop_winsdk.sln",
"chars": 2681,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.23107.0\nMini"
},
{
"path": "scripts/BuildNuGetPackage.cmd",
"chars": 313,
"preview": "nuget.exe pack Microsoft.Wpf.Interop.DirectX.nuspec -Version 0.9.0-beta-99999 -Properties ArchitecturePublicName=x64;NuG"
},
{
"path": "scripts/Microsoft.Wpf.Interop.DirectX.nuspec",
"chars": 1611,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">\n "
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/AssemblyInfo.cpp",
"chars": 363,
"preview": "// Copyright (c) Microsoft Corporation. All rights reserved.\n#include \"stdafx.h\"\n\nusing namespace System;\nusing namespa"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/D3D11Image.cpp",
"chars": 3432,
"preview": "#include \"D3D11Image.h\"\n\nnamespace Microsoft {\n namespace Wpf {\n namespace Interop {\n namespace Dir"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/D3D11Image.h",
"chars": 3182,
"preview": "// SurfaceQueueInteropHelper.h\n\n#pragma once\n\n#include \"SurfaceQueueInteropHelper.h\"\n\n\nusing namespace System;\nusing nam"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_dxsdk.vcxproj",
"chars": 10939,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_winsdk.vcxproj",
"chars": 10854,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.micros"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/Stdafx.cpp",
"chars": 216,
"preview": "// stdafx.cpp : source file that includes just the standard includes\n// SurfaceQueueInteropHelper.pch will be the pre-co"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/Stdafx.h",
"chars": 559,
"preview": "// stdafx.h : include file for standard system include files,\n// or project specific include files that are used frequen"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice10.cpp",
"chars": 5962,
"preview": "// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF\n// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice11.cpp",
"chars": 6586,
"preview": "// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF\n// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceDevice9.cpp",
"chars": 7951,
"preview": "// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF\n// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceQueue.cpp",
"chars": 46208,
"preview": "// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF\n// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceQueue.h",
"chars": 11223,
"preview": "// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF\n// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceQueue.inl",
"chars": 3124,
"preview": "// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF\n// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueImpl.h",
"chars": 16463,
"preview": "// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF\n// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueInteropHelper.cpp",
"chars": 13531,
"preview": "#include \"SurfaceQueueInteropHelper.h\"\n\n#pragma once\n\nusing namespace System;\nusing namespace System::Windows;\nusing nam"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueInteropHelper.h",
"chars": 4810,
"preview": "// SurfaceQueueInteropHelper.h\n\n#include \"stdafx.h\"\n\n#pragma once\n\nusing namespace System;\nusing namespace System::Windo"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX/version.rc",
"chars": 138,
"preview": "/////////////////////////////////////////////////////////////////////////////\n//\n// Version\n//\n\n\n#include <fxver.h>\n#inc"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX_dxsdk.sln",
"chars": 1944,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.23107.0\nMini"
},
{
"path": "src/Microsoft.Wpf.Interop.DirectX_winsdk.sln",
"chars": 1353,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.23107.0\nMini"
}
]
About this extraction
This page contains the full source code of the Microsoft/WPFDXInterop GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 54 files (267.6 KB), approximately 68.2k tokens, and a symbol index with 136 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.