I was wondering, with the large numbers of different texture formats, the growing use of material property textures, and the upcoming requirements of WGF2.0 including unnormalized integer texture reads, wouldn't it be useful to have a system that flexibly maps texture contents to output channels?
What I was thinking of is this:
In the TMU, first, there is a bit-mapping layer that maps the bits of a single texel to up to four channels. A texel could be 8, 16, 32, 64 or 128 bits wide. These are split into up to four channels, each being 1-12, 16, 24(?) or 32 bits wide. A few bits might be left unused. Some alignment might be required. As an alternative to bit-mapping of single texels, a compressed texture format could be selected. This should encompass all existing texture formats as well as a whole load of new ones.
After that, there is a type-mapping layer. Each channel could be of one of the following types:
unsigned normalized (0 to 1)
signed normalized (-1 to 1)
unsigned unnormalized (e.g. 0 to 255)
signed unnormalized (e.g. -128 to 127)
color (0 to 1, sRGB converted if desired)
FP (only for 16bit, 24bit and 32bit channels)
zero or one (those would be used to fill the unused output channels)
As a last step after filtering, input channels are mapped to output channels. This is to account for e.g. luminance being mapped to red, green and blue in current texture formats. Actually, this step is basically obsolete with hardware that can do arbitrary swizzle.
So for example, some existing formats would be:
R8G8B8A8: bit-map: 8:8:8:8, type-map c:c:c:un, swizzle xyzw
X8R8G8B8: bit-map: 8:8:8:8, type-map 0:c:c:c, swizzle yzwx
A8L8: bit-map 8:8, type-map un:un:0:0, swizzle yyyx
But you could also do some very helpful packing, like one FP16 and two 8bit values in a single texture.
I'd like to see something like this in WGF2.0, but I think the chances are very slim.
What do you think about it?
What I was thinking of is this:
In the TMU, first, there is a bit-mapping layer that maps the bits of a single texel to up to four channels. A texel could be 8, 16, 32, 64 or 128 bits wide. These are split into up to four channels, each being 1-12, 16, 24(?) or 32 bits wide. A few bits might be left unused. Some alignment might be required. As an alternative to bit-mapping of single texels, a compressed texture format could be selected. This should encompass all existing texture formats as well as a whole load of new ones.
After that, there is a type-mapping layer. Each channel could be of one of the following types:
unsigned normalized (0 to 1)
signed normalized (-1 to 1)
unsigned unnormalized (e.g. 0 to 255)
signed unnormalized (e.g. -128 to 127)
color (0 to 1, sRGB converted if desired)
FP (only for 16bit, 24bit and 32bit channels)
zero or one (those would be used to fill the unused output channels)
As a last step after filtering, input channels are mapped to output channels. This is to account for e.g. luminance being mapped to red, green and blue in current texture formats. Actually, this step is basically obsolete with hardware that can do arbitrary swizzle.
So for example, some existing formats would be:
R8G8B8A8: bit-map: 8:8:8:8, type-map c:c:c:un, swizzle xyzw
X8R8G8B8: bit-map: 8:8:8:8, type-map 0:c:c:c, swizzle yzwx
A8L8: bit-map 8:8, type-map un:un:0:0, swizzle yyyx
But you could also do some very helpful packing, like one FP16 and two 8bit values in a single texture.
I'd like to see something like this in WGF2.0, but I think the chances are very slim.
What do you think about it?