@@ -125,8 +125,11 @@ const kUnsizedDepthStencilFormatInfo = /* prettier-ignore */ makeTable(kTexFmtIn
125
125
'depth24unorm-stencil8' : [ , , , true , true , , , , 'depth' , , , , 'depth24unorm-stencil8' ] ,
126
126
'depth32float-stencil8' : [ , , , true , true , , , , 'depth' , , , , 'depth32float-stencil8' ] ,
127
127
} as const ) ;
128
- const kCompressedTextureFormatInfo = /* prettier-ignore */ makeTable ( kTexFmtInfoHeader ,
128
+
129
+ // Separated compressed formats by type
130
+ const kBCTextureFormatInfo = /* prettier-ignore */ makeTable ( kTexFmtInfoHeader ,
129
131
[ false , false , true , false , false , false , true , true , , , 4 , 4 , ] as const , {
132
+ // Block Compression (BC) formats
130
133
'bc1-rgba-unorm' : [ , , , , , , , , 'float' , 8 , 4 , 4 , 'texture-compression-bc' ] ,
131
134
'bc1-rgba-unorm-srgb' : [ , , , , , , , , 'float' , 8 , 4 , 4 , 'texture-compression-bc' ] ,
132
135
'bc2-rgba-unorm' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-bc' ] ,
@@ -142,11 +145,58 @@ const kCompressedTextureFormatInfo = /* prettier-ignore */ makeTable(kTexFmtInfo
142
145
'bc7-rgba-unorm' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-bc' ] ,
143
146
'bc7-rgba-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-bc' ] ,
144
147
} as const ) ;
148
+ const kETC2TextureFormatInfo = /* prettier-ignore */ makeTable ( kTexFmtInfoHeader ,
149
+ [ false , false , true , false , false , false , true , true , , , 4 , 4 , ] as const , {
150
+ // Ericsson Compression (ETC2) formats
151
+ 'etc2-rgb8unorm' : [ , , , , , , , , 'float' , 8 , 4 , 4 , 'texture-compression-etc2' ] ,
152
+ 'etc2-rgb8unorm-srgb' : [ , , , , , , , , 'float' , 8 , 4 , 4 , 'texture-compression-etc2' ] ,
153
+ 'etc2-rgb8a1unorm' : [ , , , , , , , , 'float' , 8 , 4 , 4 , 'texture-compression-etc2' ] ,
154
+ 'etc2-rgb8a1unorm-srgb' : [ , , , , , , , , 'float' , 8 , 4 , 4 , 'texture-compression-etc2' ] ,
155
+ 'etc2-rgba8unorm' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-etc2' ] ,
156
+ 'etc2-rgba8unorm-srgb' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-etc2' ] ,
157
+ 'eac-r11unorm' : [ , , , , , , , , 'float' , 8 , 4 , 4 , 'texture-compression-etc2' ] ,
158
+ 'eac-r11snorm' : [ , , , , , , , , 'float' , 8 , 4 , 4 , 'texture-compression-etc2' ] ,
159
+ 'eac-rg11unorm' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-etc2' ] ,
160
+ 'eac-rg11snorm' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-etc2' ] ,
161
+ } as const ) ;
162
+ const kASTCTextureFormatInfo = /* prettier-ignore */ makeTable ( kTexFmtInfoHeader ,
163
+ [ false , false , true , false , false , false , true , true , , , , , ] as const , {
164
+ // Adaptable Scalable Compression (ASTC) formats
165
+ 'astc-4x4-unorm' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-astc' ] ,
166
+ 'astc-4x4-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 4 , 4 , 'texture-compression-astc' ] ,
167
+ 'astc-5x4-unorm' : [ , , , , , , , , 'float' , 16 , 5 , 4 , 'texture-compression-astc' ] ,
168
+ 'astc-5x4-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 5 , 4 , 'texture-compression-astc' ] ,
169
+ 'astc-5x5-unorm' : [ , , , , , , , , 'float' , 16 , 5 , 5 , 'texture-compression-astc' ] ,
170
+ 'astc-5x5-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 5 , 5 , 'texture-compression-astc' ] ,
171
+ 'astc-6x5-unorm' : [ , , , , , , , , 'float' , 16 , 6 , 5 , 'texture-compression-astc' ] ,
172
+ 'astc-6x5-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 6 , 5 , 'texture-compression-astc' ] ,
173
+ 'astc-6x6-unorm' : [ , , , , , , , , 'float' , 16 , 6 , 6 , 'texture-compression-astc' ] ,
174
+ 'astc-6x6-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 6 , 6 , 'texture-compression-astc' ] ,
175
+ 'astc-8x5-unorm' : [ , , , , , , , , 'float' , 16 , 8 , 5 , 'texture-compression-astc' ] ,
176
+ 'astc-8x5-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 8 , 5 , 'texture-compression-astc' ] ,
177
+ 'astc-8x6-unorm' : [ , , , , , , , , 'float' , 16 , 8 , 6 , 'texture-compression-astc' ] ,
178
+ 'astc-8x6-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 8 , 6 , 'texture-compression-astc' ] ,
179
+ 'astc-8x8-unorm' : [ , , , , , , , , 'float' , 16 , 8 , 8 , 'texture-compression-astc' ] ,
180
+ 'astc-8x8-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 8 , 8 , 'texture-compression-astc' ] ,
181
+ 'astc-10x5-unorm' : [ , , , , , , , , 'float' , 16 , 10 , 5 , 'texture-compression-astc' ] ,
182
+ 'astc-10x5-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 10 , 5 , 'texture-compression-astc' ] ,
183
+ 'astc-10x6-unorm' : [ , , , , , , , , 'float' , 16 , 10 , 6 , 'texture-compression-astc' ] ,
184
+ 'astc-10x6-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 10 , 6 , 'texture-compression-astc' ] ,
185
+ 'astc-10x8-unorm' : [ , , , , , , , , 'float' , 16 , 10 , 8 , 'texture-compression-astc' ] ,
186
+ 'astc-10x8-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 10 , 8 , 'texture-compression-astc' ] ,
187
+ 'astc-10x10-unorm' : [ , , , , , , , , 'float' , 16 , 10 , 10 , 'texture-compression-astc' ] ,
188
+ 'astc-10x10-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 10 , 10 , 'texture-compression-astc' ] ,
189
+ 'astc-12x10-unorm' : [ , , , , , , , , 'float' , 16 , 12 , 10 , 'texture-compression-astc' ] ,
190
+ 'astc-12x10-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 12 , 10 , 'texture-compression-astc' ] ,
191
+ 'astc-12x12-unorm' : [ , , , , , , , , 'float' , 16 , 12 , 12 , 'texture-compression-astc' ] ,
192
+ 'astc-12x12-unorm-srgb' : [ , , , , , , , , 'float' , 16 , 12 , 12 , 'texture-compression-astc' ] ,
193
+ } as const ) ;
145
194
146
195
// Definitions for use locally. To access the table entries, use `kTextureFormatInfo`.
147
196
148
197
// TODO: Consider generating the exports below programmatically by filtering the big list, instead
149
198
// of using these local constants? Requires some type magic though.
199
+ /* prettier-ignore */ const kCompressedTextureFormatInfo = { ...kBCTextureFormatInfo , ...kETC2TextureFormatInfo , ...kASTCTextureFormatInfo } as const ;
150
200
/* prettier-ignore */ const kColorTextureFormatInfo = { ...kRegularTextureFormatInfo , ...kCompressedTextureFormatInfo } as const ;
151
201
/* prettier-ignore */ const kEncodableTextureFormatInfo = { ...kRegularTextureFormatInfo , ...kSizedDepthStencilFormatInfo } as const ;
152
202
/* prettier-ignore */ const kSizedTextureFormatInfo = { ...kRegularTextureFormatInfo , ...kSizedDepthStencilFormatInfo , ...kCompressedTextureFormatInfo } as const ;
0 commit comments