Skip to content
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

missing enums #70

Open
prashant-saxena opened this issue Jul 11, 2023 · 0 comments
Open

missing enums #70

prashant-saxena opened this issue Jul 11, 2023 · 0 comments

Comments

@prashant-saxena
Copy link

Hello,
I am wrapping webgpu library using pyclibrary. You can download the binary depending on your OS from here
The two header files I am processing are webgpu.h and wgpu.h. You can also use the shared library (wgpu_native.dll or wgpu_native.so) from the package.

Here is my initial code:

    parser = CParser(['webgpu.h','wgpu.h'])
    clib = CLibrary('wgpu_native.dll', parser, prefix=['WGPU', 'wgpu'],
                     lock_calls=False, convention='cdll', backend='ctypes')

You will find many enums inside webgpu.h. One of them is this:

typedef enum WGPUTextureUsage {
    WGPUTextureUsage_None = 0x00000000,
    WGPUTextureUsage_CopySrc = 0x00000001,
    WGPUTextureUsage_CopyDst = 0x00000002,
    WGPUTextureUsage_TextureBinding = 0x00000004,
    WGPUTextureUsage_StorageBinding = 0x00000008,
    WGPUTextureUsage_RenderAttachment = 0x00000010,
    WGPUTextureUsage_Force32 = 0x7FFFFFFF
} WGPUTextureUsage;

Correct way to access the members of this enum

clib.TextureUsage.TextureUsage_RenderAttachment
or
clib.TextureUsage.TextureUsage_CopyDst

WGPU and wgpu are gone as prefix, which is required and correct behavior.

The problem is that I'm getting an error:

AttributeError: type object 'c_long' has no attribute 'TextureUsage_RenderAttachment'

clib.TextureUsage is c_long type. Am I missing something here? Although I am not sure about other enums in the headers but I believe the situation would be the same. Another issue #69 is also related to these header and shared library.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant