-
Notifications
You must be signed in to change notification settings - Fork 167
Open
Labels
Description
pix3.h
from https://www.nuget.org/packages/WinPixEventRuntime/1.0.230302001 defines a union
as follows:
union PIXCaptureParameters
{
enum PIXCaptureStorage
{
Memory = 0,
};
struct GpuCaptureParameters
{
PCWSTR FileName;
} GpuCaptureParameters;
struct TimingCaptureParameters
{
PCWSTR FileName;
UINT32 MaximumToolingMemorySizeMb;
PIXCaptureStorage CaptureStorage;
BOOL CaptureGpuTiming;
BOOL CaptureCallstacks;
BOOL CaptureCpuSamples;
UINT32 CpuSamplesPerSecond;
BOOL CaptureFileIO;
BOOL CaptureVirtualAllocEvents;
BOOL CaptureHeapAllocEvents;
BOOL CaptureXMemEvents; // Xbox only
BOOL CapturePixMemEvents; // Xbox only
} TimingCaptureParameters;
};
This generates the following CSharp code:
[StructLayout(LayoutKind.Explicit)]
public partial struct PIXCaptureParameters
{
[FieldOffset(0)]
[NativeTypeName("struct GpuCaptureParameters")] public GpuCaptureParameters GpuCaptureParameters;
[FieldOffset(0)]
[NativeTypeName("struct TimingCaptureParameters")] public TimingCaptureParameters TimingCaptureParameters;
public enum PIXCaptureStorage
{
Memory = 0,
}
public unsafe partial struct GpuCaptureParameters
{
[NativeTypeName("PCWSTR"),Const] public ushort* FileName;
}
public unsafe partial struct TimingCaptureParameters
{
[NativeTypeName("PCWSTR"),Const] public ushort* FileName;
[NativeTypeName("UINT32")] public uint MaximumToolingMemorySizeMb;
[NativeTypeName("PIXCaptureParameters::PIXCaptureStorage")] public PIXCaptureStorage CaptureStorage;
[NativeTypeName("BOOL")] public int CaptureGpuTiming;
[NativeTypeName("BOOL")] public int CaptureCallstacks;
[NativeTypeName("BOOL")] public int CaptureCpuSamples;
[NativeTypeName("UINT32")] public uint CpuSamplesPerSecond;
[NativeTypeName("BOOL")] public int CaptureFileIO;
[NativeTypeName("BOOL")] public int CaptureVirtualAllocEvents;
[NativeTypeName("BOOL")] public int CaptureHeapAllocEvents;
[NativeTypeName("BOOL")] public int CaptureXMemEvents;
[NativeTypeName("BOOL")] public int CapturePixMemEvents;
}
}
Which fails to compile because the field name clashes the nested struct
name:
windows-pix\.metadata\obj\generated\obj\crossarch\common\WinPixEventRuntime.modified.cs(272,84): error CS0102: The type 'PIXCaptureParameters' already contains a definition for 'GpuCaptureParameters'
windows-pix\.metadata\obj\generated\obj\crossarch\common\WinPixEventRuntime.modified.cs(275,90): error CS0102: The type 'PIXCaptureParameters' already contains a definition for 'TimingCaptureParameters'
What would be the right way to fix this? I tried using --remap PIXCaptureParameters::GpuCaptureParameters=GpuCaptureParameters_t
which makes the struct- and field name change, but the field type does not (i.e. compile error because that type is no longer found).
When using --remap GpuCaptureParameters=GpuCaptureParameters_t
, all three change, also defeating the purpose (field name, field type, and type name).