@flighthq/render-gl 0.5.1-next.1047.858b9b6 → 0.5.1-next.1050.0bd43cc

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.
package/README.md CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/render-gl`. The `@fl
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/render-gl@0.5.1-next.1047.858b9b6](https://github.com/flighthq/flight/tree/858b9b601de814f6b6940cbb1ffff0916b903268/packages/render-gl)
17
- - [License](https://github.com/flighthq/flight/blob/858b9b601de814f6b6940cbb1ffff0916b903268/LICENSE.md)
16
+ - [Source for @flighthq/render-gl@0.5.1-next.1050.0bd43cc](https://github.com/flighthq/flight/tree/0bd43ccdf62d9977512bf6c0fd6dc3ec177a8c8f/packages/render-gl)
17
+ - [License](https://github.com/flighthq/flight/blob/0bd43ccdf62d9977512bf6c0fd6dc3ec177a8c8f/LICENSE.md)
@@ -23,11 +23,11 @@ export function initializeGlSkinPaletteTexture(out, gl) {
23
23
  out.texture = gl.createTexture();
24
24
  }
25
25
  // Uploads a joint-matrix palette into the data texture and binds it. `jointMatrices` is the flat
26
- // column-major palette (16 floats per joint), `jointCount` how many joints it holds. Always uploads
27
- // via texImage2D; texture parameters are set once when capacity grows. Leaves the palette texture
28
- // bound on TEXTURE_2D of the active texture unit (the caller selects the unit and sets the sampler
29
- // uniform). Reads `jointMatrices`/`jointCount` before any allocation, so it is safe against an
30
- // aliased struct.
26
+ // column-major palette (16 floats per joint), `jointCount` how many joints it holds. Allocates
27
+ // storage via texImage2D on first use or when capacity grows; subsequent same-capacity uploads use
28
+ // texSubImage2D. Leaves the palette texture bound on TEXTURE_2D of the active texture unit (the
29
+ // caller selects the unit and sets the sampler uniform). Reads `jointMatrices`/`jointCount` before
30
+ // any allocation, so it is safe against an aliased struct.
31
31
  export function uploadGlSkinPaletteTexture(gl, palette, jointMatrices, jointCount, texelsPerJoint = 4) {
32
32
  // Four texels per joint for the 4x4 pose palette, three for the 3x3 normal palette. Parameterized
33
33
  // rather than duplicated so both palettes share one upload path and cannot drift in how they grow,
@@ -35,15 +35,16 @@ export function uploadGlSkinPaletteTexture(gl, palette, jointMatrices, jointCoun
35
35
  // pose palette would, and the reasons not to are identical.
36
36
  const width = jointCount * texelsPerJoint;
37
37
  gl.bindTexture(gl.TEXTURE_2D, palette.texture);
38
- // texSubImage2D for RGBA32F full-width replacement has produced silent data loss on at least one
39
- // driver (no GL error, readback zeros). texImage2D is negligible cost for palette-sized textures.
40
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, width, 1, 0, gl.RGBA, gl.FLOAT, jointMatrices);
41
38
  if (jointCount > palette.jointCapacity) {
39
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, width, 1, 0, gl.RGBA, gl.FLOAT, jointMatrices);
42
40
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
43
41
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
44
42
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
45
43
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
46
44
  palette.jointCapacity = jointCount;
47
45
  }
46
+ else {
47
+ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, 1, gl.RGBA, gl.FLOAT, jointMatrices);
48
+ }
48
49
  }
49
50
  //# sourceMappingURL=glSkinPaletteTexture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glSkinPaletteTexture.js","sourceRoot":"","sources":["../src/glSkinPaletteTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE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AC,aAAa,GAAG,UAAU,CAAC;IACrC,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,aAA6B,CAAC,CAAC;IACvG,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/render-gl",
3
- "version": "0.5.1-next.1047.858b9b6",
3
+ "version": "0.5.1-next.1050.0bd43cc",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,16 +38,16 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/color": "0.5.1-next.1047.858b9b6",
42
- "@flighthq/entity": "0.5.1-next.1047.858b9b6",
43
- "@flighthq/log": "0.5.1-next.1047.858b9b6",
44
- "@flighthq/scene2d": "0.5.1-next.1047.858b9b6",
45
- "@flighthq/geometry": "0.5.1-next.1047.858b9b6",
46
- "@flighthq/render": "0.5.1-next.1047.858b9b6",
47
- "@flighthq/registry": "0.5.1-next.1047.858b9b6",
48
- "@flighthq/signals": "0.5.1-next.1047.858b9b6",
49
- "@flighthq/texture": "0.5.1-next.1047.858b9b6",
50
- "@flighthq/types": "0.5.1-next.1047.858b9b6"
41
+ "@flighthq/color": "0.5.1-next.1050.0bd43cc",
42
+ "@flighthq/entity": "0.5.1-next.1050.0bd43cc",
43
+ "@flighthq/log": "0.5.1-next.1050.0bd43cc",
44
+ "@flighthq/scene2d": "0.5.1-next.1050.0bd43cc",
45
+ "@flighthq/geometry": "0.5.1-next.1050.0bd43cc",
46
+ "@flighthq/render": "0.5.1-next.1050.0bd43cc",
47
+ "@flighthq/registry": "0.5.1-next.1050.0bd43cc",
48
+ "@flighthq/signals": "0.5.1-next.1050.0bd43cc",
49
+ "@flighthq/texture": "0.5.1-next.1050.0bd43cc",
50
+ "@flighthq/types": "0.5.1-next.1050.0bd43cc"
51
51
  },
52
52
  "devDependencies": {
53
53
  "typescript": "^5.3.0"
@@ -97,7 +97,7 @@ describe('uploadGlSkinPaletteTexture', () => {
97
97
  expect(bind?.args[1]).toBe(palette.texture);
98
98
  });
99
99
 
100
- it('uses texImage2D without resetting parameters when the palette fits the current capacity', () => {
100
+ it('uses texSubImage2D without resetting parameters when the palette fits the current capacity', () => {
101
101
  const { gl, calls } = makeGl();
102
102
  const palette = createGlSkinPaletteTexture(gl);
103
103
  uploadGlSkinPaletteTexture(gl, palette, makePalette(4), 4);
@@ -105,12 +105,14 @@ describe('uploadGlSkinPaletteTexture', () => {
105
105
 
106
106
  uploadGlSkinPaletteTexture(gl, palette, makePalette(2), 2);
107
107
 
108
- const upload = calls.find((c) => c.name === 'texImage2D');
109
- expect(upload).toBeDefined();
110
- expect(upload?.args[3]).toBe(8); // width = 2 joints * 4
108
+ const sub = calls.find((c) => c.name === 'texSubImage2D');
109
+ expect(sub).toBeDefined();
110
+ expect(sub?.args[2]).toBe(0); // xoffset
111
+ expect(sub?.args[3]).toBe(0); // yoffset
112
+ expect(sub?.args[4]).toBe(8); // width = 2 joints * 4
111
113
  expect(palette.jointCapacity).toBe(4); // capacity unchanged
112
114
  expect(calls.some((c) => c.name === 'texParameteri')).toBe(false);
113
- expect(calls.some((c) => c.name === 'texSubImage2D')).toBe(false);
115
+ expect(calls.some((c) => c.name === 'texImage2D')).toBe(false);
114
116
  });
115
117
 
116
118
  it('grows storage (reallocates) when the palette exceeds the current capacity', () => {