Code style improvements
このコミットが含まれているのは:
1 親
145fc5817e
コミット
3c050dbad4
8ファイル変更
+68
-159
検索条件に一致するファイルはありません
@@ -28,8 +28,6 @@ namespace ComputeSharp.Shaders.Extensions
|
||||
using ComPtr<ID3DBlob> d3D3BlobError = default;
|
||||
using ComPtr<ID3D12RootSignature> d3D12RootSignature = default;
|
||||
|
||||
int result;
|
||||
|
||||
fixed (D3D12_DESCRIPTOR_RANGE1* d3D12DescriptorRange1 = d3D12DescriptorRanges1)
|
||||
{
|
||||
D3D12_ROOT_PARAMETER1* d3D12RootParameters1 = stackalloc D3D12_ROOT_PARAMETER1[d3D12DescriptorRanges1.Length];
|
||||
@@ -52,24 +50,20 @@ namespace ComputeSharp.Shaders.Extensions
|
||||
|
||||
// Serialize the root signature from the data just computed. When this is done
|
||||
// we just work with the resulting blobs, so the input data can be unpinned.
|
||||
result = FX.D3D12SerializeVersionedRootSignature(
|
||||
FX.D3D12SerializeVersionedRootSignature(
|
||||
&d3d12VersionedRootSignatureDescription,
|
||||
d3D3Blob.GetAddressOf(),
|
||||
d3D3BlobError.GetAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result, d3D3BlobError);
|
||||
d3D3BlobError.GetAddressOf()).Assert();
|
||||
}
|
||||
|
||||
Guid d3D12RootSignatureGuid = FX.IID_ID3D12RootSignature;
|
||||
|
||||
result = d3d12device.CreateRootSignature(
|
||||
d3d12device.CreateRootSignature(
|
||||
0,
|
||||
d3D3Blob.Get()->GetBufferPointer(),
|
||||
d3D3Blob.Get()->GetBufferSize(),
|
||||
&d3D12RootSignatureGuid,
|
||||
d3D12RootSignature.GetVoidAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
d3D12RootSignature.GetVoidAddressOf()).Assert();
|
||||
|
||||
return d3D12RootSignature.Move();
|
||||
}
|
||||
@@ -97,12 +91,10 @@ namespace ComputeSharp.Shaders.Extensions
|
||||
d3d12ComputePipelineStateDescription.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
|
||||
Guid d3d12ComputePipelineStateGuid = FX.IID_ID3D12PipelineState;
|
||||
|
||||
int result = d3d12device.CreateComputePipelineState(
|
||||
d3d12device.CreateComputePipelineState(
|
||||
&d3d12ComputePipelineStateDescription,
|
||||
&d3d12ComputePipelineStateGuid,
|
||||
d3D12PipelineState.GetVoidAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
d3D12PipelineState.GetVoidAddressOf()).Assert();
|
||||
|
||||
return d3D12PipelineState.Move();
|
||||
}
|
||||
|
||||
@@ -43,17 +43,10 @@ namespace ComputeSharp.Shaders.Translation
|
||||
Guid dxcLibraryCLGuid = FX.CLSID_DxcLibrary;
|
||||
Guid dxcLibraryGuid = FX.IID_IDxcLibrary;
|
||||
|
||||
int result = FX.DxcCreateInstance(&dxcCompilerCLGuid, &dxcCompilerGuid, dxcCompiler.GetVoidAddressOf());
|
||||
FX.DxcCreateInstance(&dxcCompilerCLGuid, &dxcCompilerGuid, dxcCompiler.GetVoidAddressOf()).Assert();
|
||||
FX.DxcCreateInstance(&dxcLibraryCLGuid, &dxcLibraryGuid, dxcLibrary.GetVoidAddressOf()).Assert();
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
|
||||
result = FX.DxcCreateInstance(&dxcLibraryCLGuid, &dxcLibraryGuid, dxcLibrary.GetVoidAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
|
||||
result = dxcLibrary.Get()->CreateIncludeHandler(dxcIncludeHandler.GetAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
dxcLibrary.Get()->CreateIncludeHandler(dxcIncludeHandler.GetAddressOf()).Assert();
|
||||
|
||||
DxcCompiler = dxcCompiler;
|
||||
DxcLibrary = dxcLibrary;
|
||||
@@ -72,14 +65,14 @@ namespace ComputeSharp.Shaders.Translation
|
||||
using ComPtr<IDxcOperationResult> dxcOperationResult = default;
|
||||
using ComPtr<IDxcBlob> dxcBlobBytecode = default;
|
||||
|
||||
int result;
|
||||
|
||||
// Get the encoded blob from the source code
|
||||
fixed (char* p = source)
|
||||
{
|
||||
result = DxcLibrary.Get()->CreateBlobWithEncodingOnHeapCopy(p, (uint)source.Length * 2, 1200, dxcBlobEncoding.GetAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
DxcLibrary.Get()->CreateBlobWithEncodingOnHeapCopy(
|
||||
p,
|
||||
(uint)source.Length * 2,
|
||||
1200,
|
||||
dxcBlobEncoding.GetAddressOf()).Assert();
|
||||
}
|
||||
|
||||
// Try to compile the new compute shader
|
||||
@@ -89,7 +82,7 @@ namespace ComputeSharp.Shaders.Translation
|
||||
{
|
||||
char nullTerminator = '\0';
|
||||
|
||||
result = DxcCompiler.Get()->Compile(
|
||||
DxcCompiler.Get()->Compile(
|
||||
dxcBlobEncoding.Upcast<IDxcBlobEncoding, IDxcBlob>().Get(),
|
||||
(ushort*)&nullTerminator,
|
||||
(ushort*)entryPoint,
|
||||
@@ -99,23 +92,17 @@ namespace ComputeSharp.Shaders.Translation
|
||||
null,
|
||||
0,
|
||||
DxcIncludeHandler.Get(),
|
||||
dxcOperationResult.GetAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
dxcOperationResult.GetAddressOf()).Assert();
|
||||
}
|
||||
|
||||
int status;
|
||||
|
||||
result = dxcOperationResult.Get()->GetStatus(&status);
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
dxcOperationResult.Get()->GetStatus(&status).Assert();
|
||||
|
||||
// The compilation was successful, so we can extract the shader bytecode
|
||||
if (status == 0)
|
||||
{
|
||||
result = dxcOperationResult.Get()->GetResult(dxcBlobBytecode.GetAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
dxcOperationResult.Get()->GetResult(dxcBlobBytecode.GetAddressOf()).Assert();
|
||||
|
||||
return dxcBlobBytecode.Move();
|
||||
}
|
||||
@@ -134,17 +121,13 @@ namespace ComputeSharp.Shaders.Translation
|
||||
{
|
||||
using ComPtr<IDxcBlobEncoding> dxcBlobEncodingError = default;
|
||||
|
||||
int result = dxcOperationResult.Get()->GetErrorBuffer(dxcBlobEncodingError.GetAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
dxcOperationResult.Get()->GetErrorBuffer(dxcBlobEncodingError.GetAddressOf()).Assert();
|
||||
|
||||
using ComPtr<IDxcBlobUtf16> dxcBlobUtf16Error = default;
|
||||
|
||||
result = DxcLibrary.Get()->GetBlobAsUtf16(
|
||||
DxcLibrary.Get()->GetBlobAsUtf16(
|
||||
dxcBlobEncodingError.Upcast<IDxcBlobEncoding, IDxcBlob>().Get(),
|
||||
dxcBlobUtf16Error.Upcast<IDxcBlobUtf16, IDxcBlobEncoding>().GetAddressOf());
|
||||
|
||||
ThrowHelper.ThrowIfFailed(result);
|
||||
dxcBlobUtf16Error.Upcast<IDxcBlobUtf16, IDxcBlobEncoding>().GetAddressOf()).Assert();
|
||||
|
||||
string message = new string(
|
||||
(char*)dxcBlobUtf16Error.Get()->GetStringPointer(),
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする