mirror of
https://github.com/amerkoleci/Vortice.Win32.git
synced 2026-01-14 08:06:02 +08:00
D3D12: Add ID3D12GraphicsCommandList extensions methods.
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
|
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
|
||||||
<RestoreConfigFile>$(MSBuildThisFileDirectory)NuGet.config</RestoreConfigFile>
|
<RestoreConfigFile>$(MSBuildThisFileDirectory)NuGet.config</RestoreConfigFile>
|
||||||
|
|
||||||
<VersionPrefix>1.9.10</VersionPrefix>
|
<VersionPrefix>1.9.11</VersionPrefix>
|
||||||
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
|
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
|
||||||
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public static unsafe partial class ID3D12DeviceExtensions
|
|||||||
|
|
||||||
fixed (FeatureLevel* pFeatureLevels = featureLevels)
|
fixed (FeatureLevel* pFeatureLevels = featureLevels)
|
||||||
{
|
{
|
||||||
var featureData = new FeatureDataFeatureLevels
|
FeatureDataFeatureLevels featureData = new()
|
||||||
{
|
{
|
||||||
NumFeatureLevels = (uint)featureLevels.Length,
|
NumFeatureLevels = (uint)featureLevels.Length,
|
||||||
pFeatureLevelsRequested = pFeatureLevels,
|
pFeatureLevelsRequested = pFeatureLevels,
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
// Copyright © Amer Koleci and Contributors.
|
||||||
|
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
|
||||||
|
|
||||||
|
using static Win32.Graphics.Direct3D12.Apis;
|
||||||
|
|
||||||
|
namespace Win32.Graphics.Direct3D12;
|
||||||
|
|
||||||
|
public static unsafe class ID3D12GraphicsCommandListExtensions
|
||||||
|
{
|
||||||
|
public static void ResourceBarrierTransition<TD3D12GraphicsCommandList>(
|
||||||
|
ref this TD3D12GraphicsCommandList self,
|
||||||
|
ID3D12Resource* resource,
|
||||||
|
ResourceStates stateBefore,
|
||||||
|
ResourceStates stateAfter,
|
||||||
|
uint subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
|
||||||
|
ResourceBarrierFlags flags = ResourceBarrierFlags.None)
|
||||||
|
where TD3D12GraphicsCommandList : unmanaged, ID3D12GraphicsCommandList.Interface
|
||||||
|
{
|
||||||
|
ResourceBarrier barrier = Direct3D12.ResourceBarrier.InitTransition(resource, stateBefore, stateAfter, subresource, flags);
|
||||||
|
self.ResourceBarrier(1u, &barrier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResourceBarrierAliasing<TD3D12GraphicsCommandList>(
|
||||||
|
ref this TD3D12GraphicsCommandList self,
|
||||||
|
ID3D12Resource* resourceBefore,
|
||||||
|
ID3D12Resource* resourceAfter)
|
||||||
|
where TD3D12GraphicsCommandList : unmanaged, ID3D12GraphicsCommandList.Interface
|
||||||
|
{
|
||||||
|
ResourceBarrier barrier = Direct3D12.ResourceBarrier.InitAliasing(resourceBefore, resourceAfter);
|
||||||
|
self.ResourceBarrier(1u, &barrier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResourceBarrierUAV<TD3D12GraphicsCommandList>(
|
||||||
|
ref this TD3D12GraphicsCommandList self, ID3D12Resource* resource)
|
||||||
|
where TD3D12GraphicsCommandList : unmanaged, ID3D12GraphicsCommandList.Interface
|
||||||
|
{
|
||||||
|
ResourceBarrier barrier = Direct3D12.ResourceBarrier.InitUAV(resource);
|
||||||
|
self.ResourceBarrier(1u, &barrier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResourceBarrier<TD3D12GraphicsCommandList>(ref this TD3D12GraphicsCommandList self, ResourceBarrier barrier)
|
||||||
|
where TD3D12GraphicsCommandList : unmanaged, ID3D12GraphicsCommandList.Interface
|
||||||
|
{
|
||||||
|
self.ResourceBarrier(1u, &barrier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResourceBarrier<TD3D12GraphicsCommandList>(
|
||||||
|
ref this TD3D12GraphicsCommandList self, ResourceBarrier[] barriers)
|
||||||
|
where TD3D12GraphicsCommandList : unmanaged, ID3D12GraphicsCommandList.Interface
|
||||||
|
{
|
||||||
|
fixed (ResourceBarrier* pBarriers = barriers)
|
||||||
|
{
|
||||||
|
self.ResourceBarrier((uint)barriers.Length, pBarriers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResourceBarrier<TD3D12GraphicsCommandList>(
|
||||||
|
ref this TD3D12GraphicsCommandList self, int numBarriers, ResourceBarrier[] barriers)
|
||||||
|
where TD3D12GraphicsCommandList : unmanaged, ID3D12GraphicsCommandList.Interface
|
||||||
|
{
|
||||||
|
fixed (ResourceBarrier* pBarriers = barriers)
|
||||||
|
{
|
||||||
|
self.ResourceBarrier((uint)numBarriers, pBarriers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResourceBarrier<TD3D12GraphicsCommandList>(
|
||||||
|
ref this TD3D12GraphicsCommandList self, ReadOnlySpan<ResourceBarrier> barriers)
|
||||||
|
where TD3D12GraphicsCommandList : unmanaged, ID3D12GraphicsCommandList.Interface
|
||||||
|
{
|
||||||
|
fixed (ResourceBarrier* pBarriers = barriers)
|
||||||
|
{
|
||||||
|
self.ResourceBarrier((uint)barriers.Length, pBarriers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResourceBarrier<TD3D12GraphicsCommandList>(
|
||||||
|
ref this TD3D12GraphicsCommandList self, int numBarriers, ReadOnlySpan<ResourceBarrier> barriers)
|
||||||
|
where TD3D12GraphicsCommandList : unmanaged, ID3D12GraphicsCommandList.Interface
|
||||||
|
{
|
||||||
|
fixed (ResourceBarrier* pBarriers = barriers)
|
||||||
|
{
|
||||||
|
self.ResourceBarrier((uint)numBarriers, pBarriers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user