@antv/l7-renderer 2.21.10 → 2.21.11-beta.1

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.
@@ -45,7 +45,7 @@ import {
45
45
  stencilFuncMap,
46
46
  stencilOpMap
47
47
  } from "./constants";
48
- var { isPlainObject, isTypedArray } = lodashUtil;
48
+ var { isPlainObject, isTypedArray, isNil } = lodashUtil;
49
49
  var DeviceModel = class {
50
50
  constructor(device, options, service) {
51
51
  this.device = device;
@@ -104,7 +104,7 @@ var DeviceModel = class {
104
104
  if (elements) {
105
105
  this.indexBuffer = elements.get();
106
106
  }
107
- const inputLayout = device.createInputLayout({
107
+ const inputLayout = service.renderCache.createInputLayout({
108
108
  vertexBufferDescriptors,
109
109
  indexBufferFormat: elements ? Format.U32_R : null,
110
110
  program: this.program
@@ -113,6 +113,7 @@ var DeviceModel = class {
113
113
  this.pipeline = this.createPipeline(options);
114
114
  }
115
115
  createPipeline(options, pick) {
116
+ var _a;
116
117
  const { primitive = gl.TRIANGLES, depth, cull, blend, stencil } = options;
117
118
  const depthParams = this.initDepthDrawParams({ depth });
118
119
  const depthEnabled = !!(depthParams && depthParams.enable);
@@ -122,7 +123,7 @@ var DeviceModel = class {
122
123
  const blendEnabled = !!(blendParams && blendParams.enable);
123
124
  const stencilParams = this.getStencilDrawParams({ stencil });
124
125
  const stencilEnabled = !!(stencilParams && stencilParams.enable);
125
- return this.device.createRenderPipeline({
126
+ const pipeline = this.device.createRenderPipeline({
126
127
  // return this.service.renderCache.createRenderPipeline({
127
128
  inputLayout: this.inputLayout,
128
129
  program: this.program,
@@ -178,6 +179,10 @@ var DeviceModel = class {
178
179
  }
179
180
  }
180
181
  });
182
+ if (stencilEnabled && !isNil((_a = stencil == null ? void 0 : stencil.func) == null ? void 0 : _a.ref)) {
183
+ pipeline.stencilFuncReference = stencil.func.ref;
184
+ }
185
+ return pipeline;
181
186
  }
182
187
  updateAttributesAndElements() {
183
188
  }
@@ -221,7 +226,9 @@ var DeviceModel = class {
221
226
  );
222
227
  device["swapChainHeight"] = tmpHeight;
223
228
  renderPass.setPipeline(this.pipeline);
224
- renderPass.setStencilReference(1);
229
+ if (!isNil(this.pipeline.stencilFuncReference)) {
230
+ renderPass.setStencilReference(this.pipeline.stencilFuncReference);
231
+ }
225
232
  renderPass.setVertexInput(
226
233
  this.inputLayout,
227
234
  this.vertexBuffers.map((buffer) => ({
@@ -277,7 +284,6 @@ var DeviceModel = class {
277
284
  (_a = this.vertexBuffers) == null ? void 0 : _a.forEach((buffer) => buffer.destroy());
278
285
  (_b = this.indexBuffer) == null ? void 0 : _b.destroy();
279
286
  (_c = this.bindings) == null ? void 0 : _c.destroy();
280
- this.inputLayout.destroy();
281
287
  this.pipeline.destroy();
282
288
  this.destroyed = true;
283
289
  }
package/es/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- *
3
- */
4
1
  import DeviceRendererService from './device';
5
2
  import ReglRendererService from './regl';
6
3
  export { DeviceRendererService, ReglRendererService };
@@ -55,7 +55,7 @@ var import_l7_utils = require("@antv/l7-utils");
55
55
  var import_DeviceFramebuffer = __toESM(require("./DeviceFramebuffer"));
56
56
  var import_DeviceTexture2D = __toESM(require("./DeviceTexture2D"));
57
57
  var import_constants = require("./constants");
58
- var { isPlainObject, isTypedArray } = import_l7_utils.lodashUtil;
58
+ var { isPlainObject, isTypedArray, isNil } = import_l7_utils.lodashUtil;
59
59
  var DeviceModel = class {
60
60
  constructor(device, options, service) {
61
61
  this.device = device;
@@ -114,7 +114,7 @@ var DeviceModel = class {
114
114
  if (elements) {
115
115
  this.indexBuffer = elements.get();
116
116
  }
117
- const inputLayout = device.createInputLayout({
117
+ const inputLayout = service.renderCache.createInputLayout({
118
118
  vertexBufferDescriptors,
119
119
  indexBufferFormat: elements ? import_g_device_api.Format.U32_R : null,
120
120
  program: this.program
@@ -123,6 +123,7 @@ var DeviceModel = class {
123
123
  this.pipeline = this.createPipeline(options);
124
124
  }
125
125
  createPipeline(options, pick) {
126
+ var _a;
126
127
  const { primitive = import_l7_core.gl.TRIANGLES, depth, cull, blend, stencil } = options;
127
128
  const depthParams = this.initDepthDrawParams({ depth });
128
129
  const depthEnabled = !!(depthParams && depthParams.enable);
@@ -132,7 +133,7 @@ var DeviceModel = class {
132
133
  const blendEnabled = !!(blendParams && blendParams.enable);
133
134
  const stencilParams = this.getStencilDrawParams({ stencil });
134
135
  const stencilEnabled = !!(stencilParams && stencilParams.enable);
135
- return this.device.createRenderPipeline({
136
+ const pipeline = this.device.createRenderPipeline({
136
137
  // return this.service.renderCache.createRenderPipeline({
137
138
  inputLayout: this.inputLayout,
138
139
  program: this.program,
@@ -188,6 +189,10 @@ var DeviceModel = class {
188
189
  }
189
190
  }
190
191
  });
192
+ if (stencilEnabled && !isNil((_a = stencil == null ? void 0 : stencil.func) == null ? void 0 : _a.ref)) {
193
+ pipeline.stencilFuncReference = stencil.func.ref;
194
+ }
195
+ return pipeline;
191
196
  }
192
197
  updateAttributesAndElements() {
193
198
  }
@@ -231,7 +236,9 @@ var DeviceModel = class {
231
236
  );
232
237
  device["swapChainHeight"] = tmpHeight;
233
238
  renderPass.setPipeline(this.pipeline);
234
- renderPass.setStencilReference(1);
239
+ if (!isNil(this.pipeline.stencilFuncReference)) {
240
+ renderPass.setStencilReference(this.pipeline.stencilFuncReference);
241
+ }
235
242
  renderPass.setVertexInput(
236
243
  this.inputLayout,
237
244
  this.vertexBuffers.map((buffer) => ({
@@ -287,7 +294,6 @@ var DeviceModel = class {
287
294
  (_a = this.vertexBuffers) == null ? void 0 : _a.forEach((buffer) => buffer.destroy());
288
295
  (_b = this.indexBuffer) == null ? void 0 : _b.destroy();
289
296
  (_c = this.bindings) == null ? void 0 : _c.destroy();
290
- this.inputLayout.destroy();
291
297
  this.pipeline.destroy();
292
298
  this.destroyed = true;
293
299
  }
package/lib/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- *
3
- */
4
1
  import DeviceRendererService from './device';
5
2
  import ReglRendererService from './regl';
6
3
  export { DeviceRendererService, ReglRendererService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-renderer",
3
- "version": "2.21.10",
3
+ "version": "2.21.11-beta.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "https://github.com/orgs/antvis/people",
@@ -16,11 +16,11 @@
16
16
  "@antv/g-device-api": "^1.6.4",
17
17
  "@babel/runtime": "^7.7.7",
18
18
  "regl": "1.6.1",
19
- "@antv/l7-core": "2.21.10",
20
- "@antv/l7-utils": "2.21.10"
19
+ "@antv/l7-core": "2.21.11-beta.1",
20
+ "@antv/l7-utils": "2.21.11-beta.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@antv/l7-test-utils": "^2.21.10"
23
+ "@antv/l7-test-utils": "^2.21.11-beta.1"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public",