Code updates from the DX12GameEngine repo
See https://github.com/Aminator9000/DirectX12GameEngine/commit/a9ede9996504736a8d55f2b6d42e27ae82aaadc3.
このコミットが含まれているのは:
1 親
ad23f8764d
コミット
05b9f22cea
5ファイル変更
+79
-90
検索条件に一致するファイルはありません
@@ -64,7 +64,7 @@ namespace DirectX12ComputeShaderSample
|
||||
array[i] = i + 1;
|
||||
}
|
||||
|
||||
using Buffer<float> inputBuffer = Buffer.New(device, array.AsSpan(), BufferFlags.UnorderedAccess, GraphicsHeapType.Default);
|
||||
using Buffer<float> gpuBuffer = Buffer.UnorderedAccess.New(device, array.AsSpan());
|
||||
|
||||
// Execute computer shader
|
||||
|
||||
@@ -73,28 +73,18 @@ namespace DirectX12ComputeShaderSample
|
||||
commandList.SetPipelineState(pipelineState);
|
||||
|
||||
commandList.SetComputeRoot32BitConstant(0, width, 0);
|
||||
commandList.SetComputeRootDescriptorTable(1, inputBuffer);
|
||||
commandList.SetComputeRootDescriptorTable(1, gpuBuffer);
|
||||
|
||||
commandList.Dispatch(2, 2, 1);
|
||||
commandList.Flush(true);
|
||||
}
|
||||
|
||||
// Copy data back to CPU
|
||||
|
||||
using Buffer<float> outputBuffer = Buffer.New<float>(device, array.Length, BufferFlags.None, GraphicsHeapType.Readback);
|
||||
|
||||
using (CommandList copyCommandList = new CommandList(device, CommandListType.Copy))
|
||||
{
|
||||
copyCommandList.CopyResource(inputBuffer, outputBuffer);
|
||||
copyCommandList.Flush(true);
|
||||
}
|
||||
|
||||
// Print matrix
|
||||
|
||||
Console.WriteLine("Before:");
|
||||
PrintMatrix(array, width, height);
|
||||
|
||||
outputBuffer.GetData(array.AsSpan());
|
||||
gpuBuffer.GetData(array.AsSpan());
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("After:");
|
||||
@@ -118,3 +108,4 @@ namespace DirectX12ComputeShaderSample
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする