Skip to content

Commit b66df50

Browse files
authored
Disable checking supported textures for getting preferred format (#342)
1 parent fc8436d commit b66df50

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

wgpu/backends/rs.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -551,26 +551,27 @@ def get_preferred_format(self, adapter):
551551
canvas = self._get_canvas()
552552
self._surface_id = get_surface_id_from_canvas(canvas)
553553

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 = []
574575

575576
# Select one
576577
default = "bgra8unorm-srgb" # seems to be a good default

wgpu/resources/codegen_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
* Enum AutoLayoutMode missing in wgpu.h
2727
* Enum CanvasAlphaMode missing in wgpu.h
2828
* Wrote 231 enum mappings and 49 struct-field mappings to rs_mappings.py
29-
* Validated 94 C function calls
30-
* Not using 89 C functions
29+
* Validated 92 C function calls
30+
* Not using 90 C functions
3131
* Validated 73 C structs

0 commit comments

Comments
 (0)