WebGPU and wgpu-native are still changing fast, and with that we do to. We do not yet attempt to make things backwards compatible. Instead we try to be precise about tracking changes to the public API.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Possible sections in each release:
- Added: for new features.
- Changed: for changes in existing functionality.
- Deprecated: for soon-to-be removed features.
- Removed: for now removed features.
- Fixed: for any bug fixes.
- Security: in case of vulnerabilities.
Fixed:
- Ensure that wgpu is compatible both with imgui 1.6.0 and older by @hmaarrfk in #649
- Clean up async code and add proper trio / rendercanvas support by @fyellin in #631
- Remove timeout in awaitable by @almarklein in #651
- Allow
rendercanvas.get_context()
before a backend is selected by @almarklein in #652
Changed:
- Update to Imgui 1.6+ by @panxinmiao in #645
Some internal refactoring, fix the doc theme, and compatibility with rendercanvas.
Changed:
- Do not confound STDERR and STDOUT by @hmaarrfk in #638
- More consolidation by @fyellin in #641
- Use rtd theme for docs by @almarklein in #639
- Refactor present-method mechanic by @almarklein in #642
Added:
- Overrideable constants by @fyellin in #579
- Implemention for multi-draw features by @fyellin in #583
- Statistics query by @fyellin in #605
- Examples for asyncio and trio by @almarklein in #608
- Add example that uses PySide6 with asyncio compat by @almarklein in #612
- Add pre-commit hooks for ruff by @claydugo in #629
- Include pre-commit in optional dependencies by @claydugo in #630
Changed:
- Async API by @almarklein in #598
- Renamed
request_adapter()
torequest_adapter_sync()
(old method still works with warning). - Renamed
enumerate_adapters()
toenumerate_adapters_sync()
(old method still works with warning). - Renamed
request_device()
torequest_device_sync()
(old method still works with warning). - Renamed
buffer.map()
tobuffer.map_sync()
(old method still works with warning).
- Renamed
- Renamed
request_device_trace
->request_device
by @fyellin in #589 - Make depth_stencil_attachment follow the spec by @fyellin in #611
- If data in
create_buffer_with_data
isn't a multiple of 4, just round up. by @fyellin in #626 - Drop support for Python 3.8.
Fixed:
- Fix snake case for 1d/2d/3d suffix by @almarklein in #617
Docs:
- Add note on examples by @almarklein in #597
- Tweaks to examples by @almarklein in #610
- Add extra version info on dev installs by @almarklein in #623
- Fix small typo in README intro by @otterbotter in #625
Internal changes:
- Remove _release code that's duplicated 19 times. by @fyellin in #590
- Fix some small errors by @fyellin in #591
- Refactor build system by @almarklein in #596
- Use ruff instead of black and flake8 by @almarklein in #599
- Fixes to testing by @almarklein in #604
- Remove stuff that's been deprecated for a while by @almarklein in #607
- Improve generated type hints and defaults by @almarklein in #606
- Add better async support for wgpu-native by @almarklein in #609
- Nitpicky changes flagged by PyCharm by @fyellin in #613
- Python 3.13. Remove ruff flakiness by @fyellin in #614
- Structure checking by @fyellin in #615
- Eliminate warning in test suite by @fyellin in #621
- Fix install of mesa drivers by @almarklein in #622
- Only keep alive those objects that are necessary. by @fyellin in #628
- Refactor canvas context to allow presenting as image by @almarklein in #586
- Prevent extra errors when canvascontext creation fails by @almarklein in #635
Added:
- Add support for push constants (a wgpu native extension).
Fixed:
- Fixed jupyter gui backend.
Added:
- Now also building wheels for Windows aarch64.
Changed:
- Updated to latest wgpu-native (v22.1.0.5).
Fixed:
- Various typos in the docs.
- Fixed the wheels for 32bit Windows.
Added:
- Support for occlusion queries.
- Support for render bundles.
- Support for IMGUI, via
wgpu.utils.imgui
. - Wx is now a fully supported GUI backend.
- A
BaseEnum
class was added towgpu.utils
, so it can be used in downstream libs like pygfx. - The
WGPUCanvas.add_event_handler()
method now has anorder
arg.
Changed:
- The flags and enums are implemented using a new enum class, enabling better static code analysis (i.e. autocompletion in IDE's).
- Native (desktop) features must now be specified in the same way as normal (WebGPU) features: lowercase and with hyphens between the words.
- Bindings can omit offset and size (the full size will be used). This makes our API follow WebGPU better.
- Support omitting fields from
BindGroupLayoutEntry
,BufferBindingLayout
,SamplerBindingLayout
,StorageTextureBindingLayout
,VertexState
. See #534 for details. - In cases where a
view_dimension
is given, it must be provided as a string (e.g. '2d'). Ints are no longer allowed, because e.g. 2 does not mean '2d', which can be a source of confusion.
(Due to problems with the CD process, we had to bump the version a few times.)
Changed:
- Updated to wgpu-native 0.19.4.1. Does not incur API changes.
- Updated to latest IDL.
- Replaced the
adapter.request_adapter_info()
method with theadapter.info
property.
Changed:
- The
Adapter.request_adapter_info()
method is replaced by the.info
property.
Added:
- Implement
canvas.set_title()
by @almarklein in #508 - Add experimental support for
get_mapped_range()
by @almarklein in #522
Changed:
- Allow
create_render_pipeline()
to useAutoLayout
by @fyellin in #500 - Support omitting the
topology
field in theprimitive
dict passed tocreate_render_pipeline()
by @fyellin in #503 - Support omitting last arguments in
set_bind_group()
by @panxinmiao in #511 - Try to optimize proxy_func by @almarklein in #507
Fixed:
- Fix wx examples by @panxinmiao in #520
- Support timestamp queryset for
begin_render_pass()
by @almarklein in #505 - Implement
destroy()
the right way by @almarklein in #519
Added:
- New example to demonstrate manual GLFW integration by @Korijn in #480
- More details in docs of enumerate_adapters by @almarklein in #489
- Add GPU cloud compute info to docs by @kushalkolar in #495
Changed:
- Make modifiers and buttons tuples for immutability by @hmaarrfk in #492
Fixed:
- Fix WxWgpuWindow by not calling 'add_event_handler' by @cansik in #486
Added:
- Users can set the
WGPU_GUI_BACKEND
environment variable to prefer a specific backend. - Added
wgpu.gpu.enumerate_adapters()
. - Added
adapter.summary
property, to easily get a one-line description of each adapter.
Changed:
- Avoid present-related warning messages when an exception is raised from the draw function.
- The
adapter.request_adapter_info()
now also containsvendor_id
anddevice_id
.
Fixed:
- For GUI backend selection:
- Honor
%gui
in IPython and Jupyter. - Don't enter Qt event loop when Qt is active by the env (e.g. IPython).
- Prefer glfw when we detect a running asyncio loop.
- Make the glfw backend work in IPython.
- The
run()
function can be called multiple times (similar toplt.plot()
).
- Honor
Changed:
- Updated to wgpu-native 0.19.3.1. Does not incur API changes.
- Updated to latest IDL. Does not incur API changes.
Fixed:
- Wayland is finally properly supported, albeit via XWayland.
Added:
- Tests for detecting nan and inf values in shaders.
Added:
- The
wgpu.DiagnosticsBase
is now a public base class that can be subclassed by downstream libs (like pygfx) to provide diagnostics.
Changed:
- Diagnostics renders bools as
✓
or-
, and large ints get scientific notation.
Added:
- The feature "float32-filterable" is now available natively.
- Add list of projects using wgpu-py to README. (#456)
Changed:
- Updated to wgpu-native 0.19.1.1. (#458)
Canvas.get_context()
now raises an error if no backend is selected yet (instead of returning a worthless base context object).- Omitting the call to
context.get_current_texture()
results in a warning instead of an exception.
Removed:
- Shadertoy util is removed from the wgpu-py. It is now available as a separate package: wgpu-shadertoy. (#455)
Fixed:
- Devices no longer leak memory.
Added:
- Implement support for timestamp QuerySet.
- Add texture input and iFrameRate builtin to Shadertoy util #453
Fixed:
- Prevent access violation errors with GLFW on Windows.
- Prevent a segfault when deleting a
GPUPipelineLayout
(observed in a very specific use-case on LavaPipe). - Fix
triangle_glsl.py
example. - Fix that when logger is set to debug, errors are produced when Python exits.
Added:
- Support for linux-aarch64 (binary wheels available)! This includes Raspberry Pi's with a 64-bit OS, and adds support for building linux docker images on Apple Silicon devices without having to emulate x86 (no need for
--platform linux/amd64
).
Added:
- Add
iDate
builtin to Shadertoy utility. - Allow "auto" layout args for
create_compute_pipeline()
. - Official support for Python 3.12 and pypy.
Changed:
- Update to wgpu-native 0.18.1.2.
CanvasContext.get_current_texture()
now returns aGPUTexture
instead of aGPUTextureView
.OffscreenCanvasBase.present()
now receives aGPUTexture
instead of aGPUTextureView
, and this is a new texture on each draw (no re-use).- Renamed ``wgpu.gui.WgpuOffscreenCanvas
to
WgpuOffscreenCanvasBase`. - The
wgpu.base
submodule that defined the GPU classes is renamed to be a private module. The newwgpu.classes
namespace contains all GPU classes (and nothing else). - The
__repr__
of the GPU classes shows a shorter canonical class name. - Flags and Enums have a more useful
__repr__
.
Fixed:
- Dragging a window between windows with different scale factor (with Qt on Windows) no longer puts the window in an invalid state. A warning is still produced though.
GPUCommandEncoder.begin_render_pass()
binds the lifetime of passed texture views to the returned render pass object to prevent premature destruction when no reference to a texture view is kept.
This is a big release that contains many improvements, but also multiple API changes.
Most backward incompatible changes are due to two things: the backend system has been refactored, making it simpler and future-proof. And we have revised the buffer mapping API, making it more similar to the WebGPU spec, and providing more flexible and performant ways to set buffer data.
A summary to help you update your code:
# X import wgpu.backends.rs
import wgpu
# X wgpu.request_adapter(canvas=None, power_preference="high-performance")
wgpu.gpu.request_adapter(power_preference="high-performance")
# X buffer.map_read()
buffer.map("READ")
buffer.read_mapped(...)
buffer.read_mapped(...)
buffer.unmap()
# X buffer.map_write()
buffer.map("WRITE")
buffer.write_mapped(data1, ...)
buffer.write_mapped(data2, ...)
buffer.unmap()
Added:
- The
wgpu.gpu
object, which represents the API entrypoint. This makes the API more clear and more similar to the WebGPU API. - A convenience
auto
backend, and a stubjs_webgpu
backend. - New function
enumerate_adapters()
in thewgpu_native
backend. - Warning about pip when wgpu-native binary is missing on Linux
- The
GPUBuffer
has new methodsmap()
,map_async()
,unmap()
. These have been part of the WebGPU spec for a long time, but we had an alternative API, until now. - The
GPUBuffer
has new methodsread_mapped()
andwrite_mapped()
. These are not present in the WebGPU spec; they are the Pythonic alternative togetMappedRange()
. - Flags can now be passed as strings, and can even be combined using "MAP_READ|COPY_DIST".
- GUI events have an extra "timestamp" field, and wheel events an additional "buttons" field.
- A diagnostics subsystem that amongst other things counts GPU objects. Try e.g.
wgpu.diagnostics.print_report()
. - Several improvements to the shadertoy util: offscreen support and a snapshot method.
Changed:
- Can create a buffer that is initially mapped:
device.create_buffer(..., mapped_at_creation=True)
is enabled again. - The
wgpu.request_adapter()
function is moved towgpu.gpu.request_adapter()
. Same for the async version. - The
canvas
argument of therequest_adapter()
function is now optional. - The
rs
backend is renamed towgpu_native
. - It is no longer necessary to explicitly import the backend.
- The
GPUDevice.request_device_tracing()
method is now a function in thewgpu_native
backend. - We no longer force using Vulkan on Windows. For now wgpu-native still prefers Vulkan over D3D12.
- The
wgpu.utils
subpackage is imported by default, but most submodules are not. This means thatcompute_with_buffers
must be explicitly imported fromwgpu.utils.compute
.
Deprecated:
wgpu.request_adapter()
and its async version. Usewgpu.gpu.request_adapter()
instead.- The
GPUBuffer
methodsmap_read()
andmap_write()
are deprecated, in favor ofmap()
,unmap()
,read_mapped()
andwrite_mapped()
.
To be clear, these are not changed:
- The convenient
device.create_buffer_with_data()
(not part of the WebGPU spec) is still available. - The
GPUQueue.read_buffer()
andGPUQueue.write_buffer()
methods are unchanged.
Fixed:
- The shaderutil now re-uses the default device, avoiding memoryleaks when running multiple consecutively.
- The GUI backend selection takes into account whether a backend module is already imported.
- The offscreen GUI backend no longer uses asyncio (it does not need an event loop).
- Prevent a few classes of memoryleaks. Mind that creating many
GPUDevice
objects still leaks.
Changed:
- Update to wgpu-native 0.17.2.1. No changes are needed in downstream code.
In this release the API is aligned with the latest webgpu.idl, and we updated to wgpu-native (v0.17.0.2).
Added:
- New
wgpu.wgsl_language_features
property, which for now always returns an empty set. - The
GPUShaderModule.compilation_info
property (and its async version) are replaced with aget_compilation_info()
method. - The WebGPU features "bgra8unorm-storage" and "float32-filterable" are now available.
Changed:
- The binary wheels are now based on manylinux 2.28, and the 32bit Linux wheels are no longer built.
- In WGSL: toplevel constants must be defined using
const
, usinglet
will now fail. - In WGSL: it is no longer possible to re-declare an existing variable name.
- Error messages may look a bit different, since wgpu-native now produces nice messages replacing our custom ones.
- Errors produced by a call into a wgpu-native function now produce a Python exception (no more async logging of errors).
Fixed:
- Fixed setting the dpi awareness in the Qt backend, by correctly looking up the Qt version.
Changed:
- Links to readthedocs now point to stable instead of latest, so that people reading the docs see these that reflect the latest release.
- Don't enable any features by default (previously WGPUNativeFeature_TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES was enabled).
Fixed:
- Fixed issue related to winid (native widgets) on embedded Qt widgets on Windows (#348).
- Fixed our example screenshot tests.
Changed:
- The offscreen
WgpuCanvas.draw()
method now returns amemoryview
instead of a numpy array. - The shadertoy util changed internally from using numpy to using a memoryview.
Fixed:
- Fixed that
get_preferred_format()
could crash (inwgpuSurfaceGetSupportedFormats
) due to an upstream bug in wgpu-native (#342)
Added:
- The shadertoy util now supports GLSL, so code from the shadertoy website can be directly copied and run with wgpu (#343)
Changed:
- Improved documentation.
Added:
- Added
print_report()
to get a report on the internals of wgpu. - Added
command_encoder.clear_buffer()
- Added support for GLSL.
In this release the API is aligned with the latest webgpu.idl, and we updated to the latest release of wgpu-native (v0.14.2.3).
Changed:
- To use the default
min_binding_size
increate_bind_group_layout
, it should beNone
instead of zero. - If the depth-stencil texture has not room for stencil data, the
stencil_read_mask
andstencil_write_mask
fields in theDepthStencilState
struct passed tocreate_render_pipeline()
must be set to 0. - In WGSL,
@stage(compute)
must now be@compute
. Same forvertex
andfragment
. - In WGSL, the list of reserved words has been extended, including e.g.
mod
,matrix
andref
. - In WGSL,
smoothStep
is nowsmoothstep
.
Added:
- New IDL: texture has new props
weight
,height
,depth_or_array_layers
. - New IDL: Buffer has new prop
map_state
.
Fixed:
- The offscreen canvas's mainloop prevents leaking callbacks better (#322)
- Prevent error messages when Qt examples/apps are closed (#326)
Fixed:
- Prevent Qt warning about setting dpi awareness (#320)
- Make canvases close when they get deleted (#319)
- Fix qt canvas in ipython (#315)
- Make offscreen canvas closable (#309)
- Fix that the offscreen canvas had it size hardcoded, ignoring the given size (#317)
- Fixed renaming of
queue
in docs (#308) - Fix using
.draw_frame
on qt canvas (#304) - Add missing dev dependencies (#295)
Added:
- A shadertoy utility, plus examples (#312)
Changed:
- Improve the error prompt when wgsl code is multi line error (#311, #316)
- Tests: execute examples in the test process (#310)
- Package only the release binary (not the debug build) (#299)
- Codegen: uses in-memory file system during code generation (#303)
- Improve readme (#290, #302, #314)
Fixed:
- Fixed imports for PyQt6.
- Keyboard events work again for Qt 6.3.
- Fixed that overloading
handle_event()
did not work for a canvas based on a Qt or wx main widget/window.
Added:
- Can now add a wildcard ("*") to
add_event_handler
to handle all events. - Shader error messages show more context, making shader debugging much easier.
- VSync can now be turned off to raise the frame rate when needed. Note that FPS measurements are still a poor performance benchmark!
Changed:
- GLFW canvas does not draw when minimized anymore.
- The offscreen and Jupyter canvas now use the srgb format for consistency with normal canvases.
- The examples have been adjusted for srgb colors.
Fixed:
- Fixed regression that
canvas.handle_event()
could no longer be overloaded to handle move and wheel events.
Changed:
- Added a note in the docs to explain that the version of the examples must match the runtime version.
Changed:
- Now targeting wgpu-native 0.12.0.1.
- Updated API to the latest WebGPU spec.
- Better error logging using the new callbacks in wgpu-native.
- All destructors (drop methods) are now working as they should.
To update, you need to adjust to the following API changes:
- The encoder's
end_pass()
are renamed toend()
. - The compute encoder's
dispatch()
is renameddispatch_workgroups
, anddispatch_indirect
todispatch_workgroups_indirect
. - The
load_value
is replaced withclear_value
andload_op
. - Same for
depth_load_value
andstencil_load_value
. - The
device.create_sampler()
method for mipmap filtering now uses theMipmapFilterMode
enum instead of theFilterMode
enum. Since the fields of these enums are the same, you probably don't need to change anything.
To update, your shaders need the following changes:
- The decorators have changed from
[[...]]
to@...
.- E.g. change
[[location(0)]]
to@location(0)
. - E.g. change
[[group(0), binding(0)]]
to@group(0) @binding(0)
.
- E.g. change
- Structs now use
,
to separate fields instead of;
. - The
elseif
keyword is nowelse if
. - Buffers bound as arrays don't need to be defined via a struct anymore.
Fixed:
- Fixed that event handlers could not be added while in an event handler.
- Prevent swap chain errors when minimizing a window.
Added:
- The
QWgpuWidget
now also supports the autogui events. - Our CI now tests the examples (including image comparisons).
Changed:
- Pointer move and wheel events are now rate-limited, leading to better performance if e.g. picking is done at each event.
Added:
- Added
wgpu.gui.base.log_exception
, a context-manager to catch and log exceptions, e.g. in event callbacks.
Fixed:
- Mouse down events were not emitted during double clicks in the Qt canvas.
- Mouse move events were not emitted no button is pressed in the Qt canvas.
Fixed:
- Position of glfw pointer events on MacOS.
Added:
- Expanded the
auto
gui backend, which can now also select qt framework if available. - The qt gui backend (like the glfw gui backend) supports user events in the same manner as the jupyter gui backend.
- Expanded the
auto
gui backend to also support an offscreen canvas intended for automated tests.
Fixed:
- Size of glfw windows on MacOS.
Fixed:
- Exceptions in user-interaction callbacks don't break the glfw loop anymore.
- Pointer events in glfw have the correct key modifiers now.
Added:
- #224 - Added
add_event_handler
andremove_event_handler
to GLFW and Jupyter GUI canvases.
Changed:
- Now targeting wgpu-native v0.11.0.1, containing many upstream fixes and improvements.
- The
[[block]]
syntax in shaders has been dropped. - Renamed
ProgrammableStage.clamp_depth
->unclipped_depth
.
Added:
- Official support for Windows 3.10.
- The
max_fps
argument can be provided to a canvas. - The glfw gui backend supports user events in the same manner as the jupyter gui backend, using the jupyter_rfb event specification.
- Introduce the
auto
gui backend, which selects either glfw or jupyter.
Fixed:
- The wx gui backend is now fully functional.
Changed:
- The qt and wx gui backend now contain
WgpuCanvas
for a toplevel window, andWgpuWidget
for an embeddable widget. - All gui backends (can) now limit the FPS.
- No changes to the wgpu API.
Fixed:
- Include the correct binaries in macOS arm64 wheels
- Options for arch argument of download-wgpu-native.py script
Added:
- Experimental support for macos_arm64 (M1).
Changed:
- The Qt examples use PySide6 instead of PyQt5.
Changed:
- Update to the latest wgpu-native (including latest Naga).
- The power-preference is actually taken into account.
- The adapter actually reports its limits.
- The limits in
request_device
are actually used. - The
Adapter.is_software
property is renamed toAdapter.is_fallback_adapter
.
Added:
- An offscreen canvas to take snapshots without needing a window.
Changed:
- On Windows, the Vulkan backend is now forced unless
WGPU_BACKEND_TYPE
is set.
Fixed:
- Better support for multiple canvases by fixing a specific Qt issue.
- Fixed that canvas was not passed to low level function of
request_adapter
. - Support calling
get_current_texture()
multiple times during a draw.
Added:
- The wgpu backend can be forced using the
WGPU_BACKEND_TYPE
env variable. Values can be e.g. "D3D12", "Metal", "Vulkan". - Initial support for off-screen canvases.
- Adds
adapter.is_software
property.
Changed:
- The
GPUPresentationContext
class has been renamed toGPUCanvasContext
. - The functionality of the swap-chain has moved to the
GPUCanvasContext
. - The now removed
GPUSwapChain
was used as a context manager. Instead, the frame is presented (ala GL swapbuffers) automatically at the end of a draw. - The
canvas.configure_swap_chain()
method has been removed. Instead,canvas.get_context()
should be used, to obtain a present/canvas context. - The
adapter.request_device()
method has its argumentsnon_guaranteed_features
andnon_guaranteed_limits
replaced withrequired_features
andrequired_limits
. - The enum field
StoreOp.clear
is nowStoreOp.discard
. - The flag field
TextureUsage.SAMPLED
is nowTextureUsage.TEXTURE_BINDING
. - The flag field
TextureUsage.STORAGE
is nowTextureUsage.STORAGE_BINDING
. - The enum
InputStepMode
is nowVertexStepMode
. - WGSL:
arrays
must be declared asvar
(notlet
) in order to allow dynamic indexing. - WGSL: storage classes are written differently.
Changed:
- 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.
Added:
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.
Fixed:
- An error in the docs of
create_render_pipeline
. - Vulkan backend is now forced to prevent DX12 being select and causing probems because it's less mature.
This release uses a new version of wgpu-native which has changed quite a bit internally. There is more validation (thus more restrictions). There are only a few changes to the API. However, one big change is that shaders can now be provided as both SpirV and WGSL. Due to the strict validation, most shaders compiled by PyShader are not usable anymore. We recommend using WGSL instead.
Added:
- Added
GPUAdapter.properties
(the amount of information it contains will increase in the future). - Added proper support for WGSL.
Changed:
- Renamed
renderpass.set_blend_color
->set_blend_constant
. - Stricter validation of SpirV shaders.
- Float32 texture formats must now use a non-filtering sampler and texture-sample-type.
- Integer texture formats can no longer use a texture (use
textureLoad
instead). - ... and more tighter restrictions.
Removed:
- The API concerning debug markers and groups is temporarily removed.
- Adapter and device features is temporarily removed.
- Adapter and device limits is temporarily removed.
This release represents about half a year of progress on the WebGPU API, so the API has changed quite a bit. The wgpu-py API more closely reflects the webgpu API - wgpu-native does not affect the API except for a few additional features.
Added:
- Added
GPUQueue.read_buffer
as extra API (next towrite_buffer
which is original WebGPU API). - Added
GPUQueue.read_texture
as extra API.
y Removed:
- Removed
GPUBuffer.read_data()
. Usedevice.queue.read_buffer()
instead. Note thatusage
MAP_READ
should be replaced withCOPY_SRC
. - Removed
GPUBuffer.write_data()
. Usedevice.queue.write_buffer()
instead. Note thatusage
MAP_WRITE
should be replaced withCOPY_DST
.
Changed:
GPUCanvasContext.get_swap_chain_preferred_format()
: now takes anadapter
instead of adevice
.GPUAdapter.extensions
: is now calledfeatures
.GPUAdapter.request_device()
: theextensions
andlimit
args are nownon_guaranteed_features
andnon_guaranteed_limits
.GPUDevice.default_queue
: is now calledqueue
.GPUDevice.create_compute_pipeline()
: thecompute_stage
arg is now calledcompute
.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()
: argsmip_level_count
andarray_layer_count
are defaultNone
instead of0
.GPUCommandEncoder.begin_render_pass()
: thecolor_attachments
anddepth_stencil_attachment
arguments have theirattachment
field renamed toview
.GPURenderEncoderBase.set_index_buffer()
has an extra argument (after the buffer) to specify the format. The index format is no longer specified indevice.create_render_pipeline()
.- Flag
TextureUsage
has field OUTPUT_ATTACHMENT renamed to RENDER_ATTACHMENT. - Enum
BindingType
is split up in different enums for buffer, sampler, sampled texture and storage texture. - Enum
BlendFactor
has some of its field names changed. - Enum
VertexFormat
has its field names changed, e.g. ushort2 -> uint16x2. - The API is more restrictive in the use of buffer/texture usage combinations.
- The API is more restrictive in formats for storage buffers/textures.
- When copying from/to textures, the
bytes_per_row
must now be a multiple of 256.
With this update we're using a later release of wgpu-native, and follow changes
is the WebGPU spec. Further, we've removed the need for ctypes to communicate
data arrays. Instead, wgpu-py can consume any object that supports the buffer
protocol, and it returns memoryview
objects.
Added:
- The texture object has more properties to query the parameters that it was created with.
- The texture view object has a
texture
property. - The render and compute pipeline objects have a property
layout
and a methodget_bind_group_layout()
. - The shader object got a
compilation_info
method, but this does not do anything yet. - The
create_shader_module()
has asource_map
attribute, but this is yet unused. - Log messages from wgpu-native (Rust) are now injected into Python's logger.
- The
queue
object got two new methodswrite_buffer
andwrite_texture
. - The buffer has
read_data()
andwrite_data()
methods. Note: the latter may be removed later. - The device
create_buffer_with_data
is added as a convenience function. This will likely stay.
Changed:
- Targets wgpu-native v.0.5.2. The first release build from the wgpu-native repo itself.
- The
array_layer
in copy operations involving a texture is removed. - The
utils.compute_with_buffers
function now accepts any data dat supports the buffer protocol (not just ctypes arrays). The outputs arememoryview
objects, which shape and format can be specified. When a ctypes array type is specified, the output will be an instance of that type. This means that these changes are fully backwards compatible.
Removed:
- The buffer (for now) no longer exposes a data mapping API. Instead use
read_data()
andwrite_data()
. - The device
create_buffer_mapped
method is similarly removed. Usecreate_buffer_with_data
instead.
Added:
- 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.- Support for debug markers.
Changed:
- Targets wgpu-native v0.5.1. This is the last release when wgpu-native was still part of wgpu-core.
- The
bindings
in bind groups and bind group layouts are now calledentries
. - There is no more generic storage texture, only a readonly and a writeonly one.
- The
set_index_buffer
andset_vertex_buffer
methods got asize
argument. - The
row_pitch
andimage_height
args in copy operations involving a texture are renamed tobytes_per_row
androws_per_image
. - Rendering is now done under the swap_chain's context:
with swap_chain as current_texture_view
This release is the first moderately mature version of wgpu-py.