FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add additional dstformat in copyExternalImageToTexture with Tier1 by mei1127 · Pull Request #5299 · gpuweb/gpuweb · GitHub

/ gpuweb Public

Add additional dstformat in copyExternalImageToTexture with Tier1 - #5299

Closed
mei1127 wants to merge 2 commits into
gpuweb:mainfrom
mei1127:99
Closed

Add additional dstformat in copyExternalImageToTexture with Tier1#5299
mei1127 wants to merge 2 commits into
gpuweb:mainfrom
mei1127:99

Conversation

mei1127 commented Sep 9, 2025
edited by kainino0x
Loading

Copy link
Copy Markdown
Contributor

This commit adds additional destination.texture.format in copyExternalImageToTexture function with texture-formats-tier1 enabled. These additional formats are renderable with the feature.

Issue: #5289

greggman commented Sep 9, 2025

Copy link
Copy Markdown
Member

Is it defined what the conversion is to snorm formats?

Copy link
Copy Markdown
Contributor

Is it defined what the conversion is to snorm formats?

Why not? It should have the same arithmetic results as copy to unorm or float - just different encodings happen at the end to get it into the texture.

I am noticing that the definition currently links to equivalent texel representation though which is not appropriate (oops) - that's only worded to apply to copies that don't involve format conversions. In principle this is supposed to effectively just be a rendering operation, so I guess we should probably actually word the spec like it performs a render pass where the shader reads the value and writes it out from the fragment shader.

Comment thread spec/index.bs
- {{GPUTextureFormat/"rgb10a2unorm"}}
- {{GPUTextureFormat/"rgba16float"}}
- {{GPUTextureFormat/"rgba32float"}}
or the below formats if {{GPUFeatureName/"texture-formats-tier1"}} is enabled:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This line is not needed, because it's implicitly necessary to have created the destination texture (with RENDER_ATTACHMENT usage) in the first place.

Comment thread spec/index.bs
- {{GPUTextureFormat/"r8snorm"}}
- {{GPUTextureFormat/"rg8snorm"}}
- {{GPUTextureFormat/"rgba8snorm"}}
- {{GPUTextureFormat/"rg11b10ufloat"}}

kainino0x Sep 10, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Both (1) whether we do this and (2) whether we replace this list with a simple "must be a renderable color format supporting "unfilterable-float" sample type" are both TBD. I am marking this PR as draft until the working group has discussed it.

kainino0x marked this pull request as draft September 10, 2025 21:43

Copy link
Copy Markdown
Contributor

PRs should link to the relevant issue. I have added a link to #5289 in the PR summary.

greggman commented Sep 11, 2025
edited
Loading

Copy link
Copy Markdown
Member

Is it defined what the conversion is to snorm formats?

Why not? It should have the same arithmetic results as copy to unorm or float - just different encodings happen at the end to get it into the texture.

Given the current spec, I would expect loading normal (non-gainmap) jpg or png into a rgba8snorm texture throws away half the precision and all you get is values from 0 to 127 (the binary data in the texture). Values from 0.0 to 1.0. I suspect no one wants that. Rather, they'd like to load a normal map into rgba8snorm and get values from -1.0 to 1.0.

If we're sticking to the "it only loads values from 0 to 1" current spec, then I think we should not add the snorm formats at this time.

Copy link
Copy Markdown
Contributor

Fair point. Seems if we wanted to support that we would need some extra metadata, like a "color space" that maps the source 0..1 to destination -1..1. Not sure if that's something we would want to do or just make apps deal with this themselves.

mwyrzykowski self-requested a review September 12, 2025 14:13

mwyrzykowski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I share similar concerns as @greggman - it would seem this operation is perhaps not well defined for sNorm formats and unless someone has been asking for support, it would be preferable to exclude snorm formats.

Copy link
Copy Markdown
Contributor

If we just add it, it will be well defined per the existing spec, and IMO users wouldn't assume any other behavior. For example I would definitely be against defaulting to mapping 0..1 to -1..1 for snorm, that would be very surprising. My concern is more with it being useless and thus something we shouldn't spend time testing and implementing.

greggman added a commit to greggman/cts that referenced this pull request Oct 1, 2025
Rather than have a list of allowed formats, the new spec
allows all regular texture formats that are renderable
and not compressed, not snorm, not integer.

gpuweb/gpuweb#5289
gpuweb/gpuweb#5299
gpuweb/gpuweb#5323

Copy link
Copy Markdown
Contributor

Based on the changed WG resolution I have opened #5289 which incorporates this PR.

kainino0x closed this Oct 2, 2025
kainino0x added a commit that referenced this pull request Oct 3, 2025
…extures (#5333)

Per [today's WG
discussion](https://github.com/gpuweb/gpuweb/wiki/GPU-Web-2025%E2%80%9010-01#allow-copyexternalimagetotexture-for-all-renderable-formats-5323).

Fixes #5289
Closes #5323
Closes #5299 by superseding it. (This PR is based on that one.)

---------

Co-authored-by: shanxing <shanxing.mei@intel.com>
greggman added a commit to greggman/cts that referenced this pull request Oct 17, 2025
Rather than have a list of allowed formats, the new spec
allows all regular texture formats that are renderable
and not compressed, not snorm, not integer.

gpuweb/gpuweb#5289
gpuweb/gpuweb#5299
gpuweb/gpuweb#5323
greggman added a commit to gpuweb/cts that referenced this pull request Oct 17, 2025
Rather than have a list of allowed formats, the new spec
allows all regular texture formats that are renderable
and not compressed, not snorm, not integer.

gpuweb/gpuweb#5289
gpuweb/gpuweb#5299
gpuweb/gpuweb#5323
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL