Skip to content

Commit

Permalink
Merge remote-tracking branch 'fyellin/mdi_count' into mdi_count
Browse files Browse the repository at this point in the history
  • Loading branch information
fyellin committed Oct 1, 2024
2 parents 611ed30 + 7f2364c commit 7f3cf38
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 73 deletions.
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

os.environ["WGPU_FORCE_OFFSCREEN"] = "true"


# Load wgpu so autodoc can query docstrings
import wgpu # noqa: E402
import wgpu.utils.compute # noqa: E402


# -- Tests -------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ Compute with buffers
from wgpu.utils.compute import compute_with_buffers
.. autofunction:: wgpu.utils.compute_with_buffers
.. autofunction:: wgpu.utils.compute.compute_with_buffers

6 changes: 0 additions & 6 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,6 @@ def test_do_not_import_utils_submodules():
assert "Error" not in out
assert "function get_default_device" in out

# FAIL: use something from utils that's not imported
code = "import wgpu; print(wgpu.utils.compute.compute_with_buffers)"
out = get_output_from_subprocess(code)
assert "Error" in out
assert "must be explicitly imported" in out and "utils" in out

# Also, no numpy
code = "import sys, wgpu.utils; print('numpy' in sys.modules)"
out = get_output_from_subprocess(code)
Expand Down
8 changes: 0 additions & 8 deletions wgpu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,3 @@

# The API entrypoint, from wgpu.classes - gets replaced when a backend loads.
gpu = GPU() # noqa: F405


# Temporary stub to help transitioning
def request_adapter(*args, **kwargs):
"""Deprecated!"""
raise DeprecationWarning(
"wgpu.request_adapter() is deprecated! Use wgpu.gpu.request_adapter_sync() instead."
)
14 changes: 0 additions & 14 deletions wgpu/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,20 +1436,6 @@ def write_mapped(self, data, buffer_offset=None, size=None):
def get_mapped_range(self, offset=0, size=None):
raise NotImplementedError("The Python API differs from WebGPU here")

@apidiff.add("Deprecated but still here to raise a warning")
def map_read(self, offset=None, size=None, iter=None):
"""Deprecated."""
raise DeprecationWarning(
"map_read() is deprecated, use map() and read_mapped() instead."
)

@apidiff.add("Deprecated but still here to raise a warning")
def map_write(self, data):
"""Deprecated."""
raise DeprecationWarning(
"map_read() is deprecated, use map() and write_mapped() instead."
)

# IDL: undefined destroy();
def destroy(self):
"""Destroy the buffer.
Expand Down
12 changes: 0 additions & 12 deletions wgpu/backends/rs.py

This file was deleted.

1 change: 0 additions & 1 deletion wgpu/backends/wgpu_native/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@
gpu = GPU() # noqa: F405
_register_backend(gpu)

from .extras import enumerate_adapters
from .extras import request_device_sync, request_device
5 changes: 0 additions & 5 deletions wgpu/backends/wgpu_native/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
# need to be able to load wgpu-native.


def enumerate_adapters():
"""Deprecated."""
raise RuntimeError("Deprecated: use wgpu.gpu.enumerate_adapters_sync() instead.")


def request_device_sync(
adapter,
trace_path,
Expand Down
4 changes: 2 additions & 2 deletions wgpu/resources/codegen_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* Diffs for GPUCanvasContext: add get_preferred_format, add present
* Diffs for GPUAdapter: add summary
* Diffs for GPUDevice: add adapter, add create_buffer_with_data, hide import_external_texture, hide lost_async, hide lost_sync, hide onuncapturederror, hide pop_error_scope_async, hide pop_error_scope_sync, hide push_error_scope
* Diffs for GPUBuffer: add map_read, add map_write, add read_mapped, add write_mapped, hide get_mapped_range
* Diffs for GPUBuffer: add read_mapped, add write_mapped, hide get_mapped_range
* Diffs for GPUTexture: add size
* Diffs for GPUTextureView: add size, add texture
* Diffs for GPUBindingCommandsMixin: change set_bind_group
* Diffs for GPUQueue: add read_buffer, add read_texture, hide copy_external_image_to_texture
* Validated 37 classes, 126 methods, 46 properties
* Validated 37 classes, 124 methods, 46 properties
### Patching API for backends/wgpu_native/_api.py
* Validated 37 classes, 107 methods, 0 properties
## Validating backends/wgpu_native/_api.py
Expand Down
24 changes: 0 additions & 24 deletions wgpu/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,3 @@

# The get_default_device() is so small and generally convenient that we import it by default.
from .device import get_default_device


class _StubModule:
def __init__(self, module):
self._module = module
self.must_be_explicitly_imported = True

def __getattr__(self, *args, **kwargs):
raise RuntimeError(f"wgpu.utils.{self._module} must be explicitly imported.")

def __repr__(self):
return f"<Stub for wgpu.utils.{self._module} - {self._module} must be explicitly imported>"


# Create stubs


def compute_with_buffers(*args, **kwargs):
raise DeprecationWarning(
"wgpu.utils.compute_with_buffers() must now be imported from wgpu.utils.compute"
)


compute = _StubModule("compute")

0 comments on commit 7f3cf38

Please sign in to comment.