Skip to content

CHANGE: Allow (internal) input module to define input event packing alignment #2176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Packages/com.unity.inputsystem/InputSystem/Events/InputEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,20 @@ public struct InputEvent
/// </summary>
public const int InvalidEventId = 0;

#if UNITY_INPUT_SYSTEM_INPUT_MODULE_DEFINES_EVENT_PACKING_ALIGNMENT
/// <summary>
/// Defines the packing alignment of native input events in event buffers.
/// </summary>
/// <remarks>
/// This is dictated by the native module implementation which populates the event buffers.
/// </remarks>
internal const int kAlignment = NativeInputEvent.alignment;
#else
/// <summary>
/// Defines the packing alignment of native input events in event buffers.
/// </summary>
internal const int kAlignment = 4;
#endif

[FieldOffset(0)]
private NativeInputEvent m_Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@
"name": "com.unity.modules.unityanalytics",
"expression": "1",
"define": "UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS"
},
{
"name": "Unity",
"expression": "6000.2.0a11",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is only to allow this PR to be tested with the Unity branch (internal). It would have to be updated to the Unity version containing the actual update to module before this PR could land.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are testing this branch consider updating this to whatever Unity version number the associated Unity branch has.

"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_DEFINES_EVENT_PACKING_ALIGNMENT"
}
],
"noEngineReferences": false
Expand Down