This function in the Oculus SDK gives error code 0xc0000005:
[DllImport(LibFile)]
private static extern void ovrHmd_GetRenderScaleAndOffset(ovrFovPort fov,
ovrSizei textureSize,
ovrRecti renderViewport,
[MarshalAs(UnmanagedType.LPArray, SizeConst = 2)]
[Out] out ovrVector2f[] uvScaleOffsetOut);
No other PInvoke functions throw errors, but I think this one's different because the output is an array. Actually there's one other function that returns an array, and it gives the same error:
[DllImport(LibFile)]
private static extern void ovrHmd_GetEyeTimewarpMatrices(IntPtr hmd, ovrEyeType eye, ovrPosef renderPose,
[MarshalAs(UnmanagedType.LPArray, SizeConst = 2)]
[Out] out ovrMatrix4f_Raw[] twnOut);
Here are the struct declarations:
[StructLayout(LayoutKind.Sequential)]
public struct ovrVector2f
{
public float x, y;
}
[StructLayout(LayoutKind.Sequential)]
public struct ovrMatrix4f_Raw
{
public float m00;
public float m01;
public float m02;
public float m03;
public float m10;
public float m11;
public float m12;
public float m13;
public float m20;
public float m21;
public float m22;
public float m23;
public float m30;
public float m31;
public float m32;
public float m33;
}
Looking at the SDK source, I know at least ovrHmd_GetRenderScaleAndOffset looks pretty boring, I can't imagine the error would come from inside the SDK.
I feel like I need to specify sizes somewhere in the function signature? And I'm wondering if it's limited to output parameters, or any and all "array of struct" parameters.