@@ -551,26 +551,27 @@ def get_preferred_format(self, adapter):
551
551
canvas = self ._get_canvas ()
552
552
self ._surface_id = get_surface_id_from_canvas (canvas )
553
553
554
- # The C-call
555
- c_count = ffi .new ("size_t *" )
556
- # H: WGPUTextureFormat const * f(WGPUSurface surface, WGPUAdapter adapter, size_t * count)
557
- c_formats = lib .wgpuSurfaceGetSupportedFormats (
558
- self ._surface_id , adapter ._internal , c_count
559
- )
560
-
561
- # Convert to string formats
562
- try :
563
- count = c_count [0 ]
564
- supported_format_ints = [c_formats [i ] for i in range (count )]
565
- formats = []
566
- for key in list (enums .TextureFormat ):
567
- i = enummap [f"TextureFormat.{ key } " ]
568
- if i in supported_format_ints :
569
- formats .append (key )
570
- finally :
571
- t = ffi .typeof (c_formats )
572
- # H: void f(void* ptr, size_t size, size_t align)
573
- lib .wgpuFree (c_formats , count * ffi .sizeof (t ), ffi .alignof (t ))
554
+ # # The C-call
555
+ # c_count = ffi.new("size_t *")
556
+ # c_formats = libxx.wgpuSurfaceGetSupportedFormats(
557
+ # self._surface_id, adapter._internal, c_count
558
+ # )
559
+ #
560
+ # # Convert to string formats
561
+ # try:
562
+ # count = c_count[0]
563
+ # supported_format_ints = [c_formats[i] for i in range(count)]
564
+ # formats = []
565
+ # for key in list(enums.TextureFormat):
566
+ # i = enummap[f"TextureFormat.{key}"]
567
+ # if i in supported_format_ints:
568
+ # formats.append(key)
569
+ # finally:
570
+ # t = ffi.typeof(c_formats)
571
+ # libxx.wgpuFree(c_formats, count * ffi.sizeof(t), ffi.alignof(t))
572
+
573
+ # There appears to be a bug in wgpuSurfaceGetSupportedFormats, see #341 - disabled it for now.
574
+ formats = []
574
575
575
576
# Select one
576
577
default = "bgra8unorm-srgb" # seems to be a good default
0 commit comments