Skip to content

Commit

Permalink
Merge pull request terrafx#384 from tannergooding/main
Browse files Browse the repository at this point in the history
Ensure NativeMemory.Copy passes parameters in the correct order
  • Loading branch information
tannergooding committed Jan 19, 2024
2 parents 4efaa4f + 825f9e4 commit 39a0cf1
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
<Product>TerraFX.Interop.Windows</Product>
<RootNamespace>TerraFX.Interop</RootNamespace>
<VersionPrefix>10.0.22621.5</VersionPrefix>
<VersionPrefix>10.0.22621.6</VersionPrefix>
<VersionSuffix Condition="'$(EXCLUDE_SUFFIX_FROM_VERSION)' != 'true'">rc1</VersionSuffix>
<VersionSuffix Condition="'$(GITHUB_EVENT_NAME)' == 'pull_request'">pr</VersionSuffix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public unsafe partial struct D3D12_RT_FORMAT_ARRAY
public D3D12_RT_FORMAT_ARRAY([NativeTypeName("const DXGI_FORMAT *")] DXGI_FORMAT* pFormats, uint NumFormats)
{
NumRenderTargets = NumFormats;
NativeMemory.Copy(Unsafe.AsPointer(ref RTFormats), pFormats, (uint)(sizeof(DXGI_FORMAT)));

fixed (DXGI_FORMAT* pRTFormats = &RTFormats[0])
{
NativeMemory.Copy(pFormats, pRTFormats, sizeof(DXGI_FORMAT));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public CD3DX12_PIPELINE_MESH_STATE_STREAM([NativeTypeName("const D3DX12_MESH_SHA

fixed (DXGI_FORMAT* pFormat = &RTVFormats.pssInner.RTFormats[0])
{
NativeMemory.Copy(&D.RTVFormats[0], pFormat, 8 * sizeof(DXGI_FORMAT));
NativeMemory.Copy(pFormat, &D.RTVFormats[0], 8 * sizeof(DXGI_FORMAT));
}

return D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public CD3DX12_PIPELINE_STATE_STREAM([NativeTypeName("const D3D12_COMPUTE_PIPELI

fixed (DXGI_FORMAT* pFormat = &RTVFormats.pssInner.RTFormats[0])
{
NativeMemory.Copy(&D.RTVFormats[0], pFormat, 8 * sizeof(DXGI_FORMAT));
NativeMemory.Copy(pFormat, &D.RTVFormats[0], 8 * sizeof(DXGI_FORMAT));
}

return D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public CD3DX12_PIPELINE_STATE_STREAM1([NativeTypeName("const D3D12_COMPUTE_PIPEL

fixed (DXGI_FORMAT* pFormat = &RTVFormats.pssInner.RTFormats[0])
{
NativeMemory.Copy(&D.RTVFormats[0], pFormat, 8 * sizeof(DXGI_FORMAT));
NativeMemory.Copy(pFormat, &D.RTVFormats[0], 8 * sizeof(DXGI_FORMAT));
}

return D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public CD3DX12_PIPELINE_STATE_STREAM2([NativeTypeName("const D3D12_COMPUTE_PIPEL

fixed (DXGI_FORMAT* pFormat = &RTVFormats.pssInner.RTFormats[0])
{
NativeMemory.Copy(&D.RTVFormats[0], pFormat, 8 * sizeof(DXGI_FORMAT));
NativeMemory.Copy(pFormat, &D.RTVFormats[0], 8 * sizeof(DXGI_FORMAT));
}

return D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public CD3DX12_PIPELINE_STATE_STREAM3([NativeTypeName("const D3D12_COMPUTE_PIPEL

fixed (DXGI_FORMAT* pFormat = &RTVFormats.pssInner.RTFormats[0])
{
NativeMemory.Copy(&D.RTVFormats[0], pFormat, 8 * sizeof(DXGI_FORMAT));
NativeMemory.Copy(pFormat, &D.RTVFormats[0], 8 * sizeof(DXGI_FORMAT));
}

return D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public CD3DX12_PIPELINE_STATE_STREAM4([NativeTypeName("const D3D12_COMPUTE_PIPEL

fixed (DXGI_FORMAT* pFormat = &RTVFormats.pssInner.RTFormats[0])
{
NativeMemory.Copy(&D.RTVFormats[0], pFormat, 8 * sizeof(DXGI_FORMAT));
NativeMemory.Copy(pFormat, &D.RTVFormats[0], 8 * sizeof(DXGI_FORMAT));
}

return D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public CD3DX12_PIPELINE_STATE_STREAM5([NativeTypeName("const D3D12_COMPUTE_PIPEL

fixed (DXGI_FORMAT* pFormat = &RTVFormats.pssInner.RTFormats[0])
{
NativeMemory.Copy(&D.RTVFormats[0], pFormat, 8 * sizeof(DXGI_FORMAT));
NativeMemory.Copy(pFormat, &D.RTVFormats[0], 8 * sizeof(DXGI_FORMAT));
}

return D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void MemcpySubresource([NativeTypeName("const D3D12_MEMCPY_DEST *"

for (uint y = 0; y < NumRows; ++y)
{
NativeMemory.Copy(pDestSlice + pDest->RowPitch * y, unchecked(pSrcSlice + pSrc->RowPitch * (nint)(y)), RowSizeInBytes);
NativeMemory.Copy(unchecked(pSrcSlice + pSrc->RowPitch * (nint)(y)), pDestSlice + pDest->RowPitch * y, RowSizeInBytes);
}
}
}
Expand All @@ -35,7 +35,7 @@ public static void MemcpySubresource([NativeTypeName("const D3D12_MEMCPY_DEST *"

for (uint y = 0; y < NumRows; ++y)
{
NativeMemory.Copy(pDestSlice + pDest->RowPitch * y, pSrcSlice + pSrc->RowPitch * (nuint)(y), RowSizeInBytes);
NativeMemory.Copy(pSrcSlice + pSrc->RowPitch * (nuint)(y), pDestSlice + pDest->RowPitch * y, RowSizeInBytes);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static HRESULT D3DX12SerializeVersionedRootSignature([NativeTypeName("con
break;
}

NativeMemory.Copy(pStaticSamplers + n, desc_1_2->pStaticSamplers + n, (uint)(sizeof(D3D12_STATIC_SAMPLER_DESC)));
NativeMemory.Copy(desc_1_2->pStaticSamplers + n, pStaticSamplers + n, (uint)(sizeof(D3D12_STATIC_SAMPLER_DESC)));
}
}
}
Expand Down Expand Up @@ -216,7 +216,7 @@ public static HRESULT D3DX12SerializeVersionedRootSignature([NativeTypeName("con
break;
}

NativeMemory.Copy(pStaticSamplers + n, desc_1_2->pStaticSamplers + n, (uint)(sizeof(D3D12_STATIC_SAMPLER_DESC)));
NativeMemory.Copy(desc_1_2->pStaticSamplers + n, pStaticSamplers + n, (uint)(sizeof(D3D12_STATIC_SAMPLER_DESC)));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion sources/Interop/Windows/Windows/um/winioctl/Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void DeviceDsmInitializeInput([NativeTypeName("PDEVICE_DSM_DEFINIT
goto Cleanup;
}

NativeMemory.Copy((DeviceDsmParameterBlock(Input)), (Parameters), (Input->ParameterBlockLength));
NativeMemory.Copy((Parameters), (DeviceDsmParameterBlock(Input)), (Input->ParameterBlockLength));
Cleanup:
return;
}
Expand Down

0 comments on commit 39a0cf1

Please sign in to comment.