Coder Social home page Coder Social logo

amerkoleci / vortice.windows Goto Github PK

View Code? Open in Web Editor NEW
953.0 43.0 68.0 198.43 MB

.NET bindings for Direct3D12, Direct3D11, WIC, Direct2D1, XInput, XAudio, X3DAudio, DXC, Direct3D9 and DirectInput.

License: MIT License

C# 47.42% C++ 14.94% C 37.56% HLSL 0.09%
direct3d direct3d11 direct3d12 graphics gamedev game-development netstandard game-engine vortice nuget

vortice.windows's Introduction

Vortice.Windows

License: MIT Build status NuGet

Vortice.Windows is a collection of Win32 and UWP libraries with bindings support for DXGI, WIC, DirectWrite, Direct2D, Direct3D9, Direct3D11, Direct3D12, XInput, XAudio2, X3DAudio, DirectInput, DirectStorage, DirectML, UIAnimation and DirectSound.

This library targets .net7.0 and .net8.0 and uses modern C# 12, see CHANGELOG for list of changes between commits.

If you are looking for high-performance low level bindings, please visit Vortice.Win32

Sponsors

Please consider becoming a SPONSOR to further help development and to allow faster issue triaging and new features to be implemented. NOTE: any feature request would require a sponsor in order to allow faster implementation and allow this project to continue.

There is a collection of samples available Vortice.Windows.Samples

Credits

Library development, contributions and bugfixes by:

  • Amer Koleci
  • Aaron Sun (DirectML)

SharpDX bindings were used for some platforms to understand how mapping works using SharpGenTools.

Build

In order to compile, make sure no spaces are present in the solution path otherwise SharpGen will fail to generate bindings. Also, you need to install Visual Studio 2022 with the following components:

  • Visual C++ Toolset Component
  • Windows 11 SDK (10.0.22621.0)
  • .NET 8 SDK

Projects using Vortice.Windows

Samples

vortice.windows's People

Contributors

amerkoleci avatar aminator avatar andrew-boyarshin avatar axiverse avatar casualpokeplayer avatar dependabot[bot] avatar dmirmilshteyn avatar fornever avatar gavin-williams avatar h1cks avatar jpmikkers avatar luoluo39 avatar manju-summoner avatar manuelxmarquez avatar miyu avatar paulbartrum avatar riqq avatar sa-exe avatar sdcb avatar sergio0694 avatar shartte avatar thebarnyofbarnim avatar yinyue200 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vortice.windows's Issues

Add type safety to StateObject API

Currently when using a StateObjectDescription you have to provide a pointer for PSubobjects and the count for NumSubobjects instead of simply a StateSubObject[] or ideally Span<StateSubObject>.

StateSubObject could also be improved, but in this case the Description field can be of any type, so maybe just accept an object as well, though that would incur boxing.

DXGIDebugInterface1 in different dll.

Hello,
While trying to use the DXGI.DXGIDebugInterface1, it was complaining it wasn't finding that method in dxgidebug.dll. I fixed it by changing the dxgidebug.dll to dxgi.dll. in the following mapping

<map function="DXGIGetDebugInterface.*" dll='"dxgi.dll"' group="Vortice.DXGI.DXGI" hresult="true" check="false" /> <map param="DXGIGetDebugInterface.*?::ppDebug" attribute="out" />

How to fill buffer?

I'm following along with the tutorial from this site, I was just wondering how can I achieve the following code with Vortice.Direct3D11?

D3D11_MAPPED_SUBRESOURCE ms;
devcon->Map(pVBuffer, NULL, D3D11_MAP_WRITE_DISCARD, NULL, &ms);   // map the buffer
memcpy(ms.pData, OurVertices, sizeof(OurVertices));                // copy the data
devcon->Unmap(pVBuffer, NULL);                                     // unmap the buffer

So far, I've been able to create the buffer:

Vertex[] vertices =
{
    new Vertex(new Vector3(0, 1, 0), new Vector3(1, 0, 0)),
    new Vertex(new Vector3(1, -1, 0), new Vector3(0, 1, 0)),
    new Vertex(new Vector3(1, -1, 0), new Vector3(0, 0, 1))
};

ID3D11Buffer vertexBuffer = device.CreateBuffer(vertices, new BufferDescription()
{
    Usage = Vortice.Direct3D11.Usage.Dynamic,
    SizeInBytes = vertices.Length * Vertex.SizeInBytes,
    BindFlags = BindFlags.VertexBuffer,
    CpuAccessFlags = CpuAccessFlags.Write
});

The vertex struct:

[StructLayout(LayoutKind.Sequential)]
public struct Vertex
{
    public Vector3 Position { get; set; }

    public Vector3 Color { get; set; }

    public static readonly int SizeInBytes = Marshal.SizeOf<Vertex>();

    public Vertex(Vector3 position, Vector3 color)
    {
        Position = position;
        Color = color;
    }
}

Error loading Vortice.Dxc libs (wrong .dll install path)

Hi, me and @Aminator are currently moving from DotNetDxc to Vortice.Dxc, and we noticed that the latter copies the two dxcompiler.dll and dxil.dll files to the wrong directory. Currently, those .dlls are placed under the runtimes\win-x[64|86]\native path, but that causes a runtime exception, as the caller of those .dlls is only looking for them next to the entry point of the app.

Right now I'm getting this error:
image

As a test, manually copying the two .dlls to the output folder solves the issue.
Would it be possible to setup the NuGet package so that instead of placing those .dlls into the runtime tree, it would just copy the correct ones (depending on the CPU architecture) right to the output folder, next to all the other .dll files?

Thanks! ๐Ÿ˜„

XAudio2 SourceVoice State.SamplesPlayed doesn't update

I was curious to try your XAudio2 library so I took some of my code that was using SlimDX's XAudio2 and ported it over. I ran into an issue because I have logic to try to keep a certain amount of data buffered in the output device at any given time, so it tries to calculate how many samples are currently buffered by doing something like:

long samplesAwaitingPlayback = _totalSamplesSubmitted - (long)_sourceVoice.State.SamplesPlayed;

In Vortice.XAudio2 v1.3.0, SamplesPlayed is always 0 so it made my code think the buffer was never emptying and therefore it stopped playing.

ID3D11DeviceContext.Map produces empty byte[]

Hey, i'm currently trying to port some code from SharpDX to Vortice.

I'm trying to capture the screen and convert it to a Bitmap or byte[]

When i call the following functions with the same arguments as in SharpDX i only get a blank image or empty byte[]

ID3D11Device.ImmediateContext.CopyResource, (This can silently fail?)
ID3D11Device.ID3D11DeviceContext.Map

Can you spot any errors in my code, or things im forgetting, i tryed to port it 1:1 from SharpDx to Vortice and all the objects look the same.

The error happens after i copy the contents from
MappedSubresource.PData, into a byte[]

Line:
Marshal.Copy(srcPtr, testArr, 0, (int)srcLen);

The same code works when i execute it in my SharpDX test solution.

CaptureScreenVortice.txt

The code im trying to port is;
https://github.com/jasonpang/screenshare/blob/master/ScreenShare.Common/ScreenCapture/DxgiOutputDuplicator.cs

Cheers

Are you aware of Tanner Gooding's TerraFX.Interop.Windows?

Heya, Amer. I found an official DirectX Discord where I asked about whether there was a possibility for officially-maintained bindings from Microsoft. After some interesting conversation, I was pointed to a project maintained by Tanner Gooding from Microsoft called TerraFX.Interop.Windows. It appears that he's somehow using the Clang compiler to generate mappings in C#. The mappings his tool generates are much more raw than what SharpGen is putting out. For example, here's the mapping for ID2D1RenderTarget::CreateSolidColorBrush:

[return: NativeTypeName("HRESULT")]
public int CreateSolidColorBrush(
    [In, NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA* color,
    [In, Optional] D2D1_BRUSH_PROPERTIES* brushProperties,
    [Out] ID2D1SolidColorBrush** solidColorBrush
)
{
    fixed (ID2D1RenderTarget* This = &this)
    {
        return MarshalFunction<_CreateSolidColorBrush>(lpVtbl->CreateSolidColorBrush)(
            This,
            color,
            brushProperties,
            solidColorBrush
        );
    }
}

To use this, I have to enable unsafe code in my project and write lots of helper code to deal with things like checking HRESULTs. Certainly annoying, but if these mappings are robust and automatically generated without manual mapping configuration, it might be worth using the library.

Here's an example of a class that creates, exposes, and releases stock brushes for use throughout the application:

public unsafe class Brushes : IBrushes
{
    private ID2D1SolidColorBrush* _opaqueWhite;

    public ID2D1SolidColorBrush* OpaqueWhite => _opaqueWhite;

    public void Dispose()
    {
        ReleaseDeviceResources();
    }

    public void ReleaseDeviceResources()
    {
        _opaqueWhite->Release();
        _opaqueWhite= null;
    }

    public void InitializeDeviceResources(ID2D1RenderTarget* renderTarget)
    {
        ReleaseDeviceResources();

        fixed (ID2D1SolidColorBrush** opaqueWhite = &_opaqueWhite)
        {
            var opaqueWhiteColor = new DXGI_RGBA { r = 1, g = 1, b = 1, a = 1 };

            renderTarget->CreateSolidColorBrush(&opaqueWhiteColor, null, opaqueWhite);
        }
    }
}

As you can see, this is a lot closer to C++'s way than C#'s traditional way. I could get comfortable with that, but having fixed blocks all over the place, dealing with pointer dereferencing, COM-style ->Release() instead of IDisposable, and no polymorphism because these types are all structs and don't implement interfaces is going to be a big pain.

Any plans to add DirectInput bindings?

Any plans to add DirectInput bindings?I ported 2D games to Vortice.Windows.But it doesn't have a DirectInput binding.
Sorry, English is not my native language.
The above is from Google translation.

Scope of SharpWindows

Hi, I know you have limited the scope to just the Core Direct X 11 and 12 capabilities. Just wondeirng if once you have completed your initial goals you would consider Direct Input XAudio later? May want to contribute at some point seeing that Sharpdx is done. At that you are using Numerics instead of rolling your own.

Happy to discuss.

Memory corruption when marshalling HitGroupDescription

The CopyMemory call in
public StateSubObject(HitGroupDescription hitGroupDescription)
incorrectly uses the size of the IndirectArgumentDescription class causing memory corruption exceptions.

This:

MemoryHelpers.CopyMemory(
    Description,
    (IntPtr)Unsafe.AsPointer(ref nativeDescription),
    sizeof(IndirectArgumentDescription));

Should instead be something like:

MemoryHelpers.CopyMemory(
    Description,
    (IntPtr)Unsafe.AsPointer(ref nativeDescription),
    sizeof(HitGroupDescription.__Native));

Feature Request

Initializers/Bootstrappers that support HoloLens. HoloLens emulator would be a good start.

Incorrect rectangle type used for many APIs

I ran into an issue during my SharpDX to Vortice.Windows migration: the use of RectangleF by mappings. I know this is an issue with at least a few APIs but it's likely the issue is much greater in scope; I just haven't had a chance to use more APIs yet.

For an example, take a look at ID2D1RenderTarget::DrawBitmap documentation. Note how the rectangle type used is D2D1_RECT_F, which is indirectly defined as this:

typedef struct D2D_RECT_F {
  FLOAT left;
  FLOAT top;
  FLOAT right;
  FLOAT bottom;
} D2D_RECT_F;

Unfortunately, the mapping is using System.Drawing.RectangleF, which is defined like this:

public struct RectangleF
{
    private float x;
    private float y;
    private float width;
    private float height;
}

When I pass a RectangleF instance, DirectX is interpreting the width and height fields as right and bottom respectively; as a result, my drawing operations are rendered incorrectly. I believe this is why SharpDX used custom types like RawRectangleF.

It might be worth looking through all of SharpDX's custom interop types to see what other types may have to be created. It's likely you'll have to create some custom structs and such with the correct StructLayoutAttribute settings.

COM memory behavior for IDXGIFactory1.EnumAdapters1

Hi,

Could you please explain whether or how I should release adapters returned by IDXGIFactory1.EnumAdapters1? From the source code I see it directly calls the native EnumAdapters1 function, which I think automatically AddRef for each returned pointer. I think the caller should Release all elements returned by this method?

I noticed that in src/samples/Vortice.SampleFramework/D3D12GraphicsDevice.cs, this is not done.

Thanks!

Desktop Duplication Sample

Greetings, I found some API difficulties coming from SharpDX, would be great to see how this is implemented on Vortice with a sample, thanks in advance.

Possible memory leak

The following code:

D3D11.D3D11CreateDevice(
    null,
    DriverType.Hardware,
    DeviceCreationFlags.BgraSupport | DeviceCreationFlags.Debug,
    new[] { FeatureLevel.Level_11_1, FeatureLevel.Level_11_0 },
    out ID3D11Device d).CheckError();

d.Dispose();

results in the following debug output after a call to IDXGIDebug::ReportLiveObjects:

DXGI WARNING: Live IDXGIFactory at 0x000001CDF07E4740, Refcount: 2 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: 	Live IDXGIAdapter at 0x000001CDF1598D30, Refcount: 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live                   IDXGIAdapter :      1 [ STATE_CREATION WARNING #0: ]
D3D11 WARNING: Live ID3D11Device at 0x000001CDF1725030, Refcount: 3 [ STATE_CREATION WARNING #441: LIVE_DEVICE]
D3D11 WARNING: 	Live ID3D11Context at 0x000001CDF17584E0, Refcount: 1, IntRef: 1 [ STATE_CREATION WARNING #2097226: LIVE_CONTEXT]
D3D11 WARNING: Live                  ID3D11Context :      1 [ STATE_CREATION WARNING #422: LIVE_OBJECT_SUMMARY]

Is this a memory leak as it appears? I noticed this when testing my D2DERR_RECREATE_TARGET code; my app started consuming memory like crazy.

Xaudio2 example

Hello,

could you please write a short example on how to load and play a sound file and use HRTF/ambisonic functions? I'd really like to learn it.

Add no spaces requirement to the build instructions

I was having issues building this project because I had spaces in the project path. This seems to be caused by SharpGenTools/CastXML module.

It would be nice, if no spaces in project path requirement was added to the build instructions in the readme, as this is not standard requirement for C# projects.

CD3D11 Helper Structures

Hello,
I'm reimplemeting the UWP DirectX 11 App that comes with Visual Studio, and I came across these helper structures. Is it implemented in some way in Vortice?
I think it would be a good idea, to make some struct initializations easier.

I can try to submit a PR, but I still don't quite get how to work with Vortice and SharpGen :).

SharpDirect3D12.IsSupported needs to release nativePtr

Ran the HelloDirect3D12 example, was failing when creating the device. Checked the code, found that the IsSupported function was failing to release the native ptr.

Added the following code.

` var device = new ID3D12Device(nativePtr);

            device.Dispose();`

Have created a pull request in regards to IsSupported.

Handle correct sign type of primitives

I just committed the fix to avoid mapping from native UINT64 and UINT16 to C# long and short, instead of ulong and and ushort.
I was planning to fix the UINT32 map as well and map to uint instead of int as now.

This commit shows the fix ea17b58

@Aminator @Sergio0694 do you find any issue with this one?

[XAudio2] GC causing audio glitches

To continue a discussion from here: MonoGame/MonoGame#7000

XAudio2 engine creates it's own native thread for audio, but that thread is somehow being blocked by GC, which causes audio glitches when GC is running. Sample project.

This may be caused by registering for callback when xaudio engine is created, using RegisterForCallback.

Is there a way to register for callback in managed code in such a way that it wouldn't cause native audio thread being blocked by GC?

[DXC] Mesh shaders Support

I would like to request support for the brand new DirectX Mesh Shaders that went into dev preview in October:

https://devblogs.microsoft.com/directx/dev-preview-of-new-directx-12-features/

This introduces the new shader stages "ms_6_5" and "as_6_5", so the bindings would have to get updated with new DxcShaderStages I guess?

I just started using Vortice.DXC after having used dxc.exe through a spawned commandline process, and I must say that it's exactly what I've been wishing for! I am making a game engine in C++, but I have a C# Cooker application to precompile shaders, convert models/textures etc, and now I can finally get rid of the ugly dxc.exe bridge I made. Thank you! :)

Load dxil.dll in the static constructor of the Dxc class

I found out that dxil.dll didn't need to be loaded while creating a pipeline state but instead before using anything from dxcompiler.dll. This is because when compiling it will make a hidden LoadLibrary call and if it finds dxil.dll, it will sign the shader bytecode, which is important as without it can't be used without experimental mode.

So simply load dxil.dll before anything else in the static constructor of the Dxc class and you can remove the Dxil class.

Incorrect Free in BuildRaytracingAccelerationStructureInputs

Hi and thank you for your great efforts so far!

There's an incorrect Marshal.FreeHGlobal in BuildRaytracingAccelerationStructureInputs:

internal void __MarshalFree()
{
    if (Union.pGeometryDescs != IntPtr.Zero)
    {
        Marshal.FreeHGlobal(Union.pGeometryDescs);
    }
}

The Union is being declared as such:

internal unsafe struct Union
{
    [FieldOffset(0)]
    public long InstanceDescs;

    [FieldOffset(0)]
    public IntPtr pGeometryDescs;
}

When using the Inputs structure in a top level acceleration structure scenario, you set the instances, when using it for bottom level acceleration scenarios, you set the geometry field, but never both (hence the union).

Setting the InstanceDescs to something other than zero will cause a crash when the runtime decides to call the Free method, making the BuildRaytracingAccelerationStructureInputs unusable in TopLevelAS cases.
(Note: The InstanceDescs points to GPU memory, whereas the pGeometryDescs points to host memory)

I've worked around this by accepting the memory leak and commented out the Marshal.Free() call, but that's obviously not a solution. Generally I'm unsure how to fix this except by letting the developer handle this manually somehow.

System.InvalidCastException at IDxcLibrary.CreateIncludeHandler

The second time I call DxcCompiler.Compile in my DirectX12WinFormsApp project it throws a System.InvalidCastException. I can't figure out why it only throws in this special case.

Here is the stack trace:

System.InvalidCastException
  HResult=0x80004002
  Message=Error 0x2629.  Debugging resource strings are unavailable. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.30319.0&File=mscorrc.dll&Key=0x2629
  Source=System.Private.CoreLib
  StackTrace:
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at Vortice.Dxc.IDxcLibrary.CreateIncludeHandler()
   at Vortice.Dxc.DxcCompiler.Compile(DxcShaderStage shaderStage, String source, String entryPoint, String sourceName, DxcCompilerOptions options, DXCDefine[] defines, IDxcIncludeHandler include)
   at DirectX12GameEngine.Shaders.ShaderCompiler.Compile(DxcShaderStage shaderStage, String source, String entryPoint, String sourceName, DxcCompilerOptions options) in C:\Users\Amin\source\repos\Aminator\DirectX12GameEngine\DirectX12GameEngine.Shaders\ShaderCompiler.cs:line 25

ID3D11DeviceContext.DiscardView1 null rects parameter not accepted

Hello,
This piece of c++ code is valid and works.

// Discard the contents of the render target.
// This is a valid operation only when the existing contents will be entirely
// overwritten. If dirty or scroll rects are used, this call should be removed.
m_d3dContext->DiscardView1(m_d3dRenderTargetView.Get(), nullptr, 0);

However:

// Discard the contents of the render target.
// This is a valid operation only when the existing contents will be entirely
// overwritten. If dirty or scroll rects are used, this call should removed.
d3dContext.DiscardView1(d3dRenderTargetView, null);

This will fail with a Object reference not set to an instance of an object.
This is probably happening because inside the DiscardView1 you're not taking into account the possibility of passing a null instead of an array.

Binaries folder visible in projects using Vortice.Dxc

Hi, this is just a follow up from #13 regarding the binaries folder in projects using Vortice.Dxc. I see that the Visibility property in the .NET Standard 2.0 .targets file is now set to false, but the folder is still visible in projects using the package.

I'm not really sure why that is or how to actually get rid of this, but I thought I'd let you know just in case, in case you had any ideas on how to fix this in the future ๐Ÿ˜„

Keep up the good work!

Missing winerror result codes

Hello,
Thanks for the recent changes you've been doing, it's making implementing the base UWP app going along very nicely.
While going further with it, I found that Vortice.Windows is missing the winerror.h DirectX specific errors (I honestly think that Microsoft is just wrong in the way they did it but what do I know)

C++ Sample that i'm looking at.

// Ignore D2DERR_RECREATE_TARGET here. This error indicates that the device
// is lost. It will be handled during the next call to Present.
HRESULT hr = context->EndDraw();
if (hr != D2DERR_RECREATE_TARGET)
{
	DX::ThrowIfFailed(hr);
}

On winerror.h we have....

//
// MessageId: D2DERR_RECREATE_TARGET
//
// MessageText:
//
// There has been a presentation error that may be recoverable. The caller needs to recreate, rerender the entire frame, and reattempt present.
//
#define D2DERR_RECREATE_TARGET           _HRESULT_TYPEDEF_(0x8899000CL)

What was I expecting to find? In Vortice.DXGI we have the Vortice.DXGI.ResultCode, but, Vortice.Direct2D1 doesn't have such analogous type.

Improvements

  • Need to rename projects with better name, for example:
    Vortice.DirectX.Direct2D -> Vortice.Direct2D1
    Vortice.DirectX.Direct3D11 -> Vortice.Direct3D11
    Vortice.DirectX.Direct3D12 -> Vortice.Direct3D12
    Vortice.DirectX.ShaderCompiler -> Vortice.D3DCompiler

  • Introduce Vortice.DXGI separation.

Any plans for a (preview) NuGet package?

Hi, first of all I wanted to say great job of picking up where SharpDX left off, this project is looking great so far! I'm working on a project that currently uses SharpDX (ComputeSharp) and it looks like Vortice.Windows could replace both SharpDX and DotNetDxc for me (especially DotNetDxc, as it bundles old .dlls and it's not suitable for my use case anyway).

Are there any plans to publish Vortice.Windows on NuGet, at least as a preview package? That'd make it possible for 3rd party NuGet packages to reference it.

Additional question: I just noticed that the shader compiler code (with a partial port of the DotNetDxc code) in this repo is under a sample project - do you plan to integrate that code into Vortice.Windows (along with the necessary .dlls) or would we still need to reference the DotNetDxc package separately?

Thanks! ๐Ÿ˜„

Make description parameters nullable for IDXGIFactory2.CreateSwapChainForXXX

Because currently these functions take value-type parameters which are not optional, there is no way to specify a NULL description as one can do in native DirectX 11. For example, in CreateSwapChainForHwnd, there is no way to specify restrictToOutput while providing no fullscreenDescription. I think probably it's better to use the pattern already used in ID3D11Device.CreateXXX methods (use nullable value-type parameters).

Need Direct3D 9 till these days.

The Vortice seems has not any plan for D3D9. Maybe because it is very old.
However, in WPF(Windows Presentation Framework), the D3D9 is the only way of low-level GPU acceleration rendering.

The D3DImage support D3D in WPF and it only accept D3D9 texture for its backbuffer.

Therefore, we need to create a shared D3D9 texture for D3D11, D3D12 or any other D3D to do actual rendering.
Of course, we can do it in Win32 or C++/CLI but we have to use x86/x64 or [DLLImport] instead of Any CPU.

In SharpDX, this is not a problem because it didn't drop the D3D9 till been retired.

Dxc DLLs not copied to the output directory in UWP

The issue is that in UWP native DLLs only get copied automatically when they are in the runtimes/win-(x64 or x86)/native folder in the NuGet package. So what you can do is put the DLLs in those folders (like you had earlier) and for .NET Core 3.0 add that additional directory with SetDllDirectory, so you don't even need a .targets file.

Ideally this is something that either should be done automatically by .NET Core 3.0 or the DLLs should be copied next to the executable. We would have to contact the .NET Core team for that, but for now the above solution suffices.

[Question] Is it possible to use this to capture a Window client area for a screenshot?

I have a .NET core 3.1 application and i've been using native calls to GDI resources, however on some devices the hardware does not support BitBlt (My laptop doesn't work, but my Desktop does). The resulting bitmap is just black. It seems like the best way to approach this is a hook or some form of direct x capabilities so that it can work across any hardware its running on. I'm not familiar with this and have been doing ok with simple BitBlt for screen capture of a window which i am performing some OCR on. Would it be possible to use this library to capture a frame?

GENERIC_READ and GENERIC_WRITE constants not implemented

I am attempting to call IWICImagingFactory2.CreateDecoderFromFilename, whose third parameter is int dwDesiredAccess. According to MSDN, this value can be set to GENERIC_READ and GENERIC_WRITE, but I am unable to find those constants defined in Vortice.Windows except as private constants in IWICStream. I believe SharpDX implemented this method using a NativeFileAccess enum.

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

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

  • D3 photo D3

    Data-Driven Documents codes.