@kitware/vtk.js 22.2.1 → 22.4.0
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/Rendering/OpenGL/RenderWindow.js +6 -0
- package/Rendering/SceneGraph/RenderWindowViewNode.js +5 -0
- package/Rendering/WebGPU/BindGroup.js +5 -4
- package/Rendering/WebGPU/Buffer.js +6 -3
- package/Rendering/WebGPU/BufferManager.js +3 -1
- package/Rendering/WebGPU/Device.js +1 -1
- package/Rendering/WebGPU/Glyph3DMapper.js +3 -2
- package/Rendering/WebGPU/HardwareSelectionPass.js +11 -7
- package/Rendering/WebGPU/HardwareSelector.js +6 -2
- package/Rendering/WebGPU/ImageMapper.js +14 -12
- package/Rendering/WebGPU/MapperHelper.js +3 -2
- package/Rendering/WebGPU/OpaquePass.js +11 -7
- package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +14 -8
- package/Rendering/WebGPU/Pipeline.js +6 -5
- package/Rendering/WebGPU/PolyDataMapper.js +7 -5
- package/Rendering/WebGPU/RenderEncoder.js +12 -3
- package/Rendering/WebGPU/RenderWindow.js +7 -0
- package/Rendering/WebGPU/Renderer.js +9 -6
- package/Rendering/WebGPU/Sampler.js +4 -3
- package/Rendering/WebGPU/StorageBuffer.js +6 -5
- package/Rendering/WebGPU/Texture.js +13 -7
- package/Rendering/WebGPU/TextureView.js +10 -21
- package/Rendering/WebGPU/UniformBuffer.js +6 -5
- package/Rendering/WebGPU/VolumePass.js +42 -28
- package/Rendering/WebGPU/VolumePassFSQ.js +32 -16
- package/Widgets/Core/WidgetManager.js +211 -71
- package/Widgets/Widgets3D/SplineWidget/behavior.js +9 -6
- package/package.json +5 -6
|
@@ -816,6 +816,12 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
816
816
|
return true;
|
|
817
817
|
};
|
|
818
818
|
|
|
819
|
+
publicAPI.createSelector = function () {
|
|
820
|
+
var ret = vtkHardwareSelector.newInstance();
|
|
821
|
+
ret.setOpenGLRenderWindow(publicAPI);
|
|
822
|
+
return ret;
|
|
823
|
+
};
|
|
824
|
+
|
|
819
825
|
publicAPI.delete = macro.chain(publicAPI.delete, publicAPI.setViewStream, deleteGLContext);
|
|
820
826
|
} // ----------------------------------------------------------------------------
|
|
821
827
|
// Object factory
|
|
@@ -123,6 +123,11 @@ function vtkRenderWindowViewNode(publicAPI, model) {
|
|
|
123
123
|
macro.vtkErrorMacro('not implemented');
|
|
124
124
|
return undefined;
|
|
125
125
|
};
|
|
126
|
+
|
|
127
|
+
publicAPI.createSelector = function () {
|
|
128
|
+
macro.vtkErrorMacro('not implemented');
|
|
129
|
+
return undefined;
|
|
130
|
+
};
|
|
126
131
|
} // ----------------------------------------------------------------------------
|
|
127
132
|
// Object factory
|
|
128
133
|
// ----------------------------------------------------------------------------
|
|
@@ -66,7 +66,8 @@ function vtkWebGPUBindGroup(publicAPI, model) {
|
|
|
66
66
|
|
|
67
67
|
model.bindGroup = device.getHandle().createBindGroup({
|
|
68
68
|
layout: publicAPI.getBindGroupLayout(device),
|
|
69
|
-
entries: entries
|
|
69
|
+
entries: entries,
|
|
70
|
+
label: model.label
|
|
70
71
|
});
|
|
71
72
|
model.bindGroupTime.modified();
|
|
72
73
|
return model.bindGroup;
|
|
@@ -74,7 +75,7 @@ function vtkWebGPUBindGroup(publicAPI, model) {
|
|
|
74
75
|
|
|
75
76
|
publicAPI.getShaderCode = function (pipeline) {
|
|
76
77
|
var lines = [];
|
|
77
|
-
var bgroup = pipeline.getBindGroupLayoutCount(model.
|
|
78
|
+
var bgroup = pipeline.getBindGroupLayoutCount(model.label);
|
|
78
79
|
|
|
79
80
|
for (var i = 0; i < model.bindables.length; i++) {
|
|
80
81
|
lines.push(model.bindables[i].getShaderCode(i, bgroup));
|
|
@@ -90,7 +91,7 @@ function vtkWebGPUBindGroup(publicAPI, model) {
|
|
|
90
91
|
var DEFAULT_VALUES = {
|
|
91
92
|
device: null,
|
|
92
93
|
handle: null,
|
|
93
|
-
|
|
94
|
+
label: null
|
|
94
95
|
}; // ----------------------------------------------------------------------------
|
|
95
96
|
|
|
96
97
|
function extend(publicAPI, model) {
|
|
@@ -104,7 +105,7 @@ function extend(publicAPI, model) {
|
|
|
104
105
|
mtime: 0
|
|
105
106
|
});
|
|
106
107
|
macro.get(publicAPI, model, ['bindGroupTime', 'handle', 'sizeInBytes', 'usage']);
|
|
107
|
-
macro.setGet(publicAPI, model, ['
|
|
108
|
+
macro.setGet(publicAPI, model, ['label', 'device', 'arrayInformation', 'sourceTime']);
|
|
108
109
|
vtkWebGPUBindGroup(publicAPI, model);
|
|
109
110
|
} // ----------------------------------------------------------------------------
|
|
110
111
|
|
|
@@ -41,7 +41,8 @@ function vtkWebGPUBuffer(publicAPI, model) {
|
|
|
41
41
|
publicAPI.create = function (sizeInBytes, usage) {
|
|
42
42
|
model.handle = model.device.getHandle().createBuffer({
|
|
43
43
|
size: sizeInBytes,
|
|
44
|
-
usage: usage
|
|
44
|
+
usage: usage,
|
|
45
|
+
label: model.label
|
|
45
46
|
});
|
|
46
47
|
model.sizeInBytes = sizeInBytes;
|
|
47
48
|
model.usage = usage;
|
|
@@ -55,7 +56,8 @@ function vtkWebGPUBuffer(publicAPI, model) {
|
|
|
55
56
|
model.handle = model.device.getHandle().createBuffer({
|
|
56
57
|
size: data.byteLength,
|
|
57
58
|
usage: usage,
|
|
58
|
-
mappedAtCreation: true
|
|
59
|
+
mappedAtCreation: true,
|
|
60
|
+
label: model.label
|
|
59
61
|
});
|
|
60
62
|
model.sizeInBytes = data.byteLength;
|
|
61
63
|
model.usage = usage;
|
|
@@ -88,6 +90,7 @@ var DEFAULT_VALUES = {
|
|
|
88
90
|
strideInBytes: 0,
|
|
89
91
|
arrayInformation: null,
|
|
90
92
|
usage: null,
|
|
93
|
+
label: null,
|
|
91
94
|
sourceTime: null
|
|
92
95
|
}; // ----------------------------------------------------------------------------
|
|
93
96
|
|
|
@@ -97,7 +100,7 @@ function extend(publicAPI, model) {
|
|
|
97
100
|
|
|
98
101
|
macro.obj(publicAPI, model);
|
|
99
102
|
macro.get(publicAPI, model, ['handle', 'sizeInBytes', 'usage']);
|
|
100
|
-
macro.setGet(publicAPI, model, ['strideInBytes', 'device', 'arrayInformation', 'sourceTime']);
|
|
103
|
+
macro.setGet(publicAPI, model, ['strideInBytes', 'device', 'arrayInformation', 'label', 'sourceTime']);
|
|
101
104
|
vtkWebGPUBuffer(publicAPI, model);
|
|
102
105
|
} // ----------------------------------------------------------------------------
|
|
103
106
|
|
|
@@ -406,7 +406,9 @@ function vtkWebGPUBufferManager(publicAPI, model) {
|
|
|
406
406
|
} // create one
|
|
407
407
|
|
|
408
408
|
|
|
409
|
-
var buffer = vtkWebGPUBuffer.newInstance(
|
|
409
|
+
var buffer = vtkWebGPUBuffer.newInstance({
|
|
410
|
+
label: req.label
|
|
411
|
+
});
|
|
410
412
|
buffer.setDevice(model.device);
|
|
411
413
|
var gpuUsage = null; // handle uniform buffers
|
|
412
414
|
|
|
@@ -126,8 +126,9 @@ function extend(publicAPI, model) {
|
|
|
126
126
|
obj(model.glyphBOBuildTime, {
|
|
127
127
|
mtime: 0
|
|
128
128
|
});
|
|
129
|
-
model.SSBO = vtkWebGPUStorageBuffer.newInstance(
|
|
130
|
-
|
|
129
|
+
model.SSBO = vtkWebGPUStorageBuffer.newInstance({
|
|
130
|
+
label: 'glyphSSBO'
|
|
131
|
+
}); // Object methods
|
|
131
132
|
|
|
132
133
|
vtkWebGPUGlyph3DMapper(publicAPI, model);
|
|
133
134
|
|
|
@@ -25,7 +25,9 @@ function vtkWebGPUHardwareSelectionPass(publicAPI, model) {
|
|
|
25
25
|
if (!model.selectionRenderEncoder) {
|
|
26
26
|
publicAPI.createRenderEncoder(); // create color texture
|
|
27
27
|
|
|
28
|
-
model.colorTexture = vtkWebGPUTexture.newInstance(
|
|
28
|
+
model.colorTexture = vtkWebGPUTexture.newInstance({
|
|
29
|
+
label: 'hardwareSelectorColor'
|
|
30
|
+
});
|
|
29
31
|
model.colorTexture.create(device, {
|
|
30
32
|
width: viewNode.getCanvas().width,
|
|
31
33
|
height: viewNode.getCanvas().height,
|
|
@@ -36,11 +38,12 @@ function vtkWebGPUHardwareSelectionPass(publicAPI, model) {
|
|
|
36
38
|
/* eslint-disable no-bitwise */
|
|
37
39
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC
|
|
38
40
|
});
|
|
39
|
-
var v1 = model.colorTexture.createView();
|
|
40
|
-
v1.setName('hardwareSelectColorTexture');
|
|
41
|
+
var v1 = model.colorTexture.createView('hardwareSelectColorTexture');
|
|
41
42
|
model.selectionRenderEncoder.setColorTextureView(0, v1); // create depth texture
|
|
42
43
|
|
|
43
|
-
model.depthTexture = vtkWebGPUTexture.newInstance(
|
|
44
|
+
model.depthTexture = vtkWebGPUTexture.newInstance({
|
|
45
|
+
label: 'hardwareSelectorDepth'
|
|
46
|
+
});
|
|
44
47
|
model.depthTexture.create(device, {
|
|
45
48
|
width: viewNode.getCanvas().width,
|
|
46
49
|
height: viewNode.getCanvas().height,
|
|
@@ -51,8 +54,7 @@ function vtkWebGPUHardwareSelectionPass(publicAPI, model) {
|
|
|
51
54
|
/* eslint-disable no-bitwise */
|
|
52
55
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC
|
|
53
56
|
});
|
|
54
|
-
var v2 = model.depthTexture.createView();
|
|
55
|
-
v2.setName('hardwareSelectDepthTexture');
|
|
57
|
+
var v2 = model.depthTexture.createView('hardwareSelectDepthTexture');
|
|
56
58
|
model.selectionRenderEncoder.setDepthTextureView(v2);
|
|
57
59
|
} else {
|
|
58
60
|
model.colorTexture.resize(viewNode.getCanvas().width, viewNode.getCanvas().height);
|
|
@@ -69,7 +71,9 @@ function vtkWebGPUHardwareSelectionPass(publicAPI, model) {
|
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
publicAPI.createRenderEncoder = function () {
|
|
72
|
-
model.selectionRenderEncoder = vtkWebGPURenderEncoder.newInstance(
|
|
74
|
+
model.selectionRenderEncoder = vtkWebGPURenderEncoder.newInstance({
|
|
75
|
+
label: 'HardwareSelectionPass'
|
|
76
|
+
}); // default settings are fine for this
|
|
73
77
|
|
|
74
78
|
model.selectionRenderEncoder.setPipelineHash('sel');
|
|
75
79
|
model.selectionRenderEncoder.setReplaceShaderCodeFunction(function (pipeline) {
|
|
@@ -290,7 +290,9 @@ function vtkWebGPUHardwareSelector(publicAPI, model) {
|
|
|
290
290
|
|
|
291
291
|
result.colorBufferWidth = 16 * Math.floor((result.width + 15) / 16);
|
|
292
292
|
result.colorBufferSizeInBytes = result.colorBufferWidth * result.height * 4 * 4;
|
|
293
|
-
colorBuffer = vtkWebGPUBuffer.newInstance(
|
|
293
|
+
colorBuffer = vtkWebGPUBuffer.newInstance({
|
|
294
|
+
label: 'hardwareSelectColorBuffer'
|
|
295
|
+
});
|
|
294
296
|
colorBuffer.setDevice(device);
|
|
295
297
|
/* eslint-disable no-bitwise */
|
|
296
298
|
|
|
@@ -316,7 +318,9 @@ function vtkWebGPUHardwareSelector(publicAPI, model) {
|
|
|
316
318
|
|
|
317
319
|
if (model.captureZValues) {
|
|
318
320
|
result.zbufferBufferWidth = 64 * Math.floor((result.width + 63) / 64);
|
|
319
|
-
zbuffer = vtkWebGPUBuffer.newInstance(
|
|
321
|
+
zbuffer = vtkWebGPUBuffer.newInstance({
|
|
322
|
+
label: 'hardwareSelectDepthBuffer'
|
|
323
|
+
});
|
|
320
324
|
zbuffer.setDevice(device);
|
|
321
325
|
result.zbufferSizeInBytes = result.height * result.zbufferBufferWidth * 4;
|
|
322
326
|
/* eslint-disable no-bitwise */
|
|
@@ -258,8 +258,7 @@ function vtkWebGPUImageMapper(publicAPI, model) {
|
|
|
258
258
|
format: 'rgba8unorm'
|
|
259
259
|
};
|
|
260
260
|
var newTex = device.getTextureManager().getTexture(treq);
|
|
261
|
-
var tview = newTex.createView();
|
|
262
|
-
tview.setName('tfunTexture');
|
|
261
|
+
var tview = newTex.createView('tfunTexture');
|
|
263
262
|
var tViews = model.helper.getTextureViews();
|
|
264
263
|
tViews[1] = tview;
|
|
265
264
|
}
|
|
@@ -276,8 +275,7 @@ function vtkWebGPUImageMapper(publicAPI, model) {
|
|
|
276
275
|
var tViews = model.helper.getTextureViews();
|
|
277
276
|
|
|
278
277
|
if (!tViews[0] || tViews[0].getTexture() !== newTex) {
|
|
279
|
-
var tview = newTex.createView();
|
|
280
|
-
tview.setName("imgTexture");
|
|
278
|
+
var tview = newTex.createView('imgTexture');
|
|
281
279
|
tViews[0] = tview;
|
|
282
280
|
}
|
|
283
281
|
|
|
@@ -293,8 +291,9 @@ function vtkWebGPUImageMapper(publicAPI, model) {
|
|
|
293
291
|
var iType = actorProperty.getInterpolationType() === InterpolationType.NEAREST ? 'nearest' : 'linear';
|
|
294
292
|
|
|
295
293
|
if (!model.clampSampler || iType !== model.clampSampler.getOptions().minFilter) {
|
|
296
|
-
model.clampSampler = vtkWebGPUSampler.newInstance(
|
|
297
|
-
|
|
294
|
+
model.clampSampler = vtkWebGPUSampler.newInstance({
|
|
295
|
+
label: 'clampSampler'
|
|
296
|
+
});
|
|
298
297
|
model.clampSampler.create(device, {
|
|
299
298
|
minFilter: iType,
|
|
300
299
|
magFilter: iType
|
|
@@ -389,8 +388,9 @@ function extend(publicAPI, model) {
|
|
|
389
388
|
vtkViewNode.extend(publicAPI, model, initialValues);
|
|
390
389
|
model.helper = vtkWebGPUFullScreenQuad.newInstance();
|
|
391
390
|
model.helper.setFragmentShaderTemplate(imgFragTemplate);
|
|
392
|
-
model.UBO = vtkWebGPUUniformBuffer.newInstance(
|
|
393
|
-
|
|
391
|
+
model.UBO = vtkWebGPUUniformBuffer.newInstance({
|
|
392
|
+
label: 'mapperUBO'
|
|
393
|
+
});
|
|
394
394
|
model.UBO.addEntry('SCTCMatrix', 'mat4x4<f32>');
|
|
395
395
|
model.UBO.addEntry('Origin', 'vec4<f32>');
|
|
396
396
|
model.UBO.addEntry('Axis2', 'vec4<f32>');
|
|
@@ -398,10 +398,12 @@ function extend(publicAPI, model) {
|
|
|
398
398
|
model.UBO.addEntry('cScale', 'vec4<f32>');
|
|
399
399
|
model.UBO.addEntry('cShift', 'vec4<f32>');
|
|
400
400
|
model.helper.setUBO(model.UBO);
|
|
401
|
-
model.SSBO = vtkWebGPUStorageBuffer.newInstance(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
model.componentSSBO.
|
|
401
|
+
model.SSBO = vtkWebGPUStorageBuffer.newInstance({
|
|
402
|
+
label: 'volumeSSBO'
|
|
403
|
+
});
|
|
404
|
+
model.componentSSBO = vtkWebGPUStorageBuffer.newInstance({
|
|
405
|
+
label: 'componentSSBO'
|
|
406
|
+
});
|
|
405
407
|
model.lutBuildTime = {};
|
|
406
408
|
obj(model.lutBuildTime, {
|
|
407
409
|
mtime: 0
|
|
@@ -230,8 +230,9 @@ function extend(publicAPI, model) {
|
|
|
230
230
|
macro.obj(publicAPI, model);
|
|
231
231
|
model.textureViews = [];
|
|
232
232
|
model.vertexInput = vtkWebGPUVertexInput.newInstance();
|
|
233
|
-
model.bindGroup = vtkWebGPUBindGroup.newInstance(
|
|
234
|
-
|
|
233
|
+
model.bindGroup = vtkWebGPUBindGroup.newInstance({
|
|
234
|
+
label: 'mapperBG'
|
|
235
|
+
});
|
|
235
236
|
model.additionalBindables = [];
|
|
236
237
|
model.fragmentShaderTemplate = model.fragmentShaderTemplate || vtkWebGPUMapperHelperFS;
|
|
237
238
|
model.vertexShaderTemplate = model.vertexShaderTemplate || vtkWebGPUMapperHelperVS;
|
|
@@ -21,7 +21,9 @@ function vtkWebGPUOpaquePass(publicAPI, model) {
|
|
|
21
21
|
|
|
22
22
|
if (!model.renderEncoder) {
|
|
23
23
|
publicAPI.createRenderEncoder();
|
|
24
|
-
model.colorTexture = vtkWebGPUTexture.newInstance(
|
|
24
|
+
model.colorTexture = vtkWebGPUTexture.newInstance({
|
|
25
|
+
label: 'opaquePassColor'
|
|
26
|
+
});
|
|
25
27
|
model.colorTexture.create(device, {
|
|
26
28
|
width: viewNode.getCanvas().width,
|
|
27
29
|
height: viewNode.getCanvas().height,
|
|
@@ -32,19 +34,19 @@ function vtkWebGPUOpaquePass(publicAPI, model) {
|
|
|
32
34
|
/* eslint-disable no-bitwise */
|
|
33
35
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC
|
|
34
36
|
});
|
|
35
|
-
var ctView = model.colorTexture.createView();
|
|
36
|
-
ctView.setName('opaquePassColorTexture');
|
|
37
|
+
var ctView = model.colorTexture.createView('opaquePassColorTexture');
|
|
37
38
|
model.renderEncoder.setColorTextureView(0, ctView);
|
|
38
39
|
model.depthFormat = 'depth32float';
|
|
39
|
-
model.depthTexture = vtkWebGPUTexture.newInstance(
|
|
40
|
+
model.depthTexture = vtkWebGPUTexture.newInstance({
|
|
41
|
+
label: 'opaquePassDepth'
|
|
42
|
+
});
|
|
40
43
|
model.depthTexture.create(device, {
|
|
41
44
|
width: viewNode.getCanvas().width,
|
|
42
45
|
height: viewNode.getCanvas().height,
|
|
43
46
|
format: model.depthFormat,
|
|
44
47
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC
|
|
45
48
|
});
|
|
46
|
-
var dView = model.depthTexture.createView();
|
|
47
|
-
dView.setName('opaquePassDepthTexture');
|
|
49
|
+
var dView = model.depthTexture.createView('opaquePassDepthTexture');
|
|
48
50
|
model.renderEncoder.setDepthTextureView(dView);
|
|
49
51
|
} else {
|
|
50
52
|
model.colorTexture.resize(viewNode.getCanvas().width, viewNode.getCanvas().height);
|
|
@@ -66,7 +68,9 @@ function vtkWebGPUOpaquePass(publicAPI, model) {
|
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
publicAPI.createRenderEncoder = function () {
|
|
69
|
-
model.renderEncoder = vtkWebGPURenderEncoder.newInstance(
|
|
71
|
+
model.renderEncoder = vtkWebGPURenderEncoder.newInstance({
|
|
72
|
+
label: 'OpaquePass'
|
|
73
|
+
}); // default settings are fine for this
|
|
70
74
|
|
|
71
75
|
model.renderEncoder.setPipelineHash('op');
|
|
72
76
|
};
|
|
@@ -26,7 +26,9 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
|
|
|
26
26
|
if (!model.translucentRenderEncoder) {
|
|
27
27
|
publicAPI.createRenderEncoder();
|
|
28
28
|
publicAPI.createFinalEncoder();
|
|
29
|
-
model.translucentColorTexture = vtkWebGPUTexture.newInstance(
|
|
29
|
+
model.translucentColorTexture = vtkWebGPUTexture.newInstance({
|
|
30
|
+
label: 'translucentPassColor'
|
|
31
|
+
});
|
|
30
32
|
model.translucentColorTexture.create(device, {
|
|
31
33
|
width: viewNode.getCanvas().width,
|
|
32
34
|
height: viewNode.getCanvas().height,
|
|
@@ -37,10 +39,11 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
|
|
|
37
39
|
/* eslint-disable no-bitwise */
|
|
38
40
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
|
|
39
41
|
});
|
|
40
|
-
var v1 = model.translucentColorTexture.createView();
|
|
41
|
-
v1.setName('oitpColorTexture');
|
|
42
|
+
var v1 = model.translucentColorTexture.createView('oitpColorTexture');
|
|
42
43
|
model.translucentRenderEncoder.setColorTextureView(0, v1);
|
|
43
|
-
model.translucentAccumulateTexture = vtkWebGPUTexture.newInstance(
|
|
44
|
+
model.translucentAccumulateTexture = vtkWebGPUTexture.newInstance({
|
|
45
|
+
label: 'translucentPassAccumulate'
|
|
46
|
+
});
|
|
44
47
|
model.translucentAccumulateTexture.create(device, {
|
|
45
48
|
width: viewNode.getCanvas().width,
|
|
46
49
|
height: viewNode.getCanvas().height,
|
|
@@ -51,8 +54,7 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
|
|
|
51
54
|
/* eslint-disable no-bitwise */
|
|
52
55
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
|
|
53
56
|
});
|
|
54
|
-
var v2 = model.translucentAccumulateTexture.createView();
|
|
55
|
-
v2.setName('oitpAccumTexture');
|
|
57
|
+
var v2 = model.translucentAccumulateTexture.createView('oitpAccumTexture');
|
|
56
58
|
model.translucentRenderEncoder.setColorTextureView(1, v2);
|
|
57
59
|
model.fullScreenQuad = vtkWebGPUFullScreenQuad.newInstance();
|
|
58
60
|
model.fullScreenQuad.setDevice(viewNode.getDevice());
|
|
@@ -88,7 +90,9 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
|
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
publicAPI.createRenderEncoder = function () {
|
|
91
|
-
model.translucentRenderEncoder = vtkWebGPURenderEncoder.newInstance(
|
|
93
|
+
model.translucentRenderEncoder = vtkWebGPURenderEncoder.newInstance({
|
|
94
|
+
label: 'translucentRender'
|
|
95
|
+
});
|
|
92
96
|
var rDesc = model.translucentRenderEncoder.getDescription();
|
|
93
97
|
rDesc.colorAttachments = [{
|
|
94
98
|
view: undefined,
|
|
@@ -157,7 +161,9 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
|
|
|
157
161
|
};
|
|
158
162
|
|
|
159
163
|
publicAPI.createFinalEncoder = function () {
|
|
160
|
-
model.translucentFinalEncoder = vtkWebGPURenderEncoder.newInstance(
|
|
164
|
+
model.translucentFinalEncoder = vtkWebGPURenderEncoder.newInstance({
|
|
165
|
+
label: 'translucentFinal'
|
|
166
|
+
});
|
|
161
167
|
model.translucentFinalEncoder.setDescription({
|
|
162
168
|
colorAttachments: [{
|
|
163
169
|
view: null,
|
|
@@ -11,11 +11,12 @@ function vtkWebGPUPipeline(publicAPI, model) {
|
|
|
11
11
|
return model.shaderDescriptions;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
publicAPI.initialize = function (device) {
|
|
14
|
+
publicAPI.initialize = function (device, hash) {
|
|
15
15
|
// start with the renderencoder settings
|
|
16
16
|
model.pipelineDescription = model.renderEncoder.getPipelineSettings();
|
|
17
17
|
model.pipelineDescription.primitive.topology = model.topology;
|
|
18
|
-
model.pipelineDescription.vertex = model.vertexState;
|
|
18
|
+
model.pipelineDescription.vertex = model.vertexState;
|
|
19
|
+
model.pipelineDescription.label = hash; // add in bind group layouts
|
|
19
20
|
|
|
20
21
|
var bindGroupLayouts = [];
|
|
21
22
|
|
|
@@ -61,7 +62,7 @@ function vtkWebGPUPipeline(publicAPI, model) {
|
|
|
61
62
|
|
|
62
63
|
model.layouts.push({
|
|
63
64
|
layout: bindGroup.getBindGroupLayout(model.device),
|
|
64
|
-
|
|
65
|
+
label: bindGroup.getLabel()
|
|
65
66
|
});
|
|
66
67
|
};
|
|
67
68
|
|
|
@@ -69,9 +70,9 @@ function vtkWebGPUPipeline(publicAPI, model) {
|
|
|
69
70
|
return model.layouts[idx].layout;
|
|
70
71
|
};
|
|
71
72
|
|
|
72
|
-
publicAPI.getBindGroupLayoutCount = function (
|
|
73
|
+
publicAPI.getBindGroupLayoutCount = function (llabel) {
|
|
73
74
|
for (var i = 0; i < model.layouts.length; i++) {
|
|
74
|
-
if (model.layouts[i].
|
|
75
|
+
if (model.layouts[i].label === llabel) {
|
|
75
76
|
return i;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
@@ -419,7 +419,9 @@ function vtkWebGPUPolyDataMapper(publicAPI, model) {
|
|
|
419
419
|
|
|
420
420
|
if (idata) {
|
|
421
421
|
if (!model.colorTexture) {
|
|
422
|
-
model.colorTexture = vtkTexture.newInstance(
|
|
422
|
+
model.colorTexture = vtkTexture.newInstance({
|
|
423
|
+
label: 'polyDataColor'
|
|
424
|
+
});
|
|
423
425
|
}
|
|
424
426
|
|
|
425
427
|
model.colorTexture.setInputData(idata);
|
|
@@ -470,8 +472,7 @@ function vtkWebGPUPolyDataMapper(publicAPI, model) {
|
|
|
470
472
|
|
|
471
473
|
if (!found) {
|
|
472
474
|
usedTextures[model.textures.length] = true;
|
|
473
|
-
var tview = newTex.createView();
|
|
474
|
-
tview.setName("Texture".concat(usedCount++));
|
|
475
|
+
var tview = newTex.createView("Texture".concat(usedCount++));
|
|
475
476
|
model.textures.push(newTex);
|
|
476
477
|
model.textureViews.push(tview);
|
|
477
478
|
var interpolate = srcTexture.getInterpolate() ? 'linear' : 'nearest';
|
|
@@ -631,8 +632,9 @@ function extend(publicAPI, model) {
|
|
|
631
632
|
model.tmpMat4 = mat4.identity(new Float64Array(16));
|
|
632
633
|
model.fragmentShaderTemplate = model.fragmentShaderTemplate || vtkWebGPUPolyDataFS;
|
|
633
634
|
model.vertexShaderTemplate = model.vertexShaderTemplate || vtkWebGPUPolyDataVS;
|
|
634
|
-
model.UBO = vtkWebGPUUniformBuffer.newInstance(
|
|
635
|
-
|
|
635
|
+
model.UBO = vtkWebGPUUniformBuffer.newInstance({
|
|
636
|
+
label: 'mapperUBO'
|
|
637
|
+
});
|
|
636
638
|
model.UBO.addEntry('BCWCMatrix', 'mat4x4<f32>');
|
|
637
639
|
model.UBO.addEntry('BCSCMatrix', 'mat4x4<f32>');
|
|
638
640
|
model.UBO.addEntry('MCWCNormals', 'mat4x4<f32>');
|
|
@@ -11,9 +11,17 @@ function vtkWebGPURenderEncoder(publicAPI, model) {
|
|
|
11
11
|
|
|
12
12
|
publicAPI.begin = function (encoder) {
|
|
13
13
|
model.handle = encoder.beginRenderPass(model.description);
|
|
14
|
+
|
|
15
|
+
if (model.label) {
|
|
16
|
+
model.handle.pushDebugGroup(model.label);
|
|
17
|
+
}
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
publicAPI.end = function () {
|
|
21
|
+
if (model.label) {
|
|
22
|
+
model.handle.popDebugGroup();
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
model.handle.endPass();
|
|
18
26
|
};
|
|
19
27
|
|
|
@@ -65,7 +73,7 @@ function vtkWebGPURenderEncoder(publicAPI, model) {
|
|
|
65
73
|
|
|
66
74
|
publicAPI.activateBindGroup = function (bg) {
|
|
67
75
|
var device = model.boundPipeline.getDevice();
|
|
68
|
-
var midx = model.boundPipeline.getBindGroupLayoutCount(bg.
|
|
76
|
+
var midx = model.boundPipeline.getBindGroupLayoutCount(bg.getLabel());
|
|
69
77
|
model.handle.setBindGroup(midx, bg.getBindGroup(device)); // verify bind group layout matches
|
|
70
78
|
|
|
71
79
|
var bgl1 = device.getBindGroupLayoutDescription(bg.getBindGroupLayout(device));
|
|
@@ -118,7 +126,8 @@ var DEFAULT_VALUES = {
|
|
|
118
126
|
pipelineHash: null,
|
|
119
127
|
pipelineSettings: null,
|
|
120
128
|
replaceShaderCodeFunction: null,
|
|
121
|
-
depthTextureView: null
|
|
129
|
+
depthTextureView: null,
|
|
130
|
+
label: null
|
|
122
131
|
}; // ----------------------------------------------------------------------------
|
|
123
132
|
|
|
124
133
|
function extend(publicAPI, model) {
|
|
@@ -177,7 +186,7 @@ function extend(publicAPI, model) {
|
|
|
177
186
|
};
|
|
178
187
|
model.colorTextureViews = [];
|
|
179
188
|
get(publicAPI, model, ['boundPipeline', 'colorTextureViews']);
|
|
180
|
-
setGet(publicAPI, model, ['depthTextureView', 'description', 'handle', 'pipelineHash', 'pipelineSettings', 'replaceShaderCodeFunction']); // For more macro methods, see "Sources/macros.js"
|
|
189
|
+
setGet(publicAPI, model, ['depthTextureView', 'description', 'handle', 'label', 'pipelineHash', 'pipelineSettings', 'replaceShaderCodeFunction']); // For more macro methods, see "Sources/macros.js"
|
|
181
190
|
// Object specific methods
|
|
182
191
|
|
|
183
192
|
vtkWebGPURenderEncoder(publicAPI, model);
|
|
@@ -598,6 +598,13 @@ function vtkWebGPURenderWindow(publicAPI, model) {
|
|
|
598
598
|
}
|
|
599
599
|
}, _callee2);
|
|
600
600
|
}));
|
|
601
|
+
|
|
602
|
+
publicAPI.createSelector = function () {
|
|
603
|
+
var ret = vtkWebGPUHardwareSelector.newInstance();
|
|
604
|
+
ret.setWebGPURenderWindow(publicAPI);
|
|
605
|
+
return ret;
|
|
606
|
+
};
|
|
607
|
+
|
|
601
608
|
publicAPI.delete = macro.chain(publicAPI.delete, publicAPI.setViewStream);
|
|
602
609
|
} // ----------------------------------------------------------------------------
|
|
603
610
|
// Object factory
|
|
@@ -181,8 +181,9 @@ function vtkWebGPURenderer(publicAPI, model) {
|
|
|
181
181
|
model.clearFSQ.setDevice(device);
|
|
182
182
|
model.clearFSQ.setPipelineHash('clearfsq');
|
|
183
183
|
model.clearFSQ.setFragmentShaderTemplate(clearFragTemplate);
|
|
184
|
-
var ubo = vtkWebGPUUniformBuffer.newInstance(
|
|
185
|
-
|
|
184
|
+
var ubo = vtkWebGPUUniformBuffer.newInstance({
|
|
185
|
+
label: 'mapperUBO'
|
|
186
|
+
});
|
|
186
187
|
ubo.addEntry('BackgroundColor', 'vec4<f32>');
|
|
187
188
|
model.clearFSQ.setUBO(ubo);
|
|
188
189
|
}
|
|
@@ -334,8 +335,9 @@ function extend(publicAPI, model) {
|
|
|
334
335
|
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
335
336
|
|
|
336
337
|
vtkViewNode.extend(publicAPI, model, initialValues);
|
|
337
|
-
model.UBO = vtkWebGPUUniformBuffer.newInstance(
|
|
338
|
-
|
|
338
|
+
model.UBO = vtkWebGPUUniformBuffer.newInstance({
|
|
339
|
+
label: 'rendererUBO'
|
|
340
|
+
});
|
|
339
341
|
model.UBO.addEntry('WCVCMatrix', 'mat4x4<f32>');
|
|
340
342
|
model.UBO.addEntry('SCPCMatrix', 'mat4x4<f32>');
|
|
341
343
|
model.UBO.addEntry('PCSCMatrix', 'mat4x4<f32>');
|
|
@@ -344,8 +346,9 @@ function extend(publicAPI, model) {
|
|
|
344
346
|
model.UBO.addEntry('WCVCNormals', 'mat4x4<f32>');
|
|
345
347
|
model.UBO.addEntry('viewportSize', 'vec2<f32>');
|
|
346
348
|
model.UBO.addEntry('cameraParallel', 'u32');
|
|
347
|
-
model.bindGroup = vtkWebGPUBindGroup.newInstance(
|
|
348
|
-
|
|
349
|
+
model.bindGroup = vtkWebGPUBindGroup.newInstance({
|
|
350
|
+
label: 'rendererBG'
|
|
351
|
+
});
|
|
349
352
|
model.bindGroup.setBindables([model.UBO]);
|
|
350
353
|
model.tmpMat4 = mat4.identity(new Float64Array(16));
|
|
351
354
|
model.stabilizedTime = {};
|
|
@@ -14,12 +14,13 @@ function vtkWebGPUSampler(publicAPI, model) {
|
|
|
14
14
|
model.device = device;
|
|
15
15
|
model.options.magFilter = options.magFilter ? options.magFilter : 'nearest';
|
|
16
16
|
model.options.minFilter = options.minFilter ? options.minFilter : 'nearest';
|
|
17
|
+
model.options.label = model.label;
|
|
17
18
|
model.handle = model.device.getHandle().createSampler(model.options);
|
|
18
19
|
model.bindGroupTime.modified();
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
publicAPI.getShaderCode = function (binding, group) {
|
|
22
|
-
var result = "@binding(".concat(binding, ") @group(").concat(group, ") var ").concat(model.
|
|
23
|
+
var result = "@binding(".concat(binding, ") @group(").concat(group, ") var ").concat(model.label, ": sampler;");
|
|
23
24
|
return result;
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -37,7 +38,7 @@ function vtkWebGPUSampler(publicAPI, model) {
|
|
|
37
38
|
var DEFAULT_VALUES = {
|
|
38
39
|
device: null,
|
|
39
40
|
handle: null,
|
|
40
|
-
|
|
41
|
+
label: null,
|
|
41
42
|
options: null
|
|
42
43
|
}; // ----------------------------------------------------------------------------
|
|
43
44
|
|
|
@@ -60,7 +61,7 @@ function extend(publicAPI, model) {
|
|
|
60
61
|
mtime: 0
|
|
61
62
|
});
|
|
62
63
|
macro.get(publicAPI, model, ['bindGroupTime', 'handle', 'options']);
|
|
63
|
-
macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'device', '
|
|
64
|
+
macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'device', 'label']);
|
|
64
65
|
vtkWebGPUSampler(publicAPI, model);
|
|
65
66
|
} // ----------------------------------------------------------------------------
|
|
66
67
|
|
|
@@ -41,7 +41,8 @@ function vtkWebGPUStorageBuffer(publicAPI, model) {
|
|
|
41
41
|
var req = {
|
|
42
42
|
nativeArray: model.Float32Array,
|
|
43
43
|
time: 0,
|
|
44
|
-
usage: BufferUsage.Storage
|
|
44
|
+
usage: BufferUsage.Storage,
|
|
45
|
+
label: model.label
|
|
45
46
|
};
|
|
46
47
|
model._buffer = device.getBufferManager().getBuffer(req);
|
|
47
48
|
model.bindGroupTime.modified();
|
|
@@ -171,14 +172,14 @@ function vtkWebGPUStorageBuffer(publicAPI, model) {
|
|
|
171
172
|
};
|
|
172
173
|
|
|
173
174
|
publicAPI.getShaderCode = function (binding, group) {
|
|
174
|
-
var lines = ["struct ".concat(model.
|
|
175
|
+
var lines = ["struct ".concat(model.label, "StructEntry\n{")];
|
|
175
176
|
|
|
176
177
|
for (var i = 0; i < model.bufferEntries.length; i++) {
|
|
177
178
|
var entry = model.bufferEntries[i];
|
|
178
179
|
lines.push(" ".concat(entry.name, ": ").concat(entry.type, ";"));
|
|
179
180
|
}
|
|
180
181
|
|
|
181
|
-
lines.push("\n};\nstruct ".concat(model.
|
|
182
|
+
lines.push("\n};\nstruct ".concat(model.label, "Struct\n{\n values: array<").concat(model.label, "StructEntry>;\n};\n@binding(").concat(binding, ") @group(").concat(group, ") var<storage, read> ").concat(model.label, ": ").concat(model.label, "Struct;\n"));
|
|
182
183
|
return lines.join('\n');
|
|
183
184
|
};
|
|
184
185
|
|
|
@@ -209,7 +210,7 @@ var DEFAULT_VALUES = {
|
|
|
209
210
|
bufferEntries: null,
|
|
210
211
|
bufferEntryNames: null,
|
|
211
212
|
sizeInBytes: 0,
|
|
212
|
-
|
|
213
|
+
label: null,
|
|
213
214
|
numberOfInstances: 1
|
|
214
215
|
}; // ----------------------------------------------------------------------------
|
|
215
216
|
|
|
@@ -236,7 +237,7 @@ function extend(publicAPI, model) {
|
|
|
236
237
|
}
|
|
237
238
|
};
|
|
238
239
|
macro.get(publicAPI, model, ['bindGroupTime']);
|
|
239
|
-
macro.setGet(publicAPI, model, ['device', 'bindGroupLayoutEntry', '
|
|
240
|
+
macro.setGet(publicAPI, model, ['device', 'bindGroupLayoutEntry', 'label', 'numberOfInstances', 'sizeInBytes']); // Object methods
|
|
240
241
|
|
|
241
242
|
vtkWebGPUStorageBuffer(publicAPI, model);
|
|
242
243
|
} // ----------------------------------------------------------------------------
|