Skip to content

Commit

Permalink
Merge pull request #55 from john-h-k/patch-1
Browse files Browse the repository at this point in the history
Add CreateRootSignature
  • Loading branch information
tannergooding authored Feb 12, 2021
2 parents a6814fb + 1b55a0d commit 48dfdb3
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
11 changes: 11 additions & 0 deletions TerraFX.Interop.Windows.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "d3d10_1shader", "d3d10_1sha
generation\um\d3d10_1shader\um-d3d10_1shader.h = generation\um\d3d10_1shader\um-d3d10_1shader.h
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dxtk12", "dxtk12", "{2B494F8E-C80A-4E97-A16F-F5AACFE43825}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DirectXHelpers", "DirectXHelpers", "{21A3721E-FCA8-445E-A95D-A73716F435CC}"
ProjectSection(SolutionItems) = preProject
generation\dxtk12\DirectXHelpers\dxtk12-DirectXHelpers.h = generation\dxtk12\DirectXHelpers\dxtk12-DirectXHelpers.h
generation\dxtk12\DirectXHelpers\generate.rsp = generation\dxtk12\DirectXHelpers\generate.rsp
generation\dxtk12\DirectXHelpers\header.txt = generation\dxtk12\DirectXHelpers\header.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TextStor", "TextStor", "{1CDD97F4-D363-4DA6-878C-42A4518D8B98}"
ProjectSection(SolutionItems) = preProject
generation\um\TextStor\generate.rsp = generation\um\TextStor\generate.rsp
Expand Down Expand Up @@ -2091,6 +2100,8 @@ Global
{3E969E6F-7198-4F83-B0C5-1936D6379E01} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
{8BDC41A2-54B8-431D-B049-538F48D5E14C} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
{22B8D2FA-95B4-4A27-A08C-8168FF8B81D3} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
{2B494F8E-C80A-4E97-A16F-F5AACFE43825} = {D9638FEE-50A4-44FF-B1F6-72E59548490B}
{21A3721E-FCA8-445E-A95D-A73716F435CC} = {2B494F8E-C80A-4E97-A16F-F5AACFE43825}
{1CDD97F4-D363-4DA6-878C-42A4518D8B98} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
{A45CD075-761F-4703-8926-D10653692F82} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
{631A693A-1FC5-4AB0-B46E-797A01BC8BF3} = {67311E5E-FA9C-43A6-B431-9EF10047A0CE}
Expand Down
2 changes: 2 additions & 0 deletions generation/dxtk12/DirectXHelpers/dxtk12-DirectXHelpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <Windows.h>
#include <DirectXHelpers.h>
10 changes: 10 additions & 0 deletions generation/dxtk12/DirectXHelpers/generate.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@../../settings.rsp
@../../remap.rsp
--file
dxtk12-DirectXHelpers.h
--output
../../../sources/Interop/Windows/dxtk12/DirectXHelpers
--test-output
../../../tests/Interop/Windows/dxtk12/DirectXHelpers
--traverse
DirectXHelpers.h
4 changes: 4 additions & 0 deletions generation/dxtk12/DirectXHelpers/header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from DirectXHelpers.h in the microsoft/DirectXTK12 tag jan2021
// Original source is Copyright © Microsoft. All rights reserved. Licensed under the University of Illinois Open Source License.
29 changes: 29 additions & 0 deletions sources/Interop/Windows/dxtk12/DirectXHelpers/Windows.Manual.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from DirectXHelpers.h in the microsoft/DirectXTK12 tag jan2021
// Original source is Copyright © Microsoft. All rights reserved. Licensed under the University of Illinois Open Source License.

using System;
using static TerraFX.Interop.D3D_ROOT_SIGNATURE_VERSION;

namespace TerraFX.Interop
{
public static unsafe partial class Windows
{
[return: NativeTypeName("HRESULT")]
public static int CreateRootSignature([NativeTypeName("ID3D12Device *")] ID3D12Device* device, [NativeTypeName("const D3D12_ROOT_SIGNATURE_DESC *")] D3D12_ROOT_SIGNATURE_DESC* rootSignatureDesc, [NativeTypeName("ID3D12RootSignature **")] ID3D12RootSignature** rootSignature)
{
using ComPtr<ID3DBlob> pSignature = new ComPtr<ID3DBlob>();
using ComPtr<ID3DBlob> pError = new ComPtr<ID3DBlob>();

HRESULT hr = D3D12SerializeRootSignature(rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, pSignature.GetAddressOf(), pError.GetAddressOf());

if (SUCCEEDED(hr))
{
hr = device->CreateRootSignature(0, pSignature.Get()->GetBufferPointer(), pSignature.Get()->GetBufferSize(), __uuidof<ID3D12RootSignature>(), (void**)rootSignature);
}

return hr;
}
}
}

0 comments on commit 48dfdb3

Please sign in to comment.