From c733c5f5b79ffcfb7b1c1ba450ede8ab0b3780e9 Mon Sep 17 00:00:00 2001 From: Frank Yellin Date: Fri, 1 Nov 2024 14:57:10 -0700 Subject: [PATCH] Fix lint problems and codegen problems. --- tests/test_async.py | 3 ++- tests/test_wgpu_native_buffer.py | 2 +- wgpu/backends/wgpu_native/_api.py | 6 +++++- wgpu/resources/codegen_report.md | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/test_async.py b/tests/test_async.py index cdd0c4f0..ac5096bb 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -31,6 +31,7 @@ def poll_function(): result = await awaitable.wait_async() else: result = awaitable.wait_sync() + assert result == 10 * 10 @pytest.mark.asyncio @@ -71,7 +72,7 @@ async def test_asynchronous_make_pipeline(loop_scope="function"): fn vertex_main() -> @builtin(position) vec4f { return vec4f(0, 0, 0, 1.); } - + @compute @workgroup_size(1) fn compute_main() { } """ diff --git a/tests/test_wgpu_native_buffer.py b/tests/test_wgpu_native_buffer.py index aa0d0704..f9281352 100644 --- a/tests/test_wgpu_native_buffer.py +++ b/tests/test_wgpu_native_buffer.py @@ -564,7 +564,7 @@ def test_show_bug_wgpu_native_305_still_not_fixed(): # Download from buffer to CPU buf.map("READ_NOSYNC") - data2 = buf.read_mapped() + data2 = bytes(buf.read_mapped()) buf.unmap() assert data1 == data2 diff --git a/wgpu/backends/wgpu_native/_api.py b/wgpu/backends/wgpu_native/_api.py index e58ad2c0..a3bef17a 100644 --- a/wgpu/backends/wgpu_native/_api.py +++ b/wgpu/backends/wgpu_native/_api.py @@ -1558,6 +1558,7 @@ def create_compute_pipeline( compute: structs.ProgrammableStage, ): descriptor = self._create_compute_pipeline_descriptor(label, layout, compute) + # H: WGPUComputePipeline f(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) id = libf.wgpuDeviceCreateComputePipeline(self._internal, descriptor) return GPUComputePipeline(label, id, self) @@ -1571,6 +1572,7 @@ async def create_compute_pipeline_async( descriptor = self._create_compute_pipeline_descriptor(label, layout, compute) if self.CREATE_PIPELINE_ASYNC_NOT_IMPLEMENTED: + # H: WGPUComputePipeline f(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) id = libf.wgpuDeviceCreateComputePipeline(self._internal, descriptor) return GPUComputePipeline(label, id, self) @@ -1593,7 +1595,7 @@ def finalizer(id): "create_compute_pipeline", callback, finalizer, self._device.poll ) - # H: void f(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUDeviceCreateRenderPipelineAsyncCallback callback, void * userdata) + # H: void f(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUDeviceCreateComputePipelineAsyncCallback callback, void * userdata) libf.wgpuDeviceCreateComputePipelineAsync( self._internal, descriptor, callback, ffi.NULL ) @@ -1651,6 +1653,7 @@ def create_render_pipeline( descriptor = self._create_render_pipeline_descriptor( label, layout, vertex, primitive, depth_stencil, multisample, fragment ) + # H: WGPURenderPipeline f(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) id = libf.wgpuDeviceCreateRenderPipeline(self._internal, descriptor) return GPURenderPipeline(label, id, self) @@ -1671,6 +1674,7 @@ async def create_render_pipeline_async( ) if self.CREATE_PIPELINE_ASYNC_NOT_IMPLEMENTED: + # H: WGPURenderPipeline f(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) id = libf.wgpuDeviceCreateRenderPipeline(self._internal, descriptor) return GPURenderPipeline(label, id, self) diff --git a/wgpu/resources/codegen_report.md b/wgpu/resources/codegen_report.md index 7b53c1cf..81bf7fea 100644 --- a/wgpu/resources/codegen_report.md +++ b/wgpu/resources/codegen_report.md @@ -20,7 +20,7 @@ * Diffs for GPUQueue: add read_buffer, add read_texture, hide copy_external_image_to_texture * Validated 37 classes, 121 methods, 46 properties ### Patching API for backends/wgpu_native/_api.py -* Validated 37 classes, 120 methods, 0 properties +* Validated 37 classes, 121 methods, 0 properties ## Validating backends/wgpu_native/_api.py * Enum field FeatureName.texture-compression-bc-sliced-3d missing in wgpu.h * Enum field FeatureName.clip-distances missing in wgpu.h @@ -35,6 +35,6 @@ * Enum CanvasAlphaMode missing in wgpu.h * Enum CanvasToneMappingMode missing in wgpu.h * Wrote 236 enum mappings and 47 struct-field mappings to wgpu_native/_mappings.py -* Validated 140 C function calls -* Not using 65 C functions +* Validated 141 C function calls +* Not using 64 C functions * Validated 82 C structs