这是indexloc提供的服务,不要输入任何密码
Skip to content

Texture swizzle: syntax is verbose and doesn't match WGSL #5296

@kainino0x

Description

@kainino0x

I've been looking at the swizzle syntax which looks like
swizzle: { r: 'r', g: 'g', b: 'b', a: 'a' }
and I think this is hard to read. It's a soup of letters, plus it's not immediately obvious what the direction of the swizzle is.

Meanwhile in WGSL a swizzle simply looks like .rgba which has a pretty unambiguous meaning (and you also see it often enough that you get used to it).

Can we just make the texture swizzle syntax the same as the WGSL swizzle syntax? I think it's much nicer if it matches and is also easier to understand.
swizzle: 'rgba'
swizzle: 'r001'
swizzle: 'gr'
etc.

Metadata

Metadata

Labels

apiWebGPU API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions