diff --git a/CHANGELOG.md b/CHANGELOG.md index 4208e669..843d127d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,14 @@ Possible sections in each release: * Security: in case of vulnerabilities. +### [v0.7.0] - TBD + +Changed: + +* Now targeting wgpu-native v0.11.0.1, containing many upstream fixes and improvements. +* The `[[block]]` syntax in shaders has been dropped. + + ### [v0.6.0] - 16-12-2021 Added: diff --git a/examples/compute_noop.py b/examples/compute_noop.py index d8b20337..57b6b266 100644 --- a/examples/compute_noop.py +++ b/examples/compute_noop.py @@ -12,7 +12,6 @@ shader_source = """ -[[block]] struct DataContainer { data: [[stride(4)]] array; }; diff --git a/examples/cube.py b/examples/cube.py index 79758bfe..66bc9095 100644 --- a/examples/cube.py +++ b/examples/cube.py @@ -147,7 +147,6 @@ shader_source = """ -[[block]] struct Locals { transform: mat4x4; }; diff --git a/tests/test_compute.py b/tests/test_compute.py index 40b89454..109e0f24 100644 --- a/tests/test_compute.py +++ b/tests/test_compute.py @@ -16,7 +16,6 @@ simple_compute_shader = """ - [[block]] struct DataContainer { data: [[stride(4)]] array; }; [[group(0), binding(0)]] @@ -120,7 +119,6 @@ def test_compute_0_1_spirv(): def test_compute_1_3(): compute_shader = """ - [[block]] struct DataContainer { data: [[stride(4)]] array; }; [[group(0), binding(0)]] @@ -156,7 +154,6 @@ def test_compute_1_3(): def test_compute_indirect(): compute_shader = """ - [[block]] struct DataContainer { data: [[stride(4)]] array; }; [[group(0), binding(0)]] @@ -263,7 +260,6 @@ def test_compute_indirect(): def test_compute_fails(): compute_shader = """ - [[block]] struct DataContainer { data: [[stride(4)]] array; }; [[group(0), binding(0)]] diff --git a/tests/test_gui_glfw.py b/tests/test_gui_glfw.py index d8bd4b5d..dcaf7c17 100644 --- a/tests/test_gui_glfw.py +++ b/tests/test_gui_glfw.py @@ -6,6 +6,7 @@ import os import sys import time +import asyncio import wgpu.backends.rs # noqa from pytest import skip @@ -38,7 +39,9 @@ def test_glfw_canvas_basics(): canvas = WgpuCanvas() canvas.set_logical_size(300, 200) - glfw.poll_events() + etime = time.time() + 0.1 + while time.time() < etime: + glfw.poll_events() lsize = canvas.get_logical_size() assert isinstance(lsize, tuple) and len(lsize) == 2 assert isinstance(lsize[0], float) and isinstance(lsize[1], float) @@ -76,7 +79,9 @@ def test_glfw_canvas_render(): import glfw from wgpu.gui.glfw import update_glfw_canvasses, WgpuCanvas - canvas = WgpuCanvas() + loop = asyncio.get_event_loop() + + canvas = WgpuCanvas(max_fps=9999) # wgpu.utils.get_default_device() adapter = wgpu.request_adapter(canvas=canvas, power_preference="high-performance") @@ -93,9 +98,13 @@ def draw_frame2(): canvas.request_draw(draw_frame2) # Give it a few rounds to start up - for i in range(5): - glfw.poll_events() - update_glfw_canvasses() + async def miniloop(): + for i in range(10): + glfw.poll_events() + update_glfw_canvasses() + await asyncio.sleep(0.01) + + loop.run_until_complete(miniloop()) # There should have been exactly one draw now assert frame_counter == 1 @@ -103,20 +112,15 @@ def draw_frame2(): for i in range(5): canvas.request_draw() # Process evens for a while - for i in range(5): - glfw.poll_events() - update_glfw_canvasses() + loop.run_until_complete(miniloop()) # We should have had just one draw assert frame_counter == 2 # Change the canvase size canvas.set_logical_size(300, 200) canvas.set_logical_size(400, 300) - for i in range(5): - time.sleep(0.01) - glfw.poll_events() - update_glfw_canvasses() # We should have had just one draw + loop.run_until_complete(miniloop()) assert frame_counter == 3 # canvas.close() diff --git a/tests/test_rs_basics.py b/tests/test_rs_basics.py index 23abeca4..4f633c96 100644 --- a/tests/test_rs_basics.py +++ b/tests/test_rs_basics.py @@ -79,7 +79,6 @@ def test_tuple_from_tuple_or_dict(): compute_shader_wgsl = """ -[[block]] struct ArrayContainer { data: [[stride(4)]] array; }; [[group(0), binding(0)]] diff --git a/wgpu/backends/rs.py b/wgpu/backends/rs.py index eb6c2fde..98cee223 100644 --- a/wgpu/backends/rs.py +++ b/wgpu/backends/rs.py @@ -56,8 +56,8 @@ apidiff = ApiDiff() # The wgpu-native version that we target/expect -__version__ = "0.10.4.1" -__commit_sha__ = "b4dd62d1781c923ae0b52195fb9e710a7fc6b177" +__version__ = "0.11.0.1" +__commit_sha__ = "9d962ef667ef6006cca7bac7489d5bf303a2a244" version_info = tuple(map(int, __version__.split("."))) check_expected_version(version_info) # produces a warning on mismatch @@ -445,10 +445,10 @@ def _request_device(self, label, features, required_limits, trace_path): # H: chain: WGPUChainedStruct, nativeFeatures: WGPUNativeFeature, label: char*, tracePath: char* extras = new_struct_p( "WGPUDeviceExtras *", - label=to_c_label(label), tracePath=c_trace_path, nativeFeatures=lib.WGPUNativeFeature_TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES, # not used: chain + # not used: label ) extras.chain.sType = lib.WGPUSType_DeviceExtras @@ -464,9 +464,10 @@ def _request_device(self, label, features, required_limits, trace_path): for key, val in required_limits.items(): setattr(c_limits, to_camel_case(key), val) - # H: nextInChain: WGPUChainedStruct *, requiredFeaturesCount: int, requiredFeatures: WGPUFeatureName *, requiredLimits: WGPURequiredLimits * + # H: nextInChain: WGPUChainedStruct *, label: char *, requiredFeaturesCount: int, requiredFeatures: WGPUFeatureName *, requiredLimits: WGPURequiredLimits * struct = new_struct_p( "WGPUDeviceDescriptor *", + label=to_c_label(label), nextInChain=ffi.cast("WGPUChainedStruct * ", extras), requiredFeaturesCount=0, requiredFeatures=ffi.new("WGPUFeatureName []", []), @@ -848,10 +849,10 @@ def create_shader_module(self, *, label="", code: str, source_map: dict = None): if isinstance(code, str): # WGSL - # H: chain: WGPUChainedStruct, source: char * + # H: chain: WGPUChainedStruct, code: char * source_struct = new_struct_p( "WGPUShaderModuleWGSLDescriptor *", - source=ffi.new("char []", code.encode()), + code=ffi.new("char []", code.encode()), # not used: chain ) source_struct[0].chain.next = ffi.NULL @@ -1422,11 +1423,13 @@ def _destroy(self): class GPUCommandEncoder(base.GPUCommandEncoder, GPUObjectBase): def begin_compute_pass(self, *, label=""): - # H: nextInChain: WGPUChainedStruct *, label: char * + # H: nextInChain: WGPUChainedStruct *, label: char *, timestampWriteCount: int, timestampWrites: WGPUComputePassTimestampWrite * struct = new_struct_p( "WGPUComputePassDescriptor *", label=to_c_label(label), # not used: nextInChain + # not used: timestampWriteCount + # not used: timestampWrites ) # H: WGPUComputePassEncoder f(WGPUCommandEncoder commandEncoder, WGPUComputePassDescriptor const * descriptor) raw_pass = lib.wgpuCommandEncoderBeginComputePass(self._internal, struct) @@ -1508,7 +1511,7 @@ def begin_render_pass( ), ) - # H: nextInChain: WGPUChainedStruct *, label: char *, colorAttachmentCount: int, colorAttachments: WGPURenderPassColorAttachment *, depthStencilAttachment: WGPURenderPassDepthStencilAttachment *, occlusionQuerySet: WGPUQuerySet + # H: nextInChain: WGPUChainedStruct *, label: char *, colorAttachmentCount: int, colorAttachments: WGPURenderPassColorAttachment *, depthStencilAttachment: WGPURenderPassDepthStencilAttachment *, occlusionQuerySet: WGPUQuerySet, timestampWriteCount: int, timestampWrites: WGPURenderPassTimestampWrite * struct = new_struct_p( "WGPURenderPassDescriptor *", label=to_c_label(label), @@ -1517,6 +1520,8 @@ def begin_render_pass( depthStencilAttachment=c_depth_stencil_attachment, # not used: occlusionQuerySet # not used: nextInChain + # not used: timestampWriteCount + # not used: timestampWrites ) # H: WGPURenderPassEncoder f(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) diff --git a/wgpu/backends/rs_mappings.py b/wgpu/backends/rs_mappings.py index 411c2967..0ee52532 100644 --- a/wgpu/backends/rs_mappings.py +++ b/wgpu/backends/rs_mappings.py @@ -4,7 +4,7 @@ # flake8: noqa -# There are 187 enum mappings +# There are 188 enum mappings enummap = { "AddressMode.clamp-to-edge": 2, @@ -48,7 +48,6 @@ "DeviceLostReason.destroyed": 1, "ErrorFilter.out-of-memory": 2, "ErrorFilter.validation": 1, - "FeatureName.depth-clamping": 1, "FeatureName.depth24unorm-stencil8": 2, "FeatureName.depth32float-stencil8": 3, "FeatureName.pipeline-statistics-query": 5, @@ -66,8 +65,8 @@ "PipelineStatisticName.compute-shader-invocations": 4, "PipelineStatisticName.fragment-shader-invocations": 3, "PipelineStatisticName.vertex-shader-invocations": 0, - "PowerPreference.high-performance": 1, - "PowerPreference.low-power": 0, + "PowerPreference.high-performance": 2, + "PowerPreference.low-power": 1, "PrimitiveTopology.line-list": 1, "PrimitiveTopology.line-strip": 2, "PrimitiveTopology.point-list": 0, @@ -96,26 +95,28 @@ "TextureDimension.1d": 0, "TextureDimension.2d": 1, "TextureDimension.3d": 2, - "TextureFormat.bc1-rgba-unorm": 42, - "TextureFormat.bc1-rgba-unorm-srgb": 43, - "TextureFormat.bc2-rgba-unorm": 44, - "TextureFormat.bc2-rgba-unorm-srgb": 45, - "TextureFormat.bc3-rgba-unorm": 46, - "TextureFormat.bc3-rgba-unorm-srgb": 47, - "TextureFormat.bc4-r-snorm": 49, - "TextureFormat.bc4-r-unorm": 48, - "TextureFormat.bc5-rg-snorm": 51, - "TextureFormat.bc5-rg-unorm": 50, - "TextureFormat.bc6h-rgb-float": 53, - "TextureFormat.bc6h-rgb-ufloat": 52, - "TextureFormat.bc7-rgba-unorm": 54, - "TextureFormat.bc7-rgba-unorm-srgb": 55, + "TextureFormat.bc1-rgba-unorm": 44, + "TextureFormat.bc1-rgba-unorm-srgb": 45, + "TextureFormat.bc2-rgba-unorm": 46, + "TextureFormat.bc2-rgba-unorm-srgb": 47, + "TextureFormat.bc3-rgba-unorm": 48, + "TextureFormat.bc3-rgba-unorm-srgb": 49, + "TextureFormat.bc4-r-snorm": 51, + "TextureFormat.bc4-r-unorm": 50, + "TextureFormat.bc5-rg-snorm": 53, + "TextureFormat.bc5-rg-unorm": 52, + "TextureFormat.bc6h-rgb-float": 55, + "TextureFormat.bc6h-rgb-ufloat": 54, + "TextureFormat.bc7-rgba-unorm": 56, + "TextureFormat.bc7-rgba-unorm-srgb": 57, "TextureFormat.bgra8unorm": 23, "TextureFormat.bgra8unorm-srgb": 24, "TextureFormat.depth16unorm": 38, "TextureFormat.depth24plus": 39, "TextureFormat.depth24plus-stencil8": 40, - "TextureFormat.depth32float": 41, + "TextureFormat.depth24unorm-stencil8": 41, + "TextureFormat.depth32float": 42, + "TextureFormat.depth32float-stencil8": 43, "TextureFormat.r16float": 7, "TextureFormat.r16sint": 6, "TextureFormat.r16uint": 5, diff --git a/wgpu/resources/codegen_report.md b/wgpu/resources/codegen_report.md index a93ad773..1aff6f32 100644 --- a/wgpu/resources/codegen_report.md +++ b/wgpu/resources/codegen_report.md @@ -2,8 +2,8 @@ ## Preparing * The webgpu.idl defines 33 classes with 83 functions * The webgpu.idl defines 5 flags, 31 enums, 54 structs -* The wgpu.h defines 128 functions -* The wgpu.h defines 5 flags, 43 enums, 67 structs +* The wgpu.h defines 131 functions +* The wgpu.h defines 5 flags, 46 enums, 69 structs ## Updating API * Wrote 5 flags to flags.py * Wrote 31 enums to enums.py @@ -25,10 +25,9 @@ * Validated 33 classes, 95 methods, 0 properties ## Validating rs.py * Enum PredefinedColorSpace missing in wgpu.h -* Enum field TextureFormat.depth24unorm-stencil8 missing in wgpu.h -* Enum field TextureFormat.depth32float-stencil8 missing in wgpu.h +* Enum field FeatureName.depth-clamping missing in wgpu.h * Enum CanvasCompositingAlphaMode missing in wgpu.h -* Wrote 187 enum mappings and 47 struct-field mappings to rs_mappings.py +* Wrote 188 enum mappings and 47 struct-field mappings to rs_mappings.py * Validated 79 C function calls -* Not using 54 C functions +* Not using 57 C functions * Validated 69 C structs diff --git a/wgpu/resources/webgpu.h b/wgpu/resources/webgpu.h index 5afb3832..b63b85dd 100644 --- a/wgpu/resources/webgpu.h +++ b/wgpu/resources/webgpu.h @@ -53,6 +53,7 @@ #include #define WGPU_WHOLE_SIZE (0xffffffffffffffffULL) +#define WGPU_WHOLE_MAP_SIZE SIZE_MAX #define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL) #define WGPU_LIMIT_U32_UNDEFINED (0xffffffffUL) #define WGPU_LIMIT_U64_UNDEFINED (0xffffffffffffffffULL) @@ -169,6 +170,14 @@ typedef enum WGPUCompareFunction { WGPUCompareFunction_Force32 = 0x7FFFFFFF } WGPUCompareFunction; +typedef enum WGPUCompilationInfoRequestStatus { + WGPUCompilationInfoRequestStatus_Success = 0x00000000, + WGPUCompilationInfoRequestStatus_Error = 0x00000001, + WGPUCompilationInfoRequestStatus_DeviceLost = 0x00000002, + WGPUCompilationInfoRequestStatus_Unknown = 0x00000003, + WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF +} WGPUCompilationInfoRequestStatus; + typedef enum WGPUCompilationMessageType { WGPUCompilationMessageType_Error = 0x00000000, WGPUCompilationMessageType_Warning = 0x00000001, @@ -176,6 +185,12 @@ typedef enum WGPUCompilationMessageType { WGPUCompilationMessageType_Force32 = 0x7FFFFFFF } WGPUCompilationMessageType; +typedef enum WGPUComputePassTimestampLocation { + WGPUComputePassTimestampLocation_Beginning = 0x00000000, + WGPUComputePassTimestampLocation_End = 0x00000001, + WGPUComputePassTimestampLocation_Force32 = 0x7FFFFFFF +} WGPUComputePassTimestampLocation; + typedef enum WGPUCreatePipelineAsyncStatus { WGPUCreatePipelineAsyncStatus_Success = 0x00000000, WGPUCreatePipelineAsyncStatus_Error = 0x00000001, @@ -216,12 +231,15 @@ typedef enum WGPUErrorType { typedef enum WGPUFeatureName { WGPUFeatureName_Undefined = 0x00000000, - WGPUFeatureName_DepthClamping = 0x00000001, + WGPUFeatureName_DepthClipControl = 0x00000001, WGPUFeatureName_Depth24UnormStencil8 = 0x00000002, WGPUFeatureName_Depth32FloatStencil8 = 0x00000003, WGPUFeatureName_TimestampQuery = 0x00000004, WGPUFeatureName_PipelineStatisticsQuery = 0x00000005, WGPUFeatureName_TextureCompressionBC = 0x00000006, + WGPUFeatureName_TextureCompressionETC2 = 0x00000007, + WGPUFeatureName_TextureCompressionASTC = 0x00000008, + WGPUFeatureName_IndirectFirstInstance = 0x00000009, WGPUFeatureName_Force32 = 0x7FFFFFFF } WGPUFeatureName; @@ -260,8 +278,9 @@ typedef enum WGPUPipelineStatisticName { } WGPUPipelineStatisticName; typedef enum WGPUPowerPreference { - WGPUPowerPreference_LowPower = 0x00000000, - WGPUPowerPreference_HighPerformance = 0x00000001, + WGPUPowerPreference_Undefined = 0x00000000, + WGPUPowerPreference_LowPower = 0x00000001, + WGPUPowerPreference_HighPerformance = 0x00000002, WGPUPowerPreference_Force32 = 0x7FFFFFFF } WGPUPowerPreference; @@ -296,6 +315,12 @@ typedef enum WGPUQueueWorkDoneStatus { WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF } WGPUQueueWorkDoneStatus; +typedef enum WGPURenderPassTimestampLocation { + WGPURenderPassTimestampLocation_Beginning = 0x00000000, + WGPURenderPassTimestampLocation_End = 0x00000001, + WGPURenderPassTimestampLocation_Force32 = 0x7FFFFFFF +} WGPURenderPassTimestampLocation; + typedef enum WGPURequestAdapterStatus { WGPURequestAdapterStatus_Success = 0x00000000, WGPURequestAdapterStatus_Unavailable = 0x00000001, @@ -319,7 +344,7 @@ typedef enum WGPUSType { WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004, WGPUSType_ShaderModuleSPIRVDescriptor = 0x00000005, WGPUSType_ShaderModuleWGSLDescriptor = 0x00000006, - WGPUSType_PrimitiveDepthClampingState = 0x00000007, + WGPUSType_PrimitiveDepthClipControl = 0x00000007, WGPUSType_Force32 = 0x7FFFFFFF } WGPUSType; @@ -419,21 +444,61 @@ typedef enum WGPUTextureFormat { WGPUTextureFormat_Depth16Unorm = 0x00000026, WGPUTextureFormat_Depth24Plus = 0x00000027, WGPUTextureFormat_Depth24PlusStencil8 = 0x00000028, - WGPUTextureFormat_Depth32Float = 0x00000029, - WGPUTextureFormat_BC1RGBAUnorm = 0x0000002A, - WGPUTextureFormat_BC1RGBAUnormSrgb = 0x0000002B, - WGPUTextureFormat_BC2RGBAUnorm = 0x0000002C, - WGPUTextureFormat_BC2RGBAUnormSrgb = 0x0000002D, - WGPUTextureFormat_BC3RGBAUnorm = 0x0000002E, - WGPUTextureFormat_BC3RGBAUnormSrgb = 0x0000002F, - WGPUTextureFormat_BC4RUnorm = 0x00000030, - WGPUTextureFormat_BC4RSnorm = 0x00000031, - WGPUTextureFormat_BC5RGUnorm = 0x00000032, - WGPUTextureFormat_BC5RGSnorm = 0x00000033, - WGPUTextureFormat_BC6HRGBUfloat = 0x00000034, - WGPUTextureFormat_BC6HRGBFloat = 0x00000035, - WGPUTextureFormat_BC7RGBAUnorm = 0x00000036, - WGPUTextureFormat_BC7RGBAUnormSrgb = 0x00000037, + WGPUTextureFormat_Depth24UnormStencil8 = 0x00000029, + WGPUTextureFormat_Depth32Float = 0x0000002A, + WGPUTextureFormat_Depth32FloatStencil8 = 0x0000002B, + WGPUTextureFormat_BC1RGBAUnorm = 0x0000002C, + WGPUTextureFormat_BC1RGBAUnormSrgb = 0x0000002D, + WGPUTextureFormat_BC2RGBAUnorm = 0x0000002E, + WGPUTextureFormat_BC2RGBAUnormSrgb = 0x0000002F, + WGPUTextureFormat_BC3RGBAUnorm = 0x00000030, + WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000031, + WGPUTextureFormat_BC4RUnorm = 0x00000032, + WGPUTextureFormat_BC4RSnorm = 0x00000033, + WGPUTextureFormat_BC5RGUnorm = 0x00000034, + WGPUTextureFormat_BC5RGSnorm = 0x00000035, + WGPUTextureFormat_BC6HRGBUfloat = 0x00000036, + WGPUTextureFormat_BC6HRGBFloat = 0x00000037, + WGPUTextureFormat_BC7RGBAUnorm = 0x00000038, + WGPUTextureFormat_BC7RGBAUnormSrgb = 0x00000039, + WGPUTextureFormat_ETC2RGB8Unorm = 0x0000003A, + WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x0000003B, + WGPUTextureFormat_ETC2RGB8A1Unorm = 0x0000003C, + WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x0000003D, + WGPUTextureFormat_ETC2RGBA8Unorm = 0x0000003E, + WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x0000003F, + WGPUTextureFormat_EACR11Unorm = 0x00000040, + WGPUTextureFormat_EACR11Snorm = 0x00000041, + WGPUTextureFormat_EACRG11Unorm = 0x00000042, + WGPUTextureFormat_EACRG11Snorm = 0x00000043, + WGPUTextureFormat_ASTC4x4Unorm = 0x00000044, + WGPUTextureFormat_ASTC4x4UnormSrgb = 0x00000045, + WGPUTextureFormat_ASTC5x4Unorm = 0x00000046, + WGPUTextureFormat_ASTC5x4UnormSrgb = 0x00000047, + WGPUTextureFormat_ASTC5x5Unorm = 0x00000048, + WGPUTextureFormat_ASTC5x5UnormSrgb = 0x00000049, + WGPUTextureFormat_ASTC6x5Unorm = 0x0000004A, + WGPUTextureFormat_ASTC6x5UnormSrgb = 0x0000004B, + WGPUTextureFormat_ASTC6x6Unorm = 0x0000004C, + WGPUTextureFormat_ASTC6x6UnormSrgb = 0x0000004D, + WGPUTextureFormat_ASTC8x5Unorm = 0x0000004E, + WGPUTextureFormat_ASTC8x5UnormSrgb = 0x0000004F, + WGPUTextureFormat_ASTC8x6Unorm = 0x00000050, + WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000051, + WGPUTextureFormat_ASTC8x8Unorm = 0x00000052, + WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000053, + WGPUTextureFormat_ASTC10x5Unorm = 0x00000054, + WGPUTextureFormat_ASTC10x5UnormSrgb = 0x00000055, + WGPUTextureFormat_ASTC10x6Unorm = 0x00000056, + WGPUTextureFormat_ASTC10x6UnormSrgb = 0x00000057, + WGPUTextureFormat_ASTC10x8Unorm = 0x00000058, + WGPUTextureFormat_ASTC10x8UnormSrgb = 0x00000059, + WGPUTextureFormat_ASTC10x10Unorm = 0x0000005A, + WGPUTextureFormat_ASTC10x10UnormSrgb = 0x0000005B, + WGPUTextureFormat_ASTC12x10Unorm = 0x0000005C, + WGPUTextureFormat_ASTC12x10UnormSrgb = 0x0000005D, + WGPUTextureFormat_ASTC12x12Unorm = 0x0000005E, + WGPUTextureFormat_ASTC12x12UnormSrgb = 0x0000005F, WGPUTextureFormat_Force32 = 0x7FFFFFFF } WGPUTextureFormat; @@ -632,10 +697,11 @@ typedef struct WGPUCompilationMessage { uint64_t length; } WGPUCompilationMessage; -typedef struct WGPUComputePassDescriptor { - WGPUChainedStruct const * nextInChain; - char const * label; -} WGPUComputePassDescriptor; +typedef struct WGPUComputePassTimestampWrite { + WGPUQuerySet querySet; + uint32_t queryIndex; + WGPUComputePassTimestampLocation location; +} WGPUComputePassTimestampWrite; typedef struct WGPUConstantEntry { WGPUChainedStruct const * nextInChain; @@ -702,10 +768,10 @@ typedef struct WGPUPipelineLayoutDescriptor { WGPUBindGroupLayout const * bindGroupLayouts; } WGPUPipelineLayoutDescriptor; -typedef struct WGPUPrimitiveDepthClampingState { +typedef struct WGPUPrimitiveDepthClipControl { WGPUChainedStruct chain; - bool clampDepth; -} WGPUPrimitiveDepthClampingState; + bool unclippedDepth; +} WGPUPrimitiveDepthClipControl; typedef struct WGPUPrimitiveState { WGPUChainedStruct const * nextInChain; @@ -736,6 +802,8 @@ typedef struct WGPURenderBundleEncoderDescriptor { WGPUTextureFormat const * colorFormats; WGPUTextureFormat depthStencilFormat; uint32_t sampleCount; + bool depthReadOnly; + bool stencilReadOnly; } WGPURenderBundleEncoderDescriptor; typedef struct WGPURenderPassDepthStencilAttachment { @@ -750,6 +818,12 @@ typedef struct WGPURenderPassDepthStencilAttachment { bool stencilReadOnly; } WGPURenderPassDepthStencilAttachment; +typedef struct WGPURenderPassTimestampWrite { + WGPUQuerySet querySet; + uint32_t queryIndex; + WGPURenderPassTimestampLocation location; +} WGPURenderPassTimestampWrite; + typedef struct WGPURequestAdapterOptions { WGPUChainedStruct const * nextInChain; WGPUSurface compatibleSurface; @@ -790,7 +864,7 @@ typedef struct WGPUShaderModuleSPIRVDescriptor { typedef struct WGPUShaderModuleWGSLDescriptor { WGPUChainedStruct chain; - char const * source; + char const * code; } WGPUShaderModuleWGSLDescriptor; typedef struct WGPUStencilFaceState { @@ -905,6 +979,13 @@ typedef struct WGPUCompilationInfo { WGPUCompilationMessage const * messages; } WGPUCompilationInfo; +typedef struct WGPUComputePassDescriptor { + WGPUChainedStruct const * nextInChain; + char const * label; + uint32_t timestampWriteCount; + WGPUComputePassTimestampWrite const * timestampWrites; +} WGPUComputePassDescriptor; + typedef struct WGPUDepthStencilState { WGPUChainedStruct const * nextInChain; WGPUTextureFormat format; @@ -1000,6 +1081,7 @@ typedef struct WGPUComputePipelineDescriptor { typedef struct WGPUDeviceDescriptor { WGPUChainedStruct const * nextInChain; + char const * label; uint32_t requiredFeaturesCount; WGPUFeatureName const * requiredFeatures; WGPURequiredLimits const * requiredLimits; @@ -1012,6 +1094,8 @@ typedef struct WGPURenderPassDescriptor { WGPURenderPassColorAttachment const * colorAttachments; WGPURenderPassDepthStencilAttachment const * depthStencilAttachment; WGPUQuerySet occlusionQuerySet; + uint32_t timestampWriteCount; + WGPURenderPassTimestampWrite const * timestampWrites; } WGPURenderPassDescriptor; typedef struct WGPUVertexState { @@ -1050,6 +1134,7 @@ extern "C" { #endif typedef void (*WGPUBufferMapCallback)(WGPUBufferMapAsyncStatus status, void * userdata); +typedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus status, WGPUCompilationInfo const * compilationInfo, void * userdata); typedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, char const * message, void * userdata); typedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, char const * message, void * userdata); typedef void (*WGPUDeviceLostCallback)(WGPUDeviceLostReason reason, char const * message, void * userdata); @@ -1066,6 +1151,7 @@ typedef WGPUInstance (*WGPUProcCreateInstance)(WGPUInstanceDescriptor const * de typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice device, char const * procName); // Procs of Adapter +typedef uint32_t (*WGPUProcAdapterEnumerateFeatures)(WGPUAdapter adapter, WGPUFeatureName* features); typedef bool (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPUSupportedLimits * limits); typedef void (*WGPUProcAdapterGetProperties)(WGPUAdapter adapter, WGPUAdapterProperties * properties); typedef bool (*WGPUProcAdapterHasFeature)(WGPUAdapter adapter, WGPUFeatureName feature); @@ -1085,6 +1171,7 @@ typedef void (*WGPUProcCommandEncoderCopyBufferToBuffer)(WGPUCommandEncoder comm typedef void (*WGPUProcCommandEncoderCopyBufferToTexture)(WGPUCommandEncoder commandEncoder, WGPUImageCopyBuffer const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize); typedef void (*WGPUProcCommandEncoderCopyTextureToBuffer)(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyBuffer const * destination, WGPUExtent3D const * copySize); typedef void (*WGPUProcCommandEncoderCopyTextureToTexture)(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize); +typedef void (*WGPUProcCommandEncoderFillBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size, uint8_t value); typedef WGPUCommandBuffer (*WGPUProcCommandEncoderFinish)(WGPUCommandEncoder commandEncoder, WGPUCommandBufferDescriptor const * descriptor); typedef void (*WGPUProcCommandEncoderInsertDebugMarker)(WGPUCommandEncoder commandEncoder, char const * markerLabel); typedef void (*WGPUProcCommandEncoderPopDebugGroup)(WGPUCommandEncoder commandEncoder); @@ -1103,7 +1190,6 @@ typedef void (*WGPUProcComputePassEncoderPopDebugGroup)(WGPUComputePassEncoder c typedef void (*WGPUProcComputePassEncoderPushDebugGroup)(WGPUComputePassEncoder computePassEncoder, char const * groupLabel); typedef void (*WGPUProcComputePassEncoderSetBindGroup)(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); typedef void (*WGPUProcComputePassEncoderSetPipeline)(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline); -typedef void (*WGPUProcComputePassEncoderWriteTimestamp)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); // Procs of ComputePipeline typedef WGPUBindGroupLayout (*WGPUProcComputePipelineGetBindGroupLayout)(WGPUComputePipeline computePipeline, uint32_t groupIndex); @@ -1126,8 +1212,10 @@ typedef WGPUShaderModule (*WGPUProcDeviceCreateShaderModule)(WGPUDevice device, typedef WGPUSwapChain (*WGPUProcDeviceCreateSwapChain)(WGPUDevice device, WGPUSurface surface, WGPUSwapChainDescriptor const * descriptor); typedef WGPUTexture (*WGPUProcDeviceCreateTexture)(WGPUDevice device, WGPUTextureDescriptor const * descriptor); typedef void (*WGPUProcDeviceDestroy)(WGPUDevice device); +typedef uint32_t (*WGPUProcDeviceEnumerateFeatures)(WGPUDevice device, WGPUFeatureName* features); typedef bool (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPUSupportedLimits * limits); typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device); +typedef bool (*WGPUProcDeviceHasFeature)(WGPUDevice device, WGPUFeatureName feature); typedef bool (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUErrorCallback callback, void * userdata); typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter); typedef void (*WGPUProcDeviceSetDeviceLostCallback)(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata); @@ -1183,13 +1271,13 @@ typedef void (*WGPUProcRenderPassEncoderSetScissorRect)(WGPURenderPassEncoder re typedef void (*WGPUProcRenderPassEncoderSetStencilReference)(WGPURenderPassEncoder renderPassEncoder, uint32_t reference); typedef void (*WGPUProcRenderPassEncoderSetVertexBuffer)(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); typedef void (*WGPUProcRenderPassEncoderSetViewport)(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth); -typedef void (*WGPUProcRenderPassEncoderWriteTimestamp)(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); // Procs of RenderPipeline typedef WGPUBindGroupLayout (*WGPUProcRenderPipelineGetBindGroupLayout)(WGPURenderPipeline renderPipeline, uint32_t groupIndex); typedef void (*WGPUProcRenderPipelineSetLabel)(WGPURenderPipeline renderPipeline, char const * label); // Procs of ShaderModule +typedef void (*WGPUProcShaderModuleGetCompilationInfo)(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void * userdata); typedef void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule shaderModule, char const * label); // Procs of Surface @@ -1211,6 +1299,7 @@ WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPUInstanceDescriptor const * descr WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPUDevice device, char const * procName); // Methods of Adapter +WGPU_EXPORT uint32_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName* features); WGPU_EXPORT bool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits); WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties); WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature); @@ -1230,6 +1319,7 @@ WGPU_EXPORT void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder command WGPU_EXPORT void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, WGPUImageCopyBuffer const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize); WGPU_EXPORT void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyBuffer const * destination, WGPUExtent3D const * copySize); WGPU_EXPORT void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, WGPUImageCopyTexture const * source, WGPUImageCopyTexture const * destination, WGPUExtent3D const * copySize); +WGPU_EXPORT void wgpuCommandEncoderFillBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size, uint8_t value); WGPU_EXPORT WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPUCommandBufferDescriptor const * descriptor); WGPU_EXPORT void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, char const * markerLabel); WGPU_EXPORT void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder); @@ -1248,7 +1338,6 @@ WGPU_EXPORT void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder comp WGPU_EXPORT void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, char const * groupLabel); WGPU_EXPORT void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); WGPU_EXPORT void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline); -WGPU_EXPORT void wgpuComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); // Methods of ComputePipeline WGPU_EXPORT WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex); @@ -1271,8 +1360,10 @@ WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, WGP WGPU_EXPORT WGPUSwapChain wgpuDeviceCreateSwapChain(WGPUDevice device, WGPUSurface surface, WGPUSwapChainDescriptor const * descriptor); WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor); WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device); +WGPU_EXPORT uint32_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName* features); WGPU_EXPORT bool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits * limits); WGPU_EXPORT WGPUQueue wgpuDeviceGetQueue(WGPUDevice device); +WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature); WGPU_EXPORT bool wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void * userdata); WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter); WGPU_EXPORT void wgpuDeviceSetDeviceLostCallback(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata); @@ -1328,13 +1419,13 @@ WGPU_EXPORT void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder rende WGPU_EXPORT void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference); WGPU_EXPORT void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); WGPU_EXPORT void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth); -WGPU_EXPORT void wgpuRenderPassEncoderWriteTimestamp(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); // Methods of RenderPipeline WGPU_EXPORT WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex); WGPU_EXPORT void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, char const * label); // Methods of ShaderModule +WGPU_EXPORT void wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void * userdata); WGPU_EXPORT void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, char const * label); // Methods of Surface