Remove GraphicsDevice.Default property and APIs
このコミットが含まれているのは:
1 親
ea0f792ae6
コミット
4e5acba69c
19ファイル変更
+67
-115
検索条件に一致するファイルはありません
@@ -5,10 +5,10 @@ using ComputeSharp;
|
||||
float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray();
|
||||
|
||||
// Create the graphics buffer
|
||||
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.Default.AllocateReadWriteBuffer(array);
|
||||
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(array);
|
||||
|
||||
// Run the shader
|
||||
GraphicsDevice.Default.For(100, new MultiplyByTwo(gpuBuffer));
|
||||
GraphicsDevice.GetDefault().For(100, new MultiplyByTwo(gpuBuffer));
|
||||
|
||||
// Get the data back
|
||||
float[] result = gpuBuffer.ToArray();
|
||||
|
||||
@@ -5,10 +5,10 @@ using ComputeSharp;
|
||||
float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray();
|
||||
|
||||
// Create the graphics buffer
|
||||
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.Default.AllocateReadWriteBuffer(array);
|
||||
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(array);
|
||||
|
||||
// Run the shader
|
||||
GraphicsDevice.Default.For(100, new MultiplyByTwo(gpuBuffer));
|
||||
GraphicsDevice.GetDefault().For(100, new MultiplyByTwo(gpuBuffer));
|
||||
|
||||
// Get the data back
|
||||
float[] result = gpuBuffer.ToArray();
|
||||
|
||||
@@ -5,10 +5,10 @@ using ComputeSharp;
|
||||
float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray();
|
||||
|
||||
// Create the graphics buffer
|
||||
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.Default.AllocateReadWriteBuffer(array);
|
||||
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(array);
|
||||
|
||||
// Run the shader
|
||||
using (var context = GraphicsDevice.Default.CreateComputeContext())
|
||||
using (var context = GraphicsDevice.GetDefault().CreateComputeContext())
|
||||
{
|
||||
context.Log("Dispatching shader");
|
||||
context.BeginEvent("Dispatching event");
|
||||
|
||||
@@ -18,7 +18,7 @@ public class DeviceDisposalTests
|
||||
{
|
||||
using ComPtr<ID3D12Device> d3D12Device = default;
|
||||
|
||||
using (GraphicsDevice graphicsDevice = GraphicsDevice.Default)
|
||||
using (GraphicsDevice graphicsDevice = GraphicsDevice.GetDefault())
|
||||
{
|
||||
InteropServices.GetID3D12Device(graphicsDevice, Windows.__uuidof<ID3D12Device>(), (void**)d3D12Device.GetAddressOf());
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ public partial class ShaderDataLoaderTests
|
||||
[TestMethod]
|
||||
public unsafe void CapturedResource()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
|
||||
DebugDispatchDataLoader dataLoader = DebugDispatchDataLoader.Create();
|
||||
|
||||
((IShader)new CapturedResourceShader(buffer)).LoadDispatchData(ref dataLoader, GraphicsDevice.Default, 111, 222, 333);
|
||||
((IShader)new CapturedResourceShader(buffer)).LoadDispatchData(ref dataLoader, GraphicsDevice.GetDefault(), 111, 222, 333);
|
||||
|
||||
Assert.AreEqual(3, dataLoader.Values.Length);
|
||||
Assert.AreEqual(1, dataLoader.Resources.Length);
|
||||
@@ -55,12 +55,12 @@ public partial class ShaderDataLoaderTests
|
||||
[TestMethod]
|
||||
public unsafe void LoadMultipleResourcesAndPrimitives()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer0 = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> buffer1 = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> buffer0 = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> buffer1 = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
|
||||
DebugDispatchDataLoader dataLoader = DebugDispatchDataLoader.Create();
|
||||
|
||||
((IShader)new MultipleResourcesAndPrimitivesShader(buffer0, buffer1, 1, 22, 77)).LoadDispatchData(ref dataLoader, GraphicsDevice.Default, 111, 222, 333);
|
||||
((IShader)new MultipleResourcesAndPrimitivesShader(buffer0, buffer1, 1, 22, 77)).LoadDispatchData(ref dataLoader, GraphicsDevice.GetDefault(), 111, 222, 333);
|
||||
|
||||
Assert.AreEqual(6, dataLoader.Values.Length);
|
||||
Assert.AreEqual(2, dataLoader.Resources.Length);
|
||||
@@ -94,12 +94,12 @@ public partial class ShaderDataLoaderTests
|
||||
[TestMethod]
|
||||
public unsafe void LoadScalarAndVectorTypes()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
|
||||
DebugDispatchDataLoader dataLoader = DebugDispatchDataLoader.Create();
|
||||
ScalarAndVectorTypesShader shader = new(buffer, new(55, 44, 888), 22, 77, new(3.14, 6.28), 42, 9999);
|
||||
|
||||
((IShader)shader).LoadDispatchData(ref dataLoader, GraphicsDevice.Default, 111, 222, 333);
|
||||
((IShader)shader).LoadDispatchData(ref dataLoader, GraphicsDevice.GetDefault(), 111, 222, 333);
|
||||
|
||||
Assert.AreEqual(18, dataLoader.Values.Length);
|
||||
Assert.AreEqual(1, dataLoader.Resources.Length);
|
||||
@@ -147,7 +147,7 @@ public partial class ShaderDataLoaderTests
|
||||
[TestMethod]
|
||||
public unsafe void LoadScalarVectorAndMatrixTypes()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
|
||||
DebugDispatchDataLoader dataLoader = DebugDispatchDataLoader.Create();
|
||||
ScalarVectorAndMatrixTypesShader shader = new(
|
||||
@@ -161,7 +161,7 @@ public partial class ShaderDataLoaderTests
|
||||
i2x2: new(11, 22, 33, 44),
|
||||
d: 9999);
|
||||
|
||||
((IShader)shader).LoadDispatchData(ref dataLoader, GraphicsDevice.Default, 111, 222, 333);
|
||||
((IShader)shader).LoadDispatchData(ref dataLoader, GraphicsDevice.GetDefault(), 111, 222, 333);
|
||||
|
||||
Assert.AreEqual(31, dataLoader.Values.Length);
|
||||
Assert.AreEqual(1, dataLoader.Resources.Length);
|
||||
@@ -226,7 +226,7 @@ public partial class ShaderDataLoaderTests
|
||||
[TestMethod]
|
||||
public unsafe void LoadFlatCustomTypeShader()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
|
||||
DebugDispatchDataLoader dataLoader = DebugDispatchDataLoader.Create();
|
||||
FlatCustomTypeShader shader = new(
|
||||
@@ -241,7 +241,7 @@ public partial class ShaderDataLoaderTests
|
||||
i2x2: new(11, 22, 33, 44),
|
||||
d: 9999));
|
||||
|
||||
((IShader)shader).LoadDispatchData(ref dataLoader, GraphicsDevice.Default, 111, 222, 333);
|
||||
((IShader)shader).LoadDispatchData(ref dataLoader, GraphicsDevice.GetDefault(), 111, 222, 333);
|
||||
|
||||
Assert.AreEqual(31, dataLoader.Values.Length);
|
||||
Assert.AreEqual(1, dataLoader.Resources.Length);
|
||||
@@ -318,7 +318,7 @@ public partial class ShaderDataLoaderTests
|
||||
[TestMethod]
|
||||
public unsafe void LoadNestedCustomTypes()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
|
||||
DebugDispatchDataLoader dataLoader = DebugDispatchDataLoader.Create();
|
||||
NestedCustomTypesShader shader = new(
|
||||
@@ -345,7 +345,7 @@ public partial class ShaderDataLoaderTests
|
||||
a: 888888,
|
||||
b: new(333.3f, 444.4f))));
|
||||
|
||||
((IShader)shader).LoadDispatchData(ref dataLoader, GraphicsDevice.Default, 111, 222, 333);
|
||||
((IShader)shader).LoadDispatchData(ref dataLoader, GraphicsDevice.GetDefault(), 111, 222, 333);
|
||||
|
||||
Assert.AreEqual(47, dataLoader.Values.Length);
|
||||
Assert.AreEqual(1, dataLoader.Resources.Length);
|
||||
@@ -417,16 +417,16 @@ public partial class ShaderDataLoaderTests
|
||||
[TestMethod]
|
||||
public unsafe void AmbiguousNames()
|
||||
{
|
||||
using ReadWriteBuffer<float> a = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> b = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> c = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> x = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> y = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> z = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> a = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> b = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> c = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> x = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> y = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
using ReadWriteBuffer<float> z = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(16);
|
||||
|
||||
DebugDispatchDataLoader dataLoader = DebugDispatchDataLoader.Create();
|
||||
|
||||
((IShader)new AmbiguousNamesShader(a, b, c, x, y, z, 7777, 8888, 9999)).LoadDispatchData(ref dataLoader, GraphicsDevice.Default, 111, 222, 333);
|
||||
((IShader)new AmbiguousNamesShader(a, b, c, x, y, z, 7777, 8888, 9999)).LoadDispatchData(ref dataLoader, GraphicsDevice.GetDefault(), 111, 222, 333);
|
||||
|
||||
Assert.AreEqual(6, dataLoader.Values.Length);
|
||||
Assert.AreEqual(6, dataLoader.Resources.Length);
|
||||
|
||||
@@ -25,7 +25,7 @@ public partial class ShaderHashCodeTests
|
||||
public void ShaderWithNoCapturedDelegates()
|
||||
{
|
||||
float value = 10;
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(1);
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(1);
|
||||
|
||||
Shader1 shader1 = new() { A = value, B = buffer };
|
||||
|
||||
@@ -58,7 +58,7 @@ public partial class ShaderHashCodeTests
|
||||
{
|
||||
Func<float, float> f = static x => x * x;
|
||||
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(1);
|
||||
using ReadWriteBuffer<float> buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(1);
|
||||
|
||||
Shader2 shader1 = new() { A = 1, B = buffer, F = f };
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public partial class InitializationTests
|
||||
[TestMethod]
|
||||
public void IsSupported()
|
||||
{
|
||||
Assert.IsTrue(GraphicsDevice.Default is not null);
|
||||
Assert.IsTrue(GraphicsDevice.GetDefault() is not null);
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
@@ -31,11 +31,11 @@ public partial class InitializationTests
|
||||
[TestMethod]
|
||||
public void DisposeDefault()
|
||||
{
|
||||
using var before = GraphicsDevice.Default.AllocateReadOnlyBuffer<float>(128);
|
||||
using var before = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer<float>(128);
|
||||
|
||||
GraphicsDevice.Default.Dispose();
|
||||
GraphicsDevice.GetDefault().Dispose();
|
||||
|
||||
using var after = GraphicsDevice.Default.AllocateReadOnlyBuffer<float>(128);
|
||||
using var after = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer<float>(128);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -45,7 +45,7 @@ public partial class InitializationTests
|
||||
|
||||
foreach (GraphicsDevice device in GraphicsDevice.EnumerateDevices())
|
||||
{
|
||||
if (i++ == 0) Assert.AreSame(GraphicsDevice.Default, device);
|
||||
if (i++ == 0) Assert.AreSame(GraphicsDevice.GetDefault(), device);
|
||||
|
||||
using ReadWriteBuffer<int> buffer = device.AllocateReadWriteBuffer<int>(128);
|
||||
|
||||
@@ -64,7 +64,7 @@ public partial class InitializationTests
|
||||
|
||||
foreach (GraphicsDevice device in GraphicsDevice.QueryDevices(info => info.DedicatedMemorySize >= 1024))
|
||||
{
|
||||
if (i++ == 0) Assert.AreSame(GraphicsDevice.Default, device);
|
||||
if (i++ == 0) Assert.AreSame(GraphicsDevice.GetDefault(), device);
|
||||
|
||||
using ReadWriteBuffer<int> buffer = device.AllocateReadWriteBuffer<int>(128);
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする