Skip to content

Commit f6b877b

Browse files
committed
ruff format
1 parent 4513e7f commit f6b877b

2 files changed

Lines changed: 17 additions & 26 deletions

File tree

tests/test_wgpu_native_basics.py

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -480,43 +480,35 @@ def test_limits_are_legal():
480480
def test_limits_are_not_legal():
481481
assert not are_limits_wgpu_legal({"max-bind-group": 8})
482482

483+
483484
def test_bind_group_resources():
484485
# make sure every resource type can be created in a bind group.
485486
device = wgpu.utils.get_default_device()
486487

487488
sampler = device.create_sampler()
488489
texture1 = device.create_texture(
489490
label="texture1",
490-
size = (8, 8, 1),
491-
format = wgpu.TextureFormat.rgba8unorm,
491+
size=(8, 8, 1),
492+
format=wgpu.TextureFormat.rgba8unorm,
492493
usage=wgpu.TextureUsage.TEXTURE_BINDING | wgpu.TextureUsage.COPY_DST,
493494
)
494495
texture2 = device.create_texture(
495496
label="texture2",
496-
size = (8, 8, 1),
497-
format = wgpu.TextureFormat.rgba8unorm,
497+
size=(8, 8, 1),
498+
format=wgpu.TextureFormat.rgba8unorm,
498499
usage=wgpu.TextureUsage.TEXTURE_BINDING | wgpu.TextureUsage.COPY_DST,
499500
)
500501
texture_view = texture2.create_view()
501502

502503
buffer = device.create_buffer(
503-
size = 256,
504-
usage = wgpu.BufferUsage.UNIFORM,
504+
size=256,
505+
usage=wgpu.BufferUsage.UNIFORM,
505506
)
506507

507508
entires = [
508-
wgpu.structs.BindGroupEntry(
509-
binding=0,
510-
resource=sampler
511-
),
512-
wgpu.structs.BindGroupEntry(
513-
binding=1,
514-
resource=texture1
515-
),
516-
wgpu.structs.BindGroupEntry(
517-
binding=2,
518-
resource=texture_view
519-
),
509+
wgpu.structs.BindGroupEntry(binding=0, resource=sampler),
510+
wgpu.structs.BindGroupEntry(binding=1, resource=texture1),
511+
wgpu.structs.BindGroupEntry(binding=2, resource=texture_view),
520512
wgpu.structs.BindGroupEntry(
521513
binding=3,
522514
resource=buffer,
@@ -525,7 +517,7 @@ def test_bind_group_resources():
525517
binding=4,
526518
resource=wgpu.structs.BufferBinding(
527519
buffer=buffer,
528-
)
520+
),
529521
),
530522
# maybe external texture one day
531523
]
@@ -550,23 +542,21 @@ def test_bind_group_resources():
550542
wgpu.BindGroupLayoutEntry(
551543
binding=3,
552544
visibility=wgpu.ShaderStage.COMPUTE,
553-
buffer=wgpu.structs.BufferBindingLayout()
545+
buffer=wgpu.structs.BufferBindingLayout(),
554546
),
555547
wgpu.BindGroupLayoutEntry(
556548
binding=4,
557549
visibility=wgpu.ShaderStage.COMPUTE,
558-
buffer=wgpu.structs.BufferBindingLayout()
550+
buffer=wgpu.structs.BufferBindingLayout(),
559551
),
560552
]
561553

562554
layout = device.create_bind_group_layout(entries=layout_entries)
563555

564-
bind_group = device.create_bind_group(
565-
layout=layout,
566-
entries=entires
567-
)
556+
bind_group = device.create_bind_group(layout=layout, entries=entires)
568557

569558
assert bind_group
570559

560+
571561
if __name__ == "__main__":
572562
run_tests(globals())

wgpu/backends/wgpu_native/_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,8 @@ def create_bind_group(
17301730
)
17311731
elif isinstance(resource, (GPUTextureView, GPUTexture)):
17321732
if type(resource) is GPUTexture:
1733-
resource = resource.create_view() # also see https://github.com/pygfx/wgpu-py/issues/825
1733+
# also see https://github.com/pygfx/wgpu-py/issues/825
1734+
resource = resource.create_view()
17341735
_keep_alive.append(resource)
17351736
# H: nextInChain: WGPUChainedStruct *, binding: int, buffer: WGPUBuffer, offset: int, size: int, sampler: WGPUSampler, textureView: WGPUTextureView
17361737
c_entry = new_struct(

0 commit comments

Comments
 (0)