Repository navigation
gameinput: implement IGameInput::CreateAggregateDevice and reading delegation - #1937
Conversation
Flyander
left a comment
There was a problem hiding this comment.
The aggregate path accepts a requested kind without intersecting it with the aggregate's supported input kind. In find_reading and GetCurrentReading, a keyboard query against a gamepad aggregate therefore searches keyboard devices and can return a keyboard reading; unlike the physical-device path, it never rejects the mismatch. Please reject an empty intersection and constrain the search to the aggregate's supported kind. The GDK defines an aggregate as a virtual device for one specified kind: https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/interfaces/igameinput/methods/igameinput_createaggregatedevice?view=gdk-2510
There is a second functional gap: registering a reading callback filtered to an aggregate cannot match events from its physical members because matches() requires the callback's device pointer to equal the event's physical device pointer. Aggregate devices are also not surfaced through the device-status callback enumeration. As a result, the new aggregate works only for polling/history callers and silently produces no callback notifications. Please route member events through the aggregate filter and emit its status notifications, or return an explicit unsupported result for those registration paths until that is implemented. The GDK callback docs describe device filtering and aggregate status notifications: https://learn.microsoft.com/en-us/gaming/gdk/docs/features/common/input/advanced/input-callbacks?view=gdk-2604
|
Thanks @Flyander for the review and guidance on aggregate device semantics! Updated in commit
|
Flyander
left a comment
There was a problem hiding this comment.
The updated head resolves both findings: aggregate polling now intersects kinds and searches only connected member devices, while callback registration with an aggregate returns E_NOTIMPL until event routing is supported. The new synthetic cases cover kind mismatch, polling and the explicit callback limitation. Reviewed the diff; I did not run the tests.
Flyander
left a comment
There was a problem hiding this comment.
Correction to my earlier approval: I missed that the current diff does not actually include the callback cases described in the PR comment.
untime/test/gameinput_test.cpp exercises aggregate polling and kind mismatch, but no assertion calls RegisterReadingCallback or RegisterDeviceCallback with an aggregate. Since these now return E_NOTIMPL by design, please add a small synthetic check for both calls and confirm the callback token remains invalid; that will keep the explicit unsupported boundary from regressing to silent event loss. I should not have said those cases were covered in my approval.
Flyander
left a comment
There was a problem hiding this comment.
Clarification: runtime/test/gameinput_test.cpp adds aggregate polling and kind-mismatch cases, but does not call RegisterReadingCallback or RegisterDeviceCallback with an aggregate. Please add synthetic assertions for both calls and verify the returned callback token remains invalid, matching the E_NOTIMPL guard in gameinput.cpp.
|
Thanks @Flyander for the review! Updated in commit
|
Flyander
left a comment
There was a problem hiding this comment.
The latest head adds the requested synthetic assertions for both aggregate callback registration paths and checks that each returns E_NOTIMPL with an invalid token. The earlier callback-coverage gap is resolved. I reviewed the updated diff and did not run tests.
|
Tested 3ba5205, merged onto
A question on the API version. The shim is GameInput v0 ( So a title built against v0 always got E_NOTIMPL here and can't rely on an aggregate device. The stub's E_NOTIMPL was the console behaviour. Is there a reason to expect the game to call it and use the result? If so, Small nit: AI-assisted (Claude Code). |
|
Tested 3ba5205 natively on Windows: pass, no regressions. Setup: Windows 11 Pro 10.0.26300, MSVC 19.44.35230 (VS 2022 Build Tools), Vulkan SDK 1.4.363.0,
Code-read notes (questions, not blockers):
AI-assisted (Claude Code). |
|
Thanks @XFlawless1 for the real-hardware verification across both the RTX 5080 and AMD RDNA2 iGPU! Regarding your code-read notes, they were actually addressed in the latest updates:
|
3ad2531 to
c8ca1d2
Compare
Claimed in the coordination issue as: #1745 (comment)
What and why
IGameInput::CreateAggregateDeviceimplementation:In GDK titles,
IGameInput::CreateAggregateDeviceprovides a single consolidated virtual device representing all connected controllers of a given kind (e.g.,GameInputKindGamepad). This allows the game to query input state without having to manually enumerate and track individual controller connect/disconnect cycles.E_POINTERifout == nullptr.GameInputKindUnknown, multiple combined kinds, or unsupported kind flags withE_INVALIDARG, matching GDK GameInput specification.AddRef()), ensuring singleton semantics per kind.GameInputFamilyAggregate,GameInputDeviceConnected, creates display name and deterministic device ID.Reading delegation & aggregation:
IGameInput::GetCurrentReading: whendeviceis an aggregate device (GameInputFamilyAggregate), dynamically routes across all connected devices matching the target kind to find the most recent reading.find_reading(GetNextReading/GetPreviousReading): when passed an aggregate device filter, scopes history traversal to all connected devices matching the aggregate device kind.Tested
test_aggregate_deviceinruntime/test/gameinput_test.cpp:CreateAggregateDeviceparameter validation (E_POINTERon null output pointer,E_INVALIDARGonGameInputKindUnknown, multiple kinds, and unsupported flags).GameInputKindGamepadand correct metadata (GameInputFamilyAggregate,GameInputDeviceConnected).GetCurrentReadingreturnsGAMEINPUT_E_READING_NOT_FOUNDwhen no physical/virtual pads are attached.buttons_of(r) == GameInputGamepadA).GetPreviousReadingusing the aggregate device filter traverses history and locates the prior active reading.Checklist
docs/design.md, with how it was confirmed.