Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ktx2 hdr #2587

Open
wants to merge 4 commits into
base: dev/1.5
Choose a base branch
from
Open

Conversation

gz65555
Copy link
Collaborator

@gz65555 gz65555 commented Mar 18, 2025

Please check if the PR fulfills these requirements

close: #2520

Summary by CodeRabbit

  • New Features

    • Expanded HDR texture support with new formats (HDR, BC6H, RGBA16) that enhance visual quality in WebGL scenes.
    • Introduced a new HDR-enabled demonstration scene for advanced rendering.
    • Improved interactive test workflows with automated server management for a smoother testing experience.
  • Refactor

    • Streamlined the texture transcoding process by consolidating transcoder usage and optimizing worker processes, resulting in enhanced performance.

@gz65555 gz65555 requested review from GuoLei1990 and zhuxudong March 18, 2025 05:36
Copy link

coderabbitai bot commented Mar 18, 2025

Walkthrough

This pull request integrates HDR support into the KTX2 workflow by adding new HDR texture formats and updating related transcoding logic. The changes span Cypress configuration improvements (including a test server spawn and shutdown), modifications to several enum definitions, and significant updates in the KTX2 loading and transcoding pipelines. Additionally, obsolete transcoder components have been removed, and new URLs are used for WebAssembly resources.

Changes

File(s) Change Summary
cypress.config.ts Added new import for ChildProcess and spawn. Updated Cypress configuration to enable experimentalInteractiveRunEvents and added logic to spawn and shutdown a test server during test runs. Restructured the on("task", { compare }) function for image comparison logging.
e2e/case/texture-hdr-ktx2.ts New file that sets up a WebGL engine environment for rendering a scene with HDR KTX2 textures including camera, lighting, and material configurations.
packages/core/src/texture/enums/TextureFormat.ts Added new enum value BC6H = 36 with a documentation comment for HDR texture compression.
packages/loader/src/ktx2/KTX2Container.ts Updated ColorModel enum by adding HDR = 167. Removed isUASTC getter and added a new colorModel getter that returns a string representation.
packages/loader/src/ktx2/KTX2Loader.ts Removed references to KhronosTranscoder and static variables. Revised _parseBuffer to always use the BinomialLLCTranscoder. Updated _priorityFormats to include HDR formats and modified _supportedMap accordingly.
packages/loader/src/ktx2/KTX2TargetFormat.ts Added new enum members BC6H and RGBA16 to support HDR textures.
packages/loader/src/ktx2/transcoder/BinomialLLCTranscoder.ts Updated URLs for fetching basis_transcoder.js and basis_transcoder.wasm to new endpoints.
packages/loader/src/ktx2/transcoder/BinomialLLCWorkerCode.ts Expanded BasisFormat enum to include BC6H = 22, RGB_HALF = 24, and RGBA_HALF = 25. Updated the TargetFormat enum to include BC6H and modified the mapping function accordingly.
packages/loader/src/ktx2/transcoder/KhronosTranscoder.ts
packages/loader/src/ktx2/transcoder/KhronosWorkerCode.ts
Removed the entire KhronosTranscoder class and the KhronosWorkerCode.ts file, eliminating the old transcoding workflow.
packages/rhi-webgl/src/GLTexture.ts Introduced a new case in the _getFormatDetail method to handle TextureFormat.BC6H, utilizing the EXT_texture_compression_bptc WebGL extension.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as "Cypress Runner"
    participant NodeEvents as "setupNodeEvents"
    participant ChildProc as "ChildProcess (spawn)"
    
    Runner->>NodeEvents: Call setupNodeEvents()
    NodeEvents->>ChildProc: Spawn test server ("npm run e2e:case")
    NodeEvents->>Runner: Register shutdown callback
    Runner->>NodeEvents: Complete test run
    NodeEvents->>ChildProc: Shutdown test server
Loading
sequenceDiagram
    participant Loader as "KTX2Loader"
    participant Transcoder as "BinomialLLCTranscoder"
    participant Worker as "Worker Thread"
    
    Loader->>Transcoder: Initialize transcoder (with HDR support)
    Transcoder->>Worker: Fetch new JS & WASM resources
    Worker->>Transcoder: Process texture data (including HDR formats)
    Transcoder->>Loader: Return transcoded result
Loading

Assessment against linked issues

Objective Addressed Explanation
KTX2 support HDR (#2520)

Suggested labels

enhancement, Rendering, shader, high priority

Suggested reviewers

  • zhuxudong
  • GuoLei1990
  • Sway007

Poem

Hi, I'm a happy rabbit in code delight,
Hopping through HDR textures shining so bright.
With transcoding revamped and servers that start,
I nibble on bugs and sip on art.
CodeRabbit cheers—let's keep our bytes light!
🐰💻✨

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24da0cb and 728868e.

📒 Files selected for processing (1)
  • tests/src/loader/KTX2Loader.test.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/src/loader/KTX2Loader.test.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: codecov
  • GitHub Check: build (22.x, windows-latest)
  • GitHub Check: e2e (22.x)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
e2e/case/texture-hdr-ktx2.ts (1)

43-44: Consider adding a fallback for unsupported HDR formats.

The test loads an HDR KTX2 texture without checking for format support. Since BC6H requires the EXT_texture_compression_bptc extension which may not be available in all browsers, consider adding a fallback texture or format detection.

engine.resourceManager.load<Texture2D>("/autumn_field_puresky_1k.ktx2").then((tex) => {
  mtl.baseTexture = tex;
+ // Handle possible fallback if HDR format is not supported
+ if (!tex.loaded) {
+   console.warn("HDR texture format not supported, falling back to LDR version");
+   return engine.resourceManager.load<Texture2D>("/autumn_field_puresky_1k_ldr.ktx2").then(fallbackTex => {
+     mtl.baseTexture = fallbackTex;
+     updateForE2E(engine);
+     initScreenshot(engine, camera);
+   });
+ }
  updateForE2E(engine);
  initScreenshot(engine, camera);
});
packages/loader/src/ktx2/KTX2Loader.ts (1)

64-64: Leverage container color model to determine priority formats.
Retrieving formatPriorities using the container’s colorModel (e.g., "hdr") is a concise way to select the suitable format list. Consider logging or handling unseen color models in future expansions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c5c86e9 and 24da0cb.

📒 Files selected for processing (11)
  • cypress.config.ts (3 hunks)
  • e2e/case/texture-hdr-ktx2.ts (1 hunks)
  • packages/core/src/texture/enums/TextureFormat.ts (1 hunks)
  • packages/loader/src/ktx2/KTX2Container.ts (2 hunks)
  • packages/loader/src/ktx2/KTX2Loader.ts (4 hunks)
  • packages/loader/src/ktx2/KTX2TargetFormat.ts (1 hunks)
  • packages/loader/src/ktx2/transcoder/BinomialLLCTranscoder.ts (1 hunks)
  • packages/loader/src/ktx2/transcoder/BinomialLLCWorkerCode.ts (3 hunks)
  • packages/loader/src/ktx2/transcoder/KhronosTranscoder.ts (0 hunks)
  • packages/loader/src/ktx2/transcoder/KhronosWorkerCode.ts (0 hunks)
  • packages/rhi-webgl/src/GLTexture.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/loader/src/ktx2/transcoder/KhronosWorkerCode.ts
  • packages/loader/src/ktx2/transcoder/KhronosTranscoder.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/loader/src/ktx2/KTX2Container.ts

[error] 56-65: This getter should return a value.

(lint/suspicious/useGetterReturn)

🔇 Additional comments (17)
packages/core/src/texture/enums/TextureFormat.ts (1)

34-35: Excellent addition of BC6H texture format for HDR support.

The BC6H format is properly integrated into the TextureFormat enum with a clear documentation comment explaining its purpose for high-dynamic range color spaces. The enum value assignment (36) follows the pattern in the file and doesn't conflict with existing values.

packages/loader/src/ktx2/KTX2TargetFormat.ts (1)

20-24: Good implementation of HDR texture support with BC6H and RGBA16.

The addition of BC6H and RGBA16 to the KTX2TargetFormat enum is appropriate for supporting HDR textures. The comment documentation is clear, especially noting that RGBA16 is a half float type, which is important for HDR workflows. The comma after R8G8B8A8 maintains proper syntax.

e2e/case/texture-hdr-ktx2.ts (2)

1-50: Well-structured test case for HDR KTX2 textures.

This test file provides a complete example for loading and displaying an HDR KTX2 texture. The implementation follows the standard patterns used in the engine and includes all necessary components (camera, light, mesh) to properly test the feature.


43-43:

❓ Verification inconclusive

Verify the HDR texture path.

The path /autumn_field_puresky_1k.ktx2 is used without any checks to ensure the file exists. Consider verifying that this texture file is included in your test assets.


🏁 Script executed:

#!/bin/bash
# Check if the HDR texture file exists in the expected location
fd -p 'autumn_field_puresky_1k.ktx2' --type file

Length of output: 48


Action Required: Verify HDR Texture File

The automated search did not locate /autumn_field_puresky_1k.ktx2. Please manually verify that this HDR texture file is present in your test assets. If the file is missing or located elsewhere, update the texture path accordingly.

packages/loader/src/ktx2/KTX2Container.ts (1)

11-12: Support for HDR format added to ColorModel enum.

The enum has been extended with the HDR (High Dynamic Range) color model with value 167, which aligns with the PR objective to support KTX2 HDR textures.

packages/loader/src/ktx2/transcoder/BinomialLLCWorkerCode.ts (3)

83-86: BasisFormat enum extended with HDR-related formats.

Added support for BC6H, RGB_HALF, and RGBA_HALF formats which are essential for HDR texture processing.


89-102: Added HDR support to TargetFormat enum with helpful documentation.

The TargetFormat enum now includes BC6H and properly documents that this enum is a copy of KTX2TargetFormat needed for worker context.


112-114: Implemented BC6H case in format transcoding logic.

The getTranscodeFormatFromTarget function now correctly maps TargetFormat.BC6H to BasisFormat.BC6H, completing the HDR support implementation.

packages/loader/src/ktx2/transcoder/BinomialLLCTranscoder.ts (1)

13-18:

✅ Verification successful

Updated URLs for transcoder resources.

The URLs for basis_transcoder.js and basis_transcoder.wasm have been updated to new locations in the portal_ccutza path.


🏁 Script executed:

#!/bin/bash
# Verify that the new URLs are accessible
curl -I "https://mdn.alipayobjects.com/portal_ccutza/afts/file/A*0YJjQqUYHNsAAAAAAAAAAAAAAQAAAQ/basis_transcoder.js"
curl -I "https://mdn.alipayobjects.com/portal_ccutza/afts/file/A*u5r0R4OOqiQAAAAAAAAAAAAAAQAAAQ/basis_transcoder.wasm"

Length of output: 3297


URL Verification Successful: Updated transcoder resources are accessible

  • In file packages/loader/src/ktx2/transcoder/BinomialLLCTranscoder.ts (lines 13–18), the URLs now correctly point to the new portal_ccutza locations.
  • The verification tests show that both the JavaScript and WASM resources return HTTP 200 responses, confirming they are available.

No further modifications are required.

cypress.config.ts (4)

6-6: Added child_process imports for test server management.

Import of ChildProcess and spawn functions enables launching and managing test server processes.


23-23: Enabled experimental Cypress feature for interactive run events.

Setting experimentalInteractiveRunEvents to true allows using the after:run event for test server cleanup.


26-30: Added test server lifecycle management.

The code now spawns a test server using npm run e2e:case command and properly shuts it down after tests complete.


50-81: Improved image comparison task structure and logging.

The compare task has been restructured with better timing information and a simplified conditional check for matching results.

packages/loader/src/ktx2/KTX2Loader.ts (4)

40-41: Add new HDR priority format.
The addition of an "hdr" entry references BC6H and RGBA16 formats, which is a clear approach for handling HDR textures. Good job defining an explicit fallback, ensuring that if BC6H is unavailable, RGBA16 is selected.


47-47: Include BC6H in _supportedMap.
Referencing GLCapabilityType.bptc for BC6H is correct, as the same extension covers both BC6H and BC7.


66-72: Chain-based transcoding process.
The promise chain for initializing and transcoding via BinomialLLCTranscoder is straightforward. Just ensure any errors are propagated up or handled at the call site as you already appear to do in the caller.


183-186: Support new HDR texture formats.
Adding cases for BC6H and RGBA16 properly expands HDR coverage. If TextureFormat.R16G16B16A16 is a half-float representation, confirm that it meets your HDR precision needs.

Copy link

codecov bot commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 42.85714% with 48 lines in your changes missing coverage. Please review.

Project coverage is 69.03%. Comparing base (c5c86e9) to head (728868e).

Files with missing lines Patch % Lines
e2e/case/texture-hdr-ktx2.ts 0.00% 27 Missing and 1 partial ⚠️
...oader/src/ktx2/transcoder/BinomialLLCWorkerCode.ts 0.00% 11 Missing ⚠️
packages/rhi-webgl/src/GLTexture.ts 20.00% 4 Missing ⚠️
packages/loader/src/ktx2/KTX2Loader.ts 81.25% 3 Missing ⚠️
packages/loader/src/ktx2/KTX2Container.ts 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2587      +/-   ##
==========================================
+ Coverage   68.98%   69.03%   +0.05%     
==========================================
  Files         961      960       -1     
  Lines      100339   100105     -234     
  Branches     8681     8678       -3     
==========================================
- Hits        69215    69109     -106     
+ Misses      30864    30734     -130     
- Partials      260      262       +2     
Flag Coverage Δ
unittests 69.03% <42.85%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gz65555 gz65555 changed the title Feat/support ktx2 hdr support ktx2 hdr Mar 19, 2025
@gz65555 gz65555 changed the title support ktx2 hdr Support ktx2 hdr Mar 19, 2025
@zhuxudong zhuxudong changed the base branch from main to dev/1.5 March 27, 2025 03:30
/** The BC6H format is a texture compression format designed to support high-dynamic range (HDR) color spaces in source data. */
BC6H,
/** Half float type. */
RGBA16
Copy link
Member

@GuoLei1990 GuoLei1990 Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be as consistent as possible with TextureFormat

/** RGBA format, 16 bits per channel. */
 R16G16B16A16

@@ -0,0 +1,49 @@
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this e2e test to config.ts and upload fixtures

@@ -40,12 +37,14 @@ export class KTX2Loader extends Loader<Texture2D | TextureCube> {
KTX2TargetFormat.ETC,
KTX2TargetFormat.BC1_BC3,
KTX2TargetFormat.PVRTC
]
],
hdr: [KTX2TargetFormat.BC6H, KTX2TargetFormat.RGBA16]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use [ColorModel.HDR] as key is better, the same applies to etc1s and uastc

get isUASTC() {
return this.dataFormatDescriptor.colorModel === ColorModel.UASTC;
get colorModel() {
switch (this.dataFormatDescriptor.colorModel) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just return dataFormatDescriptor.colorModel as colorModel is better:

get colorModel():ColorModel{
return this.dataFormatDescriptor.colorModel;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@@ -124,6 +124,11 @@ export class GLTexture implements IPlatformTexture {
internalFormat: GLCompressedTextureInternalFormat.RGBA_BPTC_UNORM_EXT,
isCompressed: true
};
case TextureFormat.BC6H:
return {
internalFormat: gl.getExtension("EXT_texture_compression_bptc").COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use GLCompressedTextureInternalFormat.RGB_BPTC_UNSIGNED_FLOAT_EXT

@@ -102,6 +109,8 @@ export function transcode(buffer: Uint8Array, targetFormat: any, KTX2File: any):
return hasAlpha ? BasisFormat.ETC2 : BasisFormat.ETC1;
case TargetFormat.PVRTC:
return hasAlpha ? BasisFormat.PVRTC1_4_RGBA : BasisFormat.PVRTC1_4_RGB;
case TargetFormat.BC6H:
return BasisFormat.BC6H;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TargetFormat.RGBA16 is miss?

return { engine, result, targetFormat, params: ktx2Container.keyValue["GalaceanTextureParams"] as Uint8Array };
});
const binomialLLCWorker = KTX2Loader._getBinomialLLCTranscoder();
return binomialLLCWorker
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete EngineConfiguration.ktx2Loader.transcoder

@@ -40,12 +37,14 @@ export class KTX2Loader extends Loader<Texture2D | TextureCube> {
KTX2TargetFormat.ETC,
KTX2TargetFormat.BC1_BC3,
KTX2TargetFormat.PVRTC
]
],
hdr: [KTX2TargetFormat.BC6H, KTX2TargetFormat.RGBA16]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KTX2TargetFormat.RGBA16 is not processed in _detectSupportedFormat()

meshRenderer.setMaterial(mtl);

engine.resourceManager.load<Texture2D>("/autumn_field_puresky_1k.ktx2").then((tex) => {
mtl.baseTexture = tex;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add Bloom or Tonemapping to test HDR color space

@@ -40,12 +37,14 @@ export class KTX2Loader extends Loader<Texture2D | TextureCube> {
KTX2TargetFormat.ETC,
KTX2TargetFormat.BC1_BC3,
KTX2TargetFormat.PVRTC
]
],
hdr: [KTX2TargetFormat.BC6H, KTX2TargetFormat.RGBA16]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what should KTX2Loader do if textureHalfFloat is not supported in WebGL1?

@@ -31,6 +31,8 @@ export enum TextureFormat {
BC3 = 11,
/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */
BC7 = 12,
/** The BC6H format is a texture compression format designed to support high-dynamic range (HDR) color spaces in source data. */
BC6H = 36,
Copy link
Member

@GuoLei1990 GuoLei1990 Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opt comments :
/** RGB HDR compressed format, 8 bits per pixel. */

RGBA8 = 13,
BC6H = 22,
RGB_HALF = 24,
RGBA_HALF = 25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RGBA_HALF should return Uint16Array as mipmap ?

on("after:run", () => {
console.log("Shutting down test server...");
if (server) server.kill();
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -8,7 +8,8 @@ enum DFDTransferFunction {

enum ColorModel {
ETC1S = 163,
UASTC = 166
UASTC = 166,
HDR = 167
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be adjusted to follow the original intention of enumeration

enum ColorModel {
  ETC1S = 163,
  UASTC_LDR_4X4 = 166,
  UASTC_HDR_4X4 = 167
}

@@ -17,5 +17,9 @@ export enum KTX2TargetFormat {
/** RG format, 16 bits per pixel. */
R8G8,
/** RGBA format, 32 bits per pixel. */
R8G8B8A8
R8G8B8A8,
/** The BC6H format is a texture compression format designed to support high-dynamic range (HDR) color spaces in source data. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/** RGB HDR compressed format, 8 bits per pixel. */

RGBA8 = 13,
BC6H = 22,
RGB_HALF = 24,
RGBA_HALF = 25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RGB_HALF and RGBA_HALF never use?

@@ -91,7 +97,8 @@ export function transcode(buffer: Uint8Array, targetFormat: any, KTX2File: any):
ETC,
R8,
RG8,
RGBA8
RGBA8,
BC6H
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use KTX2TargetFormat directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KTX2 support HDR
3 participants