Skip to content

Commit

Permalink
chore(core): Remove webgl-only topologies (#2028)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Mar 13, 2024
1 parent d472e79 commit c5c15fb
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 54 deletions.
2 changes: 0 additions & 2 deletions docs/api-reference/core/resources/render-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,8 @@ Describes how primitives (points, lines or triangles) are formed from vertexes.
| `'point-list'` ||| Each vertex defines a point primitive. |
| `'line-list'` ||| Each consecutive pair of two vertices defines a line primitive. |
| `'line-strip'` ||| Each vertex after the first defines a line primitive between it and the previous vertex. |
| `'line-loop-webgl'` ||| As `line-strip`, connects the last vertex back to the first. |
| `'triangle-list'` ||| Each consecutive triplet of three vertices defines a triangle primitive. |
| `'triangle-strip'` ||| Each vertex after the first two defines a triangle primitive between it and the previous two vertices. |
| `'triangle-fan-webgl'` ||| A set of connected triangles that share one central vertex. |


## Members
Expand Down
10 changes: 5 additions & 5 deletions docs/api-reference/core/resources/transform-feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ WebGL APIs [`gl.endTransformFeedback`](https://developer.mozilla.org/en-US/docs/

## Enumerations

| Primitive Mode | Compatible Topology |
| -------------- | ------------------------------------------------------- |
| `GL.POINTS` | `point-list` |
| `GL.LINES` | `line-list`, `line-strip`, `line-loop-webgl` |
| `GL.TRIANGLES` | `triangle-list`, `triangle-strip`, `triangle-fan-webgl` |
| Primitive Mode | Compatible Topology |
| -------------- | --------------------------------- |
| `GL.POINTS` | `point-list` |
| `GL.LINES` | `line-list`, `line-strip` |
| `GL.TRIANGLES` | `triangle-list`, `triangle-strip` |

## Limits

Expand Down
6 changes: 6 additions & 0 deletions docs/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ luma.gl largely follows [SEMVER](https://semver.org) conventions. Breaking chang

*For detailed commit level logs that include alpha and beta releases, see the [CHANGELOG](https://github.com/visgl/luma.gl/blob/master/CHANGELOG.md) in the github repository.*

## Upgrading to v9.1

**@luma.gl/core**

- `RenderPipeline.topology`: `line-loop-webgl` and `triangle-fan-webgl` topologies are no longer supported. Rebuild your geometries using `triangle-strip` and `line-list`.

## Upgrading to v9.0

luma.gl v9 is a major modernization of the luma.gl API, with many breaking changes, so the upgrade notes for this release are unusually long. To facilitate porting to the v9 release we have also provided a
Expand Down
1 change: 1 addition & 0 deletions docs/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Target Date: Q2 2024
- New [`luma.attachDevice()`](/docs/api-reference/core/luma#attachdevice) method - A `Device` can now be attached to a `WebGL2RenderingContext` without calling `WebGLDevice.attach()`.

**@luma.gl/engine**

- New `AsyncTexture` class allows applications to create textures from a URL or Promise.

## Version 9.0
Expand Down
6 changes: 1 addition & 5 deletions modules/core/src/adapter/types/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ export type PrimitiveTopology =
| 'point-list'
| 'line-list'
| 'line-strip'
/** @deprecated */
| 'line-loop-webgl'
| 'triangle-list'
| 'triangle-strip'
/** @deprecated */
| 'triangle-fan-webgl';
| 'triangle-strip';

export type IndexFormat = 'uint16' | 'uint32';

Expand Down
9 changes: 1 addition & 8 deletions modules/engine/src/geometry/geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ import {uid} from '../utils/uid';
export type GeometryProps = {
id?: string;
/** Determines how vertices are read from the 'vertex' attributes */
topology:
| 'point-list'
| 'line-list'
| 'line-strip'
| 'line-loop-webgl'
| 'triangle-list'
| 'triangle-strip'
| 'triangle-fan-webgl';
topology: 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';
/** Auto calculated from attributes if not provided */
vertexCount?: number;
attributes: Record<string, GeometryAttribute | TypedArray>;
Expand Down
9 changes: 1 addition & 8 deletions modules/engine/src/geometry/gpu-geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ import {uid} from '../utils/uid';
export type GPUGeometryProps = {
id?: string;
/** Determines how vertices are read from the 'vertex' attributes */
topology:
| 'point-list'
| 'line-list'
| 'line-strip'
| 'line-loop-webgl'
| 'triangle-list'
| 'triangle-strip'
| 'triangle-fan-webgl';
topology: 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';
/** Auto calculated from attributes if not provided */
vertexCount: number;
bufferLayout: BufferLayout[];
Expand Down
4 changes: 1 addition & 3 deletions modules/gltf/src/gltf/gl-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ export function convertGLDrawModeToTopology(
case GLEnum.POINTS: return 'point-list';
case GLEnum.LINES: return 'line-list';
case GLEnum.LINE_STRIP: return 'line-strip';
case GLEnum.LINE_LOOP: return 'line-loop-webgl';
case GLEnum.TRIANGLES: return 'triangle-list';
case GLEnum.TRIANGLE_STRIP: return 'triangle-strip';
case GLEnum.TRIANGLE_FAN: return 'triangle-fan-webgl';
default: throw new Error(drawMode);
default: throw new Error(String(drawMode));
}
}
4 changes: 0 additions & 4 deletions modules/webgl/src/adapter/helpers/webgl-topology-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ export function getGLDrawMode(
case 'point-list': return GL.POINTS;
case 'line-list': return GL.LINES;
case 'line-strip': return GL.LINE_STRIP;
case 'line-loop-webgl': return GL.LINE_LOOP;
case 'triangle-list': return GL.TRIANGLES;
case 'triangle-strip': return GL.TRIANGLE_STRIP;
case 'triangle-fan-webgl': return GL.TRIANGLE_FAN;
default: throw new Error(topology);
}
}
Expand All @@ -101,10 +99,8 @@ export function getGLPrimitive(topology: PrimitiveTopology): GL.POINTS | GL.LINE
case 'point-list': return GL.POINTS;
case 'line-list': return GL.LINES;
case 'line-strip': return GL.LINES;
case 'line-loop-webgl': return GL.LINES;
case 'triangle-list': return GL.TRIANGLES;
case 'triangle-strip': return GL.TRIANGLES;
case 'triangle-fan-webgl': return GL.TRIANGLES;
default: throw new Error(topology);
}
}
11 changes: 0 additions & 11 deletions modules/webgl/src/adapter/resources/webgl-render-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,6 @@ export class WEBGLRenderPipeline extends RenderPipeline {

// Merge provided layout with introspected layout
this.shaderLayout = mergeShaderLayout(this.introspectedLayout, props.shaderLayout);

// WebGPU has more restrictive topology support than WebGL
switch (this.props.topology) {
case 'triangle-fan-webgl':
case 'line-loop-webgl':
log.warn(
`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`
);
break;
default:
}
}

override destroy(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,6 @@ export class WebGPURenderPipeline extends RenderPipeline {
]
};

// WebGPU has more restrictive topology support than WebGL
switch (this.props.topology) {
case 'triangle-fan-webgl':
case 'line-loop-webgl':
throw new Error(`WebGPU does not support primitive topology ${this.props.topology}`);
default:
}

// Create a partially populated descriptor
const descriptor: GPURenderPipelineDescriptor = {
vertex,
Expand Down

0 comments on commit c5c15fb

Please sign in to comment.