gputex 0.8.0 → 0.9.0

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/dist/testing.js CHANGED
@@ -1652,6 +1652,8 @@ function encodeFastBlock(px) {
1652
1652
  ];
1653
1653
  const qsq = [0, 0, 0, 0];
1654
1654
  const qlsq = [0, 0, 0, 0];
1655
+ const sxp = [0, 0, 0];
1656
+ const syp = [0, 0, 0];
1655
1657
  for (let k = 0; k < 16; k++) {
1656
1658
  const r = px[k * 3];
1657
1659
  const g = px[k * 3 + 1];
@@ -1664,6 +1666,10 @@ function encodeFastBlock(px) {
1664
1666
  qsum[q][2] += b;
1665
1667
  qsq[q] += r * r + g * g + b * b;
1666
1668
  qlsq[q] += l * l;
1669
+ for (let c = 0; c < 3; c++) {
1670
+ sxp[c] += (k & 3) * px[k * 3 + c];
1671
+ syp[c] += (k >> 2) * px[k * 3 + c];
1672
+ }
1667
1673
  }
1668
1674
  const pair = (a, b) => ({
1669
1675
  sum: [qsum[a][0] + qsum[b][0], qsum[a][1] + qsum[b][1], qsum[a][2] + qsum[b][2]],
@@ -1704,7 +1710,7 @@ function encodeFastBlock(px) {
1704
1710
  };
1705
1711
  const resA = residual(pair(0, 2)) + residual(pair(1, 3));
1706
1712
  const resB = residual(pair(0, 1)) + residual(pair(2, 3));
1707
- const gray = qsum.every((q) => q[0] === q[1] && q[1] === q[2]);
1713
+ const gray = qsum.every((q) => q[0] === q[1] && q[1] === q[2]) && sxp[0] === sxp[1] && sxp[1] === sxp[2] && syp[0] === syp[1] && syp[1] === syp[2];
1708
1714
  let flip;
1709
1715
  let cur;
1710
1716
  if (gray) {
package/dist/three.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CompressResult as CompressResult$1, CompressTextureSource, CompressOptions, TextureHint, PreferredFormat, FormatQuality, SvgRasterSize, TextureFormat, Encoder, EncoderImageSource } from './index.js';
2
- export { ASTC4x4Encoder, ASTC4x4WebGLEncoder, BC1Encoder, BC1WebGLEncoder, BC5Encoder, BC5WebGLEncoder, BC7Encoder, BC7EncoderOptions, BC7WebGLEncoder, Capabilities, ETC2Encoder, EncodeBytesResult, EncodeCallOptions, EncodeMipChainResult, EncodedLevelBytes, EncoderConstructor, EncoderOptions, ExtensionProvider, FeatureProvider, FormatSelection, FormatVariant, MipLevel, RasterizeSvgOptions, RawPixelSource, SelectFormatOptions, WebGLBlockEncoder, WebGLCapabilities, WebGLEncodeBytesResult, WebGLEncoderConstructor, WebGLEncoderImageSource, WebGLEncoderOptions, WebGLFormatSelection, WebGPUFeature, clearTranscodeCache, compressTextureToBytes, createWebGLContext, detectCapabilities, detectWebGLCapabilities, generateGpuMipChain, generateMipChain, getSharedWebGLContext, gpuMipLevelCount, isWebGLAvailable, padToBlockMultiple, rasterizeSvg, releaseSharedGpuResources, selectFormat, selectWebGLFormat, setTranscodeCacheLimit } from './index.js';
2
+ export { ASTC4x4Encoder, ASTC4x4WebGLEncoder, BC1Encoder, BC1WebGLEncoder, BC5Encoder, BC5WebGLEncoder, BC7Encoder, BC7EncoderOptions, BC7WebGLEncoder, Capabilities, ETC2Encoder, ETC2WebGLEncoder, EncodeBytesResult, EncodeCallOptions, EncodeMipChainResult, EncodedLevelBytes, EncoderConstructor, EncoderOptions, ExtensionProvider, FeatureProvider, FormatSelection, FormatVariant, MipLevel, PrewarmResult, PrewarmTarget, RasterizeSvgOptions, RawPixelSource, SelectFormatOptions, WebGLBlockEncoder, WebGLCapabilities, WebGLEncodeBytesResult, WebGLEncoderConstructor, WebGLEncoderImageSource, WebGLEncoderOptions, WebGLFormatSelection, WebGPUFeature, clearTranscodeCache, compressTextureToBytes, createWebGLContext, detectCapabilities, detectWebGLCapabilities, generateGpuMipChain, generateMipChain, getSharedWebGLContext, gpuMipLevelCount, isWebGLAvailable, padToBlockMultiple, prewarmCompressTexture, rasterizeSvg, releaseSharedGpuResources, selectFormat, selectWebGLFormat, setTranscodeCacheLimit } from './index.js';
3
3
  import { Texture, CompressedTexture, Loader, CompressedPixelFormat } from 'three';
4
4
 
5
5
  /** A `compressTexture()` result: a ready-to-use texture plus the same encode
@@ -50,6 +50,9 @@ declare class GputexLoader extends Loader<Texture> {
50
50
  */
51
51
  device?: GPUDevice;
52
52
  adapter?: GPUAdapter;
53
+ /** Encode on the WebGL2 fallback even when WebGPU is available (testing).
54
+ * See `CompressOptions.forceWebGL`. Default false. */
55
+ forceWebGL: boolean;
53
56
  /**
54
57
  * Most recent full encode result. Useful when the caller wants format
55
58
  * / mipLevels / astcNormalRemap metadata without threading a separate