@antv/g-webgpu-engine
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -6,2 +6,16 @@ # Change Log | ||
# [0.6.0](https://github.com/xiaoiver/GWebGPUEngine/compare/v0.4.1...v0.6.0) (2020-11-23) | ||
### Features | ||
* modify Kernel & Compiler API ([a6003b5](https://github.com/xiaoiver/GWebGPUEngine/commit/a6003b54fa7581815a7d4c0ef503fb334546eacb)) | ||
* ray tracer ([3fa95b9](https://github.com/xiaoiver/GWebGPUEngine/commit/3fa95b939b2dbf519ebf266b5e57bc7493258b9b)) | ||
* support render multi views in the same canvas [#29](https://github.com/xiaoiver/GWebGPUEngine/issues/29) ([18bc4b5](https://github.com/xiaoiver/GWebGPUEngine/commit/18bc4b518baf2dfc3980e9a5a2cc6d8789e3f141)) | ||
* support unit chart ([11511a1](https://github.com/xiaoiver/GWebGPUEngine/commit/11511a17b71f82de0de48f6cd2e51cd1c09f18d7)) | ||
# [0.5.0](https://github.com/xiaoiver/GWebGPUEngine/compare/v0.4.1...v0.5.0) (2020-11-06) | ||
@@ -8,0 +22,0 @@ |
@@ -12,2 +12,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
*/ | ||
import { gl } from '@antv/g-webgpu-core'; | ||
import { injectable } from 'inversify'; | ||
@@ -123,2 +124,18 @@ import regl from 'regl'; | ||
this.setScissor = function (scissor) { | ||
if (_this.gl && _this.gl._gl) { | ||
// https://developer.mozilla.org/zh-CN/docs/Web/API/WebGLRenderingContext/scissor | ||
if (scissor.enable && scissor.box) { | ||
// console.log(scissor.box); | ||
_this.gl._gl.enable(gl.SCISSOR_TEST); | ||
_this.gl._gl.scissor(scissor.box.x, scissor.box.y, scissor.box.width, scissor.box.height); | ||
} else { | ||
_this.gl._gl.disable(gl.SCISSOR_TEST); | ||
} | ||
_this.gl._refresh(); | ||
} | ||
}; | ||
this.viewport = function (_ref3) { | ||
@@ -204,5 +221,6 @@ var x = _ref3.x, | ||
antialias: cfg.antialias, | ||
premultipliedAlpha: true, | ||
preserveDrawingBuffer: true | ||
premultipliedAlpha: true // preserveDrawingBuffer: false, | ||
}, | ||
pixelRatio: 1, | ||
// TODO: use extensions | ||
@@ -209,0 +227,0 @@ extensions: ['OES_element_index_uint', 'OES_texture_float', 'OES_standard_derivatives', // wireframe |
@@ -36,3 +36,5 @@ import _typeof from "@babel/runtime/helpers/typeof"; | ||
cull = options.cull, | ||
instances = options.instances; | ||
instances = options.instances, | ||
scissor = options.scissor, | ||
viewport = options.viewport; | ||
var reglUniforms = {}; | ||
@@ -74,2 +76,10 @@ | ||
if (scissor) { | ||
drawParams.scissor = scissor; | ||
} | ||
if (viewport) { | ||
drawParams.viewport = viewport; | ||
} | ||
this.initDepthDrawParams({ | ||
@@ -76,0 +86,0 @@ depth: depth |
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; | ||
// import glslangInit from '@webgpu/glslang/dist/web-devel/glslang.onefile'; | ||
// @ts-nocheck | ||
/* tslint:disable */ | ||
import { loadScriptAsync } from '../utils/dom'; | ||
var glslang; | ||
@@ -14,3 +11,2 @@ export default function () { | ||
_ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { | ||
var glslangModule; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -29,16 +25,9 @@ while (1) { | ||
_context.next = 4; | ||
return import( | ||
/* webpackIgnore: true */ | ||
'https://cdn.jsdelivr.net/npm/@webgpu/glslang@0.0.15/dist/web-devel/glslang.js'); | ||
return loadScriptAsync('https://preview.babylonjs.com/glslang/glslang.js'); | ||
case 4: | ||
glslangModule = _context.sent; | ||
_context.next = 7; | ||
return glslangModule.default(); | ||
case 7: | ||
glslang = _context.sent; | ||
glslang = window.glslang('https://preview.babylonjs.com/glslang/glslang.wasm'); | ||
return _context.abrupt("return", glslang); | ||
case 9: | ||
case 6: | ||
case "end": | ||
@@ -45,0 +34,0 @@ return _context.stop(); |
@@ -310,3 +310,4 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
if (this.depthTexture) {// this.depthTexture.destroy(); | ||
if (this.depthTexture) { | ||
this.depthTexture.destroy(); | ||
} | ||
@@ -497,4 +498,2 @@ | ||
value: function startMainRenderPass() { | ||
this.renderEncoder.pushDebugGroup('start main rendering'); | ||
if (this.currentRenderPass && !this.currentRenderTarget) { | ||
@@ -530,3 +529,2 @@ this.endMainRenderPass(); | ||
var clearStencil = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
this.renderTargetEncoder.pushDebugGroup('start render target rendering'); | ||
var gpuTexture = (_renderTarget$get$col = renderTarget.get().color) === null || _renderTarget$get$col === void 0 ? void 0 : _renderTarget$get$col.texture; | ||
@@ -575,3 +573,2 @@ var colorTextureView; | ||
this.mainRenderPass = null; | ||
this.renderEncoder.popDebugGroup(); | ||
} | ||
@@ -592,3 +589,2 @@ } | ||
this.currentRenderPass.endPass(); | ||
this.renderTargetEncoder.popDebugGroup(); | ||
this.resetCachedViewport(); | ||
@@ -595,0 +591,0 @@ } |
@@ -185,35 +185,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
bufferBindingIndex++; // } else if (buffer.type === 'image2D') { | ||
// if (!buffer.size) { | ||
// throw new Error(`The size of ${buffer.name} must be declared.`); | ||
// } | ||
// const gpuBuffer = this.engine.createTexture( | ||
// buffer.size, | ||
// // @ts-ignore | ||
// buffer.data, | ||
// 4, // sampled-texture | ||
// ); | ||
// const sampler = this.engine.createSampler({ | ||
// magFilter: 'linear', | ||
// minFilter: 'linear', | ||
// }); | ||
// bindGroupEntries.push({ | ||
// binding: bufferBindingIndex, | ||
// resource: gpuBuffer.createView(), | ||
// }); | ||
// bindGroupEntries.push({ | ||
// binding: bufferBindingIndex + 1, | ||
// resource: sampler, | ||
// }); | ||
// bindGroupLayoutEntries.push({ | ||
// binding: bufferBindingIndex, | ||
// visibility: 4, | ||
// type: 'sampled-texture', | ||
// }); | ||
// bindGroupLayoutEntries.push({ | ||
// binding: bufferBindingIndex + 1, | ||
// visibility: 4, | ||
// type: 'sampler', | ||
// }); | ||
// bufferBindingIndex += 2; | ||
bufferBindingIndex++; | ||
} | ||
@@ -225,8 +193,10 @@ } | ||
computeStage: computeStage | ||
}); // this.bindGroup = this.engine.device.createBindGroup({ | ||
// layout: this.computePipeline.getBindGroupLayout(0), | ||
// entries: this.bindGroupEntries, | ||
// }); | ||
}); | ||
console.log(this.bindGroupEntries); | ||
this.bindGroup = this.engine.device.createBindGroup({ | ||
layout: this.computePipeline.getBindGroupLayout(0), | ||
entries: this.bindGroupEntries | ||
}); | ||
case 11: | ||
case 13: | ||
case "end": | ||
@@ -327,22 +297,21 @@ return _context.stop(); | ||
value: function run() { | ||
var _this3 = this; | ||
if (this.engine.currentComputePass) { | ||
var _this$engine$currentC; | ||
this.engine.currentComputePass.setPipeline(this.computePipeline); | ||
this.bindGroupEntries.forEach(function (entry) { | ||
if (!entry.resource.buffer) { | ||
// get referred kernel's output | ||
var gpuBuffer = entry.resource.refer.model.outputBuffer; | ||
_this3.vertexBuffers[entry.resource.name] = gpuBuffer; | ||
entry.resource.buffer = gpuBuffer.get(); | ||
} | ||
}); | ||
var bindGroup = this.engine.device.createBindGroup({ | ||
layout: this.computePipeline.getBindGroupLayout(0), | ||
entries: this.bindGroupEntries | ||
}); | ||
this.engine.currentComputePass.setBindGroup(0, bindGroup); | ||
this.engine.currentComputePass.setPipeline(this.computePipeline); // this.bindGroupEntries.forEach((entry) => { | ||
// if (!entry.resource.buffer) { | ||
// // get referred kernel's output | ||
// const gpuBuffer = (entry.resource.refer.model as WebGPUComputeModel) | ||
// .outputBuffer; | ||
// this.vertexBuffers[entry.resource.name] = gpuBuffer; | ||
// entry.resource.buffer = gpuBuffer.get(); | ||
// } | ||
// }); | ||
// const bindGroup = this.engine.device.createBindGroup({ | ||
// layout: this.computePipeline.getBindGroupLayout(0), | ||
// entries: this.bindGroupEntries, | ||
// }); | ||
this.engine.currentComputePass.setBindGroup(0, this.bindGroup); | ||
(_this$engine$currentC = this.engine.currentComputePass).dispatch.apply(_this$engine$currentC, _toConsumableArray(this.context.dispatch)); | ||
@@ -384,3 +353,2 @@ } | ||
var outputBuffer = model.outputBuffer; | ||
debugger; | ||
@@ -387,0 +355,0 @@ if (inputBuffer && outputBuffer && inputBuffer !== outputBuffer) { |
@@ -18,2 +18,4 @@ "use strict"; | ||
var _gWebgpuCore = require("@antv/g-webgpu-core"); | ||
var _inversify = require("inversify"); | ||
@@ -138,2 +140,18 @@ | ||
this.setScissor = function (scissor) { | ||
if (_this.gl && _this.gl._gl) { | ||
// https://developer.mozilla.org/zh-CN/docs/Web/API/WebGLRenderingContext/scissor | ||
if (scissor.enable && scissor.box) { | ||
// console.log(scissor.box); | ||
_this.gl._gl.enable(_gWebgpuCore.gl.SCISSOR_TEST); | ||
_this.gl._gl.scissor(scissor.box.x, scissor.box.y, scissor.box.width, scissor.box.height); | ||
} else { | ||
_this.gl._gl.disable(_gWebgpuCore.gl.SCISSOR_TEST); | ||
} | ||
_this.gl._refresh(); | ||
} | ||
}; | ||
this.viewport = function (_ref3) { | ||
@@ -219,5 +237,6 @@ var x = _ref3.x, | ||
antialias: cfg.antialias, | ||
premultipliedAlpha: true, | ||
preserveDrawingBuffer: true | ||
premultipliedAlpha: true // preserveDrawingBuffer: false, | ||
}, | ||
pixelRatio: 1, | ||
// TODO: use extensions | ||
@@ -224,0 +243,0 @@ extensions: ['OES_element_index_uint', 'OES_texture_float', 'OES_standard_derivatives', // wireframe |
@@ -49,3 +49,5 @@ "use strict"; | ||
cull = options.cull, | ||
instances = options.instances; | ||
instances = options.instances, | ||
scissor = options.scissor, | ||
viewport = options.viewport; | ||
var reglUniforms = {}; | ||
@@ -87,2 +89,10 @@ | ||
if (scissor) { | ||
drawParams.scissor = scissor; | ||
} | ||
if (viewport) { | ||
drawParams.viewport = viewport; | ||
} | ||
this.initDepthDrawParams({ | ||
@@ -89,0 +99,0 @@ depth: depth |
@@ -12,10 +12,6 @@ "use strict"; | ||
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard")); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
// import glslangInit from '@webgpu/glslang/dist/web-devel/glslang.onefile'; | ||
// @ts-nocheck | ||
var _dom = require("../utils/dom"); | ||
/* tslint:disable */ | ||
var glslang; | ||
@@ -29,3 +25,2 @@ | ||
_ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { | ||
var glslangModule; | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
@@ -44,16 +39,9 @@ while (1) { | ||
_context.next = 4; | ||
return Promise.resolve().then(function () { | ||
return (0, _interopRequireWildcard2.default)(require('https://cdn.jsdelivr.net/npm/@webgpu/glslang@0.0.15/dist/web-devel/glslang.js')); | ||
}); | ||
return (0, _dom.loadScriptAsync)('https://preview.babylonjs.com/glslang/glslang.js'); | ||
case 4: | ||
glslangModule = _context.sent; | ||
_context.next = 7; | ||
return glslangModule.default(); | ||
case 7: | ||
glslang = _context.sent; | ||
glslang = window.glslang('https://preview.babylonjs.com/glslang/glslang.wasm'); | ||
return _context.abrupt("return", glslang); | ||
case 9: | ||
case 6: | ||
case "end": | ||
@@ -60,0 +48,0 @@ return _context.stop(); |
@@ -327,3 +327,4 @@ "use strict"; | ||
if (this.depthTexture) {// this.depthTexture.destroy(); | ||
if (this.depthTexture) { | ||
this.depthTexture.destroy(); | ||
} | ||
@@ -514,4 +515,2 @@ | ||
value: function startMainRenderPass() { | ||
this.renderEncoder.pushDebugGroup('start main rendering'); | ||
if (this.currentRenderPass && !this.currentRenderTarget) { | ||
@@ -547,3 +546,2 @@ this.endMainRenderPass(); | ||
var clearStencil = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
this.renderTargetEncoder.pushDebugGroup('start render target rendering'); | ||
var gpuTexture = (_renderTarget$get$col = renderTarget.get().color) === null || _renderTarget$get$col === void 0 ? void 0 : _renderTarget$get$col.texture; | ||
@@ -592,3 +590,2 @@ var colorTextureView; | ||
this.mainRenderPass = null; | ||
this.renderEncoder.popDebugGroup(); | ||
} | ||
@@ -609,3 +606,2 @@ } | ||
this.currentRenderPass.endPass(); | ||
this.renderTargetEncoder.popDebugGroup(); | ||
this.resetCachedViewport(); | ||
@@ -612,0 +608,0 @@ } |
@@ -204,35 +204,3 @@ "use strict"; | ||
bufferBindingIndex++; // } else if (buffer.type === 'image2D') { | ||
// if (!buffer.size) { | ||
// throw new Error(`The size of ${buffer.name} must be declared.`); | ||
// } | ||
// const gpuBuffer = this.engine.createTexture( | ||
// buffer.size, | ||
// // @ts-ignore | ||
// buffer.data, | ||
// 4, // sampled-texture | ||
// ); | ||
// const sampler = this.engine.createSampler({ | ||
// magFilter: 'linear', | ||
// minFilter: 'linear', | ||
// }); | ||
// bindGroupEntries.push({ | ||
// binding: bufferBindingIndex, | ||
// resource: gpuBuffer.createView(), | ||
// }); | ||
// bindGroupEntries.push({ | ||
// binding: bufferBindingIndex + 1, | ||
// resource: sampler, | ||
// }); | ||
// bindGroupLayoutEntries.push({ | ||
// binding: bufferBindingIndex, | ||
// visibility: 4, | ||
// type: 'sampled-texture', | ||
// }); | ||
// bindGroupLayoutEntries.push({ | ||
// binding: bufferBindingIndex + 1, | ||
// visibility: 4, | ||
// type: 'sampler', | ||
// }); | ||
// bufferBindingIndex += 2; | ||
bufferBindingIndex++; | ||
} | ||
@@ -244,8 +212,10 @@ } | ||
computeStage: computeStage | ||
}); // this.bindGroup = this.engine.device.createBindGroup({ | ||
// layout: this.computePipeline.getBindGroupLayout(0), | ||
// entries: this.bindGroupEntries, | ||
// }); | ||
}); | ||
console.log(this.bindGroupEntries); | ||
this.bindGroup = this.engine.device.createBindGroup({ | ||
layout: this.computePipeline.getBindGroupLayout(0), | ||
entries: this.bindGroupEntries | ||
}); | ||
case 11: | ||
case 13: | ||
case "end": | ||
@@ -346,22 +316,21 @@ return _context.stop(); | ||
value: function run() { | ||
var _this3 = this; | ||
if (this.engine.currentComputePass) { | ||
var _this$engine$currentC; | ||
this.engine.currentComputePass.setPipeline(this.computePipeline); | ||
this.bindGroupEntries.forEach(function (entry) { | ||
if (!entry.resource.buffer) { | ||
// get referred kernel's output | ||
var gpuBuffer = entry.resource.refer.model.outputBuffer; | ||
_this3.vertexBuffers[entry.resource.name] = gpuBuffer; | ||
entry.resource.buffer = gpuBuffer.get(); | ||
} | ||
}); | ||
var bindGroup = this.engine.device.createBindGroup({ | ||
layout: this.computePipeline.getBindGroupLayout(0), | ||
entries: this.bindGroupEntries | ||
}); | ||
this.engine.currentComputePass.setBindGroup(0, bindGroup); | ||
this.engine.currentComputePass.setPipeline(this.computePipeline); // this.bindGroupEntries.forEach((entry) => { | ||
// if (!entry.resource.buffer) { | ||
// // get referred kernel's output | ||
// const gpuBuffer = (entry.resource.refer.model as WebGPUComputeModel) | ||
// .outputBuffer; | ||
// this.vertexBuffers[entry.resource.name] = gpuBuffer; | ||
// entry.resource.buffer = gpuBuffer.get(); | ||
// } | ||
// }); | ||
// const bindGroup = this.engine.device.createBindGroup({ | ||
// layout: this.computePipeline.getBindGroupLayout(0), | ||
// entries: this.bindGroupEntries, | ||
// }); | ||
this.engine.currentComputePass.setBindGroup(0, this.bindGroup); | ||
(_this$engine$currentC = this.engine.currentComputePass).dispatch.apply(_this$engine$currentC, (0, _toConsumableArray2.default)(this.context.dispatch)); | ||
@@ -403,3 +372,2 @@ } | ||
var outputBuffer = model.outputBuffer; | ||
debugger; | ||
@@ -406,0 +374,0 @@ if (inputBuffer && outputBuffer && inputBuffer !== outputBuffer) { |
{ | ||
"name": "@antv/g-webgpu-engine", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "", | ||
@@ -25,3 +25,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@antv/g-webgpu-core": "^0.5.0", | ||
"@antv/g-webgpu-core": "^0.6.0", | ||
"@webgpu/glslang": "^0.0.15", | ||
@@ -46,3 +46,3 @@ "@webgpu/types": "^0.0.31", | ||
}, | ||
"gitHead": "a6003b54fa7581815a7d4c0ef503fb334546eacb" | ||
"gitHead": "25cfea6a4e7fb2d471392949531f99413186cfd6" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
655603
99
6077
0
+ Added@antv/g-webgpu-core@0.6.0(transitive)
- Removed@antv/g-webgpu-core@0.5.6(transitive)
Updated@antv/g-webgpu-core@^0.6.0