Skip to content

Commit 5cbe48e

Browse files
Allow GPUTexture where GPUTextureView is used (#186)
This PR reflects the following spec changes: - gpuweb/gpuweb#5228
1 parent a9e810d commit 5cbe48e

File tree

3 files changed

+47
-45
lines changed

3 files changed

+47
-45
lines changed

dist/index.d.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ interface GPUDevice {
114114
type GPUBindingResource =
115115

116116
| GPUSampler
117+
| GPUTexture
117118
| GPUTextureView
118119
| GPUBuffer
119120
| GPUBufferBinding
@@ -543,7 +544,7 @@ interface GPUBindGroupEntry {
543544
*/
544545
binding: GPUIndex32;
545546
/**
546-
* The resource to bind, which may be a {@link GPUSampler}, {@link GPUTextureView},
547+
* The resource to bind, which may be a {@link GPUSampler}, {@link GPUTexture}, {@link GPUTextureView},
547548
* {@link GPUBuffer}, {@link GPUBufferBinding}, or {@link GPUExternalTexture}.
548549
*/
549550
resource: GPUBindingResource;
@@ -571,29 +572,22 @@ interface GPUBindGroupLayoutEntry {
571572
*/
572573
visibility: GPUShaderStageFlags;
573574
/**
574-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
575-
* is {@link GPUBufferBinding}.
576575
*/
577576
buffer?: GPUBufferBindingLayout;
578577
/**
579-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
580-
* is {@link GPUSampler}.
581578
*/
582579
sampler?: GPUSamplerBindingLayout;
583580
/**
584-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
585-
* is {@link GPUTextureView}.
586581
*/
587582
texture?: GPUTextureBindingLayout;
588583
/**
589-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
590-
* is {@link GPUTextureView}.
591584
*/
592585
storageTexture?: GPUStorageTextureBindingLayout;
593586
/**
594-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
595-
* is either {@link GPUExternalTexture} or {@link GPUTextureView}.
596-
* External textures use several binding slots: see Exceeds the binding slot limits.
587+
* Exactly one of these members must be set, indicating the binding type.
588+
* The contents of the member specify options specific to that type.
589+
* The corresponding resource in {@link GPUDevice#createBindGroup} requires
590+
* the corresponding binding resource type for this binding.
597591
*/
598592
externalTexture?: GPUExternalTextureBindingLayout;
599593
}
@@ -1224,21 +1218,25 @@ interface GPURenderBundleEncoderDescriptor
12241218

12251219
interface GPURenderPassColorAttachment {
12261220
/**
1227-
* A {@link GPUTextureView} describing the texture subresource that will be output to for this
1228-
* color attachment.
1221+
* Describes the texture subresource that will be output to for this color attachment.
1222+
* The subresource is determined by calling [$get as texture view$]({@link GPURenderPassColorAttachment#view}).
12291223
*/
1230-
view: GPUTextureView;
1224+
view:
1225+
| GPUTexture
1226+
| GPUTextureView;
12311227
/**
12321228
* Indicates the depth slice index of {@link GPUTextureViewDimension} `"3d"` {@link GPURenderPassColorAttachment#view}
12331229
* that will be output to for this color attachment.
12341230
*/
12351231
depthSlice?: GPUIntegerCoordinate;
12361232
/**
1237-
* A {@link GPUTextureView} describing the texture subresource that will receive the resolved
1238-
* output for this color attachment if {@link GPURenderPassColorAttachment#view} is
1239-
* multisampled.
1233+
* Describes the texture subresource that will receive the resolved output for this color
1234+
* attachment if {@link GPURenderPassColorAttachment#view} is multisampled.
1235+
* The subresource is determined by calling [$get as texture view$]({@link GPURenderPassColorAttachment#resolveTarget}).
12401236
*/
1241-
resolveTarget?: GPUTextureView;
1237+
resolveTarget?:
1238+
| GPUTexture
1239+
| GPUTextureView;
12421240
/**
12431241
* Indicates the value to clear {@link GPURenderPassColorAttachment#view} to prior to executing the
12441242
* render pass. If not map/exist|provided, defaults to `{r: 0, g: 0, b: 0, a: 0}`. Ignored
@@ -1263,10 +1261,13 @@ interface GPURenderPassColorAttachment {
12631261

12641262
interface GPURenderPassDepthStencilAttachment {
12651263
/**
1266-
* A {@link GPUTextureView} describing the texture subresource that will be output to
1267-
* and read from for this depth/stencil attachment.
1264+
* Describes the texture subresource that will be output to and read from for this
1265+
* depth/stencil attachment.
1266+
* The subresource is determined by calling [$get as texture view$]({@link GPURenderPassDepthStencilAttachment#view}).
12681267
*/
1269-
view: GPUTextureView;
1268+
view:
1269+
| GPUTexture
1270+
| GPUTextureView;
12701271
/**
12711272
* Indicates the value to clear {@link GPURenderPassDepthStencilAttachment#view}'s depth component
12721273
* to prior to executing the render pass. Ignored if {@link GPURenderPassDepthStencilAttachment#depthLoadOp}

generated/index.d.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
type GPUBindingResource =
22

33
| GPUSampler
4+
| GPUTexture
45
| GPUTextureView
56
| GPUBuffer
67
| GPUBufferBinding
@@ -430,7 +431,7 @@ interface GPUBindGroupEntry {
430431
*/
431432
binding: GPUIndex32;
432433
/**
433-
* The resource to bind, which may be a {@link GPUSampler}, {@link GPUTextureView},
434+
* The resource to bind, which may be a {@link GPUSampler}, {@link GPUTexture}, {@link GPUTextureView},
434435
* {@link GPUBuffer}, {@link GPUBufferBinding}, or {@link GPUExternalTexture}.
435436
*/
436437
resource: GPUBindingResource;
@@ -458,29 +459,22 @@ interface GPUBindGroupLayoutEntry {
458459
*/
459460
visibility: GPUShaderStageFlags;
460461
/**
461-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
462-
* is {@link GPUBufferBinding}.
463462
*/
464463
buffer?: GPUBufferBindingLayout;
465464
/**
466-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
467-
* is {@link GPUSampler}.
468465
*/
469466
sampler?: GPUSamplerBindingLayout;
470467
/**
471-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
472-
* is {@link GPUTextureView}.
473468
*/
474469
texture?: GPUTextureBindingLayout;
475470
/**
476-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
477-
* is {@link GPUTextureView}.
478471
*/
479472
storageTexture?: GPUStorageTextureBindingLayout;
480473
/**
481-
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
482-
* is either {@link GPUExternalTexture} or {@link GPUTextureView}.
483-
* External textures use several binding slots: see Exceeds the binding slot limits.
474+
* Exactly one of these members must be set, indicating the binding type.
475+
* The contents of the member specify options specific to that type.
476+
* The corresponding resource in {@link GPUDevice#createBindGroup} requires
477+
* the corresponding binding resource type for this binding.
484478
*/
485479
externalTexture?: GPUExternalTextureBindingLayout;
486480
}
@@ -1096,21 +1090,25 @@ interface GPURenderBundleEncoderDescriptor
10961090

10971091
interface GPURenderPassColorAttachment {
10981092
/**
1099-
* A {@link GPUTextureView} describing the texture subresource that will be output to for this
1100-
* color attachment.
1093+
* Describes the texture subresource that will be output to for this color attachment.
1094+
* The subresource is determined by calling [$get as texture view$]({@link GPURenderPassColorAttachment#view}).
11011095
*/
1102-
view: GPUTextureView;
1096+
view:
1097+
| GPUTexture
1098+
| GPUTextureView;
11031099
/**
11041100
* Indicates the depth slice index of {@link GPUTextureViewDimension} `"3d"` {@link GPURenderPassColorAttachment#view}
11051101
* that will be output to for this color attachment.
11061102
*/
11071103
depthSlice?: GPUIntegerCoordinate;
11081104
/**
1109-
* A {@link GPUTextureView} describing the texture subresource that will receive the resolved
1110-
* output for this color attachment if {@link GPURenderPassColorAttachment#view} is
1111-
* multisampled.
1105+
* Describes the texture subresource that will receive the resolved output for this color
1106+
* attachment if {@link GPURenderPassColorAttachment#view} is multisampled.
1107+
* The subresource is determined by calling [$get as texture view$]({@link GPURenderPassColorAttachment#resolveTarget}).
11121108
*/
1113-
resolveTarget?: GPUTextureView;
1109+
resolveTarget?:
1110+
| GPUTexture
1111+
| GPUTextureView;
11141112
/**
11151113
* Indicates the value to clear {@link GPURenderPassColorAttachment#view} to prior to executing the
11161114
* render pass. If not map/exist|provided, defaults to `{r: 0, g: 0, b: 0, a: 0}`. Ignored
@@ -1135,10 +1133,13 @@ interface GPURenderPassColorAttachment {
11351133

11361134
interface GPURenderPassDepthStencilAttachment {
11371135
/**
1138-
* A {@link GPUTextureView} describing the texture subresource that will be output to
1139-
* and read from for this depth/stencil attachment.
1136+
* Describes the texture subresource that will be output to and read from for this
1137+
* depth/stencil attachment.
1138+
* The subresource is determined by calling [$get as texture view$]({@link GPURenderPassDepthStencilAttachment#view}).
11401139
*/
1141-
view: GPUTextureView;
1140+
view:
1141+
| GPUTexture
1142+
| GPUTextureView;
11421143
/**
11431144
* Indicates the value to clear {@link GPURenderPassDepthStencilAttachment#view}'s depth component
11441145
* to prior to executing the render pass. Ignored if {@link GPURenderPassDepthStencilAttachment#depthLoadOp}

0 commit comments

Comments
 (0)