@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.
Files changed (33) hide show
  1. package/Rendering/OpenGL/RenderWindow.js +6 -0
  2. package/Rendering/SceneGraph/RenderWindowViewNode.js +5 -0
  3. package/Rendering/WebGPU/BindGroup.js +5 -4
  4. package/Rendering/WebGPU/Buffer.js +6 -3
  5. package/Rendering/WebGPU/BufferManager.js +3 -1
  6. package/Rendering/WebGPU/Device.js +1 -1
  7. package/Rendering/WebGPU/FullScreenQuad.js +1 -1
  8. package/Rendering/WebGPU/Glyph3DMapper.js +5 -4
  9. package/Rendering/WebGPU/HardwareSelectionPass.js +11 -7
  10. package/Rendering/WebGPU/HardwareSelector.js +7 -2
  11. package/Rendering/WebGPU/ImageMapper.js +16 -14
  12. package/Rendering/WebGPU/MapperHelper.js +7 -6
  13. package/Rendering/WebGPU/OpaquePass.js +11 -7
  14. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +17 -11
  15. package/Rendering/WebGPU/Pipeline.js +6 -5
  16. package/Rendering/WebGPU/PolyDataMapper.js +11 -9
  17. package/Rendering/WebGPU/RenderEncoder.js +12 -3
  18. package/Rendering/WebGPU/RenderWindow.js +10 -1
  19. package/Rendering/WebGPU/Renderer.js +10 -7
  20. package/Rendering/WebGPU/Sampler.js +4 -3
  21. package/Rendering/WebGPU/ShaderDescription.js +4 -4
  22. package/Rendering/WebGPU/SphereMapper.js +3 -3
  23. package/Rendering/WebGPU/StickMapper.js +4 -4
  24. package/Rendering/WebGPU/StorageBuffer.js +6 -5
  25. package/Rendering/WebGPU/Texture.js +13 -7
  26. package/Rendering/WebGPU/TextureView.js +10 -21
  27. package/Rendering/WebGPU/UniformBuffer.js +6 -5
  28. package/Rendering/WebGPU/VertexInput.js +1 -1
  29. package/Rendering/WebGPU/VolumePass.js +30 -22
  30. package/Rendering/WebGPU/VolumePassFSQ.js +18 -18
  31. package/Widgets/Core/WidgetManager.js +211 -71
  32. package/Widgets/Widgets3D/SplineWidget/behavior.js +9 -6
  33. package/package.json +5 -6
@@ -66,6 +66,7 @@ function vtkWebGPURenderWindow(publicAPI, model) {
66
66
 
67
67
  publicAPI.recreateSwapChain = function () {
68
68
  if (model.context) {
69
+ model.context.unconfigure();
69
70
  var presentationFormat = model.context.getPreferredFormat(model.adapter);
70
71
  /* eslint-disable no-undef */
71
72
 
@@ -77,6 +78,7 @@ function vtkWebGPURenderWindow(publicAPI, model) {
77
78
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_DST,
78
79
  size: model.size
79
80
  });
81
+ model._configured = true;
80
82
  }
81
83
  };
82
84
 
@@ -96,7 +98,7 @@ function vtkWebGPURenderWindow(publicAPI, model) {
96
98
  publicAPI.removeUnusedNodes();
97
99
  publicAPI.initialize();
98
100
  } else if (model.initialized) {
99
- if (!model.context.validConfiguration) {
101
+ if (!model._configured) {
100
102
  publicAPI.recreateSwapChain();
101
103
  }
102
104
 
@@ -596,6 +598,13 @@ function vtkWebGPURenderWindow(publicAPI, model) {
596
598
  }
597
599
  }, _callee2);
598
600
  }));
601
+
602
+ publicAPI.createSelector = function () {
603
+ var ret = vtkWebGPUHardwareSelector.newInstance();
604
+ ret.setWebGPURenderWindow(publicAPI);
605
+ return ret;
606
+ };
607
+
599
608
  publicAPI.delete = macro.chain(publicAPI.delete, publicAPI.setViewStream);
600
609
  } // ----------------------------------------------------------------------------
601
610
  // Object factory
@@ -7,7 +7,7 @@ import vtkWebGPUUniformBuffer from './UniformBuffer.js';
7
7
  import { registerOverride } from './ViewNodeFactory.js';
8
8
 
9
9
  var vtkDebugMacro = vtkDebugMacro$1;
10
- var clearFragTemplate = "\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> = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"; // ----------------------------------------------------------------------------
10
+ var clearFragTemplate = "\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> = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"; // ----------------------------------------------------------------------------
11
11
  // vtkWebGPURenderer methods
12
12
  // ----------------------------------------------------------------------------
13
13
 
@@ -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
- ubo.setName('mapperUBO');
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
- model.UBO.setName('rendererUBO');
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
- model.bindGroup.setName('rendererBG');
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.name, ": sampler;");
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
- name: null,
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', 'name']);
64
+ macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'device', 'label']);
64
65
  vtkWebGPUSampler(publicAPI, model);
65
66
  } // ----------------------------------------------------------------------------
66
67
 
@@ -51,9 +51,9 @@ function vtkWebGPUShaderDescription(publicAPI, model) {
51
51
 
52
52
  for (var i = 0; i < inputNames.length; i++) {
53
53
  if (inputInterpolations[i] !== undefined) {
54
- inputStruct.push(" [[location(".concat(i, "), interpolate(").concat(inputInterpolations[i], ")]] ").concat(inputNames[i], " : ").concat(inputTypes[i], ";"));
54
+ inputStruct.push(" @location(".concat(i, ") @interpolate(").concat(inputInterpolations[i], ") ").concat(inputNames[i], " : ").concat(inputTypes[i], ";"));
55
55
  } else {
56
- inputStruct.push(" [[location(".concat(i, ")]] ").concat(inputNames[i], " : ").concat(inputTypes[i], ";"));
56
+ inputStruct.push(" @location(".concat(i, ") ").concat(inputNames[i], " : ").concat(inputTypes[i], ";"));
57
57
  }
58
58
  }
59
59
  }
@@ -79,9 +79,9 @@ function vtkWebGPUShaderDescription(publicAPI, model) {
79
79
 
80
80
  for (var _i2 = 0; _i2 < model.outputNames.length; _i2++) {
81
81
  if (model.outputInterpolations[_i2] !== undefined) {
82
- outputStruct.push(" [[location(".concat(_i2, "), interpolate(").concat(model.outputInterpolations[_i2], ")]] ").concat(model.outputNames[_i2], " : ").concat(model.outputTypes[_i2], ";"));
82
+ outputStruct.push(" @location(".concat(_i2, ") @interpolate(").concat(model.outputInterpolations[_i2], ") ").concat(model.outputNames[_i2], " : ").concat(model.outputTypes[_i2], ";"));
83
83
  } else {
84
- outputStruct.push(" [[location(".concat(_i2, ")]] ").concat(model.outputNames[_i2], " : ").concat(model.outputTypes[_i2], ";"));
84
+ outputStruct.push(" @location(".concat(_i2, ") ").concat(model.outputNames[_i2], " : ").concat(model.outputTypes[_i2], ";"));
85
85
  }
86
86
  }
87
87
 
@@ -8,7 +8,7 @@ import { registerOverride } from './ViewNodeFactory.js';
8
8
  var BufferUsage = vtkWebGPUBufferManager.BufferUsage,
9
9
  PrimitiveTypes = vtkWebGPUBufferManager.PrimitiveTypes;
10
10
  var vtkErrorMacro = vtkErrorMacro$1;
11
- var vtkWebGPUSphereMapperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::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 vertexVC: vec4<f32> = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4<f32>(vertexBC.x, vertexBC.y, vertexBC.z, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = length(offsetMC)*0.5;\n\n // make the triangle face the camera\n if (rendererUBO.cameraParallel == 0u)\n {\n var dir: vec3<f32> = normalize(-vertexVC.xyz);\n var base2: vec3<f32> = normalize(cross(dir,vec3<f32>(1.0,0.0,0.0)));\n var base1: vec3<f32> = cross(base2,dir);\n dir = vertexVC.xyz + offsetMC.x*base1 + offsetMC.y*base2;\n vertexVC = vec4<f32>(dir, 1.0);\n }\n else\n {\n // add in the offset\n var tmp2: vec2<f32> = vertexVC.xy + offsetMC;\n vertexVC = vec4<f32>(tmp2, vertexVC.zw);\n }\n\n output.vertexVC = vertexVC.xyz;\n\n //VTK::Position::Impl\n\n return output;\n}\n"; // ----------------------------------------------------------------------------
11
+ var vtkWebGPUSphereMapperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::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 vertexVC: vec4<f32> = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4<f32>(vertexBC.x, vertexBC.y, vertexBC.z, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = length(offsetMC)*0.5;\n\n // make the triangle face the camera\n if (rendererUBO.cameraParallel == 0u)\n {\n var dir: vec3<f32> = normalize(-vertexVC.xyz);\n var base2: vec3<f32> = normalize(cross(dir,vec3<f32>(1.0,0.0,0.0)));\n var base1: vec3<f32> = cross(base2,dir);\n dir = vertexVC.xyz + offsetMC.x*base1 + offsetMC.y*base2;\n vertexVC = vec4<f32>(dir, 1.0);\n }\n else\n {\n // add in the offset\n var tmp2: vec2<f32> = vertexVC.xy + offsetMC;\n vertexVC = vec4<f32>(tmp2, vertexVC.zw);\n }\n\n output.vertexVC = vertexVC.xyz;\n\n //VTK::Position::Impl\n\n return output;\n}\n"; // ----------------------------------------------------------------------------
12
12
  // vtkWebGPUSphereMapper methods
13
13
  // ----------------------------------------------------------------------------
14
14
 
@@ -22,7 +22,7 @@ function vtkWebGPUSphereMapper(publicAPI, model) {
22
22
  vDesc.addOutput('vec3<f32>', 'centerVC');
23
23
  vDesc.addOutput('f32', 'radiusVC');
24
24
  var fDesc = pipeline.getShaderDescription('fragment');
25
- fDesc.addBuiltinOutput('f32', '[[builtin(frag_depth)]] fragDepth');
25
+ fDesc.addBuiltinOutput('f32', '@builtin(frag_depth) fragDepth');
26
26
  var sphereFrag = "\n // compute the eye position and unit direction\n var vertexVC: vec4<f32>;\n var EyePos: vec3<f32>;\n var EyeDir: vec3<f32>;\n var invertedDepth: f32 = 1.0;\n if (rendererUBO.cameraParallel != 0u) {\n EyePos = vec3<f32>(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3<f32>(0.0, 0.0, -1.0);\n }\n else {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3<f32>(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0) {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n // find the intersection\n var b: f32 = 2.0*dot(EyePos,EyeDir);\n var c: f32 = dot(EyePos,EyePos) - 1.0;\n var d: f32 = b*b - 4.0*c;\n var normal: vec3<f32> = vec3<f32>(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else {\n var t: f32 = (-b - invertedDepth*sqrt(d))*0.5;\n\n // compute the normal, for unit sphere this is just\n // the intersection point\n normal = invertedDepth*normalize(EyePos + t*EyeDir);\n // compute the intersection point in VC\n vertexVC = vec4<f32>(normal * input.radiusVC + input.centerVC, 1.0);\n }\n // compute the pixel's depth\n var pos: vec4<f32> = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n ";
27
27
  var code = fDesc.getCode();
28
28
  code = vtkWebGPUShaderCache.substitute(code, '//VTK::Normal::Impl', [sphereFrag]).result;
@@ -31,7 +31,7 @@ function vtkWebGPUSphereMapper(publicAPI, model) {
31
31
 
32
32
  publicAPI.replaceShaderPosition = function (hash, pipeline, vertexInput) {
33
33
  var vDesc = pipeline.getShaderDescription('vertex');
34
- vDesc.addBuiltinOutput('vec4<f32>', '[[builtin(position)]] Position');
34
+ vDesc.addBuiltinOutput('vec4<f32>', '@builtin(position) Position');
35
35
  var code = vDesc.getCode();
36
36
  code = vtkWebGPUShaderCache.substitute(code, '//VTK::Position::Impl', [' output.Position = rendererUBO.VCPCMatrix*vertexVC;']).result;
37
37
  vDesc.setCode(code);
@@ -27,7 +27,7 @@ var vtkErrorMacro = vtkErrorMacro$1; // Vertices
27
27
  // 4: 011
28
28
  // 5: 111
29
29
 
30
- var vtkWebGPUStickMapperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n[[stage(vertex)]]\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var offsetsArray: array<vec3<f32>, 12> = array<vec3<f32>, 12>(\n vec3<f32>(-1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n vec3<f32>(-1.0, -1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, 1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n vec3<f32>(1.0, 1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, 1.0),\n vec3<f32>(1.0, 1.0, 1.0),\n vec3<f32>(-1.0, 1.0, 1.0)\n );\n\n var output : vertexOutput;\n\n var vertexVC: vec4<f32> = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4<f32>(vertexBC.x, vertexBC.y, vertexBC.z, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = radiusMC;\n output.lengthVC = length(orientMC);\n output.orientVC = (rendererUBO.WCVCNormals * vec4<f32>(normalize(orientMC), 0.0)).xyz;\n\n // make sure it is pointing out of the screen\n if (output.orientVC.z < 0.0)\n {\n output.orientVC = -output.orientVC;\n }\n\n // make the basis\n var xbase: vec3<f32>;\n var ybase: vec3<f32>;\n var dir: vec3<f32> = vec3<f32>(0.0,0.0,1.0);\n if (rendererUBO.cameraParallel == 0u)\n {\n dir = normalize(-vertexVC.xyz);\n }\n if (abs(dot(dir,output.orientVC)) == 1.0)\n {\n xbase = normalize(cross(vec3<f32>(0.0,1.0,0.0),output.orientVC));\n ybase = cross(xbase,output.orientVC);\n }\n else\n {\n xbase = normalize(cross(output.orientVC,dir));\n ybase = cross(output.orientVC,xbase);\n }\n\n\n var vertIdx: u32 = input.vertexIndex % 12u;\n var offsets: vec3<f32> = offsetsArray[vertIdx];\n\n vertexVC = vec4<f32>(vertexVC.xyz +\n output.radiusVC * offsets.x * xbase +\n output.radiusVC * offsets.y * ybase +\n 0.5 * output.lengthVC * offsets.z * output.orientVC, 1.0);\n\n output.vertexVC = vertexVC;\n\n //VTK::Position::Impl\n\n return output;\n}\n"; // ----------------------------------------------------------------------------
30
+ var vtkWebGPUStickMapperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@stage(vertex)\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var offsetsArray: array<vec3<f32>, 12> = array<vec3<f32>, 12>(\n vec3<f32>(-1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n vec3<f32>(-1.0, -1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, 1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n vec3<f32>(1.0, 1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, 1.0),\n vec3<f32>(1.0, 1.0, 1.0),\n vec3<f32>(-1.0, 1.0, 1.0)\n );\n\n var output : vertexOutput;\n\n var vertexVC: vec4<f32> = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4<f32>(vertexBC.x, vertexBC.y, vertexBC.z, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = radiusMC;\n output.lengthVC = length(orientMC);\n output.orientVC = (rendererUBO.WCVCNormals * vec4<f32>(normalize(orientMC), 0.0)).xyz;\n\n // make sure it is pointing out of the screen\n if (output.orientVC.z < 0.0)\n {\n output.orientVC = -output.orientVC;\n }\n\n // make the basis\n var xbase: vec3<f32>;\n var ybase: vec3<f32>;\n var dir: vec3<f32> = vec3<f32>(0.0,0.0,1.0);\n if (rendererUBO.cameraParallel == 0u)\n {\n dir = normalize(-vertexVC.xyz);\n }\n if (abs(dot(dir,output.orientVC)) == 1.0)\n {\n xbase = normalize(cross(vec3<f32>(0.0,1.0,0.0),output.orientVC));\n ybase = cross(xbase,output.orientVC);\n }\n else\n {\n xbase = normalize(cross(output.orientVC,dir));\n ybase = cross(output.orientVC,xbase);\n }\n\n\n var vertIdx: u32 = input.vertexIndex % 12u;\n var offsets: vec3<f32> = offsetsArray[vertIdx];\n\n vertexVC = vec4<f32>(vertexVC.xyz +\n output.radiusVC * offsets.x * xbase +\n output.radiusVC * offsets.y * ybase +\n 0.5 * output.lengthVC * offsets.z * output.orientVC, 1.0);\n\n output.vertexVC = vertexVC;\n\n //VTK::Position::Impl\n\n return output;\n}\n"; // ----------------------------------------------------------------------------
31
31
  // vtkWebGPUStickMapper methods
32
32
  // ----------------------------------------------------------------------------
33
33
 
@@ -42,9 +42,9 @@ function vtkWebGPUStickMapper(publicAPI, model) {
42
42
  vDesc.addOutput('vec3<f32>', 'orientVC');
43
43
  vDesc.addOutput('f32', 'radiusVC');
44
44
  vDesc.addOutput('f32', 'lengthVC');
45
- vDesc.addBuiltinInput('u32', '[[builtin(vertex_index)]] vertexIndex');
45
+ vDesc.addBuiltinInput('u32', '@builtin(vertex_index) vertexIndex');
46
46
  var fDesc = pipeline.getShaderDescription('fragment');
47
- fDesc.addBuiltinOutput('f32', '[[builtin(frag_depth)]] fragDepth');
47
+ fDesc.addBuiltinOutput('f32', '@builtin(frag_depth) fragDepth');
48
48
  var stickFrag = "\n // compute the eye position and unit direction\n var vertexVC: vec4<f32>;\n var EyePos: vec3<f32>;\n var EyeDir: vec3<f32>;\n\n if (rendererUBO.cameraParallel != 0u)\n {\n EyePos = vec3<f32>(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3<f32>(0.0, 0.0, -1.0);\n }\n else\n {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3<f32>(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0)\n {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n\n // rotate to new basis\n // base1, base2, orientVC\n var base1: vec3<f32>;\n if (abs(input.orientVC.z) < 0.99)\n {\n base1 = normalize(cross(input.orientVC,vec3<f32>(0.0,0.0,1.0)));\n }\n else\n {\n base1 = normalize(cross(input.orientVC,vec3<f32>(0.0,1.0,0.0)));\n }\n var base2: vec3<f32> = cross(input.orientVC,base1);\n EyePos = vec3<f32>(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,input.orientVC));\n EyeDir = vec3<f32>(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,input.orientVC));\n\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n\n // find the intersection\n var a: f32 = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n var b: f32 = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n var c: f32 = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n var d: f32 = b*b - 4.0*a*c;\n var normal: vec3<f32> = vec3<f32>(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else\n {\n var t: f32 = (-b - sqrt(d))*(0.5 / a);\n var tz: f32 = EyePos.z + t*EyeDir.z;\n var iPoint: vec3<f32> = EyePos + t*EyeDir;\n if (abs(iPoint.z)*input.radiusVC > input.lengthVC*0.5)\n {\n // test for end cap\n var t2: f32 = (-b + sqrt(d))*(0.5 / a);\n var tz2: f32 = EyePos.z + t2*EyeDir.z;\n if (tz2*input.radiusVC > input.lengthVC*0.5 || tz*input.radiusVC < -0.5*input.lengthVC) { discard; }\n else\n {\n normal = input.orientVC;\n var t3: f32 = (input.lengthVC*0.5/input.radiusVC - EyePos.z)/EyeDir.z;\n iPoint = EyePos + t3*EyeDir;\n vertexVC = vec4<f32>(input.radiusVC*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n else\n {\n // The normal is the iPoint.xy rotated back into VC\n normal = iPoint.x*base1 + iPoint.y*base2;\n // rescale rerotate and translate\n vertexVC = vec4<f32>(input.radiusVC*(normal + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n // compute the pixel's depth\n var pos: vec4<f32> = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n }\n ";
49
49
  var code = fDesc.getCode();
50
50
  code = vtkWebGPUShaderCache.substitute(code, '//VTK::Normal::Impl', [stickFrag]).result;
@@ -53,7 +53,7 @@ function vtkWebGPUStickMapper(publicAPI, model) {
53
53
 
54
54
  publicAPI.replaceShaderPosition = function (hash, pipeline, vertexInput) {
55
55
  var vDesc = pipeline.getShaderDescription('vertex');
56
- vDesc.addBuiltinOutput('vec4<f32>', '[[builtin(position)]] Position');
56
+ vDesc.addBuiltinOutput('vec4<f32>', '@builtin(position) Position');
57
57
  var code = vDesc.getCode();
58
58
  code = vtkWebGPUShaderCache.substitute(code, '//VTK::Position::Impl', [' output.Position = rendererUBO.VCPCMatrix*vertexVC;']).result;
59
59
  vDesc.setCode(code);
@@ -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.name, "StructEntry\n{")];
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.name, "Struct\n{\n values: array<").concat(model.name, "StructEntry>;\n};\n[[binding(").concat(binding, "), group(").concat(group, ")]] var<storage, read> ").concat(model.name, ": ").concat(model.name, "Struct;\n"));
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
- name: null,
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', 'name', 'numberOfInstances', 'sizeInBytes']); // Object methods
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 > 0 && arguments[0] !== undefined ? arguments[0] : {};
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.name, ": texture_").concat(model.options.dimension, "<").concat(ttype, ">;");
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.name, ": texture_depth_").concat(model.options.dimension, ";");
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
- name: null,
100
- sampler: null
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', 'name', 'texture']);
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.name, "Struct\n{")];
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.name, ": ").concat(model.name, "Struct;"));
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
- name: null,
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', 'name', 'sizeInBytes']); // Object methods
354
+ macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'device', 'label', 'sizeInBytes']); // Object methods
354
355
 
355
356
  vtkWebGPUUniformBuffer(publicAPI, model);
356
357
  } // ----------------------------------------------------------------------------
@@ -112,7 +112,7 @@ function vtkWebGPUVertexInput(publicAPI, model) {
112
112
  result += ',\n';
113
113
  }
114
114
 
115
- result = "".concat(result, " [[location(").concat(nameCount, ")]] ").concat(model.inputs[i].names[nm], " : ").concat(type);
115
+ result = "".concat(result, " @location(").concat(nameCount, ") ").concat(model.inputs[i].names[nm], " : ").concat(type);
116
116
  nameCount++;
117
117
  }
118
118
  }
@@ -33,8 +33,8 @@ var BufferUsage = vtkWebGPUBufferManager.BufferUsage,
33
33
  //
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
- 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(volumePassSmallColorTexture,\n volumePassSmallColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";
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(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
- model._copyUBO.setName('mapperUBO');
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
 
@@ -642,7 +650,7 @@ function extend(publicAPI, model) {
642
650
 
643
651
  model._mapper.getShaderReplacements().set('replaceShaderVolumePass', function (hash, pipeline, vertexInput) {
644
652
  var fDesc = pipeline.getShaderDescription('fragment');
645
- fDesc.addBuiltinInput('vec4<f32>', '[[builtin(position)]] fragPos');
653
+ fDesc.addBuiltinInput('vec4<f32>', '@builtin(position) fragPos');
646
654
  });
647
655
 
648
656
  model._boundsPoly = vtkPolyData.newInstance();