@@ -480,43 +480,35 @@ def test_limits_are_legal():
480480def test_limits_are_not_legal ():
481481 assert not are_limits_wgpu_legal ({"max-bind-group" : 8 })
482482
483+
483484def 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+
571561if __name__ == "__main__" :
572562 run_tests (globals ())
0 commit comments