Skip to content

Remove usingnamepace usage#7

Merged
hazeycode merged 1 commit into
mainfrom
remove-usingnamespace
Feb 28, 2026
Merged

Remove usingnamepace usage#7
hazeycode merged 1 commit into
mainfrom
remove-usingnamespace

Conversation

@hazeycode

Copy link
Copy Markdown
Member

Resolves #3

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes usingnamespace-based COM method mixins across the Windows bindings, aligning the codebase with Zig’s direction in ziglang/zig#20663 and keeping the bindings usable on newer Zig versions.

Changes:

  • Replaced usingnamespace ...Methods(@This()) patterns with explicit pub inline fn ... wrappers for COM/IUnknown-style interfaces across the Windows bindings.
  • Updated D3D12 usage sites to match “out-parameter” getter signatures (e.g., GetDesc(&desc), Get*HandleForHeapStart(&handle)).
  • Added a new src/meta.zig helper intended to generate interface/VTable types via reflection.

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/zxaudio2.zig Removes usingnamespace from callback implementers; adds explicit IUnknown forwarding helpers where needed.
src/zd3d12.zig Updates resource/descriptor handle getters to use out-parameters consistent with the bindings.
src/windows.zig Reworks IUnknown to expose explicit QueryInterface/AddRef/Release wrappers without usingnamespace.
src/windows/xaudio2.zig Replaces Methods() mixin pattern with explicit wrappers for XAudio2 COM interfaces.
src/windows/xapo.zig Replaces Methods() mixin pattern with explicit wrappers for XAPO interfaces.
src/windows/wincodec.zig Replaces Methods() mixin pattern with explicit wrappers for WIC interfaces.
src/windows/wasapi.zig Replaces Methods() mixin pattern with explicit wrappers for WASAPI/MMDevice interfaces.
src/windows/mf.zig Replaces Methods() mixin pattern with explicit wrappers for Media Foundation interfaces.
src/windows/dxgi.zig Replaces Methods() mixin pattern with explicit wrappers for DXGI interfaces (and inheritance chains).
src/windows/dwrite.zig Replaces Methods() mixin pattern with explicit wrappers for DirectWrite interfaces.
src/windows/directml.zig Replaces Methods() mixin pattern with explicit wrappers for DirectML interfaces; alters GetBindingProperties wrapper shape.
src/windows/d3dcommon.zig Replaces Methods() mixin pattern with explicit wrappers for IBlob (IUnknown-derived).
src/windows/d3d12sdklayers.zig Replaces Methods() mixin pattern with explicit wrappers for D3D12 SDK Layers interfaces.
src/windows/d3d11sdklayers.zig Replaces Methods() mixin pattern with explicit wrappers for D3D11 SDK Layers interfaces.
src/windows/d3d11on12.zig Replaces Methods() mixin pattern with explicit wrappers for D3D11On12 interfaces.
src/windows/d3d11.zig Replaces Methods() mixin pattern with explicit wrappers for D3D11 interfaces (including large method surfaces).
src/meta.zig Adds a reflective interface/VTable generator helper (currently inconsistent with its own declared input shape).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/meta.zig Outdated
Comment thread src/windows/directml.zig
Comment on lines +503 to +504
pub inline fn GetBindingProperties(self: *IDispatchable, properties: *BINDING_PROPERTIES) *BINDING_PROPERTIES {
return self.__v.GetBindingProperties(self, properties);

Copilot AI Feb 28, 2026

Copy link

Choose a reason for hiding this comment

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

GetBindingProperties previously returned BINDING_PROPERTIES by value (convenience wrapper around the out-parameter vtable call). It now requires the caller to allocate/pass a pointer and returns that pointer, which is an API-breaking change for consumers and makes common call sites more verbose. Consider restoring the by-value helper (and optionally adding a separate GetBindingPropertiesPtr/FillBindingProperties variant) to avoid breaking callers.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Intentional. These are supposed to be thin COM bindings not a wrapper.

@hazeycode hazeycode force-pushed the remove-usingnamespace branch from d2b4616 to f919fb6 Compare February 28, 2026 01:00
@hazeycode hazeycode merged commit 93c91d4 into main Feb 28, 2026
1 check passed
@hazeycode hazeycode deleted the remove-usingnamespace branch February 28, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove usingnamespace usage

2 participants