canvas.handle_event()could no longer be overloaded to handle move and wheel events.
To update, you need to adjust to the following API changes:
end_pass()are renamed to
load_valueis replaced with
device.create_sampler()method for mipmap filtering now uses the
MipmapFilterModeenum instead of the
FilterModeenum. 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:
,to separate fields instead of
elseifkeyword is now
QWgpuWidgetnow also supports the autogui events.
wgpu.gui.base.log_exception, a context-manager to catch and log exceptions, e.g. in event callbacks.
autogui backend, which can now also select qt framework if available.
autogui backend to also support an offscreen canvas intended for automated tests.
remove_event_handlerto GLFW and Jupyter GUI canvases.
[[block]]syntax in shaders has been dropped.
max_fpsargument can be provided to a canvas.
autogui backend, which selects either glfw or jupyter.
WgpuCanvasfor a toplevel window, and
WgpuWidgetfor an embeddable widget.
request_deviceare actually used.
Adapter.is_softwareproperty is renamed to
get_current_texture()multiple times during a draw.
WGPU_BACKEND_TYPEenv variable. Values can be e.g. "D3D12", "Metal", "Vulkan".
GPUPresentationContextclass has been renamed to
GPUSwapChainwas used as a context manager. Instead, the frame is presented (ala GL swapbuffers) automatically at the end of a draw.
canvas.configure_swap_chain()method has been removed. Instead,
canvas.get_context()should be used, to obtain a present/canvas context.
adapter.request_device()method has its arguments
arraysmust be declared as
let) in order to allow dynamic indexing.
WGPU_BACKEND_TYPEevironment variable can be set to e.g. "Vulkan". It could be good to do this on Windows to prevent selection of DX12 for now.
adapter.propertiesnow has actual values, allowing inspeciton of the selected GPU and backend.
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.
GPUAdaper.properties(the amount of information it contains will increase in the future).
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.
GPUQueue.read_bufferas extra API (next to
write_bufferwhich is original WebGPU API).
GPUQueue.read_textureas extra API.
device.queue.read_buffer()instead. Note that
MAP_READshould be replaced with
device.queue.write_buffer()instead. Note that
MAP_WRITEshould be replaced with
GPUCanvasContext.get_swap_chain_preferred_format(): now takes an
adapterinstead of a
GPUAdapter.extensions: is now called
limitargs are now
GPUDevice.default_queue: is now called
compute_stagearg is now called
GPUDevice.create_bind_group_layout()has changed the required structure of the layout enty dicts.
GPUDevice.create_render_pipeline()has changed a lot in terms of shape of input dicts. See new docs.
depth_stencil_attachmentarguments have their
attachmentfield renamed to
GPURenderEncoderBase.set_index_buffer()has an extra argument (after the buffer) to specify the format. The index format is no longer specified in
TextureUsagehas field OUTPUT_ATTACHMENT renamed to RENDER_ATTACHMENT.
BindingTypeis split up in different enums for buffer, sampler, sampled texture and storage texture.
BlendFactorhas some of its field names changed.
VertexFormathas its field names changed, e.g. ushort2 -> uint16x2.
bytes_per_rowmust 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
layoutand a method
compilation_infomethod, but this does not do anything yet.
source_mapattribute, but this is yet unused.
queueobject got two new methods
write_data()methods. Note: the latter may be removed later.
create_buffer_with_datais added as a convenience function. This will likely stay.
array_layerin copy operations involving a texture is removed.
utils.compute_with_buffersfunction now accepts any data dat supports the buffer protocol (not just ctypes arrays). The outputs are
memoryviewobjects, 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.
create_buffer_mappedmethod is similarly removed. Use
request_adapterso that the created surface can be selected on it.
bindingsin bind groups and bind group layouts are now called
set_vertex_buffermethods got a
image_heightargs in copy operations involving a texture are renamed to
with swap_chain as current_texture_view
This release is the first moderately mature version of wgpu-py.