Skip to content

Commit e6d8b46

Browse files
authored
Merge pull request #10 from pynbody/wgpu-0.15
Update for webgpu 0.15
2 parents df179a9 + 3ed2d28 commit e6d8b46

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies = [
2222
"pynbody >=1.3.0",
2323
"matplotlib >=3.6.0",
2424
"pillow >=9.5.0", # 9.5.0 needed for Image.frombytes accepting memoryview
25-
"wgpu == 0.13.0",
25+
"wgpu ~= 0.15",
2626
"jupyter_rfb >=0.4.1",
2727
"tqdm >=4.62.0",
2828
"opencv-python >=4.8.0",

src/topsy/canvas/__init__.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,22 @@ def call_later(cls, delay, fn, *args):
113113
# Note also that is_jupyter as implemented fails to distinguish correctly if we are
114114
# running inside a kernel that isn't attached to a notebook. There doesn't seem to
115115
# be any way to distinguish this, so we live with it for now.
116-
from wgpu.gui.auto import is_jupyter
116+
117+
def is_jupyter():
118+
"""Determine whether the user is executing in a Jupyter Notebook / Lab.
119+
120+
This has been pasted from an old version of wgpu.gui.auto.is_jupyter; the function was removed"""
121+
from IPython import get_ipython
122+
try:
123+
ip = get_ipython()
124+
if ip is None:
125+
return False
126+
if ip.has_trait("kernel"):
127+
return True
128+
else:
129+
return False
130+
except NameError:
131+
return False
117132

118133

119134
if is_jupyter():

src/topsy/visualizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _setup_wgpu(self):
8080
self.adapter: wgpu.GPUAdapter = wgpu.gpu.request_adapter(power_preference="high-performance")
8181
if self.device is None:
8282
type(self).device: wgpu.GPUDevice = self.adapter.request_device(
83-
required_features=["TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES"])
83+
required_features=["TextureAdapterSpecificFormatFeatures", "float32-filterable"])
8484
self.context: wgpu.GPUCanvasContext = self.canvas.get_context()
8585
self.canvas_format = self.context.get_preferred_format(self.adapter)
8686
if self.canvas_format.endswith("-srgb"):

0 commit comments

Comments
 (0)