Rename Gpu class to GraphicsDevice
このコミットが含まれているのは:
1 親
19485cd3fe
コミット
a0a3511efe
23ファイル変更
+88
-90
検索条件に一致するファイルはありません
@@ -100,10 +100,10 @@ public class BlasBenchmark : IDisposable
|
||||
B = CreateRandomArray(P);
|
||||
Y = CreateRandomArray(C * N * P);
|
||||
|
||||
BufferX = Gpu.Default.AllocateReadOnlyBuffer(X);
|
||||
BufferW = Gpu.Default.AllocateReadOnlyBuffer(W);
|
||||
BufferB = Gpu.Default.AllocateReadOnlyBuffer(B);
|
||||
BufferY = Gpu.Default.AllocateReadWriteBuffer(Y);
|
||||
BufferX = GraphicsDevice.Default.AllocateReadOnlyBuffer(X);
|
||||
BufferW = GraphicsDevice.Default.AllocateReadOnlyBuffer(W);
|
||||
BufferB = GraphicsDevice.Default.AllocateReadOnlyBuffer(B);
|
||||
BufferY = GraphicsDevice.Default.AllocateReadWriteBuffer(Y);
|
||||
|
||||
Cpu();
|
||||
GpuWithNoTemporaryBuffers();
|
||||
@@ -140,7 +140,7 @@ public class BlasBenchmark : IDisposable
|
||||
[Benchmark]
|
||||
public void GpuWithNoTemporaryBuffers()
|
||||
{
|
||||
BlasHelpers.FullyConnectedForwardGpu(Gpu.Default, C, N, M, P, BufferX!, BufferW!, BufferB!, BufferY!);
|
||||
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.Default, C, N, M, P, BufferX!, BufferW!, BufferB!, BufferY!);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -149,12 +149,12 @@ public class BlasBenchmark : IDisposable
|
||||
[Benchmark]
|
||||
public void GpuWithTemporaryBuffers()
|
||||
{
|
||||
using ReadOnlyBuffer<float> x = Gpu.Default.AllocateReadOnlyBuffer(X!);
|
||||
using ReadOnlyBuffer<float> w = Gpu.Default.AllocateReadOnlyBuffer(W!);
|
||||
using ReadOnlyBuffer<float> b = Gpu.Default.AllocateReadOnlyBuffer(B!);
|
||||
using ReadWriteBuffer<float> y = Gpu.Default.AllocateReadWriteBuffer<float>(Y!.Length);
|
||||
using ReadOnlyBuffer<float> x = GraphicsDevice.Default.AllocateReadOnlyBuffer(X!);
|
||||
using ReadOnlyBuffer<float> w = GraphicsDevice.Default.AllocateReadOnlyBuffer(W!);
|
||||
using ReadOnlyBuffer<float> b = GraphicsDevice.Default.AllocateReadOnlyBuffer(B!);
|
||||
using ReadWriteBuffer<float> y = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(Y!.Length);
|
||||
|
||||
BlasHelpers.FullyConnectedForwardGpu(Gpu.Default, C, N, M, P, x, w, b, y);
|
||||
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.Default, C, N, M, P, x, w, b, y);
|
||||
|
||||
y.CopyTo(Y);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public sealed partial class HlslBokehBlurProcessor : IImageProcessor
|
||||
/// Initializes a new instance of the <see cref="HlslBokehBlurProcessor"/> class.
|
||||
/// </summary>
|
||||
public HlslBokehBlurProcessor()
|
||||
: this(Gpu.Default, DefaultRadius, DefaultComponents)
|
||||
: this(GraphicsDevice.Default, DefaultRadius, DefaultComponents)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public sealed partial class HlslBokehBlurProcessor : IImageProcessor
|
||||
/// <param name="radius">The size of the area to sample.</param>
|
||||
/// <param name="components">The number of components to use to approximate the original 2D bokeh blur convolution kernel.</param>
|
||||
public HlslBokehBlurProcessor(int radius, int components)
|
||||
: this(Gpu.Default, radius, components)
|
||||
: this(GraphicsDevice.Default, radius, components)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor
|
||||
/// Initializes a new instance of the <see cref="HlslGaussianBlurProcessor"/> class.
|
||||
/// </summary>
|
||||
public HlslGaussianBlurProcessor()
|
||||
: this(Gpu.Default, DefaultSigma, 9)
|
||||
: this(GraphicsDevice.Default, DefaultSigma, 9)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor
|
||||
/// </summary>
|
||||
/// <param name="radius">The radius value representing the size of the area to sample.</param>
|
||||
public HlslGaussianBlurProcessor(int radius)
|
||||
: this(Gpu.Default, radius / 3F, radius)
|
||||
: this(GraphicsDevice.Default, radius / 3F, radius)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,12 @@ let main _ =
|
||||
let array = [| for i in 1 .. 100 -> (float32)i |]
|
||||
|
||||
// Create the graphics buffer
|
||||
use buffer = Gpu.Default.AllocateReadWriteBuffer(array)
|
||||
use buffer = GraphicsDevice.Default.AllocateReadWriteBuffer(array)
|
||||
|
||||
let shader = new MultiplyByTwo(buffer)
|
||||
|
||||
// Run the shader (passed by reference)
|
||||
Gpu.Default.For(100, &shader)
|
||||
GraphicsDevice.Default.For(100, &shader)
|
||||
|
||||
// Print the initial matrix
|
||||
printMatrix array 10 10 "BEFORE"
|
||||
|
||||
@@ -11,10 +11,10 @@ partial class Program
|
||||
float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray();
|
||||
|
||||
// Create the graphics buffer
|
||||
using ReadWriteBuffer<float> gpuBuffer = Gpu.Default.AllocateReadWriteBuffer(array);
|
||||
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.Default.AllocateReadWriteBuffer(array);
|
||||
|
||||
// Run the shader
|
||||
Gpu.Default.For(100, new MainKernel(gpuBuffer));
|
||||
GraphicsDevice.Default.For(100, new MainKernel(gpuBuffer));
|
||||
|
||||
// Print the initial matrix
|
||||
PrintMatrix(array, 10, 10, "BEFORE");
|
||||
|
||||
@@ -29,9 +29,9 @@ public sealed class ContouredLayersRunner : IShaderRunner
|
||||
{
|
||||
string filename = Path.Combine(Package.Current.InstalledLocation.Path, "Assets", "Textures", "RustyMetal.png");
|
||||
|
||||
this.texture = Gpu.Default.LoadReadOnlyTexture2D<Rgba32, Float4>(filename);
|
||||
this.texture = GraphicsDevice.Default.LoadReadOnlyTexture2D<Rgba32, Float4>(filename);
|
||||
}
|
||||
|
||||
Gpu.Default.ForEach(texture, new ContouredLayers((float)timespan.TotalSeconds, this.texture));
|
||||
GraphicsDevice.Default.ForEach(texture, new ContouredLayers((float)timespan.TotalSeconds, this.texture));
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
// Get the underlying ID3D12Device in use
|
||||
fixed (ID3D12Device** d3D12Device = this.d3D12Device)
|
||||
{
|
||||
_ = InteropServices.TryGetID3D12Device(Gpu.Default, Windows.__uuidof<ID3D12Device>(), (void**)d3D12Device);
|
||||
_ = InteropServices.TryGetID3D12Device(GraphicsDevice.Default, Windows.__uuidof<ID3D12Device>(), (void**)d3D12Device);
|
||||
}
|
||||
|
||||
// Create the direct command queue to use
|
||||
@@ -217,7 +217,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
D3D12_RESOURCE_DESC d3D12Resource0Description = this.d3D12Resource0.Get()->GetDesc();
|
||||
|
||||
// Create the 2D texture to use to generate frames to display
|
||||
this.texture = Gpu.Default.AllocateReadWriteTexture2D<Rgba32, float4>(
|
||||
this.texture = GraphicsDevice.Default.AllocateReadWriteTexture2D<Rgba32, float4>(
|
||||
(int)d3D12Resource0Description.Width,
|
||||
(int)d3D12Resource0Description.Height);
|
||||
}
|
||||
@@ -233,7 +233,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
}
|
||||
|
||||
// Generate the new frame
|
||||
Gpu.Default.ForEach(this.texture!, this.shaderFactory(time));
|
||||
GraphicsDevice.Default.ForEach(this.texture!, this.shaderFactory(time));
|
||||
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = default;
|
||||
|
||||
|
||||
@@ -79,6 +79,6 @@ class Program
|
||||
{
|
||||
string filename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Textures", $"{name}.png");
|
||||
|
||||
return Gpu.Default.LoadReadOnlyTexture2D<Rgba32, float4>(filename);
|
||||
return GraphicsDevice.Default.LoadReadOnlyTexture2D<Rgba32, float4>(filename);
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする