@luma.gl/engine 10.0.0-alpha.11 → 10.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -4
- package/THIRD-PARTY-NOTICES.md +185 -0
- package/dist/compute/swap.d.ts +2 -2
- package/dist/compute/swap.d.ts.map +1 -1
- package/dist/compute/swap.js.map +1 -1
- package/dist/dist.dev.js +313 -196
- package/dist/dist.min.js +61 -61
- package/dist/dynamic-texture/video-texture.cjs +1 -1
- package/dist/dynamic-texture/video-texture.d.ts +3 -3
- package/dist/dynamic-texture/video-texture.d.ts.map +1 -1
- package/dist/dynamic-texture/video-texture.js +1 -1
- package/dist/dynamic-texture/video-texture.js.map +1 -1
- package/dist/effects/index.cjs.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js +2 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
- package/dist/gltf/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/gltf/types/gltf-json-schema.js +1 -0
- package/dist/gltf/types/gltf-json-schema.js.map +1 -1
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -1
- package/dist/gltf/types/gltf-postprocessed-schema.js +1 -0
- package/dist/gltf/types/gltf-postprocessed-schema.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/lighting/index.cjs +22 -2
- package/dist/lighting/index.cjs.map +3 -3
- package/dist/lighting/index.d.ts +8 -0
- package/dist/lighting/index.d.ts.map +1 -1
- package/dist/lighting/index.js +4 -0
- package/dist/lighting/index.js.map +1 -1
- package/dist/lighting/lightmap-baker.cjs +238 -0
- package/dist/lighting/lightmap-baker.d.ts +62 -0
- package/dist/lighting/lightmap-baker.d.ts.map +1 -0
- package/dist/lighting/lightmap-baker.js +236 -0
- package/dist/lighting/lightmap-baker.js.map +1 -0
- package/dist/lighting/lightmap-data.cjs +117 -0
- package/dist/lighting/lightmap-data.d.ts +20 -0
- package/dist/lighting/lightmap-data.d.ts.map +1 -0
- package/dist/lighting/lightmap-data.js +110 -0
- package/dist/lighting/lightmap-data.js.map +1 -0
- package/dist/lighting/lightmap-environment.cjs +61 -0
- package/dist/lighting/lightmap-environment.d.ts +18 -0
- package/dist/lighting/lightmap-environment.d.ts.map +1 -0
- package/dist/lighting/lightmap-environment.js +46 -0
- package/dist/lighting/lightmap-environment.js.map +1 -0
- package/dist/lighting/pbr-model.cjs +70 -0
- package/dist/lighting/pbr-model.d.ts +5 -1
- package/dist/lighting/pbr-model.d.ts.map +1 -1
- package/dist/lighting/pbr-model.js +71 -1
- package/dist/lighting/pbr-model.js.map +1 -1
- package/dist/lighting/shadow-map-renderer.cjs +7 -3
- package/dist/lighting/shadow-map-renderer.d.ts +1 -1
- package/dist/lighting/shadow-map-renderer.d.ts.map +1 -1
- package/dist/lighting/shadow-map-renderer.js +8 -3
- package/dist/lighting/shadow-map-renderer.js.map +1 -1
- package/dist/text/index.cjs +2 -0
- package/dist/text/index.cjs.map +2 -2
- package/dist/text/index.d.ts +1 -1
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +1 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/text-2d/index.cjs +3 -0
- package/dist/text/text-2d/index.d.ts +1 -0
- package/dist/text/text-2d/index.d.ts.map +1 -1
- package/dist/text/text-2d/index.js +1 -0
- package/dist/text/text-2d/index.js.map +1 -1
- package/dist/text/text-2d/model-utils/text-code-point-source.cjs +41 -0
- package/dist/text/text-2d/model-utils/text-code-point-source.d.ts +8 -0
- package/dist/text/text-2d/model-utils/text-code-point-source.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-code-point-source.js +23 -0
- package/dist/text/text-2d/model-utils/text-code-point-source.js.map +1 -0
- package/licenses/cesium.txt +207 -0
- package/licenses/deck-community.txt +19 -0
- package/licenses/deck.txt +19 -0
- package/licenses/glfx.txt +19 -0
- package/licenses/gltf-loader-ts.txt +21 -0
- package/licenses/magenta-font.txt +13 -0
- package/licenses/nvidia-fxaa.txt +25 -0
- package/licenses/philogl.txt +19 -0
- package/licenses/spark.txt +21 -0
- package/licenses/three.txt +21 -0
- package/package.json +12 -9
- package/src/compute/swap.ts +2 -2
- package/src/dynamic-texture/video-texture.ts +9 -3
- package/src/effects/passes/postprocessing/fxaa/fxaa.ts +2 -1
- package/src/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/denoise.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/huesaturation.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/noise.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/sepia.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/vibrance.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/vignette.ts +2 -0
- package/src/gltf/types/gltf-json-schema.ts +1 -0
- package/src/gltf/types/gltf-postprocessed-schema.ts +1 -0
- package/src/lighting/index.ts +19 -0
- package/src/lighting/lightmap-baker.ts +306 -0
- package/src/lighting/lightmap-data.ts +138 -0
- package/src/lighting/lightmap-environment.ts +70 -0
- package/src/lighting/pbr-model.ts +78 -1
- package/src/lighting/shadow-map-renderer.ts +12 -3
- package/src/text/index.ts +1 -0
- package/src/text/text-2d/index.ts +1 -0
- package/src/text/text-2d/model-utils/text-code-point-source.ts +34 -0
package/dist/dist.dev.js
CHANGED
|
@@ -6612,8 +6612,13 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
6612
6612
|
}
|
|
6613
6613
|
return decoded;
|
|
6614
6614
|
}
|
|
6615
|
+
var attributeShaderTypeInfoCache = /* @__PURE__ */ new Map();
|
|
6615
6616
|
function getAttributeShaderTypeInfo(attributeType) {
|
|
6616
6617
|
const resolvedAttributeType = resolveAttributeShaderTypeAlias(attributeType);
|
|
6618
|
+
const cached = attributeShaderTypeInfoCache.get(resolvedAttributeType);
|
|
6619
|
+
if (cached) {
|
|
6620
|
+
return cached;
|
|
6621
|
+
}
|
|
6617
6622
|
const decoded = TYPE_INFO[resolvedAttributeType];
|
|
6618
6623
|
if (!decoded) {
|
|
6619
6624
|
throw new Error(`Unsupported attribute shader type: ${attributeType}`);
|
|
@@ -6622,13 +6627,15 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
6622
6627
|
const integer = primitiveType === "i32" || primitiveType === "u32";
|
|
6623
6628
|
const signed = primitiveType !== "u32";
|
|
6624
6629
|
const byteLength = PRIMITIVE_TYPE_SIZES[primitiveType] * components2;
|
|
6625
|
-
|
|
6630
|
+
const result = Object.freeze({
|
|
6626
6631
|
primitiveType,
|
|
6627
6632
|
components: components2,
|
|
6628
6633
|
byteLength,
|
|
6629
6634
|
integer,
|
|
6630
6635
|
signed
|
|
6631
|
-
};
|
|
6636
|
+
});
|
|
6637
|
+
attributeShaderTypeInfoCache.set(resolvedAttributeType, result);
|
|
6638
|
+
return result;
|
|
6632
6639
|
}
|
|
6633
6640
|
var ShaderTypeDecoder = class {
|
|
6634
6641
|
getVariableShaderTypeInfo(format) {
|
|
@@ -6737,6 +6744,9 @@ ${DECLARATION_INJECT_MARKER}
|
|
|
6737
6744
|
"mat4x3<u32>": { type: "u32", components: 12 },
|
|
6738
6745
|
"mat4x4<u32>": { type: "u32", components: 16 }
|
|
6739
6746
|
};
|
|
6747
|
+
for (const info of Object.values(UNIFORM_FORMATS)) {
|
|
6748
|
+
Object.freeze(info);
|
|
6749
|
+
}
|
|
6740
6750
|
var WGSL_ATTRIBUTE_TYPE_ALIAS_MAP = {
|
|
6741
6751
|
vec2i: "vec2<i32>",
|
|
6742
6752
|
vec3i: "vec3<i32>",
|
|
@@ -11014,7 +11024,148 @@ ${declarations.join("\n")}`).match(
|
|
|
11014
11024
|
return `${id}-${count}`;
|
|
11015
11025
|
}
|
|
11016
11026
|
|
|
11027
|
+
// ../core/src/api/utils/assert.ts
|
|
11028
|
+
function assert8(condition, message) {
|
|
11029
|
+
if (!condition) {
|
|
11030
|
+
const error = new Error(message ?? "luma.gl assertion failed.");
|
|
11031
|
+
Error.captureStackTrace?.(error, assert8);
|
|
11032
|
+
throw error;
|
|
11033
|
+
}
|
|
11034
|
+
}
|
|
11035
|
+
|
|
11017
11036
|
// ../core/src/api/adapter/resources/resource.ts
|
|
11037
|
+
var Resource = class {
|
|
11038
|
+
_owner = null;
|
|
11039
|
+
_ownedResources = /* @__PURE__ */ new Set();
|
|
11040
|
+
_state = "live";
|
|
11041
|
+
_destroyingOwnedResources = false;
|
|
11042
|
+
_destroyRequested = false;
|
|
11043
|
+
/** The resource responsible for destroying this resource, or null for caller-managed lifetime. */
|
|
11044
|
+
get owner() {
|
|
11045
|
+
return this._owner;
|
|
11046
|
+
}
|
|
11047
|
+
/** A snapshot of this resource's children. Mutating the snapshot cannot change ownership. */
|
|
11048
|
+
get ownedResources() {
|
|
11049
|
+
return Array.from(this._ownedResources);
|
|
11050
|
+
}
|
|
11051
|
+
/** Whether destruction has completed, including when cleanup reported an error. */
|
|
11052
|
+
get destroyed() {
|
|
11053
|
+
return this._state === "destroyed";
|
|
11054
|
+
}
|
|
11055
|
+
/** Transfer exclusive ownership, or return lifetime responsibility to the caller with null. */
|
|
11056
|
+
transferOwnershipTo(owner) {
|
|
11057
|
+
assert8(this._state === "live" && !this._destroyingOwnedResources);
|
|
11058
|
+
assert8(!this._owner || this._owner.canChangeOwnership());
|
|
11059
|
+
assert8(!owner || owner.canChangeOwnership());
|
|
11060
|
+
for (let ancestor = owner; ancestor; ancestor = ancestor._owner) {
|
|
11061
|
+
assert8(ancestor !== this);
|
|
11062
|
+
}
|
|
11063
|
+
if (owner !== this._owner) {
|
|
11064
|
+
this._owner?._ownedResources.delete(this);
|
|
11065
|
+
this._owner = owner;
|
|
11066
|
+
owner?._ownedResources.add(this);
|
|
11067
|
+
}
|
|
11068
|
+
return this;
|
|
11069
|
+
}
|
|
11070
|
+
/** Destroy children before this resource. Subclasses implement hooks instead of overriding. */
|
|
11071
|
+
destroy() {
|
|
11072
|
+
if (this._state !== "live") {
|
|
11073
|
+
return;
|
|
11074
|
+
}
|
|
11075
|
+
if (this._destroyingOwnedResources) {
|
|
11076
|
+
this._destroyRequested = true;
|
|
11077
|
+
return;
|
|
11078
|
+
}
|
|
11079
|
+
this._destroyRequested = false;
|
|
11080
|
+
this._state = "destroying";
|
|
11081
|
+
this._owner?._ownedResources.delete(this);
|
|
11082
|
+
this._owner = null;
|
|
11083
|
+
const errors = [];
|
|
11084
|
+
try {
|
|
11085
|
+
try {
|
|
11086
|
+
this.onBeforeDestroy();
|
|
11087
|
+
} catch (error) {
|
|
11088
|
+
errors.push(error);
|
|
11089
|
+
}
|
|
11090
|
+
this.destroyChildren(errors);
|
|
11091
|
+
try {
|
|
11092
|
+
this.onDestroy();
|
|
11093
|
+
} catch (error) {
|
|
11094
|
+
errors.push(error);
|
|
11095
|
+
}
|
|
11096
|
+
} finally {
|
|
11097
|
+
this._state = "destroyed";
|
|
11098
|
+
}
|
|
11099
|
+
if (errors.length) {
|
|
11100
|
+
throw new AggregateError(errors, "Resource cleanup failed");
|
|
11101
|
+
}
|
|
11102
|
+
}
|
|
11103
|
+
/** @deprecated Use destroy(). */
|
|
11104
|
+
delete() {
|
|
11105
|
+
this.destroy();
|
|
11106
|
+
return this;
|
|
11107
|
+
}
|
|
11108
|
+
/** @deprecated Use resource.transferOwnershipTo(this). */
|
|
11109
|
+
attachResource(resource) {
|
|
11110
|
+
resource.transferOwnershipTo(this);
|
|
11111
|
+
}
|
|
11112
|
+
/** @deprecated Use resource.transferOwnershipTo(null). Only detaches a child owned by this. */
|
|
11113
|
+
detachResource(resource) {
|
|
11114
|
+
if (resource._owner === this) {
|
|
11115
|
+
resource.transferOwnershipTo(null);
|
|
11116
|
+
}
|
|
11117
|
+
}
|
|
11118
|
+
/** @deprecated Check resource.owner and call resource.destroy(). */
|
|
11119
|
+
destroyAttachedResource(resource) {
|
|
11120
|
+
if (resource._owner === this) {
|
|
11121
|
+
resource.destroy();
|
|
11122
|
+
}
|
|
11123
|
+
}
|
|
11124
|
+
/** @deprecated Destroy individually owned resources, or destroy the owner. */
|
|
11125
|
+
destroyAttachedResources() {
|
|
11126
|
+
if (this._state !== "live" || this._destroyingOwnedResources) {
|
|
11127
|
+
return;
|
|
11128
|
+
}
|
|
11129
|
+
const errors = [];
|
|
11130
|
+
this.destroyChildren(errors);
|
|
11131
|
+
if (this._destroyRequested) {
|
|
11132
|
+
try {
|
|
11133
|
+
this.destroy();
|
|
11134
|
+
} catch (error) {
|
|
11135
|
+
errors.push(error);
|
|
11136
|
+
}
|
|
11137
|
+
}
|
|
11138
|
+
if (errors.length) {
|
|
11139
|
+
throw new AggregateError(errors, "Resource cleanup failed");
|
|
11140
|
+
}
|
|
11141
|
+
}
|
|
11142
|
+
/** Stop activity before children are destroyed. Errors are collected; this hook cannot veto cleanup. */
|
|
11143
|
+
onBeforeDestroy() {
|
|
11144
|
+
}
|
|
11145
|
+
/** Release this resource's own state after its children have been destroyed. */
|
|
11146
|
+
onDestroy() {
|
|
11147
|
+
}
|
|
11148
|
+
canChangeOwnership() {
|
|
11149
|
+
return this._state === "live" && !this._destroyingOwnedResources;
|
|
11150
|
+
}
|
|
11151
|
+
destroyChildren(errors) {
|
|
11152
|
+
this._destroyingOwnedResources = true;
|
|
11153
|
+
try {
|
|
11154
|
+
for (const resource of this._ownedResources) {
|
|
11155
|
+
try {
|
|
11156
|
+
resource.destroy();
|
|
11157
|
+
} catch (error) {
|
|
11158
|
+
errors.push(error);
|
|
11159
|
+
}
|
|
11160
|
+
}
|
|
11161
|
+
} finally {
|
|
11162
|
+
this._ownedResources.clear();
|
|
11163
|
+
this._destroyingOwnedResources = false;
|
|
11164
|
+
}
|
|
11165
|
+
}
|
|
11166
|
+
};
|
|
11167
|
+
|
|
11168
|
+
// ../core/src/api/adapter/resources/device-resource.ts
|
|
11018
11169
|
var CPU_HOTSPOT_PROFILER_MODULE = "cpu-hotspot-profiler";
|
|
11019
11170
|
var RESOURCE_COUNTS_STATS = "GPU Resource Counts";
|
|
11020
11171
|
var LEGACY_RESOURCE_COUNTS_STATS = "Resource Counts";
|
|
@@ -11070,7 +11221,7 @@ ${declarations.join("\n")}`).match(
|
|
|
11070
11221
|
]);
|
|
11071
11222
|
var ORDERED_STATS_CACHE = /* @__PURE__ */ new WeakMap();
|
|
11072
11223
|
var ORDERED_STAT_NAME_SET_CACHE = /* @__PURE__ */ new WeakMap();
|
|
11073
|
-
var
|
|
11224
|
+
var DeviceResource = class extends Resource {
|
|
11074
11225
|
/** Default properties for resource */
|
|
11075
11226
|
static defaultProps = {
|
|
11076
11227
|
id: "undefined",
|
|
@@ -11093,14 +11244,10 @@ ${declarations.join("\n")}`).match(
|
|
|
11093
11244
|
userData = {};
|
|
11094
11245
|
/** The device that this resource is associated with - TODO can we remove this dup? */
|
|
11095
11246
|
_device;
|
|
11096
|
-
/** Whether this resource has been destroyed */
|
|
11097
|
-
destroyed = false;
|
|
11098
11247
|
/** For resources that allocate GPU memory */
|
|
11099
11248
|
allocatedBytes = 0;
|
|
11100
11249
|
/** Stats bucket currently holding the tracked allocation */
|
|
11101
11250
|
allocatedBytesName = null;
|
|
11102
|
-
/** Attached resources will be destroyed when this resource is destroyed. Tracks auto-created "sub" resources. */
|
|
11103
|
-
_attachedResources = /* @__PURE__ */ new Set();
|
|
11104
11251
|
/** Whether luma.gl created and owns the underlying resource handle. */
|
|
11105
11252
|
get ownsHandle() {
|
|
11106
11253
|
return (this.props.handle === void 0 || this.props.handle === null) && !this.isHandleBorrowed;
|
|
@@ -11110,9 +11257,10 @@ ${declarations.join("\n")}`).match(
|
|
|
11110
11257
|
return Boolean(this.props._isHandleBorrowed);
|
|
11111
11258
|
}
|
|
11112
11259
|
/**
|
|
11113
|
-
* Create a new
|
|
11260
|
+
* Create a new DeviceResource. Called from Subclass
|
|
11114
11261
|
*/
|
|
11115
11262
|
constructor(device, props, defaultProps) {
|
|
11263
|
+
super();
|
|
11116
11264
|
if (!device) {
|
|
11117
11265
|
throw new Error("no device");
|
|
11118
11266
|
}
|
|
@@ -11124,20 +11272,6 @@ ${declarations.join("\n")}`).match(
|
|
|
11124
11272
|
this.userData = this.props.userData || {};
|
|
11125
11273
|
this.addStats();
|
|
11126
11274
|
}
|
|
11127
|
-
/**
|
|
11128
|
-
* destroy can be called on any resource to release it before it is garbage collected.
|
|
11129
|
-
*/
|
|
11130
|
-
destroy() {
|
|
11131
|
-
if (this.destroyed) {
|
|
11132
|
-
return;
|
|
11133
|
-
}
|
|
11134
|
-
this.destroyResource();
|
|
11135
|
-
}
|
|
11136
|
-
/** @deprecated Use destroy() */
|
|
11137
|
-
delete() {
|
|
11138
|
-
this.destroy();
|
|
11139
|
-
return this;
|
|
11140
|
-
}
|
|
11141
11275
|
/**
|
|
11142
11276
|
* Combines a map of user props and default props, only including props from defaultProps
|
|
11143
11277
|
* @returns returns a map of overridden default props
|
|
@@ -11145,46 +11279,19 @@ ${declarations.join("\n")}`).match(
|
|
|
11145
11279
|
getProps() {
|
|
11146
11280
|
return this.props;
|
|
11147
11281
|
}
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
* Attaches a resource. Attached resources are auto destroyed when this resource is destroyed
|
|
11151
|
-
* Called automatically when sub resources are auto created but can be called by application
|
|
11152
|
-
*/
|
|
11153
|
-
attachResource(resource) {
|
|
11154
|
-
this._attachedResources.add(resource);
|
|
11155
|
-
}
|
|
11156
|
-
/**
|
|
11157
|
-
* Detach an attached resource. The resource will no longer be auto-destroyed when this resource is destroyed.
|
|
11158
|
-
*/
|
|
11159
|
-
detachResource(resource) {
|
|
11160
|
-
this._attachedResources.delete(resource);
|
|
11161
|
-
}
|
|
11162
|
-
/**
|
|
11163
|
-
* Destroys a resource (only if owned), and removes from the owned (auto-destroy) list for this resource.
|
|
11164
|
-
*/
|
|
11165
|
-
destroyAttachedResource(resource) {
|
|
11166
|
-
if (this._attachedResources.delete(resource)) {
|
|
11167
|
-
resource.destroy();
|
|
11168
|
-
}
|
|
11169
|
-
}
|
|
11170
|
-
/** Destroy all owned resources. Make sure the resources are no longer needed before calling. */
|
|
11171
|
-
destroyAttachedResources() {
|
|
11172
|
-
for (const resource of this._attachedResources) {
|
|
11173
|
-
resource.destroy();
|
|
11174
|
-
}
|
|
11175
|
-
this._attachedResources = /* @__PURE__ */ new Set();
|
|
11282
|
+
/** Backend cleanup. Override this instead of destroy(); children are already destroyed. */
|
|
11283
|
+
destroyHandle() {
|
|
11176
11284
|
}
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11285
|
+
/** Complete device bookkeeping even when backend cleanup fails. */
|
|
11286
|
+
onDestroy() {
|
|
11287
|
+
try {
|
|
11288
|
+
this.destroyHandle();
|
|
11289
|
+
} finally {
|
|
11290
|
+
this.trackDeallocatedMemory();
|
|
11291
|
+
this.removeStats();
|
|
11182
11292
|
}
|
|
11183
|
-
this.destroyAttachedResources();
|
|
11184
|
-
this.removeStats();
|
|
11185
|
-
this.destroyed = true;
|
|
11186
11293
|
}
|
|
11187
|
-
/**
|
|
11294
|
+
/** Track object destruction after backend cleanup. */
|
|
11188
11295
|
removeStats() {
|
|
11189
11296
|
const profiler = getCpuHotspotProfiler(this._device);
|
|
11190
11297
|
const startTime = profiler ? getTimestamp() : 0;
|
|
@@ -11362,7 +11469,7 @@ ${declarations.join("\n")}`).match(
|
|
|
11362
11469
|
let prototype = Object.getPrototypeOf(resource);
|
|
11363
11470
|
while (prototype) {
|
|
11364
11471
|
const parentPrototype = Object.getPrototypeOf(prototype);
|
|
11365
|
-
if (!parentPrototype || parentPrototype ===
|
|
11472
|
+
if (!parentPrototype || parentPrototype === DeviceResource.prototype) {
|
|
11366
11473
|
return getPrototypeToStringTag(prototype) || resource[Symbol.toStringTag] || resource.constructor.name;
|
|
11367
11474
|
}
|
|
11368
11475
|
prototype = parentPrototype;
|
|
@@ -11381,7 +11488,7 @@ ${declarations.join("\n")}`).match(
|
|
|
11381
11488
|
}
|
|
11382
11489
|
|
|
11383
11490
|
// ../core/src/api/adapter/resources/buffer.ts
|
|
11384
|
-
var Buffer4 = class _Buffer extends
|
|
11491
|
+
var Buffer4 = class _Buffer extends DeviceResource {
|
|
11385
11492
|
/** Index buffer */
|
|
11386
11493
|
static INDEX = 16;
|
|
11387
11494
|
/** Vertex buffer */
|
|
@@ -11462,7 +11569,7 @@ ${declarations.join("\n")}`).match(
|
|
|
11462
11569
|
}
|
|
11463
11570
|
}
|
|
11464
11571
|
static defaultProps = {
|
|
11465
|
-
...
|
|
11572
|
+
...DeviceResource.defaultProps,
|
|
11466
11573
|
handle: void 0,
|
|
11467
11574
|
usage: 0,
|
|
11468
11575
|
// Buffer.COPY_DST | Buffer.COPY_SRC
|
|
@@ -11484,7 +11591,19 @@ ${declarations.join("\n")}`).match(
|
|
|
11484
11591
|
}
|
|
11485
11592
|
|
|
11486
11593
|
// ../core/src/shadertypes/data-types/decode-data-types.ts
|
|
11594
|
+
var dataTypeInfoCache = /* @__PURE__ */ new Map();
|
|
11487
11595
|
function getDataTypeInfo(type) {
|
|
11596
|
+
const cached = dataTypeInfoCache.get(type);
|
|
11597
|
+
if (cached) {
|
|
11598
|
+
return cached;
|
|
11599
|
+
}
|
|
11600
|
+
const decoded = Object.freeze(decodeDataTypeInfo(type));
|
|
11601
|
+
if (Object.hasOwn(NORMALIZED_TYPE_MAP, type)) {
|
|
11602
|
+
dataTypeInfoCache.set(type, decoded);
|
|
11603
|
+
}
|
|
11604
|
+
return decoded;
|
|
11605
|
+
}
|
|
11606
|
+
function decodeDataTypeInfo(type) {
|
|
11488
11607
|
const normalized2 = type.includes("norm");
|
|
11489
11608
|
const integer = !normalized2 && !type.startsWith("float");
|
|
11490
11609
|
const signed = type.startsWith("s");
|
|
@@ -11825,40 +11944,33 @@ ${declarations.join("\n")}`).match(
|
|
|
11825
11944
|
return this.isCompressed(format) && !format.endsWith("-webgl") ? WEBGPU_CREATE_FILTER2 : 0;
|
|
11826
11945
|
}
|
|
11827
11946
|
/** Computes the memory layout for a texture, in particular including row byte alignment */
|
|
11828
|
-
computeMemoryLayout(opts) {
|
|
11829
|
-
return computeTextureMemoryLayout(opts);
|
|
11947
|
+
computeMemoryLayout(opts, result) {
|
|
11948
|
+
return computeTextureMemoryLayout(opts, result);
|
|
11830
11949
|
}
|
|
11831
11950
|
};
|
|
11832
11951
|
var textureFormatDecoder = new TextureFormatDecoder();
|
|
11833
|
-
function computeTextureMemoryLayout({
|
|
11834
|
-
format,
|
|
11835
|
-
width,
|
|
11836
|
-
height,
|
|
11837
|
-
depth,
|
|
11838
|
-
byteAlignment
|
|
11839
|
-
}) {
|
|
11952
|
+
function computeTextureMemoryLayout({ format, width, height, depth, byteAlignment }, result = {}) {
|
|
11840
11953
|
const formatInfo = textureFormatDecoder.getInfo(format);
|
|
11954
|
+
const { bytesPerPixel, blockHeight = 1, compressed = false } = formatInfo;
|
|
11955
|
+
const bytesPerRow = getTextureBytesPerRow(formatInfo, width, byteAlignment);
|
|
11956
|
+
const rowsPerImage = compressed ? Math.ceil(height / blockHeight) : height;
|
|
11957
|
+
result.bytesPerPixel = bytesPerPixel;
|
|
11958
|
+
result.bytesPerRow = bytesPerRow;
|
|
11959
|
+
result.rowsPerImage = rowsPerImage;
|
|
11960
|
+
result.depthOrArrayLayers = depth;
|
|
11961
|
+
result.bytesPerImage = bytesPerRow * rowsPerImage;
|
|
11962
|
+
result.byteLength = result.bytesPerImage * depth;
|
|
11963
|
+
return result;
|
|
11964
|
+
}
|
|
11965
|
+
function getTextureBytesPerRow(formatInfo, width, byteAlignment) {
|
|
11841
11966
|
const {
|
|
11842
11967
|
bytesPerPixel,
|
|
11843
11968
|
bytesPerBlock = bytesPerPixel,
|
|
11844
11969
|
blockWidth = 1,
|
|
11845
|
-
blockHeight = 1,
|
|
11846
11970
|
compressed = false
|
|
11847
11971
|
} = formatInfo;
|
|
11848
11972
|
const blockColumns = compressed ? Math.ceil(width / blockWidth) : width;
|
|
11849
|
-
|
|
11850
|
-
const unpaddedBytesPerRow = blockColumns * bytesPerBlock;
|
|
11851
|
-
const bytesPerRow = Math.ceil(unpaddedBytesPerRow / byteAlignment) * byteAlignment;
|
|
11852
|
-
const rowsPerImage = blockRows;
|
|
11853
|
-
const byteLength = bytesPerRow * rowsPerImage * depth;
|
|
11854
|
-
return {
|
|
11855
|
-
bytesPerPixel,
|
|
11856
|
-
bytesPerRow,
|
|
11857
|
-
rowsPerImage,
|
|
11858
|
-
depthOrArrayLayers: depth,
|
|
11859
|
-
bytesPerImage: bytesPerRow * rowsPerImage,
|
|
11860
|
-
byteLength
|
|
11861
|
-
};
|
|
11973
|
+
return Math.ceil(blockColumns * bytesPerBlock / byteAlignment) * byteAlignment;
|
|
11862
11974
|
}
|
|
11863
11975
|
function getTextureFormatCapabilities(format) {
|
|
11864
11976
|
const info = getTextureFormatDefinition(format);
|
|
@@ -11880,7 +11992,18 @@ ${declarations.join("\n")}`).match(
|
|
|
11880
11992
|
formatCapabilities.filter &&= !isDepthStencil && !isSigned && !isInteger && !isWebGLSpecific;
|
|
11881
11993
|
return formatCapabilities;
|
|
11882
11994
|
}
|
|
11995
|
+
var textureFormatInfoCache = /* @__PURE__ */ new Map();
|
|
11883
11996
|
function getTextureFormatInfo(format) {
|
|
11997
|
+
let formatInfo = textureFormatInfoCache.get(format);
|
|
11998
|
+
if (!formatInfo) {
|
|
11999
|
+
const decoded = decodeTextureFormatInfo(format);
|
|
12000
|
+
decoded.bitsPerChannel = Object.freeze([...decoded.bitsPerChannel]);
|
|
12001
|
+
formatInfo = Object.freeze(decoded);
|
|
12002
|
+
textureFormatInfoCache.set(format, formatInfo);
|
|
12003
|
+
}
|
|
12004
|
+
return formatInfo;
|
|
12005
|
+
}
|
|
12006
|
+
function decodeTextureFormatInfo(format) {
|
|
11884
12007
|
let formatInfo = getTextureFormatInfoUsingTable(format);
|
|
11885
12008
|
if (textureFormatDecoder.isCompressed(format)) {
|
|
11886
12009
|
formatInfo.channels = "rgb";
|
|
@@ -12020,9 +12143,9 @@ ${declarations.join("\n")}`).match(
|
|
|
12020
12143
|
}
|
|
12021
12144
|
|
|
12022
12145
|
// ../core/src/api/adapter/resources/sampler.ts
|
|
12023
|
-
var Sampler = class _Sampler extends
|
|
12146
|
+
var Sampler = class _Sampler extends DeviceResource {
|
|
12024
12147
|
static defaultProps = {
|
|
12025
|
-
...
|
|
12148
|
+
...DeviceResource.defaultProps,
|
|
12026
12149
|
type: "color-sampler",
|
|
12027
12150
|
addressModeU: "clamp-to-edge",
|
|
12028
12151
|
addressModeV: "clamp-to-edge",
|
|
@@ -12047,8 +12170,24 @@ ${declarations.join("\n")}`).match(
|
|
|
12047
12170
|
return props;
|
|
12048
12171
|
}
|
|
12049
12172
|
};
|
|
12173
|
+
function setTextureSampler(texture, sampler) {
|
|
12174
|
+
const nextSampler = sampler instanceof Sampler ? sampler : texture.device.createSampler(sampler);
|
|
12175
|
+
if (nextSampler === texture.sampler) {
|
|
12176
|
+
return;
|
|
12177
|
+
}
|
|
12178
|
+
if (!(sampler instanceof Sampler)) {
|
|
12179
|
+
nextSampler.transferOwnershipTo(texture);
|
|
12180
|
+
}
|
|
12181
|
+
const previousSampler = texture.sampler;
|
|
12182
|
+
texture.sampler = nextSampler;
|
|
12183
|
+
if (previousSampler?.owner === texture) {
|
|
12184
|
+
previousSampler.destroy();
|
|
12185
|
+
}
|
|
12186
|
+
}
|
|
12050
12187
|
|
|
12051
12188
|
// ../core/src/api/adapter/resources/texture.ts
|
|
12189
|
+
var textureLayoutScratchPool = [];
|
|
12190
|
+
var emptyTextureReadOptions = Object.freeze({});
|
|
12052
12191
|
var BASE_DIMENSIONS = {
|
|
12053
12192
|
"1d": "1d",
|
|
12054
12193
|
"2d": "2d",
|
|
@@ -12057,7 +12196,7 @@ ${declarations.join("\n")}`).match(
|
|
|
12057
12196
|
"cube-array": "2d",
|
|
12058
12197
|
"3d": "3d"
|
|
12059
12198
|
};
|
|
12060
|
-
var Texture = class _Texture extends
|
|
12199
|
+
var Texture = class _Texture extends DeviceResource {
|
|
12061
12200
|
/** The texture can be bound for use as a sampled texture in a shader */
|
|
12062
12201
|
static SAMPLE = 4;
|
|
12063
12202
|
/** The texture can be bound for use as a storage texture in a shader */
|
|
@@ -12145,7 +12284,7 @@ ${declarations.join("\n")}`).match(
|
|
|
12145
12284
|
}
|
|
12146
12285
|
/** Set sampler props associated with this texture */
|
|
12147
12286
|
setSampler(sampler) {
|
|
12148
|
-
this
|
|
12287
|
+
setTextureSampler(this, sampler);
|
|
12149
12288
|
}
|
|
12150
12289
|
/**
|
|
12151
12290
|
* Copy raw image data (bytes) into the texture.
|
|
@@ -12167,17 +12306,24 @@ ${declarations.join("\n")}`).match(
|
|
|
12167
12306
|
* Calculates the memory layout of the texture, required when reading and writing data.
|
|
12168
12307
|
* @return the backend-aligned linear layout, in particular bytesPerRow which includes any required padding for buffer copy/read paths
|
|
12169
12308
|
*/
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
const
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12309
|
+
/** The optional result is caller-owned; internal scratch never escapes this call. */
|
|
12310
|
+
computeMemoryLayout(options_ = emptyTextureReadOptions, result) {
|
|
12311
|
+
const scratch = textureLayoutScratchPool.pop() || {
|
|
12312
|
+
readOptions: {},
|
|
12313
|
+
layoutOptions: {}
|
|
12314
|
+
};
|
|
12315
|
+
try {
|
|
12316
|
+
const options = this._normalizeTextureReadOptions(options_, scratch.readOptions);
|
|
12317
|
+
const layoutOptions = scratch.layoutOptions;
|
|
12318
|
+
layoutOptions.format = this.format;
|
|
12319
|
+
layoutOptions.width = options.width;
|
|
12320
|
+
layoutOptions.height = options.height;
|
|
12321
|
+
layoutOptions.depth = options.depthOrArrayLayers;
|
|
12322
|
+
layoutOptions.byteAlignment = this.byteAlignment;
|
|
12323
|
+
return textureFormatDecoder.computeMemoryLayout(layoutOptions, result);
|
|
12324
|
+
} finally {
|
|
12325
|
+
textureLayoutScratchPool.push(scratch);
|
|
12326
|
+
}
|
|
12181
12327
|
}
|
|
12182
12328
|
/**
|
|
12183
12329
|
* Read the contents of a texture into a GPU Buffer.
|
|
@@ -12286,59 +12432,57 @@ ${declarations.join("\n")}`).match(
|
|
|
12286
12432
|
});
|
|
12287
12433
|
}
|
|
12288
12434
|
}
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
const
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12435
|
+
/** The optional result is caller-owned scratch storage; every result field is overwritten. */
|
|
12436
|
+
_normalizeCopyImageDataOptions(options_, result = {}) {
|
|
12437
|
+
const { data, depth, depthOrArrayLayers } = options_;
|
|
12438
|
+
this._normalizeTextureWriteOptions(options_, result);
|
|
12439
|
+
if (depthOrArrayLayers === void 0 && depth !== void 0) {
|
|
12440
|
+
const mipDepth = this.dimension === "3d" ? Math.max(1, this.depth >> result.mipLevel) : this.depth;
|
|
12441
|
+
result.depthOrArrayLayers = Math.min(depth, mipDepth - result.z);
|
|
12442
|
+
}
|
|
12443
|
+
result.data = data;
|
|
12444
|
+
result.depth = result.depthOrArrayLayers;
|
|
12445
|
+
return result;
|
|
12296
12446
|
}
|
|
12297
|
-
_normalizeCopyExternalImageOptions(options_) {
|
|
12298
|
-
const
|
|
12299
|
-
const mipLevel = optionsWithoutUndefined.mipLevel ?? 0;
|
|
12300
|
-
const mipLevelSize = this._getMipLevelSize(mipLevel);
|
|
12447
|
+
_normalizeCopyExternalImageOptions(options_, result = {}) {
|
|
12448
|
+
const { width, height } = options_;
|
|
12301
12449
|
const size = this.device.getExternalImageSize(options_.image);
|
|
12302
|
-
const options =
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
options.
|
|
12450
|
+
const options = _Texture._normalizeOptions(
|
|
12451
|
+
options_,
|
|
12452
|
+
_Texture.defaultCopyExternalImageOptions,
|
|
12453
|
+
result
|
|
12454
|
+
);
|
|
12455
|
+
const mipWidth = Math.max(1, this.width >> options.mipLevel);
|
|
12456
|
+
const mipHeight = this.baseDimension === "1d" ? 1 : Math.max(1, this.height >> options.mipLevel);
|
|
12457
|
+
const mipDepth = this.dimension === "3d" ? Math.max(1, this.depth >> options.mipLevel) : this.depth;
|
|
12458
|
+
options.width = Math.min(width ?? size.width, mipWidth - options.x);
|
|
12459
|
+
options.height = Math.min(height ?? size.height, mipHeight - options.y);
|
|
12460
|
+
options.depth = Math.min(options.depth, mipDepth - options.z);
|
|
12311
12461
|
return options;
|
|
12312
12462
|
}
|
|
12313
|
-
_normalizeCopyElementImageOptions(options_) {
|
|
12314
|
-
const
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
options.width = Math.min(options.width,
|
|
12323
|
-
options.height = Math.min(options.height,
|
|
12324
|
-
options.depth = Math.min(options.depth,
|
|
12463
|
+
_normalizeCopyElementImageOptions(options_, result = {}) {
|
|
12464
|
+
const options = _Texture._normalizeOptions(
|
|
12465
|
+
options_,
|
|
12466
|
+
_Texture.defaultCopyElementImageOptions,
|
|
12467
|
+
result
|
|
12468
|
+
);
|
|
12469
|
+
const mipWidth = Math.max(1, this.width >> options.mipLevel);
|
|
12470
|
+
const mipHeight = this.baseDimension === "1d" ? 1 : Math.max(1, this.height >> options.mipLevel);
|
|
12471
|
+
const mipDepth = this.dimension === "3d" ? Math.max(1, this.depth >> options.mipLevel) : this.depth;
|
|
12472
|
+
options.width = Math.min(options.width ?? mipWidth, mipWidth - options.x);
|
|
12473
|
+
options.height = Math.min(options.height ?? mipHeight, mipHeight - options.y);
|
|
12474
|
+
options.depth = Math.min(options.depth, mipDepth - options.z);
|
|
12325
12475
|
return options;
|
|
12326
12476
|
}
|
|
12327
|
-
_normalizeTextureReadOptions(options_) {
|
|
12328
|
-
const
|
|
12329
|
-
const
|
|
12330
|
-
const
|
|
12331
|
-
const
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
options.width = Math.min(options.width, mipLevelSize.width - options.x);
|
|
12337
|
-
options.height = Math.min(options.height, mipLevelSize.height - options.y);
|
|
12338
|
-
options.depthOrArrayLayers = Math.min(
|
|
12339
|
-
options.depthOrArrayLayers,
|
|
12340
|
-
mipLevelSize.depthOrArrayLayers - options.z
|
|
12341
|
-
);
|
|
12477
|
+
_normalizeTextureReadOptions(options_, result = {}) {
|
|
12478
|
+
const { depthOrArrayLayers } = options_;
|
|
12479
|
+
const options = _Texture._normalizeOptions(options_, _Texture.defaultTextureReadOptions, result);
|
|
12480
|
+
const mipWidth = Math.max(1, this.width >> options.mipLevel);
|
|
12481
|
+
const mipHeight = this.baseDimension === "1d" ? 1 : Math.max(1, this.height >> options.mipLevel);
|
|
12482
|
+
const mipDepth = this.dimension === "3d" ? Math.max(1, this.depth >> options.mipLevel) : this.depth;
|
|
12483
|
+
options.width = Math.min(options.width ?? mipWidth, mipWidth - options.x);
|
|
12484
|
+
options.height = Math.min(options.height ?? mipHeight, mipHeight - options.y);
|
|
12485
|
+
options.depthOrArrayLayers = Math.min(depthOrArrayLayers ?? mipDepth, mipDepth - options.z);
|
|
12342
12486
|
return options;
|
|
12343
12487
|
}
|
|
12344
12488
|
/**
|
|
@@ -12393,31 +12537,15 @@ ${declarations.join("\n")}`).match(
|
|
|
12393
12537
|
throw new Error(`${this} color readback does not support format ${this.format}`);
|
|
12394
12538
|
}
|
|
12395
12539
|
}
|
|
12396
|
-
_normalizeTextureWriteOptions(options_) {
|
|
12397
|
-
const
|
|
12398
|
-
|
|
12399
|
-
const
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
options.width = Math.min(options.width, mipLevelSize.width - options.x);
|
|
12406
|
-
options.height = Math.min(options.height, mipLevelSize.height - options.y);
|
|
12407
|
-
options.depthOrArrayLayers = Math.min(
|
|
12408
|
-
options.depthOrArrayLayers,
|
|
12409
|
-
mipLevelSize.depthOrArrayLayers - options.z
|
|
12410
|
-
);
|
|
12411
|
-
const layout = textureFormatDecoder.computeMemoryLayout({
|
|
12412
|
-
format: this.format,
|
|
12413
|
-
width: options.width,
|
|
12414
|
-
height: options.height,
|
|
12415
|
-
depth: options.depthOrArrayLayers,
|
|
12416
|
-
byteAlignment: this.byteAlignment
|
|
12417
|
-
});
|
|
12418
|
-
const minimumBytesPerRow = layout.bytesPerPixel * options.width;
|
|
12419
|
-
options.bytesPerRow = optionsWithoutUndefined.bytesPerRow ?? layout.bytesPerRow;
|
|
12420
|
-
options.rowsPerImage = optionsWithoutUndefined.rowsPerImage ?? options.height;
|
|
12540
|
+
_normalizeTextureWriteOptions(options_, result = {}) {
|
|
12541
|
+
const { byteOffset = 0, bytesPerRow, rowsPerImage } = options_;
|
|
12542
|
+
this._normalizeTextureReadOptions(options_, result);
|
|
12543
|
+
const options = result;
|
|
12544
|
+
options.byteOffset = byteOffset;
|
|
12545
|
+
const formatInfo = this.device.getTextureFormatInfo(this.format);
|
|
12546
|
+
const minimumBytesPerRow = formatInfo.bytesPerPixel * options.width;
|
|
12547
|
+
options.bytesPerRow = bytesPerRow ?? getTextureBytesPerRow(formatInfo, options.width, this.byteAlignment);
|
|
12548
|
+
options.rowsPerImage = rowsPerImage ?? options.height;
|
|
12421
12549
|
if (options.bytesPerRow < minimumBytesPerRow) {
|
|
12422
12550
|
throw new Error(
|
|
12423
12551
|
`bytesPerRow (${options.bytesPerRow}) must be at least ${minimumBytesPerRow} for ${this.format}`
|
|
@@ -12428,7 +12556,7 @@ ${declarations.join("\n")}`).match(
|
|
|
12428
12556
|
`rowsPerImage (${options.rowsPerImage}) must be at least ${options.height} for ${this.format}`
|
|
12429
12557
|
);
|
|
12430
12558
|
}
|
|
12431
|
-
const bytesPerPixel =
|
|
12559
|
+
const { bytesPerPixel } = formatInfo;
|
|
12432
12560
|
if (bytesPerPixel && options.bytesPerRow % bytesPerPixel !== 0) {
|
|
12433
12561
|
throw new Error(
|
|
12434
12562
|
`bytesPerRow (${options.bytesPerRow}) must be a multiple of bytesPerPixel (${bytesPerPixel}) for ${this.format}`
|
|
@@ -12456,13 +12584,15 @@ ${declarations.join("\n")}`).match(
|
|
|
12456
12584
|
}
|
|
12457
12585
|
return allocatedByteLength * this.samples;
|
|
12458
12586
|
}
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12587
|
+
/** Fill every declared field, resetting stale scratch values without allocating entries or spreads. */
|
|
12588
|
+
static _normalizeOptions(options, defaults, result) {
|
|
12589
|
+
for (const key in defaults) {
|
|
12590
|
+
result[key] = options[key] === void 0 ? defaults[key] : options[key];
|
|
12591
|
+
}
|
|
12592
|
+
return result;
|
|
12463
12593
|
}
|
|
12464
12594
|
static defaultProps = {
|
|
12465
|
-
...
|
|
12595
|
+
...DeviceResource.defaultProps,
|
|
12466
12596
|
data: null,
|
|
12467
12597
|
dimension: "2d",
|
|
12468
12598
|
format: "rgba8unorm",
|
|
@@ -12536,19 +12666,6 @@ ${declarations.join("\n")}`).match(
|
|
|
12536
12666
|
mipLevel: 0,
|
|
12537
12667
|
aspect: "all"
|
|
12538
12668
|
};
|
|
12539
|
-
static defaultTextureWriteOptions = {
|
|
12540
|
-
byteOffset: 0,
|
|
12541
|
-
bytesPerRow: void 0,
|
|
12542
|
-
rowsPerImage: void 0,
|
|
12543
|
-
x: 0,
|
|
12544
|
-
y: 0,
|
|
12545
|
-
z: 0,
|
|
12546
|
-
width: void 0,
|
|
12547
|
-
height: void 0,
|
|
12548
|
-
depthOrArrayLayers: 1,
|
|
12549
|
-
mipLevel: 0,
|
|
12550
|
-
aspect: "all"
|
|
12551
|
-
};
|
|
12552
12669
|
};
|
|
12553
12670
|
|
|
12554
12671
|
// ../core/src/api/adapter-utils/bind-groups.ts
|
|
@@ -16545,7 +16662,7 @@ void main(void) {
|
|
|
16545
16662
|
};
|
|
16546
16663
|
|
|
16547
16664
|
// src/scenegraph/scenegraph-node.ts
|
|
16548
|
-
function
|
|
16665
|
+
function assert11(condition, message) {
|
|
16549
16666
|
if (!condition) {
|
|
16550
16667
|
throw new Error(message);
|
|
16551
16668
|
}
|
|
@@ -16587,17 +16704,17 @@ void main(void) {
|
|
|
16587
16704
|
return `{type: ScenegraphNode, id: ${this.id})}`;
|
|
16588
16705
|
}
|
|
16589
16706
|
setPosition(position) {
|
|
16590
|
-
|
|
16707
|
+
assert11(position.length === 3, "setPosition requires vector argument");
|
|
16591
16708
|
this.position = position;
|
|
16592
16709
|
return this;
|
|
16593
16710
|
}
|
|
16594
16711
|
setRotation(rotation) {
|
|
16595
|
-
|
|
16712
|
+
assert11(rotation.length === 3 || rotation.length === 4, "setRotation requires vector argument");
|
|
16596
16713
|
this.rotation = rotation;
|
|
16597
16714
|
return this;
|
|
16598
16715
|
}
|
|
16599
16716
|
setScale(scale5) {
|
|
16600
|
-
|
|
16717
|
+
assert11(scale5.length === 3, "setScale requires vector argument");
|
|
16601
16718
|
this.scale = scale5;
|
|
16602
16719
|
return this;
|
|
16603
16720
|
}
|
|
@@ -17828,7 +17945,7 @@ void main(void) {
|
|
|
17828
17945
|
this._observeSource();
|
|
17829
17946
|
return this._updateTimestamp;
|
|
17830
17947
|
}
|
|
17831
|
-
/**
|
|
17948
|
+
/** DeviceResource label used by debug output. */
|
|
17832
17949
|
get [Symbol.toStringTag]() {
|
|
17833
17950
|
return "VideoTexture";
|
|
17834
17951
|
}
|