change Marshal.SizeOf to sizeof
parent
810f270a41
commit
a0082bcec6
|
@ -107,13 +107,13 @@ namespace MoonWorks.Audio
|
||||||
|
|
||||||
IntPtr chainPtr;
|
IntPtr chainPtr;
|
||||||
chainPtr = Marshal.AllocHGlobal(
|
chainPtr = Marshal.AllocHGlobal(
|
||||||
Marshal.SizeOf<FAudio.FAudioEffectChain>()
|
sizeof(FAudio.FAudioEffectChain)
|
||||||
);
|
);
|
||||||
|
|
||||||
FAudio.FAudioEffectChain* reverbChain = (FAudio.FAudioEffectChain*) chainPtr;
|
FAudio.FAudioEffectChain* reverbChain = (FAudio.FAudioEffectChain*) chainPtr;
|
||||||
reverbChain->EffectCount = 1;
|
reverbChain->EffectCount = 1;
|
||||||
reverbChain->pEffectDescriptors = Marshal.AllocHGlobal(
|
reverbChain->pEffectDescriptors = Marshal.AllocHGlobal(
|
||||||
Marshal.SizeOf<FAudio.FAudioEffectDescriptor>()
|
sizeof(FAudio.FAudioEffectDescriptor)
|
||||||
);
|
);
|
||||||
|
|
||||||
FAudio.FAudioEffectDescriptor* reverbDescriptor =
|
FAudio.FAudioEffectDescriptor* reverbDescriptor =
|
||||||
|
@ -146,7 +146,7 @@ namespace MoonWorks.Audio
|
||||||
// Defaults based on FAUDIOFX_I3DL2_PRESET_GENERIC
|
// Defaults based on FAUDIOFX_I3DL2_PRESET_GENERIC
|
||||||
|
|
||||||
IntPtr reverbParamsPtr = Marshal.AllocHGlobal(
|
IntPtr reverbParamsPtr = Marshal.AllocHGlobal(
|
||||||
Marshal.SizeOf<FAudio.FAudioFXReverbParameters>()
|
sizeof(FAudio.FAudioFXReverbParameters)
|
||||||
);
|
);
|
||||||
|
|
||||||
FAudio.FAudioFXReverbParameters* reverbParams = (FAudio.FAudioFXReverbParameters*) reverbParamsPtr;
|
FAudio.FAudioFXReverbParameters* reverbParams = (FAudio.FAudioFXReverbParameters*) reverbParamsPtr;
|
||||||
|
@ -176,7 +176,7 @@ namespace MoonWorks.Audio
|
||||||
ReverbVoice,
|
ReverbVoice,
|
||||||
0,
|
0,
|
||||||
reverbParamsPtr,
|
reverbParamsPtr,
|
||||||
(uint) Marshal.SizeOf<FAudio.FAudioFXReverbParameters>(),
|
(uint) sizeof(FAudio.FAudioFXReverbParameters),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal(reverbParamsPtr);
|
Marshal.FreeHGlobal(reverbParamsPtr);
|
||||||
|
@ -187,7 +187,7 @@ namespace MoonWorks.Audio
|
||||||
{
|
{
|
||||||
SendCount = 2,
|
SendCount = 2,
|
||||||
pSends = Marshal.AllocHGlobal(
|
pSends = Marshal.AllocHGlobal(
|
||||||
2 * Marshal.SizeOf<FAudio.FAudioSendDescriptor>()
|
2 * sizeof(FAudio.FAudioSendDescriptor)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
FAudio.FAudioSendDescriptor* sendDesc = (FAudio.FAudioSendDescriptor*) ReverbSends.pSends;
|
FAudio.FAudioSendDescriptor* sendDesc = (FAudio.FAudioSendDescriptor*) ReverbSends.pSends;
|
||||||
|
|
|
@ -511,7 +511,7 @@ namespace MoonWorks.Graphics
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
(IntPtr) ptr,
|
(IntPtr) ptr,
|
||||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
(uint) (uniforms.Length * sizeof(T))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,7 +530,7 @@ namespace MoonWorks.Graphics
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
(IntPtr) ptr,
|
(IntPtr) ptr,
|
||||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
(uint) (uniforms.Length * sizeof(T))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -549,7 +549,7 @@ namespace MoonWorks.Graphics
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
(IntPtr) ptr,
|
(IntPtr) ptr,
|
||||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
(uint) (uniforms.Length * sizeof(T))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -745,7 +745,7 @@ namespace MoonWorks.Graphics
|
||||||
uint numElements
|
uint numElements
|
||||||
) where T : unmanaged
|
) where T : unmanaged
|
||||||
{
|
{
|
||||||
var elementSize = Marshal.SizeOf<T>();
|
var elementSize = sizeof(T);
|
||||||
|
|
||||||
fixed (T* ptr = &data[0])
|
fixed (T* ptr = &data[0])
|
||||||
{
|
{
|
||||||
|
@ -762,19 +762,19 @@ namespace MoonWorks.Graphics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBufferData<T>(
|
public unsafe void SetBufferData<T>(
|
||||||
Buffer buffer,
|
Buffer buffer,
|
||||||
IntPtr dataPtr,
|
IntPtr dataPtr,
|
||||||
uint bufferOffsetInElements,
|
uint bufferOffsetInElements,
|
||||||
uint numElements
|
uint numElements
|
||||||
) {
|
) where T : unmanaged {
|
||||||
Refresh.Refresh_SetBufferData(
|
Refresh.Refresh_SetBufferData(
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
buffer.Handle,
|
buffer.Handle,
|
||||||
(uint) Marshal.SizeOf<T>() * bufferOffsetInElements,
|
(uint) sizeof(T) * bufferOffsetInElements,
|
||||||
dataPtr,
|
dataPtr,
|
||||||
(uint) Marshal.SizeOf<T>() * numElements
|
(uint) sizeof(T) * numElements
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ namespace MoonWorks.Graphics
|
||||||
/// <param name="data">An array of data to copy into the texture.</param>
|
/// <param name="data">An array of data to copy into the texture.</param>
|
||||||
public unsafe void SetTextureData<T>(in TextureSlice textureSlice, T[] data) where T : unmanaged
|
public unsafe void SetTextureData<T>(in TextureSlice textureSlice, T[] data) where T : unmanaged
|
||||||
{
|
{
|
||||||
var size = Marshal.SizeOf<T>();
|
var size = sizeof(T);
|
||||||
|
|
||||||
fixed (T* ptr = &data[0])
|
fixed (T* ptr = &data[0])
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,8 +25,8 @@ namespace MoonWorks.Graphics.Font
|
||||||
{
|
{
|
||||||
fixed (FontRange *pFontRanges = &fontRanges[0])
|
fixed (FontRange *pFontRanges = &fontRanges[0])
|
||||||
{
|
{
|
||||||
var nativeSize = fontRanges.Length * Marshal.SizeOf<Wellspring.FontRange>();
|
var nativeSize = fontRanges.Length * sizeof(Wellspring.FontRange);
|
||||||
void* fontRangeMemory = NativeMemory.Alloc((nuint) fontRanges.Length, (nuint) Marshal.SizeOf<Wellspring.FontRange>());
|
void* fontRangeMemory = NativeMemory.Alloc((nuint) fontRanges.Length, (nuint) sizeof(Wellspring.FontRange));
|
||||||
System.Buffer.MemoryCopy(pFontRanges, fontRangeMemory, nativeSize, nativeSize);
|
System.Buffer.MemoryCopy(pFontRanges, fontRangeMemory, nativeSize, nativeSize);
|
||||||
|
|
||||||
var result = Wellspring.Wellspring_PackFontRanges(Handle, (IntPtr) fontRangeMemory, (uint) fontRanges.Length);
|
var result = Wellspring.Wellspring_PackFontRanges(Handle, (IntPtr) fontRangeMemory, (uint) fontRanges.Length);
|
||||||
|
|
|
@ -128,13 +128,13 @@ namespace MoonWorks.Graphics
|
||||||
public VertexInputRate InputRate;
|
public VertexInputRate InputRate;
|
||||||
|
|
||||||
// Shortcut for the common case of having a single vertex binding.
|
// Shortcut for the common case of having a single vertex binding.
|
||||||
public static VertexBinding Create<T>()
|
public unsafe static VertexBinding Create<T>() where T : unmanaged
|
||||||
{
|
{
|
||||||
return new VertexBinding
|
return new VertexBinding
|
||||||
{
|
{
|
||||||
Binding = 0,
|
Binding = 0,
|
||||||
InputRate = VertexInputRate.Vertex,
|
InputRate = VertexInputRate.Vertex,
|
||||||
Stride = (uint) Marshal.SizeOf<T>()
|
Stride = (uint) sizeof(T)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,16 +24,16 @@ namespace MoonWorks.Graphics
|
||||||
/// <param name="usageFlags">Specifies how the buffer will be used.</param>
|
/// <param name="usageFlags">Specifies how the buffer will be used.</param>
|
||||||
/// <param name="elementCount">How many elements of type T the buffer will contain.</param>
|
/// <param name="elementCount">How many elements of type T the buffer will contain.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Buffer Create<T>(
|
public unsafe static Buffer Create<T>(
|
||||||
GraphicsDevice device,
|
GraphicsDevice device,
|
||||||
BufferUsageFlags usageFlags,
|
BufferUsageFlags usageFlags,
|
||||||
uint elementCount
|
uint elementCount
|
||||||
)
|
) where T : unmanaged
|
||||||
{
|
{
|
||||||
return new Buffer(
|
return new Buffer(
|
||||||
device,
|
device,
|
||||||
usageFlags,
|
usageFlags,
|
||||||
(uint) Marshal.SizeOf<T>() * elementCount
|
(uint) sizeof(T) * elementCount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,18 +13,18 @@ namespace MoonWorks.Graphics
|
||||||
public uint BufferBindingCount;
|
public uint BufferBindingCount;
|
||||||
public uint ImageBindingCount;
|
public uint ImageBindingCount;
|
||||||
|
|
||||||
public static ComputeShaderInfo Create<T>(
|
public unsafe static ComputeShaderInfo Create<T>(
|
||||||
ShaderModule shaderModule,
|
ShaderModule shaderModule,
|
||||||
string entryPointName,
|
string entryPointName,
|
||||||
uint bufferBindingCount,
|
uint bufferBindingCount,
|
||||||
uint imageBindingCount
|
uint imageBindingCount
|
||||||
)
|
) where T : unmanaged
|
||||||
{
|
{
|
||||||
return new ComputeShaderInfo
|
return new ComputeShaderInfo
|
||||||
{
|
{
|
||||||
ShaderModule = shaderModule,
|
ShaderModule = shaderModule,
|
||||||
EntryPointName = entryPointName,
|
EntryPointName = entryPointName,
|
||||||
UniformBufferSize = (uint) Marshal.SizeOf<T>(),
|
UniformBufferSize = (uint) sizeof(T),
|
||||||
BufferBindingCount = bufferBindingCount,
|
BufferBindingCount = bufferBindingCount,
|
||||||
ImageBindingCount = imageBindingCount
|
ImageBindingCount = imageBindingCount
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace MoonWorks.Graphics
|
||||||
public uint UniformBufferSize;
|
public uint UniformBufferSize;
|
||||||
public uint SamplerBindingCount;
|
public uint SamplerBindingCount;
|
||||||
|
|
||||||
public static GraphicsShaderInfo Create<T>(
|
public unsafe static GraphicsShaderInfo Create<T>(
|
||||||
ShaderModule shaderModule,
|
ShaderModule shaderModule,
|
||||||
string entryPointName,
|
string entryPointName,
|
||||||
uint samplerBindingCount
|
uint samplerBindingCount
|
||||||
|
@ -22,7 +22,7 @@ namespace MoonWorks.Graphics
|
||||||
{
|
{
|
||||||
ShaderModule = shaderModule,
|
ShaderModule = shaderModule,
|
||||||
EntryPointName = entryPointName,
|
EntryPointName = entryPointName,
|
||||||
UniformBufferSize = (uint) Marshal.SizeOf<T>(),
|
UniformBufferSize = (uint) sizeof(T),
|
||||||
SamplerBindingCount = samplerBindingCount
|
SamplerBindingCount = samplerBindingCount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue