Skip to content

Commit

Permalink
Release (#1526)
Browse files Browse the repository at this point in the history
* feat: export webgl & webgpu device #1505 (#1510)

* feat: export webgl & webgpu device #1505

* feat: use setVertexInput instead of inputState

* feat: modify createProgram interface in Device API #1505

* fix: allow default values in createTexture & megaState #1505

* feat: support msaa in webgl2 & webgpu #1505

* fix: use latest gfx-naga in webgpu #1505

* feat: setImageData in webgpu #1505

* fix: adjust setImageData params #1505

* chore: commit changeset

* feat: 取消react-g的log打印 (#1523)

取消react-g的log打印

* chore: commit changeset

* fix: antialiasing SDF & Text #1522 (#1525)

* feat: export webgl & webgpu device #1505 (#1510)

* feat: export webgl & webgpu device #1505

* feat: use setVertexInput instead of inputState

* feat: modify createProgram interface in Device API #1505

* fix: allow default values in createTexture & megaState #1505

* feat: support msaa in webgl2 & webgpu #1505

* fix: use latest gfx-naga in webgpu #1505

* feat: setImageData in webgpu #1505

* fix: adjust setImageData params #1505

* chore: commit changeset

* feat: 取消react-g的log打印 (#1523)

取消react-g的log打印

* chore: commit changeset

* fix: antialiasing SDF & Text #1522

---------

Co-authored-by: Torres Wang <[email protected]>

* chore: lint

* chore(release): bump version (#1524)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update webgl snapshots

---------

Co-authored-by: Torres Wang <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Sep 11, 2023
1 parent 189708e commit 0b59e28
Show file tree
Hide file tree
Showing 144 changed files with 5,274 additions and 1,882 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ dist
node_modules
rollup.config.js
site
rust
__tests__
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('Render custom material with g-webgl', () => {
bufferGeometry.setVertexBuffer({
bufferIndex: VertexAttributeBufferIndex.POSITION,
byteStride: 4 * 3,
frequency: VertexBufferFrequency.PerVertex,
frequency: VertexBufferFrequency.VERTEX,
attributes: [
{
format: Format.F32_RGB,
Expand Down
Binary file modified __tests__/integration/__node__tests__/webgl/snapshots/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/__node__tests__/webgl/snapshots/ellipse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/__node__tests__/webgl/snapshots/rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/__node__tests__/webgl/snapshots/text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions packages/g-mobile-webgl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @antv/g-mobile-webgl

## 0.9.20

### Patch Changes

- Updated dependencies [c54cc6fb]
- Updated dependencies [568ec0f4]
- @antv/g-plugin-device-renderer@1.9.17
- @antv/g-plugin-webgl-device@1.9.17

## 0.9.19

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-mobile-webgl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-mobile-webgl",
"version": "0.9.19",
"version": "0.9.20",
"description": "A renderer implemented by WebGL1/2 in mobile environment",
"keywords": [
"antv",
Expand Down
10 changes: 10 additions & 0 deletions packages/g-plugin-3d/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @antv/g-plugin-3d

## 1.9.17

### Patch Changes

- c54cc6fb: Antialiasing SDF & Text.
- 568ec0f4: Export Device API in webgl & webgpu.
- Updated dependencies [c54cc6fb]
- Updated dependencies [568ec0f4]
- @antv/g-plugin-device-renderer@1.9.17

## 1.9.16

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-3d",
"version": "1.9.16",
"version": "1.9.17",
"description": "Provide 3D extension for G",
"keywords": [
"antv",
Expand Down
8 changes: 4 additions & 4 deletions packages/g-plugin-3d/src/geometries/ProceduralGeometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Format,
VertexAttributeBufferIndex,
VertexAttributeLocation,
VertexBufferFrequency,
VertexStepMode,
} from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-plugin-device-renderer';
import { mat4, vec3, vec4 } from 'gl-matrix';
Expand Down Expand Up @@ -139,7 +139,7 @@ export abstract class ProceduralGeometry<
this.setVertexBuffer({
bufferIndex: VertexAttributeBufferIndex.POSITION,
byteStride: 4 * 3,
frequency: VertexBufferFrequency.PerVertex,
stepMode: VertexStepMode.VERTEX,
attributes: [
{
format: Format.F32_RGB,
Expand All @@ -152,7 +152,7 @@ export abstract class ProceduralGeometry<
this.setVertexBuffer({
bufferIndex: VertexAttributeBufferIndex.NORMAL,
byteStride: 4 * 3,
frequency: VertexBufferFrequency.PerVertex,
stepMode: VertexStepMode.VERTEX,
attributes: [
{
format: Format.F32_RGB,
Expand All @@ -165,7 +165,7 @@ export abstract class ProceduralGeometry<
this.setVertexBuffer({
bufferIndex: VertexAttributeBufferIndex.UV,
byteStride: 4 * 2,
frequency: VertexBufferFrequency.PerVertex,
stepMode: VertexStepMode.VERTEX,
attributes: [
{
format: Format.F32_RG,
Expand Down
8 changes: 4 additions & 4 deletions packages/g-plugin-3d/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Fog,
FogType,
Format,
FrontFaceMode,
FrontFace,
GL,
Light,
Material,
Expand All @@ -24,7 +24,7 @@ import {
TextureUsage,
VertexAttributeBufferIndex,
VertexAttributeLocation,
VertexBufferFrequency,
VertexStepMode,
WrapMode,
} from '@antv/g-plugin-device-renderer';

Expand All @@ -42,7 +42,7 @@ export {
Fog,
FogType,
Format,
FrontFaceMode,
FrontFace,
Light,
Material,
Mesh,
Expand All @@ -56,7 +56,7 @@ export {
GL,
VertexAttributeBufferIndex,
VertexAttributeLocation,
VertexBufferFrequency,
VertexStepMode,
WrapMode,
};

Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/src/materials/MeshBasicMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class MeshBasicMaterial<
super(device, {
vertexShader: vert,
fragmentShader: frag,
cullMode: CullMode.Back,
cullMode: CullMode.BACK,
...props,
});

Expand Down
8 changes: 6 additions & 2 deletions packages/g-plugin-3d/src/materials/PointMaterial.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { IMaterial, Texture, Device } from '@antv/g-plugin-device-renderer';
import type {
IMaterial,
Texture,
Device,
} from '@antv/g-plugin-device-renderer';
import { Material, CullMode } from '@antv/g-plugin-device-renderer';
import vert from '../shaders/point.vert';
import frag from '../shaders/point.frag';
Expand Down Expand Up @@ -57,7 +61,7 @@ export class PointMaterial<T extends IPointMaterial> extends Material<T> {
super(device, {
vertexShader: vert,
fragmentShader: frag,
cullMode: CullMode.Back,
cullMode: CullMode.BACK,
...props,
});

Expand Down
7 changes: 7 additions & 0 deletions packages/g-plugin-device-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-plugin-device-renderer

## 1.9.17

### Patch Changes

- c54cc6fb: Antialiasing SDF & Text.
- 568ec0f4: Export Device API in webgl & webgpu.

## 1.9.16

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-device-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-device-renderer",
"version": "1.9.16",
"version": "1.9.17",
"description": "A G plugin of renderer implementation with GPUDevice",
"keywords": [
"antv",
Expand Down
12 changes: 6 additions & 6 deletions packages/g-plugin-device-renderer/src/PickingPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,12 @@ export class PickingPlugin implements RenderingPlugin {
depthWrite: true,
},
{
rgbBlendMode: BlendMode.Add,
rgbBlendSrcFactor: BlendFactor.One,
rgbBlendDstFactor: BlendFactor.Zero,
alphaBlendMode: BlendMode.Add,
alphaBlendSrcFactor: BlendFactor.One,
alphaBlendDstFactor: BlendFactor.Zero,
rgbBlendMode: BlendMode.ADD,
rgbBlendSrcFactor: BlendFactor.ONE,
rgbBlendDstFactor: BlendFactor.ZERO,
alphaBlendMode: BlendMode.ADD,
alphaBlendSrcFactor: BlendFactor.ONE,
alphaBlendDstFactor: BlendFactor.ZERO,
},
),
);
Expand Down
17 changes: 11 additions & 6 deletions packages/g-plugin-device-renderer/src/RenderGraphPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ export class RenderGraphPlugin implements RenderingPlugin {

renderingService.hooks.destroy.tap(RenderGraphPlugin.tag, () => {
this.renderHelper.destroy();
this.batchManager.destroy();
this.texturePool.destroy();

canvas.removeEventListener(ElementEvent.MOUNTED, handleMounted);
canvas.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
Expand All @@ -246,6 +248,9 @@ export class RenderGraphPlugin implements RenderingPlugin {
ElementEvent.BOUNDS_CHANGED,
handleBoundsChanged,
);

this.device.destroy();
this.device.checkForLeaks();
});

/**
Expand Down Expand Up @@ -355,12 +360,12 @@ export class RenderGraphPlugin implements RenderingPlugin {
blendConstant: TransparentBlack,
},
{
rgbBlendMode: BlendMode.Add,
alphaBlendMode: BlendMode.Add,
rgbBlendSrcFactor: BlendFactor.SrcAlpha,
alphaBlendSrcFactor: BlendFactor.One,
rgbBlendDstFactor: BlendFactor.OneMinusSrcAlpha,
alphaBlendDstFactor: BlendFactor.OneMinusSrcAlpha,
rgbBlendMode: BlendMode.ADD,
alphaBlendMode: BlendMode.ADD,
rgbBlendSrcFactor: BlendFactor.SRC_ALPHA,
alphaBlendSrcFactor: BlendFactor.ONE,
rgbBlendDstFactor: BlendFactor.ONE_MINUS_SRC_ALPHA,
alphaBlendDstFactor: BlendFactor.ONE_MINUS_SRC_ALPHA,
},
),
);
Expand Down
8 changes: 4 additions & 4 deletions packages/g-plugin-device-renderer/src/TexturePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export class TexturePool {
height: 1,
depth: 1,
numLevels: 1,
dimension: TextureDimension.n2D,
usage: TextureUsage.Sampled,
dimension: TextureDimension.TEXTURE_2D,
usage: TextureUsage.SAMPLED,
pixelStore: {
unpackFlipY: false,
},
Expand All @@ -64,7 +64,7 @@ export class TexturePool {
}

if (!isString(src)) {
texture.setImageData(src);
texture.setImageData([src]);
texture.emit(TextureEvent.LOADED);
this.context.renderingService.dirtify();
} else {
Expand All @@ -81,7 +81,7 @@ export class TexturePool {
if (image) {
image.onload = () => {
const onSuccess = (bitmap: ImageBitmap | HTMLImageElement) => {
this.textureCache[id].setImageData(bitmap);
this.textureCache[id].setImageData([bitmap]);
this.textureCache[id].emit(TextureEvent.LOADED);
this.context.renderingService.dirtify();
if (successCallback) {
Expand Down
8 changes: 4 additions & 4 deletions packages/g-plugin-device-renderer/src/drawcalls/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
VertexAttributeBufferIndex,
VertexAttributeLocation,
} from './Instanced';
import { Format, VertexBufferFrequency } from '../platform';
import { Format, VertexStepMode } from '../platform';
import frag from '../shader/image.frag';
import vert from '../shader/image.vert';
import { enumToObject } from '../utils';
Expand Down Expand Up @@ -79,7 +79,7 @@ export class ImageDrawcall extends Instanced {
this.geometry.setVertexBuffer({
bufferIndex: VertexAttributeBufferIndex.POSITION,
byteStride: 4 * 2,
frequency: VertexBufferFrequency.PerInstance,
stepMode: VertexStepMode.INSTANCE,
attributes: [
{
format: Format.F32_RG,
Expand All @@ -92,7 +92,7 @@ export class ImageDrawcall extends Instanced {
this.geometry.setVertexBuffer({
bufferIndex: ImageVertexAttributeBufferIndex.PACKED_STYLE,
byteStride: 4 * 4,
frequency: VertexBufferFrequency.PerInstance,
stepMode: VertexStepMode.INSTANCE,
attributes: [
{
format: Format.F32_RGBA,
Expand All @@ -106,7 +106,7 @@ export class ImageDrawcall extends Instanced {
this.geometry.setVertexBuffer({
bufferIndex: VertexAttributeBufferIndex.UV,
byteStride: 4 * 2,
frequency: VertexBufferFrequency.PerVertex,
stepMode: VertexStepMode.VERTEX,
attributes: [
{
format: Format.F32_RG,
Expand Down
Loading

0 comments on commit 0b59e28

Please sign in to comment.