@kitware/vtk.js 22.2.0 → 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/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/FullScreenQuad.js +1 -1
- package/Rendering/WebGPU/Glyph3DMapper.js +5 -4
- package/Rendering/WebGPU/HardwareSelectionPass.js +11 -7
- package/Rendering/WebGPU/HardwareSelector.js +7 -2
- package/Rendering/WebGPU/ImageMapper.js +16 -14
- package/Rendering/WebGPU/MapperHelper.js +7 -6
- package/Rendering/WebGPU/OpaquePass.js +11 -7
- package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +17 -11
- package/Rendering/WebGPU/Pipeline.js +6 -5
- package/Rendering/WebGPU/PolyDataMapper.js +11 -9
- package/Rendering/WebGPU/RenderEncoder.js +12 -3
- package/Rendering/WebGPU/RenderWindow.js +10 -1
- package/Rendering/WebGPU/Renderer.js +10 -7
- package/Rendering/WebGPU/Sampler.js +4 -3
- package/Rendering/WebGPU/ShaderDescription.js +4 -4
- package/Rendering/WebGPU/SphereMapper.js +3 -3
- package/Rendering/WebGPU/StickMapper.js +4 -4
- 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/VertexInput.js +1 -1
- package/Rendering/WebGPU/VolumePass.js +30 -22
- package/Rendering/WebGPU/VolumePassFSQ.js +18 -18
- 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
|
|
|
@@ -11,7 +11,7 @@ function vtkWebGPUFullScreenQuad(publicAPI, model) {
|
|
|
11
11
|
|
|
12
12
|
publicAPI.replaceShaderPosition = function (hash, pipeline, vertexInput) {
|
|
13
13
|
var vDesc = pipeline.getShaderDescription('vertex');
|
|
14
|
-
vDesc.addBuiltinOutput('vec4<f32>', '
|
|
14
|
+
vDesc.addBuiltinOutput('vec4<f32>', '@builtin(position) Position');
|
|
15
15
|
var code = vDesc.getCode();
|
|
16
16
|
code = vtkWebGPUShaderCache.substitute(code, '//VTK::Position::Impl', ['output.tcoordVS = vec2<f32>(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);', 'output.Position = vec4<f32>(vertexBC, 1.0);']).result;
|
|
17
17
|
vDesc.setCode(code);
|
|
@@ -21,8 +21,8 @@ function vtkWebGPUGlyph3DMapper(publicAPI, model) {
|
|
|
21
21
|
|
|
22
22
|
publicAPI.replaceShaderPosition = function (hash, pipeline, vertexInput) {
|
|
23
23
|
var vDesc = pipeline.getShaderDescription('vertex');
|
|
24
|
-
vDesc.addBuiltinInput('u32', '
|
|
25
|
-
vDesc.addBuiltinOutput('vec4<f32>', '
|
|
24
|
+
vDesc.addBuiltinInput('u32', '@builtin(instance_index) instanceIndex');
|
|
25
|
+
vDesc.addBuiltinOutput('vec4<f32>', '@builtin(position) Position');
|
|
26
26
|
var code = vDesc.getCode();
|
|
27
27
|
code = vtkWebGPUShaderCache.substitute(code, '//VTK::Position::Impl', [' output.Position = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix', ' *glyphSSBO.values[input.instanceIndex].matrix', ' *vertexBC;']).result;
|
|
28
28
|
vDesc.setCode(code);
|
|
@@ -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) {
|
|
@@ -278,6 +278,7 @@ function vtkWebGPUHardwareSelector(publicAPI, model) {
|
|
|
278
278
|
// result object (by value in most cases)
|
|
279
279
|
|
|
280
280
|
result = {
|
|
281
|
+
area: [0, 0, texture.getWidth() - 1, texture.getHeight() - 1],
|
|
281
282
|
captureZValues: model.captureZValues,
|
|
282
283
|
fieldAssociation: model.fieldAssociation,
|
|
283
284
|
renderer: renderer,
|
|
@@ -289,7 +290,9 @@ function vtkWebGPUHardwareSelector(publicAPI, model) {
|
|
|
289
290
|
|
|
290
291
|
result.colorBufferWidth = 16 * Math.floor((result.width + 15) / 16);
|
|
291
292
|
result.colorBufferSizeInBytes = result.colorBufferWidth * result.height * 4 * 4;
|
|
292
|
-
colorBuffer = vtkWebGPUBuffer.newInstance(
|
|
293
|
+
colorBuffer = vtkWebGPUBuffer.newInstance({
|
|
294
|
+
label: 'hardwareSelectColorBuffer'
|
|
295
|
+
});
|
|
293
296
|
colorBuffer.setDevice(device);
|
|
294
297
|
/* eslint-disable no-bitwise */
|
|
295
298
|
|
|
@@ -315,7 +318,9 @@ function vtkWebGPUHardwareSelector(publicAPI, model) {
|
|
|
315
318
|
|
|
316
319
|
if (model.captureZValues) {
|
|
317
320
|
result.zbufferBufferWidth = 64 * Math.floor((result.width + 63) / 64);
|
|
318
|
-
zbuffer = vtkWebGPUBuffer.newInstance(
|
|
321
|
+
zbuffer = vtkWebGPUBuffer.newInstance({
|
|
322
|
+
label: 'hardwareSelectDepthBuffer'
|
|
323
|
+
});
|
|
319
324
|
zbuffer.setDevice(device);
|
|
320
325
|
result.zbufferSizeInBytes = result.height * result.zbufferBufferWidth * 4;
|
|
321
326
|
/* eslint-disable no-bitwise */
|
|
@@ -11,7 +11,7 @@ import { InterpolationType } from '../Core/ImageProperty/Constants.js';
|
|
|
11
11
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
12
12
|
|
|
13
13
|
var SlicingMode = Constants.SlicingMode;
|
|
14
|
-
var imgFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n
|
|
14
|
+
var imgFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::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 //VTK::Image::Sample\n\n // var computedColor: vec4<f32> = vec4<f32>(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n"; // ----------------------------------------------------------------------------
|
|
15
15
|
// helper methods
|
|
16
16
|
// ----------------------------------------------------------------------------
|
|
17
17
|
|
|
@@ -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
|
|
@@ -318,7 +317,7 @@ function vtkWebGPUImageMapper(publicAPI, model) {
|
|
|
318
317
|
|
|
319
318
|
publicAPI.replaceShaderPosition = function (hash, pipeline, vertexInput) {
|
|
320
319
|
var vDesc = pipeline.getShaderDescription('vertex');
|
|
321
|
-
vDesc.addBuiltinOutput('vec4<f32>', '
|
|
320
|
+
vDesc.addBuiltinOutput('vec4<f32>', '@builtin(position) Position');
|
|
322
321
|
var code = vDesc.getCode();
|
|
323
322
|
var lines = ['var pos: vec4<f32> = mapperUBO.Origin +', ' (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;', 'pos.w = 1.0;'];
|
|
324
323
|
|
|
@@ -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
|
|
@@ -6,8 +6,8 @@ import vtkWebGPUShaderCache from './ShaderCache.js';
|
|
|
6
6
|
import vtkWebGPUShaderDescription from './ShaderDescription.js';
|
|
7
7
|
import vtkWebGPUVertexInput from './VertexInput.js';
|
|
8
8
|
|
|
9
|
-
var vtkWebGPUMapperHelperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n
|
|
10
|
-
var vtkWebGPUMapperHelperFS = "\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n
|
|
9
|
+
var vtkWebGPUMapperHelperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@stage(vertex)\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4<f32> = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n";
|
|
10
|
+
var vtkWebGPUMapperHelperFS = "\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::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::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4<f32> = vec4<f32>(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"; // ----------------------------------------------------------------------------
|
|
11
11
|
// vtkWebGPUMapperHelper methods
|
|
12
12
|
// ----------------------------------------------------------------------------
|
|
13
13
|
|
|
@@ -94,7 +94,7 @@ function vtkWebGPUMapperHelper(publicAPI, model) {
|
|
|
94
94
|
code = vtkWebGPUShaderCache.substitute(code, '//VTK::Mapper::Dec', [ubocode]).result;
|
|
95
95
|
vDesc.setCode(code);
|
|
96
96
|
var fDesc = pipeline.getShaderDescription('fragment');
|
|
97
|
-
fDesc.addBuiltinInput('bool', '
|
|
97
|
+
fDesc.addBuiltinInput('bool', '@builtin(front_facing) frontFacing');
|
|
98
98
|
code = fDesc.getCode();
|
|
99
99
|
code = vtkWebGPUShaderCache.substitute(code, '//VTK::Mapper::Dec', [ubocode]).result;
|
|
100
100
|
fDesc.setCode(code);
|
|
@@ -104,7 +104,7 @@ function vtkWebGPUMapperHelper(publicAPI, model) {
|
|
|
104
104
|
|
|
105
105
|
publicAPI.replaceShaderPosition = function (hash, pipeline, vertexInput) {
|
|
106
106
|
var vDesc = pipeline.getShaderDescription('vertex');
|
|
107
|
-
vDesc.addBuiltinOutput('vec4<f32>', '
|
|
107
|
+
vDesc.addBuiltinOutput('vec4<f32>', '@builtin(position) Position');
|
|
108
108
|
var code = vDesc.getCode();
|
|
109
109
|
code = vtkWebGPUShaderCache.substitute(code, '//VTK::Position::Impl', [' output.Position = rendererUBO.SCPCMatrix*vertexBC;']).result;
|
|
110
110
|
vDesc.setCode(code);
|
|
@@ -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
|
};
|
|
@@ -5,7 +5,7 @@ import vtkWebGPUShaderCache from './ShaderCache.js';
|
|
|
5
5
|
import vtkRenderPass from '../SceneGraph/RenderPass.js';
|
|
6
6
|
import vtkWebGPUFullScreenQuad from './FullScreenQuad.js';
|
|
7
7
|
|
|
8
|
-
var oitpFragTemplate = "\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n
|
|
8
|
+
var oitpFragTemplate = "\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 tcoord: vec2<i32> = vec2<i32>(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4<f32> = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4<f32> = vec4<f32>(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";
|
|
9
9
|
|
|
10
10
|
function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
|
|
11
11
|
// Set our className
|
|
@@ -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,
|
|
@@ -110,7 +114,7 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
|
|
|
110
114
|
var fDesc = pipeline.getShaderDescription('fragment');
|
|
111
115
|
fDesc.addOutput('vec4<f32>', 'outColor');
|
|
112
116
|
fDesc.addOutput('f32', 'outAccum');
|
|
113
|
-
fDesc.addBuiltinInput('vec4<f32>', '
|
|
117
|
+
fDesc.addBuiltinInput('vec4<f32>', '@builtin(position) fragPos');
|
|
114
118
|
var code = fDesc.getCode();
|
|
115
119
|
code = vtkWebGPUShaderCache.substitute(code, '//VTK::RenderEncoder::Impl', [// very simple depth weighting in w
|
|
116
120
|
'var w: f32 = 1.0 - input.fragPos.z * 0.9;', 'output.outColor = vec4<f32>(computedColor.rgb*computedColor.a, computedColor.a) * w;', 'output.outAccum = computedColor.a;']).result;
|
|
@@ -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,
|
|
@@ -168,7 +174,7 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
|
|
|
168
174
|
model.translucentFinalEncoder.setReplaceShaderCodeFunction(function (pipeline) {
|
|
169
175
|
var fDesc = pipeline.getShaderDescription('fragment');
|
|
170
176
|
fDesc.addOutput('vec4<f32>', 'outColor');
|
|
171
|
-
fDesc.addBuiltinInput('vec4<f32>', '
|
|
177
|
+
fDesc.addBuiltinInput('vec4<f32>', '@builtin(position) fragPos');
|
|
172
178
|
var code = fDesc.getCode();
|
|
173
179
|
code = vtkWebGPUShaderCache.substitute(code, '//VTK::RenderEncoder::Impl', ['output.outColor = vec4<f32>(computedColor.rgb*computedColor.a, computedColor.a);']).result;
|
|
174
180
|
fDesc.setCode(code);
|
|
@@ -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
|
}
|
|
@@ -20,8 +20,8 @@ var StartEvent = {
|
|
|
20
20
|
var EndEvent = {
|
|
21
21
|
type: 'EndEvent'
|
|
22
22
|
};
|
|
23
|
-
var vtkWebGPUPolyDataVS = "\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n
|
|
24
|
-
var vtkWebGPUPolyDataFS = "\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n
|
|
23
|
+
var vtkWebGPUPolyDataVS = "\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@stage(vertex)\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertex: vec4<f32> = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n";
|
|
24
|
+
var vtkWebGPUPolyDataFS = "\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::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 var ambientColor: vec4<f32> = mapperUBO.AmbientColor;\n var diffuseColor: vec4<f32> = mapperUBO.DiffuseColor;\n var opacity: f32 = mapperUBO.Opacity;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n var computedColor: vec4<f32> = vec4<f32>(ambientColor.rgb * mapperUBO.AmbientIntensity\n + diffuse * mapperUBO.DiffuseIntensity\n + specular * mapperUBO.SpecularIntensity,\n opacity);\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n if (computedColor.a == 0.0) { discard; };\n\n //VTK::Position::Impl\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";
|
|
25
25
|
|
|
26
26
|
function isEdges(hash) {
|
|
27
27
|
// edge pipelines have "edge" in them
|
|
@@ -104,11 +104,11 @@ function vtkWebGPUPolyDataMapper(publicAPI, model) {
|
|
|
104
104
|
|
|
105
105
|
publicAPI.replaceShaderPosition = function (hash, pipeline, vertexInput) {
|
|
106
106
|
var vDesc = pipeline.getShaderDescription('vertex');
|
|
107
|
-
vDesc.addBuiltinOutput('vec4<f32>', '
|
|
107
|
+
vDesc.addBuiltinOutput('vec4<f32>', '@builtin(position) Position');
|
|
108
108
|
var code = vDesc.getCode();
|
|
109
109
|
|
|
110
110
|
if (isEdges(hash)) {
|
|
111
|
-
vDesc.addBuiltinInput('u32', '
|
|
111
|
+
vDesc.addBuiltinInput('u32', '@builtin(instance_index) instanceIndex'); // widen the edge
|
|
112
112
|
|
|
113
113
|
code = vtkWebGPUShaderCache.substitute(code, '//VTK::Position::Impl', [' var tmpPos: vec4<f32> = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix*vertexBC;', ' var tmpPos2: vec3<f32> = tmpPos.xyz / tmpPos.w;', ' tmpPos2.x = tmpPos2.x + 1.4*(f32(input.instanceIndex % 2u) - 0.5)/rendererUBO.viewportSize.x;', ' tmpPos2.y = tmpPos2.y + 1.4*(f32(input.instanceIndex / 2u) - 0.5)/rendererUBO.viewportSize.y;', ' tmpPos2.z = tmpPos2.z + 0.00001;', // could become a setting
|
|
114
114
|
' output.Position = vec4<f32>(tmpPos2.xyz * tmpPos.w, tmpPos.w);']).result;
|
|
@@ -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);
|