Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
allow setting texture usage directly
  • Loading branch information
kushalkolar committed Apr 25, 2026
commit dd733e6d342caa0afda5f642fd155e690fbb86df
5 changes: 4 additions & 1 deletion fastplotlib/graphics/features/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def __init__(
data,
property_name: str = "data",
cpu_buffer: bool = True,
usage: wgpu.TextureUsage = 0,
colorspace: ColorspacesRGB = ColorspacesRGB.srgb,
):
super().__init__(property_name=property_name)
Expand All @@ -60,9 +61,10 @@ def __init__(
# create a local buffer
self._value = np.empty(data.shape, dtype=data.dtype)
self.value[:] = data[:]
usage = usage
else:
self._value = None
usage = wgpu.TextureUsage.COPY_DST
usage = wgpu.TextureUsage.COPY_DST | usage
# auto-determine format, adapted from pygfx.Texture
element_format = get_element_format_from_numpy_array(data)
if element_format is None:
Expand Down Expand Up @@ -106,6 +108,7 @@ def __init__(
self.value[slicer],
dim=2,
colorspace=colorspace,
usage=usage
)
else:
# we only supply the size
Expand Down