Skip to content

Commit 5bdd32c

Browse files
authored
Update to latest idl (#223)
* new idl * make adjustments * update changelog
1 parent f7fa4be commit 5bdd32c

File tree

8 files changed

+323
-180
lines changed

8 files changed

+323
-180
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Changed:
2424

2525
* Now targeting wgpu-native v0.11.0.1, containing many upstream fixes and improvements.
2626
* The `[[block]]` syntax in shaders has been dropped.
27-
27+
* Renamed `ProgrammableStage.clamp_depth` -> `unclipped_depth`.
2828

2929
### [v0.6.0] - 16-12-2021
3030

wgpu/backends/rs.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,17 @@ def create_pipeline_layout(
845845
id = lib.wgpuDeviceCreatePipelineLayout(self._internal, struct)
846846
return GPUPipelineLayout(label, id, self, bind_group_layouts)
847847

848-
def create_shader_module(self, *, label="", code: str, source_map: dict = None):
849-
848+
def create_shader_module(
849+
self,
850+
*,
851+
label="",
852+
code: str,
853+
source_map: dict = None,
854+
hints: "Dict[str, structs.ShaderModuleCompilationHint]" = None,
855+
):
856+
if hints:
857+
for val in hints.values():
858+
check_struct("ShaderModuleCompilationHint", val)
850859
if isinstance(code, str):
851860
# WGSL
852861
# H: chain: WGPUChainedStruct, code: char *
@@ -1152,7 +1161,7 @@ async def create_render_pipeline_async(
11521161
fragment=fragment,
11531162
)
11541163

1155-
def create_command_encoder(self, *, label="", measure_execution_time: bool = False):
1164+
def create_command_encoder(self, *, label=""):
11561165
# H: nextInChain: WGPUChainedStruct *, label: char *
11571166
struct = new_struct_p(
11581167
"WGPUCommandEncoderDescriptor *",
@@ -1178,14 +1187,7 @@ def create_render_bundle_encoder(
11781187
raise NotImplementedError()
11791188

11801189
# FIXME: new method to implement
1181-
def create_query_set(
1182-
self,
1183-
*,
1184-
label="",
1185-
type: "enums.QueryType",
1186-
count: int,
1187-
pipeline_statistics: "List[enums.PipelineStatisticName]" = [],
1188-
):
1190+
def create_query_set(self, *, label="", type: "enums.QueryType", count: int):
11891191
raise NotImplementedError()
11901192

11911193
def _destroy(self):
@@ -1422,7 +1424,14 @@ def _destroy(self):
14221424

14231425

14241426
class GPUCommandEncoder(base.GPUCommandEncoder, GPUObjectBase):
1425-
def begin_compute_pass(self, *, label=""):
1427+
def begin_compute_pass(
1428+
self,
1429+
*,
1430+
label="",
1431+
timestamp_writes: "List[structs.ComputePassTimestampWrite]" = [],
1432+
):
1433+
for val in timestamp_writes:
1434+
check_struct("ComputePassTimestampWrite", val)
14261435
# H: nextInChain: WGPUChainedStruct *, label: char *, timestampWriteCount: int, timestampWrites: WGPUComputePassTimestampWrite *
14271436
struct = new_struct_p(
14281437
"WGPUComputePassDescriptor *",
@@ -1442,8 +1451,11 @@ def begin_render_pass(
14421451
color_attachments: "List[structs.RenderPassColorAttachment]",
14431452
depth_stencil_attachment: "structs.RenderPassDepthStencilAttachment" = None,
14441453
occlusion_query_set: "GPUQuerySet" = None,
1454+
timestamp_writes: "List[structs.RenderPassTimestampWrite]" = [],
14451455
):
14461456
# Note that occlusion_query_set is ignored because wgpu-native does not have it.
1457+
for val in timestamp_writes:
1458+
check_struct("RenderPassTimestampWrite", val)
14471459

14481460
c_color_attachments_list = []
14491461
for color_attachment in color_attachments:
@@ -1768,6 +1780,10 @@ def _destroy(self):
17681780
# H: void f(WGPUCommandEncoder commandEncoder)
17691781
internal # lib.wgpuCommandEncoderDrop(internal) # Causes 'Cannot remove a vacant resource'
17701782

1783+
# FIXME: new method to implement
1784+
def clear_buffer(self, buffer, offset=0, size=None):
1785+
raise NotImplementedError()
1786+
17711787

17721788
class GPUProgrammablePassEncoder(base.GPUProgrammablePassEncoder):
17731789
def set_bind_group(
@@ -1864,10 +1880,6 @@ def end_pass(self):
18641880
# H: void f(WGPUComputePassEncoder computePassEncoder)
18651881
lib.wgpuComputePassEncoderEndPass(self._internal)
18661882

1867-
# FIXME: new method to implement
1868-
def write_timestamp(self, query_set, query_index):
1869-
raise NotImplementedError()
1870-
18711883
def _destroy(self):
18721884
if self._internal is not None and lib is not None:
18731885
self._internal, internal = None, self._internal
@@ -2000,10 +2012,6 @@ def begin_occlusion_query(self, query_index):
20002012
def end_occlusion_query(self):
20012013
raise NotImplementedError()
20022014

2003-
# FIXME: new method to implement
2004-
def write_timestamp(self, query_set, query_index):
2005-
raise NotImplementedError()
2006-
20072015

20082016
class GPURenderBundleEncoder(
20092017
base.GPURenderBundleEncoder,

wgpu/backends/rs_mappings.py

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# flake8: noqa
66

7-
# There are 188 enum mappings
7+
# There are 227 enum mappings
88

99
enummap = {
1010
"AddressMode.clamp-to-edge": 2,
@@ -42,16 +42,21 @@
4242
"CompilationMessageType.error": 0,
4343
"CompilationMessageType.info": 2,
4444
"CompilationMessageType.warning": 1,
45+
"ComputePassTimestampLocation.beginning": 0,
46+
"ComputePassTimestampLocation.end": 1,
4547
"CullMode.back": 2,
4648
"CullMode.front": 1,
4749
"CullMode.none": 0,
4850
"DeviceLostReason.destroyed": 1,
4951
"ErrorFilter.out-of-memory": 2,
5052
"ErrorFilter.validation": 1,
53+
"FeatureName.depth-clip-control": 1,
5154
"FeatureName.depth24unorm-stencil8": 2,
5255
"FeatureName.depth32float-stencil8": 3,
53-
"FeatureName.pipeline-statistics-query": 5,
56+
"FeatureName.indirect-first-instance": 9,
57+
"FeatureName.texture-compression-astc": 8,
5458
"FeatureName.texture-compression-bc": 6,
59+
"FeatureName.texture-compression-etc2": 7,
5560
"FeatureName.timestamp-query": 4,
5661
"FilterMode.linear": 1,
5762
"FilterMode.nearest": 0,
@@ -60,11 +65,6 @@
6065
"IndexFormat.uint16": 1,
6166
"IndexFormat.uint32": 2,
6267
"LoadOp.load": 1,
63-
"PipelineStatisticName.clipper-invocations": 1,
64-
"PipelineStatisticName.clipper-primitives-out": 2,
65-
"PipelineStatisticName.compute-shader-invocations": 4,
66-
"PipelineStatisticName.fragment-shader-invocations": 3,
67-
"PipelineStatisticName.vertex-shader-invocations": 0,
6868
"PowerPreference.high-performance": 2,
6969
"PowerPreference.low-power": 1,
7070
"PrimitiveTopology.line-list": 1,
@@ -73,8 +73,9 @@
7373
"PrimitiveTopology.triangle-list": 3,
7474
"PrimitiveTopology.triangle-strip": 4,
7575
"QueryType.occlusion": 0,
76-
"QueryType.pipeline-statistics": 1,
7776
"QueryType.timestamp": 2,
77+
"RenderPassTimestampLocation.beginning": 0,
78+
"RenderPassTimestampLocation.end": 1,
7879
"SamplerBindingType.comparison": 3,
7980
"SamplerBindingType.filtering": 1,
8081
"SamplerBindingType.non-filtering": 2,
@@ -95,6 +96,34 @@
9596
"TextureDimension.1d": 0,
9697
"TextureDimension.2d": 1,
9798
"TextureDimension.3d": 2,
99+
"TextureFormat.astc-10x10-unorm": 90,
100+
"TextureFormat.astc-10x10-unorm-srgb": 91,
101+
"TextureFormat.astc-10x5-unorm": 84,
102+
"TextureFormat.astc-10x5-unorm-srgb": 85,
103+
"TextureFormat.astc-10x6-unorm": 86,
104+
"TextureFormat.astc-10x6-unorm-srgb": 87,
105+
"TextureFormat.astc-10x8-unorm": 88,
106+
"TextureFormat.astc-10x8-unorm-srgb": 89,
107+
"TextureFormat.astc-12x10-unorm": 92,
108+
"TextureFormat.astc-12x10-unorm-srgb": 93,
109+
"TextureFormat.astc-12x12-unorm": 94,
110+
"TextureFormat.astc-12x12-unorm-srgb": 95,
111+
"TextureFormat.astc-4x4-unorm": 68,
112+
"TextureFormat.astc-4x4-unorm-srgb": 69,
113+
"TextureFormat.astc-5x4-unorm": 70,
114+
"TextureFormat.astc-5x4-unorm-srgb": 71,
115+
"TextureFormat.astc-5x5-unorm": 72,
116+
"TextureFormat.astc-5x5-unorm-srgb": 73,
117+
"TextureFormat.astc-6x5-unorm": 74,
118+
"TextureFormat.astc-6x5-unorm-srgb": 75,
119+
"TextureFormat.astc-6x6-unorm": 76,
120+
"TextureFormat.astc-6x6-unorm-srgb": 77,
121+
"TextureFormat.astc-8x5-unorm": 78,
122+
"TextureFormat.astc-8x5-unorm-srgb": 79,
123+
"TextureFormat.astc-8x6-unorm": 80,
124+
"TextureFormat.astc-8x6-unorm-srgb": 81,
125+
"TextureFormat.astc-8x8-unorm": 82,
126+
"TextureFormat.astc-8x8-unorm-srgb": 83,
98127
"TextureFormat.bc1-rgba-unorm": 44,
99128
"TextureFormat.bc1-rgba-unorm-srgb": 45,
100129
"TextureFormat.bc2-rgba-unorm": 46,
@@ -117,6 +146,16 @@
117146
"TextureFormat.depth24unorm-stencil8": 41,
118147
"TextureFormat.depth32float": 42,
119148
"TextureFormat.depth32float-stencil8": 43,
149+
"TextureFormat.eac-r11snorm": 65,
150+
"TextureFormat.eac-r11unorm": 64,
151+
"TextureFormat.eac-rg11snorm": 67,
152+
"TextureFormat.eac-rg11unorm": 66,
153+
"TextureFormat.etc2-rgb8a1unorm": 60,
154+
"TextureFormat.etc2-rgb8a1unorm-srgb": 61,
155+
"TextureFormat.etc2-rgb8unorm": 58,
156+
"TextureFormat.etc2-rgb8unorm-srgb": 59,
157+
"TextureFormat.etc2-rgba8unorm": 62,
158+
"TextureFormat.etc2-rgba8unorm-srgb": 63,
120159
"TextureFormat.r16float": 7,
121160
"TextureFormat.r16sint": 6,
122161
"TextureFormat.r16uint": 5,
@@ -197,7 +236,7 @@
197236
"VertexStepMode.vertex": 0,
198237
}
199238

200-
# There are 47 struct-field enum mappings
239+
# There are 49 struct-field enum mappings
201240

202241
cstructfield2enum = {
203242
"BlendComponent.dstFactor": "BlendFactor",
@@ -206,6 +245,7 @@
206245
"BufferBindingLayout.type": "BufferBindingType",
207246
"ColorTargetState.format": "TextureFormat",
208247
"CompilationMessage.type": "CompilationMessageType",
248+
"ComputePassTimestampWrite.location": "ComputePassTimestampLocation",
209249
"DepthStencilState.depthCompare": "CompareFunction",
210250
"DepthStencilState.format": "TextureFormat",
211251
"ImageCopyTexture.aspect": "TextureAspect",
@@ -221,6 +261,7 @@
221261
"RenderPassDepthStencilAttachment.depthStoreOp": "StoreOp",
222262
"RenderPassDepthStencilAttachment.stencilLoadOp": "LoadOp",
223263
"RenderPassDepthStencilAttachment.stencilStoreOp": "StoreOp",
264+
"RenderPassTimestampWrite.location": "RenderPassTimestampLocation",
224265
"RequestAdapterOptions.powerPreference": "PowerPreference",
225266
"SamplerBindingLayout.type": "SamplerBindingType",
226267
"SamplerDescriptor.addressModeU": "AddressMode",

0 commit comments

Comments
 (0)