@kitware/vtk.js 22.2.3 → 22.3.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/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/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 +28 -20
- package/Rendering/WebGPU/VolumePassFSQ.js +15 -15
- package/package.json +2 -3
|
@@ -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);
|
|
@@ -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
|
} // ----------------------------------------------------------------------------
|
|
@@ -36,6 +36,7 @@ function vtkWebGPUTexture(publicAPI, model) {
|
|
|
36
36
|
format: model.format,
|
|
37
37
|
// 'rgba8unorm',
|
|
38
38
|
usage: model.usage,
|
|
39
|
+
label: model.label,
|
|
39
40
|
dimension: dimension
|
|
40
41
|
});
|
|
41
42
|
};
|
|
@@ -172,7 +173,8 @@ function vtkWebGPUTexture(publicAPI, model) {
|
|
|
172
173
|
model.handle = model.device.getHandle().createTexture({
|
|
173
174
|
size: [model.width, model.height, model.depth],
|
|
174
175
|
format: model.format,
|
|
175
|
-
usage: model.usage
|
|
176
|
+
usage: model.usage,
|
|
177
|
+
label: model.label
|
|
176
178
|
});
|
|
177
179
|
}
|
|
178
180
|
};
|
|
@@ -187,20 +189,23 @@ function vtkWebGPUTexture(publicAPI, model) {
|
|
|
187
189
|
model.handle = model.device.getHandle().createTexture({
|
|
188
190
|
size: [model.width, model.height, model.depth],
|
|
189
191
|
format: model.format,
|
|
190
|
-
usage: model.usage
|
|
192
|
+
usage: model.usage,
|
|
193
|
+
label: model.label
|
|
191
194
|
});
|
|
192
195
|
}
|
|
193
196
|
};
|
|
194
197
|
|
|
195
|
-
publicAPI.createView = function () {
|
|
196
|
-
var options = arguments.length >
|
|
198
|
+
publicAPI.createView = function (label) {
|
|
199
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
197
200
|
|
|
198
201
|
// if options is missing values try to add them in
|
|
199
202
|
if (!options.dimension) {
|
|
200
203
|
options.dimension = model.depth === 1 ? '2d' : '3d';
|
|
201
204
|
}
|
|
202
205
|
|
|
203
|
-
var view = vtkWebGPUTextureView.newInstance(
|
|
206
|
+
var view = vtkWebGPUTextureView.newInstance({
|
|
207
|
+
label: label
|
|
208
|
+
});
|
|
204
209
|
view.create(publicAPI, options);
|
|
205
210
|
return view;
|
|
206
211
|
};
|
|
@@ -213,7 +218,8 @@ var DEFAULT_VALUES = {
|
|
|
213
218
|
device: null,
|
|
214
219
|
handle: null,
|
|
215
220
|
buffer: null,
|
|
216
|
-
ready: false
|
|
221
|
+
ready: false,
|
|
222
|
+
label: null
|
|
217
223
|
}; // ----------------------------------------------------------------------------
|
|
218
224
|
|
|
219
225
|
function extend(publicAPI, model) {
|
|
@@ -222,7 +228,7 @@ function extend(publicAPI, model) {
|
|
|
222
228
|
|
|
223
229
|
macro.obj(publicAPI, model);
|
|
224
230
|
macro.get(publicAPI, model, ['handle', 'ready', 'width', 'height', 'depth', 'format', 'usage']);
|
|
225
|
-
macro.setGet(publicAPI, model, ['device']);
|
|
231
|
+
macro.setGet(publicAPI, model, ['device', 'label']);
|
|
226
232
|
vtkWebGPUTexture(publicAPI, model);
|
|
227
233
|
} // ----------------------------------------------------------------------------
|
|
228
234
|
|
|
@@ -15,6 +15,7 @@ function vtkWebGPUTextureView(publicAPI, model) {
|
|
|
15
15
|
model.texture = texture;
|
|
16
16
|
model.options = options;
|
|
17
17
|
model.options.dimension = model.options.dimension || '2d';
|
|
18
|
+
model.options.label = model.label;
|
|
18
19
|
model.textureHandle = texture.getHandle();
|
|
19
20
|
model.handle = model.textureHandle.createView(model.options);
|
|
20
21
|
model.bindGroupLayoutEntry.texture.viewDimension = model.options.dimension;
|
|
@@ -38,33 +39,21 @@ function vtkWebGPUTextureView(publicAPI, model) {
|
|
|
38
39
|
ttype = 'u32';
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
var result = "@binding(".concat(binding, ") @group(").concat(group, ") var ").concat(model.
|
|
42
|
+
var result = "@binding(".concat(binding, ") @group(").concat(group, ") var ").concat(model.label, ": texture_").concat(model.options.dimension, "<").concat(ttype, ">;");
|
|
42
43
|
|
|
43
44
|
if (model.bindGroupLayoutEntry.texture.sampleType === 'depth') {
|
|
44
|
-
result = "@binding(".concat(binding, ") @group(").concat(group, ") var ").concat(model.
|
|
45
|
+
result = "@binding(".concat(binding, ") @group(").concat(group, ") var ").concat(model.label, ": texture_depth_").concat(model.options.dimension, ";");
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
return result;
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
publicAPI.addSampler = function (device, options) {
|
|
51
|
-
var newSamp = vtkWebGPUSampler.newInstance(
|
|
52
|
+
var newSamp = vtkWebGPUSampler.newInstance({
|
|
53
|
+
label: "".concat(model.label, "Sampler")
|
|
54
|
+
});
|
|
52
55
|
newSamp.create(device, options);
|
|
53
56
|
publicAPI.setSampler(newSamp);
|
|
54
|
-
model.sampler.setName("".concat(model.name, "Sampler"));
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
publicAPI.setName = function (val) {
|
|
58
|
-
if (model.sampler) {
|
|
59
|
-
model.sampler.setName("".concat(val, "Sampler"));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (model.name === val) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
model.name = val;
|
|
67
|
-
publicAPI.modified();
|
|
68
57
|
};
|
|
69
58
|
|
|
70
59
|
publicAPI.getBindGroupTime = function () {
|
|
@@ -96,8 +85,8 @@ function vtkWebGPUTextureView(publicAPI, model) {
|
|
|
96
85
|
var DEFAULT_VALUES = {
|
|
97
86
|
texture: null,
|
|
98
87
|
handle: null,
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
sampler: null,
|
|
89
|
+
label: null
|
|
101
90
|
}; // ----------------------------------------------------------------------------
|
|
102
91
|
|
|
103
92
|
function extend(publicAPI, model) {
|
|
@@ -120,8 +109,8 @@ function extend(publicAPI, model) {
|
|
|
120
109
|
macro.obj(model.bindGroupTime, {
|
|
121
110
|
mtime: 0
|
|
122
111
|
});
|
|
123
|
-
macro.get(publicAPI, model, ['bindGroupTime', '
|
|
124
|
-
macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'sampler']);
|
|
112
|
+
macro.get(publicAPI, model, ['bindGroupTime', 'texture']);
|
|
113
|
+
macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'label', 'sampler']);
|
|
125
114
|
vtkWebGPUTextureView(publicAPI, model);
|
|
126
115
|
} // ----------------------------------------------------------------------------
|
|
127
116
|
|
|
@@ -207,7 +207,8 @@ function vtkWebGPUUniformBuffer(publicAPI, model) {
|
|
|
207
207
|
var req = {
|
|
208
208
|
nativeArray: model.Float32Array,
|
|
209
209
|
time: 0,
|
|
210
|
-
usage: BufferUsage.UniformArray
|
|
210
|
+
usage: BufferUsage.UniformArray,
|
|
211
|
+
label: model.label
|
|
211
212
|
};
|
|
212
213
|
model.UBO = device.getBufferManager().getBuffer(req);
|
|
213
214
|
model.bindGroupTime.modified();
|
|
@@ -301,14 +302,14 @@ function vtkWebGPUUniformBuffer(publicAPI, model) {
|
|
|
301
302
|
publicAPI.getShaderCode = function (binding, group) {
|
|
302
303
|
// sort the entries
|
|
303
304
|
publicAPI.sortBufferEntries();
|
|
304
|
-
var lines = ["struct ".concat(model.
|
|
305
|
+
var lines = ["struct ".concat(model.label, "Struct\n{")];
|
|
305
306
|
|
|
306
307
|
for (var i = 0; i < model.bufferEntries.length; i++) {
|
|
307
308
|
var entry = model.bufferEntries[i];
|
|
308
309
|
lines.push(" ".concat(entry.name, ": ").concat(entry.type, ";"));
|
|
309
310
|
}
|
|
310
311
|
|
|
311
|
-
lines.push("};\n@binding(".concat(binding, ") @group(").concat(group, ") var<uniform> ").concat(model.
|
|
312
|
+
lines.push("};\n@binding(".concat(binding, ") @group(").concat(group, ") var<uniform> ").concat(model.label, ": ").concat(model.label, "Struct;"));
|
|
312
313
|
return lines.join('\n');
|
|
313
314
|
};
|
|
314
315
|
} // ----------------------------------------------------------------------------
|
|
@@ -320,7 +321,7 @@ var DEFAULT_VALUES = {
|
|
|
320
321
|
bufferEntries: null,
|
|
321
322
|
bufferEntryNames: null,
|
|
322
323
|
sizeInBytes: 0,
|
|
323
|
-
|
|
324
|
+
label: null,
|
|
324
325
|
bindGroupLayoutEntry: null,
|
|
325
326
|
bindGroupEntry: null
|
|
326
327
|
}; // ----------------------------------------------------------------------------
|
|
@@ -350,7 +351,7 @@ function extend(publicAPI, model) {
|
|
|
350
351
|
model.sendDirty = true;
|
|
351
352
|
model.sortDirty = true;
|
|
352
353
|
macro.get(publicAPI, model, ['binding', 'bindGroupTime']);
|
|
353
|
-
macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'device', '
|
|
354
|
+
macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'device', 'label', 'sizeInBytes']); // Object methods
|
|
354
355
|
|
|
355
356
|
vtkWebGPUUniformBuffer(publicAPI, model);
|
|
356
357
|
} // ----------------------------------------------------------------------------
|
|
@@ -34,7 +34,7 @@ var BufferUsage = vtkWebGPUBufferManager.BufferUsage,
|
|
|
34
34
|
|
|
35
35
|
var cubeFaceTriangles = [[0, 4, 6], [0, 6, 2], [1, 3, 7], [1, 7, 5], [0, 5, 4], [0, 1, 5], [2, 6, 7], [2, 7, 3], [0, 3, 1], [0, 2, 3], [4, 5, 7], [4, 7, 6]];
|
|
36
36
|
var DepthBoundsFS = "\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@stage(fragment)\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2<i32>(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";
|
|
37
|
-
var volumeCopyFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@stage(fragment)\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4<f32> = textureSample(
|
|
37
|
+
var volumeCopyFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@stage(fragment)\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4<f32> = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";
|
|
38
38
|
/* eslint-disable no-undef */
|
|
39
39
|
|
|
40
40
|
/* eslint-disable no-bitwise */
|
|
@@ -76,9 +76,9 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
76
76
|
|
|
77
77
|
model._volumeCopyQuad.setFragmentShaderTemplate(volumeCopyFragTemplate);
|
|
78
78
|
|
|
79
|
-
model._copyUBO = vtkWebGPUUniformBuffer.newInstance(
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
model._copyUBO = vtkWebGPUUniformBuffer.newInstance({
|
|
80
|
+
label: 'mapperUBO'
|
|
81
|
+
});
|
|
82
82
|
|
|
83
83
|
model._copyUBO.addEntry('tscale', 'vec2<f32>');
|
|
84
84
|
|
|
@@ -366,7 +366,9 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
366
366
|
|
|
367
367
|
publicAPI.createDepthRangeEncoder = function (viewNode) {
|
|
368
368
|
var device = viewNode.getDevice();
|
|
369
|
-
model._depthRangeEncoder = vtkWebGPURenderEncoder.newInstance(
|
|
369
|
+
model._depthRangeEncoder = vtkWebGPURenderEncoder.newInstance({
|
|
370
|
+
label: 'VolumePass DepthRange'
|
|
371
|
+
});
|
|
370
372
|
|
|
371
373
|
model._depthRangeEncoder.setPipelineHash('volr');
|
|
372
374
|
|
|
@@ -429,7 +431,9 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
429
431
|
}); // and the textures it needs
|
|
430
432
|
|
|
431
433
|
|
|
432
|
-
model._depthRangeTexture = vtkWebGPUTexture.newInstance(
|
|
434
|
+
model._depthRangeTexture = vtkWebGPUTexture.newInstance({
|
|
435
|
+
label: 'volumePassMaxDepth'
|
|
436
|
+
});
|
|
433
437
|
|
|
434
438
|
model._depthRangeTexture.create(device, {
|
|
435
439
|
width: viewNode.getCanvas().width,
|
|
@@ -438,13 +442,13 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
438
442
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
|
|
439
443
|
});
|
|
440
444
|
|
|
441
|
-
var maxView = model._depthRangeTexture.createView();
|
|
442
|
-
|
|
443
|
-
maxView.setName('maxTexture');
|
|
445
|
+
var maxView = model._depthRangeTexture.createView('maxTexture');
|
|
444
446
|
|
|
445
447
|
model._depthRangeEncoder.setColorTextureView(0, maxView);
|
|
446
448
|
|
|
447
|
-
model._depthRangeTexture2 = vtkWebGPUTexture.newInstance(
|
|
449
|
+
model._depthRangeTexture2 = vtkWebGPUTexture.newInstance({
|
|
450
|
+
label: 'volumePassDepthMin'
|
|
451
|
+
});
|
|
448
452
|
|
|
449
453
|
model._depthRangeTexture2.create(device, {
|
|
450
454
|
width: viewNode.getCanvas().width,
|
|
@@ -453,9 +457,7 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
453
457
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
|
|
454
458
|
});
|
|
455
459
|
|
|
456
|
-
var minView = model._depthRangeTexture2.createView();
|
|
457
|
-
|
|
458
|
-
minView.setName('minTexture');
|
|
460
|
+
var minView = model._depthRangeTexture2.createView('minTexture');
|
|
459
461
|
|
|
460
462
|
model._depthRangeEncoder.setColorTextureView(1, minView);
|
|
461
463
|
|
|
@@ -465,7 +467,9 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
465
467
|
};
|
|
466
468
|
|
|
467
469
|
publicAPI.createClearEncoder = function (viewNode) {
|
|
468
|
-
model._colorTexture = vtkWebGPUTexture.newInstance(
|
|
470
|
+
model._colorTexture = vtkWebGPUTexture.newInstance({
|
|
471
|
+
label: 'volumePassColor'
|
|
472
|
+
});
|
|
469
473
|
|
|
470
474
|
model._colorTexture.create(viewNode.getDevice(), {
|
|
471
475
|
width: viewNode.getCanvas().width,
|
|
@@ -478,16 +482,16 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
478
482
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC
|
|
479
483
|
});
|
|
480
484
|
|
|
481
|
-
model._colorTextureView = model._colorTexture.createView();
|
|
482
|
-
|
|
483
|
-
model._colorTextureView.setName('volumePassSmallColorTexture');
|
|
485
|
+
model._colorTextureView = model._colorTexture.createView('volumePassColorTexture');
|
|
484
486
|
|
|
485
487
|
model._colorTextureView.addSampler(viewNode.getDevice(), {
|
|
486
488
|
minFilter: 'linear',
|
|
487
489
|
magFilter: 'linear'
|
|
488
490
|
});
|
|
489
491
|
|
|
490
|
-
model._clearEncoder = vtkWebGPURenderEncoder.newInstance(
|
|
492
|
+
model._clearEncoder = vtkWebGPURenderEncoder.newInstance({
|
|
493
|
+
label: 'VolumePass Clear'
|
|
494
|
+
});
|
|
491
495
|
|
|
492
496
|
model._clearEncoder.setColorTextureView(0, model._colorTextureView);
|
|
493
497
|
|
|
@@ -524,7 +528,9 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
524
528
|
};
|
|
525
529
|
|
|
526
530
|
publicAPI.createCopyEncoder = function (viewNode) {
|
|
527
|
-
model._copyEncoder = vtkWebGPURenderEncoder.newInstance(
|
|
531
|
+
model._copyEncoder = vtkWebGPURenderEncoder.newInstance({
|
|
532
|
+
label: 'volumePassCopy'
|
|
533
|
+
});
|
|
528
534
|
|
|
529
535
|
model._copyEncoder.setDescription({
|
|
530
536
|
colorAttachments: [{
|
|
@@ -559,7 +565,9 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
559
565
|
};
|
|
560
566
|
|
|
561
567
|
publicAPI.createMergeEncoder = function (viewNode) {
|
|
562
|
-
model._mergeEncoder = vtkWebGPURenderEncoder.newInstance(
|
|
568
|
+
model._mergeEncoder = vtkWebGPURenderEncoder.newInstance({
|
|
569
|
+
label: 'volumePassMerge'
|
|
570
|
+
});
|
|
563
571
|
|
|
564
572
|
model._mergeEncoder.setColorTextureView(0, model._colorTextureView);
|
|
565
573
|
|
|
@@ -189,8 +189,7 @@ function vtkWebGPUVolumePassFSQ(publicAPI, model) {
|
|
|
189
189
|
format: 'rgba8unorm'
|
|
190
190
|
};
|
|
191
191
|
var newTex = device.getTextureManager().getTexture(treq);
|
|
192
|
-
var tview = newTex.createView();
|
|
193
|
-
tview.setName('tfunTexture');
|
|
192
|
+
var tview = newTex.createView('tfunTexture');
|
|
194
193
|
model.textureViews[2] = tview;
|
|
195
194
|
}
|
|
196
195
|
{
|
|
@@ -204,9 +203,7 @@ function vtkWebGPUVolumePassFSQ(publicAPI, model) {
|
|
|
204
203
|
|
|
205
204
|
var _newTex = device.getTextureManager().getTexture(_treq);
|
|
206
205
|
|
|
207
|
-
var _tview = _newTex.createView();
|
|
208
|
-
|
|
209
|
-
_tview.setName('ofunTexture');
|
|
206
|
+
var _tview = _newTex.createView('ofunTexture');
|
|
210
207
|
|
|
211
208
|
model.textureViews[3] = _tview;
|
|
212
209
|
}
|
|
@@ -446,8 +443,7 @@ function vtkWebGPUVolumePassFSQ(publicAPI, model) {
|
|
|
446
443
|
var newTex = device.getTextureManager().getTexture(treq);
|
|
447
444
|
|
|
448
445
|
if (!model.textureViews[vidx + 4] || model.textureViews[vidx + 4].getTexture() !== newTex) {
|
|
449
|
-
var tview = newTex.createView();
|
|
450
|
-
tview.setName("volTexture".concat(vidx));
|
|
446
|
+
var tview = newTex.createView("volTexture".concat(vidx));
|
|
451
447
|
model.textureViews[vidx + 4] = tview;
|
|
452
448
|
}
|
|
453
449
|
} // clear any old leftovers
|
|
@@ -498,8 +494,9 @@ function vtkWebGPUVolumePassFSQ(publicAPI, model) {
|
|
|
498
494
|
publicAPI.updateBuffers(device);
|
|
499
495
|
|
|
500
496
|
if (!model.clampSampler) {
|
|
501
|
-
model.clampSampler = vtkWebGPUSampler.newInstance(
|
|
502
|
-
|
|
497
|
+
model.clampSampler = vtkWebGPUSampler.newInstance({
|
|
498
|
+
label: 'clampSampler'
|
|
499
|
+
});
|
|
503
500
|
model.clampSampler.create(device, {
|
|
504
501
|
minFilter: 'linear',
|
|
505
502
|
magFilter: 'linear'
|
|
@@ -534,13 +531,16 @@ function extend(publicAPI, model) {
|
|
|
534
531
|
|
|
535
532
|
vtkWebGPUFullScreenQuad.extend(publicAPI, model, initialValues);
|
|
536
533
|
model.fragmentShaderTemplate = volFragTemplate;
|
|
537
|
-
model.UBO = vtkWebGPUUniformBuffer.newInstance(
|
|
538
|
-
|
|
534
|
+
model.UBO = vtkWebGPUUniformBuffer.newInstance({
|
|
535
|
+
label: 'mapperUBO'
|
|
536
|
+
});
|
|
539
537
|
model.UBO.addEntry('SampleDistance', 'f32');
|
|
540
|
-
model.SSBO = vtkWebGPUStorageBuffer.newInstance(
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
model.componentSSBO.
|
|
538
|
+
model.SSBO = vtkWebGPUStorageBuffer.newInstance({
|
|
539
|
+
label: 'volumeSSBO'
|
|
540
|
+
});
|
|
541
|
+
model.componentSSBO = vtkWebGPUStorageBuffer.newInstance({
|
|
542
|
+
label: 'componentSSBO'
|
|
543
|
+
});
|
|
544
544
|
model.lutBuildTime = {};
|
|
545
545
|
macro.obj(model.lutBuildTime, {
|
|
546
546
|
mtime: 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitware/vtk.js",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.3.0",
|
|
4
4
|
"description": "Visualization Toolkit for the Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3d",
|
|
@@ -112,10 +112,9 @@
|
|
|
112
112
|
"rollup-plugin-string": "3.0.0",
|
|
113
113
|
"rollup-plugin-svgo": "1.1.0",
|
|
114
114
|
"rollup-plugin-web-worker-loader": "1.6.1",
|
|
115
|
-
"semantic-release": "
|
|
115
|
+
"semantic-release": "19.0.2",
|
|
116
116
|
"string-replace-loader": "3.1.0",
|
|
117
117
|
"style-loader": "3.3.1",
|
|
118
|
-
"tap-spec": "5.0.0",
|
|
119
118
|
"tape": "5.4.0",
|
|
120
119
|
"tape-catch": "1.0.6",
|
|
121
120
|
"webpack": "5.65.0",
|