diff --git a/CHANGELOG.md b/CHANGELOG.md index 215facfb..04cadd3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,21 @@ Possible sections in each release: * Security: in case of vulnerabilities. +### [unreleased] + +Added: +* The feature "float32-filterable" is now available natively. +* Add list of projects using wgpu-py to [README](README.md#projects-using-wgpu-py). ([#456](https://github.com/pygfx/wgpu-py/pull/456)) + +Changed: +* Updated to wgpu-native 0.19.1.1. ([#458](https://github.com/pygfx/wgpu-py/pull/458)) + +Removed: +* Shadertoy util is removed from the wgpu-py. It is now available as a separate package: [wgpu-shadertoy](https://github.com/pygfx/shadertoy). ([#455](https://github.com/pygfx/wgpu-py/pull/455)) + +Fixed: +* Devices no longer leak memory. + ### [v0.13.2] - 21-12-2023 Added: @@ -208,7 +223,7 @@ Fixed: Added: -* The shadertoy util now supports GLSL, so code from the shadertoy website can be direcly copied and run with wgpu (#343) +* The shadertoy util now supports GLSL, so code from the shadertoy website can be directly copied and run with wgpu (#343) ### [v0.9.1] - 13-02-2023 @@ -514,14 +529,14 @@ Changed: Changed: -* The backend selection is automatic by default. To force a backend, the `WGPU_BACKEND_TYPE` evironment variable can be set to e.g. "Vulkan". It could be good to do this on Windows to prevent selection of DX12 for now. +* The backend selection is automatic by default. To force a backend, the `WGPU_BACKEND_TYPE` environment variable can be set to e.g. "Vulkan". It could be good to do this on Windows to prevent selection of DX12 for now. ### [v0.5.3] - 04-06-2021 Added: -* `adapter.properties` now has actual values, allowing inspeciton of the selected +* `adapter.properties` now has actual values, allowing inspection of the selected GPU and backend. * Added back support for filtering float32 textures by enabling a certain wgpu feature by default. @@ -585,7 +600,7 @@ Changed: * `GPUAdapter.request_device()`: the `extensions` and `limit` args are now `non_guaranteed_features` and `non_guaranteed_limits`. * `GPUDevice.default_queue`: is now called `queue`. * `GPUDevice.create_compute_pipeline()`: the `compute_stage` arg is now called `compute`. -* `GPUDevice.create_bind_group_layout()` has changed the required structure of the layout enty dicts. +* `GPUDevice.create_bind_group_layout()` has changed the required structure of the layout entry dicts. * `GPUDevice.create_render_pipeline()` has changed *a lot* in terms of shape of input dicts. See new docs. * `GPUTexture.create_view()`: args `mip_level_count` and `array_layer_count` are default `None` instead of `0`. * `GPUCommandEncoder.begin_render_pass()`: the `color_attachments` and `depth_stencil_attachment` arguments have their `attachment` field renamed to `view`. @@ -638,7 +653,7 @@ Removed: Added: -* The canvase now has a `request_draw` method. +* The canvas now has a `request_draw` method. * More and better docs. * The canvas can be passed to `request_adapter` so that the created surface can be selected on it. diff --git a/docs/guide.rst b/docs/guide.rst index 22c1a2c6..2e98b31f 100644 --- a/docs/guide.rst +++ b/docs/guide.rst @@ -212,7 +212,7 @@ Debugging If the default wgpu-backend causes issues, or if you want to run on a different backend for another reason, you can set the `WGPU_BACKEND_TYPE` environment variable to "Vulkan", "Metal", "D3D12", -"D3D11", or "OpenGL". +or "OpenGL". The log messages produced (by Rust) in wgpu-native are captured and injected into Python's "wgpu" logger. One can set the log level to diff --git a/docs/start.rst b/docs/start.rst index 6c279055..d66c9c18 100644 --- a/docs/start.rst +++ b/docs/start.rst @@ -49,7 +49,7 @@ Platform requirements Under the hood, wgpu runs on Vulkan, Metal, or DX12. The wgpu-backend is selected automatically, but can be overridden by setting the ``WGPU_BACKEND_TYPE`` environment variable to "Vulkan", "Metal", "D3D12", -"D3D11", or "OpenGL". +or "OpenGL". Windows +++++++ diff --git a/docs/wgpu.rst b/docs/wgpu.rst index 372f15e8..7bbfb63a 100644 --- a/docs/wgpu.rst +++ b/docs/wgpu.rst @@ -67,7 +67,7 @@ Information on the adapter can be obtained using :func:`wgpu.GPUAdapter.request_ A device is controlled with a specific backend API. By default one is selected automatically. This can be overridden by setting the -`WGPU_BACKEND_TYPE` environment variable to "Vulkan", "Metal", "D3D12", "D3D11", or "OpenGL". +`WGPU_BACKEND_TYPE` environment variable to "Vulkan", "Metal", "D3D12", or "OpenGL". The device and all objects created from it inherit from :class:`GPUObjectBase` - they represent something on the GPU. diff --git a/examples/tests/test_examples.py b/examples/tests/test_examples.py index 5e80e04d..a001bbdd 100644 --- a/examples/tests/test_examples.py +++ b/examples/tests/test_examples.py @@ -13,7 +13,7 @@ import pytest -from testutils import ( +from tests.testutils import ( can_use_wgpu_lib, wgpu_backend, is_lavapipe, @@ -37,14 +37,6 @@ examples_to_test = find_examples(query="# test_example = true", return_stems=True) -@pytest.mark.parametrize("module", examples_to_run) -def test_examples_run(module, force_offscreen): - """Run every example marked to see if they can run without error.""" - # use runpy so the module is not actually imported (and can be gc'd) - # but also to be able to run the code in the __main__ block - runpy.run_module(f"examples.{module}", run_name="__main__") - - @pytest.fixture def force_offscreen(): """Force the offscreen canvas to be selected by the auto gui module.""" @@ -145,6 +137,14 @@ def update_diffs(module, is_similar, img, stored_img): path.unlink() +@pytest.mark.parametrize("module", examples_to_run) +def test_examples_run(module, force_offscreen): + """Run every example marked to see if they can run without error.""" + # use runpy so the module is not actually imported (and can be gc'd) + # but also to be able to run the code in the __main__ block + runpy.run_module(f"examples.{module}", run_name="__main__") + + if __name__ == "__main__": # Enable tweaking in an IDE by running in an interactive session. os.environ["WGPU_FORCE_OFFSCREEN"] = "true" diff --git a/tests/test_gui_glfw.py b/tests/test_gui_glfw.py index 2ee8af01..f47794c7 100644 --- a/tests/test_gui_glfw.py +++ b/tests/test_gui_glfw.py @@ -8,10 +8,11 @@ import time import weakref import asyncio +import gc import wgpu from pytest import skip -from testutils import run_tests, can_use_glfw, can_use_wgpu_lib +from testutils import run_tests, can_use_glfw, can_use_wgpu_lib, is_pypy from renderutils import render_to_texture, render_to_screen # noqa @@ -83,6 +84,8 @@ async def miniloop(): loop.run_until_complete(miniloop()) assert ref() is not None del canvas + if is_pypy: + gc.collect() # force garbage collection for pypy loop.run_until_complete(miniloop()) assert ref() is None diff --git a/tests/test_wgpu_native_errors.py b/tests/test_wgpu_native_errors.py index dfab5df4..b021cde7 100644 --- a/tests/test_wgpu_native_errors.py +++ b/tests/test_wgpu_native_errors.py @@ -141,20 +141,10 @@ def test_parse_shader_error4(caplog): Caused by: In wgpuDeviceCreateShaderModule - Shader validation error: - ┌─ :1:1 - │ - 1 │ ╭ fn foobar() { - 2 │ │ let m = mat2x2(0.0, 0.0, 0.0, 0.); - 3 │ │ let scales = m[4]; - │ │ ^^^^ naga::Expression [9] - │ ╰──────────────────────^ naga::Function [1] + Shader '' parsing error: Index 4 is out of bounds for expression [11] - Function [1] 'foobar' is invalid - Expression [9] is invalid - Type resolution failed - Index 4 is out of bounds for expression [7] + Index 4 is out of bounds for expression [11] """ code = dedent(code) @@ -185,8 +175,8 @@ def test_validate_shader_error1(caplog): } """ - expected1 = """Left: Load { pointer: [3] } of type Matrix { columns: Quad, rows: Quad, width: 4 }""" - expected2 = """Right: Load { pointer: [6] } of type Vector { size: Tri, kind: Float, width: 4 }""" + expected1 = """Left: Load { pointer: [3] } of type Matrix { columns: Quad, rows: Quad, scalar: Scalar { kind: Float, width: 4 } }""" + expected2 = """Right: Load { pointer: [6] } of type Vector { size: Tri, scalar: Scalar { kind: Float, width: 4 } }""" expected3 = """ Validation Error @@ -236,7 +226,7 @@ def test_validate_shader_error2(caplog): } """ - expected1 = """Returning Some(Vector { size: Tri, kind: Float, width: 4 }) where Some(Vector { size: Quad, kind: Float, width: 4 }) is expected""" + expected1 = """Returning Some(Vector { size: Tri, scalar: Scalar { kind: Float, width: 4 } }) where Some(Vector { size: Quad, scalar: Scalar { kind: Float, width: 4 } }) is expected""" expected2 = """ Validation Error diff --git a/tests/test_wgpu_native_query_set.py b/tests/test_wgpu_native_query_set.py index fe8d1f70..c3e0b841 100644 --- a/tests/test_wgpu_native_query_set.py +++ b/tests/test_wgpu_native_query_set.py @@ -1,11 +1,15 @@ import wgpu.utils +import gc from testutils import run_tests, can_use_wgpu_lib +from tests_mem.testutils import is_pypy from pytest import mark @mark.skipif(not can_use_wgpu_lib, reason="Needs wgpu lib") def test_query_set(): + if is_pypy: + gc.collect() # avoid a panic here when using pypy shader_source = """ @group(0) @binding(0) var data1: array; diff --git a/tests_mem/test_gui_offscreen.py b/tests_mem/test_gui.py similarity index 88% rename from tests_mem/test_gui_offscreen.py rename to tests_mem/test_gui.py index 0dd2e381..482967f8 100644 --- a/tests_mem/test_gui_offscreen.py +++ b/tests_mem/test_gui.py @@ -80,6 +80,13 @@ def test_release_canvas_context(n): # Check that the canvas objects are really deleted assert not canvases + # This is a bit weird, but somehow this tests produces a dangling + # CommandBuffer for reasons likely related to the internals of + # wgpu-core. The lines below allocate and release a new + # CommandBuffer, which solves the issue :) + command_encoder = DEVICE.create_command_encoder() + command_encoder.finish() + TEST_FUNCS = [test_release_canvas_context] diff --git a/tests_mem/test_gui_glfw.py b/tests_mem/test_gui_glfw.py index 5f4f9b69..01b25f95 100644 --- a/tests_mem/test_gui_glfw.py +++ b/tests_mem/test_gui_glfw.py @@ -6,10 +6,11 @@ import weakref import asyncio +import wgpu import pytest import testutils # noqa from testutils import create_and_release, can_use_glfw, can_use_wgpu_lib -from test_gui_offscreen import make_draw_func_for_canvas +from test_gui import make_draw_func_for_canvas if not can_use_wgpu_lib: @@ -22,6 +23,9 @@ pytest.skip("Asyncio loop is running", allow_module_level=True) +DEVICE = wgpu.utils.get_default_device() + + async def stub_event_loop(): pass @@ -57,6 +61,10 @@ def test_release_canvas_context(n): # Check that the canvas objects are really deleted assert not canvases, f"Still {len(canvases)} canvases" + # Help clear dangling CommandBuffer, see test_gui.py + command_encoder = DEVICE.create_command_encoder() + command_encoder.finish() + if __name__ == "__main__": # testutils.TEST_ITERS = 40 # Uncomment for a mem-usage test run diff --git a/tests_mem/test_gui_qt.py b/tests_mem/test_gui_qt.py index 2804b4cb..c0043e7e 100644 --- a/tests_mem/test_gui_qt.py +++ b/tests_mem/test_gui_qt.py @@ -5,10 +5,11 @@ import gc import weakref +import wgpu import pytest import testutils # noqa from testutils import create_and_release, can_use_pyside6, can_use_wgpu_lib -from test_gui_offscreen import make_draw_func_for_canvas +from test_gui import make_draw_func_for_canvas if not can_use_wgpu_lib: @@ -17,6 +18,9 @@ pytest.skip("Need pyside6 for this test", allow_module_level=True) +DEVICE = wgpu.utils.get_default_device() + + @create_and_release def test_release_canvas_context(n): # Test with PySide canvases. @@ -51,6 +55,10 @@ def test_release_canvas_context(n): # Check that the canvas objects are really deleted assert not canvases + # Help clear dangling CommandBuffer, see test_gui.py + command_encoder = DEVICE.create_command_encoder() + command_encoder.finish() + if __name__ == "__main__": # testutils.TEST_ITERS = 40 # Uncomment for a mem-usage test run diff --git a/tests_mem/test_meta.py b/tests_mem/test_meta.py index 9271397d..1233d451 100644 --- a/tests_mem/test_meta.py +++ b/tests_mem/test_meta.py @@ -9,7 +9,7 @@ from testutils import can_use_wgpu_lib, create_and_release from testutils import get_counts, ob_name_from_test_func from test_objects import TEST_FUNCS as OBJECT_TEST_FUNCS -from test_gui_offscreen import TEST_FUNCS as GUI_TEST_FUNCS +from test_gui import TEST_FUNCS as GUI_TEST_FUNCS ALL_TEST_FUNCS = OBJECT_TEST_FUNCS + GUI_TEST_FUNCS diff --git a/tests_mem/test_objects.py b/tests_mem/test_objects.py index f044e3f6..c7058d65 100644 --- a/tests_mem/test_objects.py +++ b/tests_mem/test_objects.py @@ -25,14 +25,11 @@ def test_release_adapter(n): @create_and_release def test_release_device(n): - pytest.skip("XFAIL") - # todo: XFAIL: Device object seem not to be cleaned up at wgpu-native. - # Note: the WebGPU spec says: # [request_device()] is a one-time action: if a device is returned successfully, the adapter becomes invalid. yield { - "expected_counts_after_create": {"Device": (n, n), "Queue": (n, 0)}, + "expected_counts_after_create": {"Device": (n, n), "Queue": (n, n)}, } adapter = DEVICE.adapter for i in range(n): @@ -82,9 +79,7 @@ def test_release_bind_group_layout(n): global _bind_group_layout_binding _bind_group_layout_binding += 1 - yield { - "expected_counts_after_create": {"BindGroupLayout": (n, 1)}, - } + yield {} binding_layouts = [ { @@ -193,9 +188,13 @@ def test_release_query_set(n): @create_and_release def test_release_queue(n): - pytest.skip("XFAIL") - # todo: XFAIL: the device and queue are kinda one, and the former won't release at wgpu-native. - yield {} + # Note: cannot create a queue directly, so we create devices, which gave queue's attached. + yield { + "expected_counts_after_create": { + "Device": (n, n), + "Queue": (n, n), + }, + } adapter = DEVICE.adapter for i in range(n): d = adapter.request_device() diff --git a/tests_mem/testutils.py b/tests_mem/testutils.py index cd1cce00..b85a7148 100644 --- a/tests_mem/testutils.py +++ b/tests_mem/testutils.py @@ -81,8 +81,9 @@ def clear_mem(): if is_pypy: gc.collect() - device = wgpu.utils.get_default_device() - device._poll() + wgpu.utils.get_default_device()._poll() + + gc.collect() def get_counts(): @@ -190,7 +191,7 @@ def core_test_func(): assert ob_name == cls.__name__[3:] # Give wgpu some slack to clean up temporary resources - wgpu.utils.get_default_device()._poll() + clear_mem() # Measure peak object counts counts2 = get_counts() @@ -200,7 +201,9 @@ def core_test_func(): # Make sure the actual object has increased assert more2 # not empty - assert more2 == options["expected_counts_after_create"] + assert ( + more2 == options["expected_counts_after_create"] + ), f"Exepected:\n{options['expected_counts_after_create']}\nGot:\n{more2}" # It's ok if other objects are created too ... diff --git a/wgpu/backends/wgpu_native/__init__.py b/wgpu/backends/wgpu_native/__init__.py index ce02d5fa..f263d883 100644 --- a/wgpu/backends/wgpu_native/__init__.py +++ b/wgpu/backends/wgpu_native/__init__.py @@ -9,8 +9,8 @@ # The wgpu-native version that we target/expect -__version__ = "0.18.1.3" -__commit_sha__ = "8561b0d8c0b5af7dfb8631d6f924e5418c92f2ce" +__version__ = "0.19.1.1" +__commit_sha__ = "569a2be60d1dc90a660c1c96ffb3722942ada782" version_info = tuple(map(int, __version__.split("."))) _check_expected_version(version_info) # produces a warning on mismatch diff --git a/wgpu/backends/wgpu_native/_api.py b/wgpu/backends/wgpu_native/_api.py index fe9f4513..b23d07d7 100644 --- a/wgpu/backends/wgpu_native/_api.py +++ b/wgpu/backends/wgpu_native/_api.py @@ -1701,7 +1701,8 @@ def map(self, mode, offset=0, size=None): if sync_on_read and map_mode & lib.WGPUMapMode_Read: if self._mapped_status[2] == 0 and self._usage & flags.BufferUsage.MAP_READ: encoder = self._device.create_command_encoder() - self._device.queue.submit([encoder.finish()]) + command_buffer = encoder.finish() + self._device.queue.submit([command_buffer]) status = 999 @@ -2000,12 +2001,9 @@ def _destroy(self): class GPUCommandBuffer(classes.GPUCommandBuffer, GPUObjectBase): def _destroy(self): - # Since command buffers get destroyed when you submit them, we - # must only release them if they've not been submitted, or we get - # 'Cannot remove a vacant resource'. Got this info from the - # wgpu chat. Also see - # https://docs.rs/wgpu-core/latest/src/wgpu_core/device/mod.rs.html#4180-4194 - # --> That's why _internal is set to None in Queue.submit() + # Note that command buffers get destroyed when they are submitted. + # In earlier versions we had to take this into account by setting + # _internal to None. That seems not necessary anymore. if self._internal is not None and libf is not None: self._internal, internal = None, self._internal # H: void f(WGPUCommandBuffer commandBuffer) diff --git a/wgpu/backends/wgpu_native/_helpers.py b/wgpu/backends/wgpu_native/_helpers.py index 2492e2d9..691f6530 100644 --- a/wgpu/backends/wgpu_native/_helpers.py +++ b/wgpu/backends/wgpu_native/_helpers.py @@ -323,7 +323,7 @@ def generate_report(): but in the form of a Python dict. """ - # H: surfaces: WGPUStorageReport, backendType: WGPUBackendType, vulkan: WGPUHubReport, metal: WGPUHubReport, dx12: WGPUHubReport, dx11: WGPUHubReport, gl: WGPUHubReport + # H: surfaces: WGPURegistryReport, backendType: WGPUBackendType, vulkan: WGPUHubReport, metal: WGPUHubReport, dx12: WGPUHubReport, gl: WGPUHubReport struct = ffi.new("WGPUGlobalReport *") # H: void f(WGPUInstance instance, WGPUGlobalReport * report) @@ -332,25 +332,27 @@ def generate_report(): report = {} report["surfaces"] = { - "occupied": struct.surfaces.numOccupied, - "vacant": struct.surfaces.numVacant, + "allocated": struct.surfaces.numAllocated, + "kept": struct.surfaces.numKeptFromUser, + "released": struct.surfaces.numReleasedFromUser, "error": struct.surfaces.numError, "element_size": struct.surfaces.elementSize, } - for backend in ("vulkan", "metal", "dx12", "dx11", "gl"): + for backend in ("vulkan", "metal", "dx12", "gl"): c_hub_report = getattr(struct, backend) report[backend] = {} for key in dir(c_hub_report): - c_storage_report = getattr(c_hub_report, key) - storage_report = { - "occupied": c_storage_report.numOccupied, - "vacant": c_storage_report.numVacant, - "error": c_storage_report.numError, - "element_size": c_storage_report.elementSize, + c_registry_report = getattr(c_hub_report, key) + registry_report = { + "allocated": c_registry_report.numAllocated, + "kept": c_registry_report.numKeptFromUser, + "released": c_registry_report.numReleasedFromUser, + "error": c_registry_report.numError, + "element_size": c_registry_report.elementSize, } - # if any(x!=0 for x in storage_report.values()): - report[backend][key] = storage_report + # if any(x!=0 for x in registry_report.values()): + report[backend][key] = registry_report return report @@ -358,7 +360,7 @@ def generate_report(): class WgpuNativeCountsDiagnostics(Diagnostics): def get_subscript(self): text = "" - text += " * The o, v, e are occupied, vacant and error, respecitively.\n" + text += " * The a, k, r, e are allocated, kept, released, and error, respectively.\n" text += " * Reported memory does not include buffer/texture data.\n" return text @@ -383,23 +385,30 @@ def get_dict(self): for report_name in sorted(name_map[name] for name in names + root_names): result[report_name] = {"count": 0, "mem": 0} + # The field names to add together to obtain a representation for + # the number of objects "allocated" by wgpu-core. In practice, + # wgpu-core can keep objects around for re-use, which is why "allocated" + # and released" are not in this equation. + fields_to_add = ["kept", "error"] + # Establish what backends are active active_backends = [] for backend in backends: total = 0 for name in names: d = native_report[backend][name] - total += d["occupied"] + d["vacant"] + d["error"] + total += sum(d[k] for k in fields_to_add) if total > 0: active_backends.append(backend) # Process names in the root for name in root_names: d = native_report[name] - subtotal_count = d["occupied"] + d["vacant"] + d["error"] + subtotal_count = sum(d[k] for k in fields_to_add) impl = { - "o": d["occupied"], - "v": d["vacant"], + "a": d["allocated"], + "k": d["kept"], + "r": d["released"], "e": d["error"], "el_size": d["element_size"], } @@ -416,11 +425,12 @@ def get_dict(self): implementations = {} for backend in active_backends: d = native_report[backend][name] - subtotal_count = d["occupied"] + d["vacant"] + d["error"] + subtotal_count = sum(d[k] for k in fields_to_add) subtotal_mem = subtotal_count * d["element_size"] impl = { - "o": d["occupied"], - "v": d["vacant"], + "a": d["allocated"], + "k": d["kept"], + "r": d["released"], "e": d["error"], "el_size": d["element_size"], } diff --git a/wgpu/backends/wgpu_native/_mappings.py b/wgpu/backends/wgpu_native/_mappings.py index cde8a6f6..c0ed676f 100644 --- a/wgpu/backends/wgpu_native/_mappings.py +++ b/wgpu/backends/wgpu_native/_mappings.py @@ -4,7 +4,7 @@ # flake8: noqa -# There are 232 enum mappings +# There are 235 enum mappings enummap = { "AddressMode.clamp-to-edge": 2, @@ -93,6 +93,8 @@ "StencilOperation.keep": 0, "StencilOperation.replace": 2, "StencilOperation.zero": 1, + "StorageTextureAccess.read-only": 2, + "StorageTextureAccess.read-write": 3, "StorageTextureAccess.write-only": 1, "StoreOp.discard": 2, "StoreOp.store": 1, @@ -102,65 +104,65 @@ "TextureDimension.1d": 0, "TextureDimension.2d": 1, "TextureDimension.3d": 2, - "TextureFormat.astc-10x10-unorm": 89, - "TextureFormat.astc-10x10-unorm-srgb": 90, - "TextureFormat.astc-10x5-unorm": 83, - "TextureFormat.astc-10x5-unorm-srgb": 84, - "TextureFormat.astc-10x6-unorm": 85, - "TextureFormat.astc-10x6-unorm-srgb": 86, - "TextureFormat.astc-10x8-unorm": 87, - "TextureFormat.astc-10x8-unorm-srgb": 88, - "TextureFormat.astc-12x10-unorm": 91, - "TextureFormat.astc-12x10-unorm-srgb": 92, - "TextureFormat.astc-12x12-unorm": 93, - "TextureFormat.astc-12x12-unorm-srgb": 94, - "TextureFormat.astc-4x4-unorm": 67, - "TextureFormat.astc-4x4-unorm-srgb": 68, - "TextureFormat.astc-5x4-unorm": 69, - "TextureFormat.astc-5x4-unorm-srgb": 70, - "TextureFormat.astc-5x5-unorm": 71, - "TextureFormat.astc-5x5-unorm-srgb": 72, - "TextureFormat.astc-6x5-unorm": 73, - "TextureFormat.astc-6x5-unorm-srgb": 74, - "TextureFormat.astc-6x6-unorm": 75, - "TextureFormat.astc-6x6-unorm-srgb": 76, - "TextureFormat.astc-8x5-unorm": 77, - "TextureFormat.astc-8x5-unorm-srgb": 78, - "TextureFormat.astc-8x6-unorm": 79, - "TextureFormat.astc-8x6-unorm-srgb": 80, - "TextureFormat.astc-8x8-unorm": 81, - "TextureFormat.astc-8x8-unorm-srgb": 82, - "TextureFormat.bc1-rgba-unorm": 43, - "TextureFormat.bc1-rgba-unorm-srgb": 44, - "TextureFormat.bc2-rgba-unorm": 45, - "TextureFormat.bc2-rgba-unorm-srgb": 46, - "TextureFormat.bc3-rgba-unorm": 47, - "TextureFormat.bc3-rgba-unorm-srgb": 48, - "TextureFormat.bc4-r-snorm": 50, - "TextureFormat.bc4-r-unorm": 49, - "TextureFormat.bc5-rg-snorm": 52, - "TextureFormat.bc5-rg-unorm": 51, - "TextureFormat.bc6h-rgb-float": 54, - "TextureFormat.bc6h-rgb-ufloat": 53, - "TextureFormat.bc7-rgba-unorm": 55, - "TextureFormat.bc7-rgba-unorm-srgb": 56, + "TextureFormat.astc-10x10-unorm": 90, + "TextureFormat.astc-10x10-unorm-srgb": 91, + "TextureFormat.astc-10x5-unorm": 84, + "TextureFormat.astc-10x5-unorm-srgb": 85, + "TextureFormat.astc-10x6-unorm": 86, + "TextureFormat.astc-10x6-unorm-srgb": 87, + "TextureFormat.astc-10x8-unorm": 88, + "TextureFormat.astc-10x8-unorm-srgb": 89, + "TextureFormat.astc-12x10-unorm": 92, + "TextureFormat.astc-12x10-unorm-srgb": 93, + "TextureFormat.astc-12x12-unorm": 94, + "TextureFormat.astc-12x12-unorm-srgb": 95, + "TextureFormat.astc-4x4-unorm": 68, + "TextureFormat.astc-4x4-unorm-srgb": 69, + "TextureFormat.astc-5x4-unorm": 70, + "TextureFormat.astc-5x4-unorm-srgb": 71, + "TextureFormat.astc-5x5-unorm": 72, + "TextureFormat.astc-5x5-unorm-srgb": 73, + "TextureFormat.astc-6x5-unorm": 74, + "TextureFormat.astc-6x5-unorm-srgb": 75, + "TextureFormat.astc-6x6-unorm": 76, + "TextureFormat.astc-6x6-unorm-srgb": 77, + "TextureFormat.astc-8x5-unorm": 78, + "TextureFormat.astc-8x5-unorm-srgb": 79, + "TextureFormat.astc-8x6-unorm": 80, + "TextureFormat.astc-8x6-unorm-srgb": 81, + "TextureFormat.astc-8x8-unorm": 82, + "TextureFormat.astc-8x8-unorm-srgb": 83, + "TextureFormat.bc1-rgba-unorm": 44, + "TextureFormat.bc1-rgba-unorm-srgb": 45, + "TextureFormat.bc2-rgba-unorm": 46, + "TextureFormat.bc2-rgba-unorm-srgb": 47, + "TextureFormat.bc3-rgba-unorm": 48, + "TextureFormat.bc3-rgba-unorm-srgb": 49, + "TextureFormat.bc4-r-snorm": 51, + "TextureFormat.bc4-r-unorm": 50, + "TextureFormat.bc5-rg-snorm": 53, + "TextureFormat.bc5-rg-unorm": 52, + "TextureFormat.bc6h-rgb-float": 55, + "TextureFormat.bc6h-rgb-ufloat": 54, + "TextureFormat.bc7-rgba-unorm": 56, + "TextureFormat.bc7-rgba-unorm-srgb": 57, "TextureFormat.bgra8unorm": 23, "TextureFormat.bgra8unorm-srgb": 24, - "TextureFormat.depth16unorm": 38, - "TextureFormat.depth24plus": 39, - "TextureFormat.depth24plus-stencil8": 40, - "TextureFormat.depth32float": 41, - "TextureFormat.depth32float-stencil8": 42, - "TextureFormat.eac-r11snorm": 64, - "TextureFormat.eac-r11unorm": 63, - "TextureFormat.eac-rg11snorm": 66, - "TextureFormat.eac-rg11unorm": 65, - "TextureFormat.etc2-rgb8a1unorm": 59, - "TextureFormat.etc2-rgb8a1unorm-srgb": 60, - "TextureFormat.etc2-rgb8unorm": 57, - "TextureFormat.etc2-rgb8unorm-srgb": 58, - "TextureFormat.etc2-rgba8unorm": 61, - "TextureFormat.etc2-rgba8unorm-srgb": 62, + "TextureFormat.depth16unorm": 39, + "TextureFormat.depth24plus": 40, + "TextureFormat.depth24plus-stencil8": 41, + "TextureFormat.depth32float": 42, + "TextureFormat.depth32float-stencil8": 43, + "TextureFormat.eac-r11snorm": 65, + "TextureFormat.eac-r11unorm": 64, + "TextureFormat.eac-rg11snorm": 67, + "TextureFormat.eac-rg11unorm": 66, + "TextureFormat.etc2-rgb8a1unorm": 60, + "TextureFormat.etc2-rgb8a1unorm-srgb": 61, + "TextureFormat.etc2-rgb8unorm": 58, + "TextureFormat.etc2-rgb8unorm-srgb": 59, + "TextureFormat.etc2-rgba8unorm": 62, + "TextureFormat.etc2-rgba8unorm-srgb": 63, "TextureFormat.r16float": 7, "TextureFormat.r16sint": 6, "TextureFormat.r16uint": 5, @@ -171,31 +173,32 @@ "TextureFormat.r8snorm": 2, "TextureFormat.r8uint": 3, "TextureFormat.r8unorm": 1, - "TextureFormat.rg11b10ufloat": 26, + "TextureFormat.rg11b10ufloat": 27, "TextureFormat.rg16float": 17, "TextureFormat.rg16sint": 16, "TextureFormat.rg16uint": 15, - "TextureFormat.rg32float": 28, - "TextureFormat.rg32sint": 30, - "TextureFormat.rg32uint": 29, + "TextureFormat.rg32float": 29, + "TextureFormat.rg32sint": 31, + "TextureFormat.rg32uint": 30, "TextureFormat.rg8sint": 11, "TextureFormat.rg8snorm": 9, "TextureFormat.rg8uint": 10, "TextureFormat.rg8unorm": 8, - "TextureFormat.rgb10a2unorm": 25, - "TextureFormat.rgb9e5ufloat": 27, - "TextureFormat.rgba16float": 33, - "TextureFormat.rgba16sint": 32, - "TextureFormat.rgba16uint": 31, - "TextureFormat.rgba32float": 34, - "TextureFormat.rgba32sint": 36, - "TextureFormat.rgba32uint": 35, + "TextureFormat.rgb10a2uint": 25, + "TextureFormat.rgb10a2unorm": 26, + "TextureFormat.rgb9e5ufloat": 28, + "TextureFormat.rgba16float": 34, + "TextureFormat.rgba16sint": 33, + "TextureFormat.rgba16uint": 32, + "TextureFormat.rgba32float": 35, + "TextureFormat.rgba32sint": 37, + "TextureFormat.rgba32uint": 36, "TextureFormat.rgba8sint": 22, "TextureFormat.rgba8snorm": 20, "TextureFormat.rgba8uint": 21, "TextureFormat.rgba8unorm": 18, "TextureFormat.rgba8unorm-srgb": 19, - "TextureFormat.stencil8": 37, + "TextureFormat.stencil8": 38, "TextureSampleType.depth": 3, "TextureSampleType.float": 1, "TextureSampleType.sint": 4, @@ -362,76 +365,77 @@ 22: "rgba8sint", 23: "bgra8unorm", 24: "bgra8unorm-srgb", - 25: "rgb10a2unorm", - 26: "rg11b10ufloat", - 27: "rgb9e5ufloat", - 28: "rg32float", - 29: "rg32uint", - 30: "rg32sint", - 31: "rgba16uint", - 32: "rgba16sint", - 33: "rgba16float", - 34: "rgba32float", - 35: "rgba32uint", - 36: "rgba32sint", - 37: "stencil8", - 38: "depth16unorm", - 39: "depth24plus", - 40: "depth24plus-stencil8", - 41: "depth32float", - 42: "depth32float-stencil8", - 43: "bc1-rgba-unorm", - 44: "bc1-rgba-unorm-srgb", - 45: "bc2-rgba-unorm", - 46: "bc2-rgba-unorm-srgb", - 47: "bc3-rgba-unorm", - 48: "bc3-rgba-unorm-srgb", - 49: "bc4-r-unorm", - 50: "bc4-r-snorm", - 51: "bc5-rg-unorm", - 52: "bc5-rg-snorm", - 53: "bc6h-rgb-ufloat", - 54: "bc6h-rgb-float", - 55: "bc7-rgba-unorm", - 56: "bc7-rgba-unorm-srgb", - 57: "etc2-rgb8unorm", - 58: "etc2-rgb8unorm-srgb", - 59: "etc2-rgb8a1unorm", - 60: "etc2-rgb8a1unorm-srgb", - 61: "etc2-rgba8unorm", - 62: "etc2-rgba8unorm-srgb", - 63: "eac-r11unorm", - 64: "eac-r11snorm", - 65: "eac-rg11unorm", - 66: "eac-rg11snorm", - 67: "astc-4x4-unorm", - 68: "astc-4x4-unorm-srgb", - 69: "astc-5x4-unorm", - 70: "astc-5x4-unorm-srgb", - 71: "astc-5x5-unorm", - 72: "astc-5x5-unorm-srgb", - 73: "astc-6x5-unorm", - 74: "astc-6x5-unorm-srgb", - 75: "astc-6x6-unorm", - 76: "astc-6x6-unorm-srgb", - 77: "astc-8x5-unorm", - 78: "astc-8x5-unorm-srgb", - 79: "astc-8x6-unorm", - 80: "astc-8x6-unorm-srgb", - 81: "astc-8x8-unorm", - 82: "astc-8x8-unorm-srgb", - 83: "astc-10x5-unorm", - 84: "astc-10x5-unorm-srgb", - 85: "astc-10x6-unorm", - 86: "astc-10x6-unorm-srgb", - 87: "astc-10x8-unorm", - 88: "astc-10x8-unorm-srgb", - 89: "astc-10x10-unorm", - 90: "astc-10x10-unorm-srgb", - 91: "astc-12x10-unorm", - 92: "astc-12x10-unorm-srgb", - 93: "astc-12x12-unorm", - 94: "astc-12x12-unorm-srgb", + 25: "rgb10a2uint", + 26: "rgb10a2unorm", + 27: "rg11b10ufloat", + 28: "rgb9e5ufloat", + 29: "rg32float", + 30: "rg32uint", + 31: "rg32sint", + 32: "rgba16uint", + 33: "rgba16sint", + 34: "rgba16float", + 35: "rgba32float", + 36: "rgba32uint", + 37: "rgba32sint", + 38: "stencil8", + 39: "depth16unorm", + 40: "depth24plus", + 41: "depth24plus-stencil8", + 42: "depth32float", + 43: "depth32float-stencil8", + 44: "bc1-rgba-unorm", + 45: "bc1-rgba-unorm-srgb", + 46: "bc2-rgba-unorm", + 47: "bc2-rgba-unorm-srgb", + 48: "bc3-rgba-unorm", + 49: "bc3-rgba-unorm-srgb", + 50: "bc4-r-unorm", + 51: "bc4-r-snorm", + 52: "bc5-rg-unorm", + 53: "bc5-rg-snorm", + 54: "bc6h-rgb-ufloat", + 55: "bc6h-rgb-float", + 56: "bc7-rgba-unorm", + 57: "bc7-rgba-unorm-srgb", + 58: "etc2-rgb8unorm", + 59: "etc2-rgb8unorm-srgb", + 60: "etc2-rgb8a1unorm", + 61: "etc2-rgb8a1unorm-srgb", + 62: "etc2-rgba8unorm", + 63: "etc2-rgba8unorm-srgb", + 64: "eac-r11unorm", + 65: "eac-r11snorm", + 66: "eac-rg11unorm", + 67: "eac-rg11snorm", + 68: "astc-4x4-unorm", + 69: "astc-4x4-unorm-srgb", + 70: "astc-5x4-unorm", + 71: "astc-5x4-unorm-srgb", + 72: "astc-5x5-unorm", + 73: "astc-5x5-unorm-srgb", + 74: "astc-6x5-unorm", + 75: "astc-6x5-unorm-srgb", + 76: "astc-6x6-unorm", + 77: "astc-6x6-unorm-srgb", + 78: "astc-8x5-unorm", + 79: "astc-8x5-unorm-srgb", + 80: "astc-8x6-unorm", + 81: "astc-8x6-unorm-srgb", + 82: "astc-8x8-unorm", + 83: "astc-8x8-unorm-srgb", + 84: "astc-10x5-unorm", + 85: "astc-10x5-unorm-srgb", + 86: "astc-10x6-unorm", + 87: "astc-10x6-unorm-srgb", + 88: "astc-10x8-unorm", + 89: "astc-10x8-unorm-srgb", + 90: "astc-10x10-unorm", + 91: "astc-10x10-unorm-srgb", + 92: "astc-12x10-unorm", + 93: "astc-12x10-unorm-srgb", + 94: "astc-12x12-unorm", + 95: "astc-12x12-unorm-srgb", }, "TextureDimension": { 0: "1d", diff --git a/wgpu/resources/codegen_report.md b/wgpu/resources/codegen_report.md index 240bb68e..19300fd3 100644 --- a/wgpu/resources/codegen_report.md +++ b/wgpu/resources/codegen_report.md @@ -3,7 +3,7 @@ * The webgpu.idl defines 37 classes with 76 functions * The webgpu.idl defines 5 flags, 33 enums, 59 structs * The wgpu.h defines 198 functions -* The wgpu.h defines 7 flags, 50 enums, 92 structs +* The wgpu.h defines 7 flags, 50 enums, 93 structs ## Updating API * Wrote 5 flags to flags.py * Wrote 33 enums to enums.py @@ -20,15 +20,12 @@ ### Patching API for backends/wgpu_native/_api.py * Validated 37 classes, 107 methods, 0 properties ## Validating backends/wgpu_native/_api.py -* Enum field TextureFormat.rgb10a2uint missing in wgpu.h -* Enum field StorageTextureAccess.read-only missing in wgpu.h -* Enum field StorageTextureAccess.read-write missing in wgpu.h * Enum PipelineErrorReason missing in wgpu.h * Enum AutoLayoutMode missing in wgpu.h * Enum field VertexFormat.unorm10-10-10-2 missing in wgpu.h * Enum CanvasAlphaMode missing in wgpu.h * Enum field DeviceLostReason.unknown missing in wgpu.h -* Wrote 232 enum mappings and 47 struct-field mappings to wgpu_native/_mappings.py +* Wrote 235 enum mappings and 47 struct-field mappings to wgpu_native/_mappings.py * Validated 105 C function calls * Not using 97 C functions * Validated 75 C structs diff --git a/wgpu/resources/webgpu.h b/wgpu/resources/webgpu.h index 79c0bc03..d2533513 100644 --- a/wgpu/resources/webgpu.h +++ b/wgpu/resources/webgpu.h @@ -475,6 +475,8 @@ typedef enum WGPUStencilOperation { typedef enum WGPUStorageTextureAccess { WGPUStorageTextureAccess_Undefined = 0x00000000, WGPUStorageTextureAccess_WriteOnly = 0x00000001, + WGPUStorageTextureAccess_ReadOnly = 0x00000002, + WGPUStorageTextureAccess_ReadWrite = 0x00000003, WGPUStorageTextureAccess_Force32 = 0x7FFFFFFF } WGPUStorageTextureAccess WGPU_ENUM_ATTRIBUTE; @@ -535,76 +537,77 @@ typedef enum WGPUTextureFormat { WGPUTextureFormat_RGBA8Sint = 0x00000016, WGPUTextureFormat_BGRA8Unorm = 0x00000017, WGPUTextureFormat_BGRA8UnormSrgb = 0x00000018, - WGPUTextureFormat_RGB10A2Unorm = 0x00000019, - WGPUTextureFormat_RG11B10Ufloat = 0x0000001A, - WGPUTextureFormat_RGB9E5Ufloat = 0x0000001B, - WGPUTextureFormat_RG32Float = 0x0000001C, - WGPUTextureFormat_RG32Uint = 0x0000001D, - WGPUTextureFormat_RG32Sint = 0x0000001E, - WGPUTextureFormat_RGBA16Uint = 0x0000001F, - WGPUTextureFormat_RGBA16Sint = 0x00000020, - WGPUTextureFormat_RGBA16Float = 0x00000021, - WGPUTextureFormat_RGBA32Float = 0x00000022, - WGPUTextureFormat_RGBA32Uint = 0x00000023, - WGPUTextureFormat_RGBA32Sint = 0x00000024, - WGPUTextureFormat_Stencil8 = 0x00000025, - WGPUTextureFormat_Depth16Unorm = 0x00000026, - WGPUTextureFormat_Depth24Plus = 0x00000027, - WGPUTextureFormat_Depth24PlusStencil8 = 0x00000028, - WGPUTextureFormat_Depth32Float = 0x00000029, - WGPUTextureFormat_Depth32FloatStencil8 = 0x0000002A, - WGPUTextureFormat_BC1RGBAUnorm = 0x0000002B, - WGPUTextureFormat_BC1RGBAUnormSrgb = 0x0000002C, - WGPUTextureFormat_BC2RGBAUnorm = 0x0000002D, - WGPUTextureFormat_BC2RGBAUnormSrgb = 0x0000002E, - WGPUTextureFormat_BC3RGBAUnorm = 0x0000002F, - WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000030, - WGPUTextureFormat_BC4RUnorm = 0x00000031, - WGPUTextureFormat_BC4RSnorm = 0x00000032, - WGPUTextureFormat_BC5RGUnorm = 0x00000033, - WGPUTextureFormat_BC5RGSnorm = 0x00000034, - WGPUTextureFormat_BC6HRGBUfloat = 0x00000035, - WGPUTextureFormat_BC6HRGBFloat = 0x00000036, - WGPUTextureFormat_BC7RGBAUnorm = 0x00000037, - WGPUTextureFormat_BC7RGBAUnormSrgb = 0x00000038, - WGPUTextureFormat_ETC2RGB8Unorm = 0x00000039, - WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x0000003A, - WGPUTextureFormat_ETC2RGB8A1Unorm = 0x0000003B, - WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x0000003C, - WGPUTextureFormat_ETC2RGBA8Unorm = 0x0000003D, - WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x0000003E, - WGPUTextureFormat_EACR11Unorm = 0x0000003F, - WGPUTextureFormat_EACR11Snorm = 0x00000040, - WGPUTextureFormat_EACRG11Unorm = 0x00000041, - WGPUTextureFormat_EACRG11Snorm = 0x00000042, - WGPUTextureFormat_ASTC4x4Unorm = 0x00000043, - WGPUTextureFormat_ASTC4x4UnormSrgb = 0x00000044, - WGPUTextureFormat_ASTC5x4Unorm = 0x00000045, - WGPUTextureFormat_ASTC5x4UnormSrgb = 0x00000046, - WGPUTextureFormat_ASTC5x5Unorm = 0x00000047, - WGPUTextureFormat_ASTC5x5UnormSrgb = 0x00000048, - WGPUTextureFormat_ASTC6x5Unorm = 0x00000049, - WGPUTextureFormat_ASTC6x5UnormSrgb = 0x0000004A, - WGPUTextureFormat_ASTC6x6Unorm = 0x0000004B, - WGPUTextureFormat_ASTC6x6UnormSrgb = 0x0000004C, - WGPUTextureFormat_ASTC8x5Unorm = 0x0000004D, - WGPUTextureFormat_ASTC8x5UnormSrgb = 0x0000004E, - WGPUTextureFormat_ASTC8x6Unorm = 0x0000004F, - WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000050, - WGPUTextureFormat_ASTC8x8Unorm = 0x00000051, - WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000052, - WGPUTextureFormat_ASTC10x5Unorm = 0x00000053, - WGPUTextureFormat_ASTC10x5UnormSrgb = 0x00000054, - WGPUTextureFormat_ASTC10x6Unorm = 0x00000055, - WGPUTextureFormat_ASTC10x6UnormSrgb = 0x00000056, - WGPUTextureFormat_ASTC10x8Unorm = 0x00000057, - WGPUTextureFormat_ASTC10x8UnormSrgb = 0x00000058, - WGPUTextureFormat_ASTC10x10Unorm = 0x00000059, - WGPUTextureFormat_ASTC10x10UnormSrgb = 0x0000005A, - WGPUTextureFormat_ASTC12x10Unorm = 0x0000005B, - WGPUTextureFormat_ASTC12x10UnormSrgb = 0x0000005C, - WGPUTextureFormat_ASTC12x12Unorm = 0x0000005D, - WGPUTextureFormat_ASTC12x12UnormSrgb = 0x0000005E, + WGPUTextureFormat_RGB10A2Uint = 0x00000019, + WGPUTextureFormat_RGB10A2Unorm = 0x0000001A, + WGPUTextureFormat_RG11B10Ufloat = 0x0000001B, + WGPUTextureFormat_RGB9E5Ufloat = 0x0000001C, + WGPUTextureFormat_RG32Float = 0x0000001D, + WGPUTextureFormat_RG32Uint = 0x0000001E, + WGPUTextureFormat_RG32Sint = 0x0000001F, + WGPUTextureFormat_RGBA16Uint = 0x00000020, + WGPUTextureFormat_RGBA16Sint = 0x00000021, + WGPUTextureFormat_RGBA16Float = 0x00000022, + WGPUTextureFormat_RGBA32Float = 0x00000023, + WGPUTextureFormat_RGBA32Uint = 0x00000024, + WGPUTextureFormat_RGBA32Sint = 0x00000025, + WGPUTextureFormat_Stencil8 = 0x00000026, + WGPUTextureFormat_Depth16Unorm = 0x00000027, + WGPUTextureFormat_Depth24Plus = 0x00000028, + WGPUTextureFormat_Depth24PlusStencil8 = 0x00000029, + WGPUTextureFormat_Depth32Float = 0x0000002A, + WGPUTextureFormat_Depth32FloatStencil8 = 0x0000002B, + WGPUTextureFormat_BC1RGBAUnorm = 0x0000002C, + WGPUTextureFormat_BC1RGBAUnormSrgb = 0x0000002D, + WGPUTextureFormat_BC2RGBAUnorm = 0x0000002E, + WGPUTextureFormat_BC2RGBAUnormSrgb = 0x0000002F, + WGPUTextureFormat_BC3RGBAUnorm = 0x00000030, + WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000031, + WGPUTextureFormat_BC4RUnorm = 0x00000032, + WGPUTextureFormat_BC4RSnorm = 0x00000033, + WGPUTextureFormat_BC5RGUnorm = 0x00000034, + WGPUTextureFormat_BC5RGSnorm = 0x00000035, + WGPUTextureFormat_BC6HRGBUfloat = 0x00000036, + WGPUTextureFormat_BC6HRGBFloat = 0x00000037, + WGPUTextureFormat_BC7RGBAUnorm = 0x00000038, + WGPUTextureFormat_BC7RGBAUnormSrgb = 0x00000039, + WGPUTextureFormat_ETC2RGB8Unorm = 0x0000003A, + WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x0000003B, + WGPUTextureFormat_ETC2RGB8A1Unorm = 0x0000003C, + WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x0000003D, + WGPUTextureFormat_ETC2RGBA8Unorm = 0x0000003E, + WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x0000003F, + WGPUTextureFormat_EACR11Unorm = 0x00000040, + WGPUTextureFormat_EACR11Snorm = 0x00000041, + WGPUTextureFormat_EACRG11Unorm = 0x00000042, + WGPUTextureFormat_EACRG11Snorm = 0x00000043, + WGPUTextureFormat_ASTC4x4Unorm = 0x00000044, + WGPUTextureFormat_ASTC4x4UnormSrgb = 0x00000045, + WGPUTextureFormat_ASTC5x4Unorm = 0x00000046, + WGPUTextureFormat_ASTC5x4UnormSrgb = 0x00000047, + WGPUTextureFormat_ASTC5x5Unorm = 0x00000048, + WGPUTextureFormat_ASTC5x5UnormSrgb = 0x00000049, + WGPUTextureFormat_ASTC6x5Unorm = 0x0000004A, + WGPUTextureFormat_ASTC6x5UnormSrgb = 0x0000004B, + WGPUTextureFormat_ASTC6x6Unorm = 0x0000004C, + WGPUTextureFormat_ASTC6x6UnormSrgb = 0x0000004D, + WGPUTextureFormat_ASTC8x5Unorm = 0x0000004E, + WGPUTextureFormat_ASTC8x5UnormSrgb = 0x0000004F, + WGPUTextureFormat_ASTC8x6Unorm = 0x00000050, + WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000051, + WGPUTextureFormat_ASTC8x8Unorm = 0x00000052, + WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000053, + WGPUTextureFormat_ASTC10x5Unorm = 0x00000054, + WGPUTextureFormat_ASTC10x5UnormSrgb = 0x00000055, + WGPUTextureFormat_ASTC10x6Unorm = 0x00000056, + WGPUTextureFormat_ASTC10x6UnormSrgb = 0x00000057, + WGPUTextureFormat_ASTC10x8Unorm = 0x00000058, + WGPUTextureFormat_ASTC10x8UnormSrgb = 0x00000059, + WGPUTextureFormat_ASTC10x10Unorm = 0x0000005A, + WGPUTextureFormat_ASTC10x10UnormSrgb = 0x0000005B, + WGPUTextureFormat_ASTC12x10Unorm = 0x0000005C, + WGPUTextureFormat_ASTC12x10UnormSrgb = 0x0000005D, + WGPUTextureFormat_ASTC12x12Unorm = 0x0000005E, + WGPUTextureFormat_ASTC12x12UnormSrgb = 0x0000005F, WGPUTextureFormat_Force32 = 0x7FFFFFFF } WGPUTextureFormat WGPU_ENUM_ATTRIBUTE; @@ -1095,7 +1098,7 @@ typedef struct WGPUSurfaceDescriptorFromXcbWindow { typedef struct WGPUSurfaceDescriptorFromXlibWindow { WGPUChainedStruct chain; void * display; - uint32_t window; + uint64_t window; } WGPUSurfaceDescriptorFromXlibWindow WGPU_STRUCTURE_ATTRIBUTE; typedef struct WGPUSurfaceTexture { @@ -1202,7 +1205,7 @@ typedef struct WGPUImageCopyTexture { typedef struct WGPUProgrammableStageDescriptor { WGPUChainedStruct const * nextInChain; WGPUShaderModule module; - char const * entryPoint; + WGPU_NULLABLE char const * entryPoint; size_t constantCount; WGPUConstantEntry const * constants; } WGPUProgrammableStageDescriptor WGPU_STRUCTURE_ATTRIBUTE; @@ -1298,7 +1301,7 @@ typedef struct WGPURenderPassDescriptor { typedef struct WGPUVertexState { WGPUChainedStruct const * nextInChain; WGPUShaderModule module; - char const * entryPoint; + WGPU_NULLABLE char const * entryPoint; size_t constantCount; WGPUConstantEntry const * constants; size_t bufferCount; @@ -1308,7 +1311,7 @@ typedef struct WGPUVertexState { typedef struct WGPUFragmentState { WGPUChainedStruct const * nextInChain; WGPUShaderModule module; - char const * entryPoint; + WGPU_NULLABLE char const * entryPoint; size_t constantCount; WGPUConstantEntry const * constants; size_t targetCount; diff --git a/wgpu/resources/wgpu.h b/wgpu/resources/wgpu.h index 76bdb474..d397fa68 100644 --- a/wgpu/resources/wgpu.h +++ b/wgpu/resources/wgpu.h @@ -14,6 +14,7 @@ typedef enum WGPUNativeSType { WGPUSType_BindGroupEntryExtras = 0x00030007, WGPUSType_BindGroupLayoutEntryExtras = 0x00030008, WGPUSType_QuerySetDescriptorExtras = 0x00030009, + WGPUSType_SurfaceConfigurationExtras = 0x0003000A, WGPUNativeSType_Force32 = 0x7FFFFFFF } WGPUNativeSType; @@ -131,8 +132,8 @@ typedef struct WGPUPushConstantRange { typedef struct WGPUPipelineLayoutExtras { WGPUChainedStruct chain; - uint32_t pushConstantRangeCount; - WGPUPushConstantRange* pushConstantRanges; + size_t pushConstantRangeCount; + WGPUPushConstantRange const * pushConstantRanges; } WGPUPipelineLayoutExtras; typedef uint64_t WGPUSubmissionIndex; @@ -155,38 +156,39 @@ typedef struct WGPUShaderModuleGLSLDescriptor { WGPUShaderDefine * defines; } WGPUShaderModuleGLSLDescriptor; -typedef struct WGPUStorageReport { - size_t numOccupied; - size_t numVacant; - size_t numError; - size_t elementSize; -} WGPUStorageReport; +typedef struct WGPURegistryReport { + size_t numAllocated; + size_t numKeptFromUser; + size_t numReleasedFromUser; + size_t numError; + size_t elementSize; +} WGPURegistryReport; typedef struct WGPUHubReport { - WGPUStorageReport adapters; - WGPUStorageReport devices; - WGPUStorageReport pipelineLayouts; - WGPUStorageReport shaderModules; - WGPUStorageReport bindGroupLayouts; - WGPUStorageReport bindGroups; - WGPUStorageReport commandBuffers; - WGPUStorageReport renderBundles; - WGPUStorageReport renderPipelines; - WGPUStorageReport computePipelines; - WGPUStorageReport querySets; - WGPUStorageReport buffers; - WGPUStorageReport textures; - WGPUStorageReport textureViews; - WGPUStorageReport samplers; + WGPURegistryReport adapters; + WGPURegistryReport devices; + WGPURegistryReport queues; + WGPURegistryReport pipelineLayouts; + WGPURegistryReport shaderModules; + WGPURegistryReport bindGroupLayouts; + WGPURegistryReport bindGroups; + WGPURegistryReport commandBuffers; + WGPURegistryReport renderBundles; + WGPURegistryReport renderPipelines; + WGPURegistryReport computePipelines; + WGPURegistryReport querySets; + WGPURegistryReport buffers; + WGPURegistryReport textures; + WGPURegistryReport textureViews; + WGPURegistryReport samplers; } WGPUHubReport; typedef struct WGPUGlobalReport { - WGPUStorageReport surfaces; + WGPURegistryReport surfaces; WGPUBackendType backendType; WGPUHubReport vulkan; WGPUHubReport metal; WGPUHubReport dx12; - WGPUHubReport dx11; WGPUHubReport gl; } WGPUGlobalReport; @@ -216,6 +218,11 @@ typedef struct WGPUQuerySetDescriptorExtras { size_t pipelineStatisticCount; } WGPUQuerySetDescriptorExtras WGPU_STRUCTURE_ATTRIBUTE; +typedef struct WGPUSurfaceConfigurationExtras { + WGPUChainedStruct chain; + WGPUBool desiredMaximumFrameLatency; +} WGPUSurfaceConfigurationExtras WGPU_STRUCTURE_ATTRIBUTE; + typedef void (*WGPULogCallback)(WGPULogLevel level, char const * message, void * userdata); #ifdef __cplusplus @@ -223,12 +230,12 @@ extern "C" { #endif void wgpuGenerateReport(WGPUInstance instance, WGPUGlobalReport * report); -size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, WGPUInstanceEnumerateAdapterOptions const * options, WGPUAdapter * adapters); +size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, WGPU_NULLABLE WGPUInstanceEnumerateAdapterOptions const * options, WGPUAdapter * adapters); WGPUSubmissionIndex wgpuQueueSubmitForIndex(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands); // Returns true if the queue is empty, or false if there are more queue submissions still in flight. -WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, WGPUWrappedSubmissionIndex const * wrappedSubmissionIndex); +WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, WGPU_NULLABLE WGPUWrappedSubmissionIndex const * wrappedSubmissionIndex); void wgpuSetLogCallback(WGPULogCallback callback, void * userdata); @@ -236,7 +243,7 @@ void wgpuSetLogLevel(WGPULogLevel level); uint32_t wgpuGetVersion(void); -void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, void* const data); +void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, void const * data); void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count); void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count);