@@ -102,56 +102,60 @@ type TextureFormatInfo = {
102
102
// Add fields as needed
103
103
} ;
104
104
105
+ export type TextureDataType = 'uint' | 'sint' | 'unorm' | 'snorm' | 'float' | 'ufloat' ;
106
+
105
107
export const kRegularTextureFormatInfo : {
106
108
readonly [ k in RegularTextureFormat ] : {
107
109
color : true ;
108
110
bytesPerBlock : number ;
109
111
blockWidth : 1 ;
110
112
blockHeight : 1 ;
113
+ dataType : TextureDataType ;
114
+ componentType : GPUTextureComponentType ;
111
115
} & TextureFormatInfo ;
112
116
} = /* prettier-ignore */ {
113
117
// 8-bit formats
114
- 'r8unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 1 , blockWidth : 1 , blockHeight : 1 } ,
115
- 'r8snorm' : { renderable : false , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 1 , blockWidth : 1 , blockHeight : 1 } ,
116
- 'r8uint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 1 , blockWidth : 1 , blockHeight : 1 } ,
117
- 'r8sint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 1 , blockWidth : 1 , blockHeight : 1 } ,
118
+ 'r8unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 1 , blockWidth : 1 , blockHeight : 1 , dataType : 'unorm' , componentType : 'float' } ,
119
+ 'r8snorm' : { renderable : false , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 1 , blockWidth : 1 , blockHeight : 1 , dataType : 'snorm' , componentType : 'float' } ,
120
+ 'r8uint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 1 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
121
+ 'r8sint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 1 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
118
122
// 16-bit formats
119
- 'r16uint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 } ,
120
- 'r16sint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 } ,
121
- 'r16float' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 } ,
122
- 'rg8unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 } ,
123
- 'rg8snorm' : { renderable : false , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 } ,
124
- 'rg8uint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 } ,
125
- 'rg8sint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 } ,
123
+ 'r16uint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
124
+ 'r16sint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
125
+ 'r16float' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 , dataType : 'float' , componentType : 'float' } ,
126
+ 'rg8unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 , dataType : 'unorm' , componentType : 'float' } ,
127
+ 'rg8snorm' : { renderable : false , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 , dataType : 'snorm' , componentType : 'float' } ,
128
+ 'rg8uint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
129
+ 'rg8sint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 2 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
126
130
// 32-bit formats
127
- 'r32uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
128
- 'r32sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
129
- 'r32float' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
130
- 'rg16uint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
131
- 'rg16sint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
132
- 'rg16float' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
133
- 'rgba8unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
134
- 'rgba8unorm-srgb' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
135
- 'rgba8snorm' : { renderable : false , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
136
- 'rgba8uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
137
- 'rgba8sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
138
- 'bgra8unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
139
- 'bgra8unorm-srgb' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
131
+ 'r32uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
132
+ 'r32sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
133
+ 'r32float' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'float' , componentType : 'float' } ,
134
+ 'rg16uint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
135
+ 'rg16sint' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
136
+ 'rg16float' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'float' , componentType : 'float' } ,
137
+ 'rgba8unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'unorm' , componentType : 'float' } ,
138
+ 'rgba8unorm-srgb' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'unorm' , componentType : 'float' } ,
139
+ 'rgba8snorm' : { renderable : false , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'float' } ,
140
+ 'rgba8uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
141
+ 'rgba8sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
142
+ 'bgra8unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'unorm' , componentType : 'float' } ,
143
+ 'bgra8unorm-srgb' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'unorm' , componentType : 'float' } ,
140
144
// Packed 32-bit formats
141
- 'rgb10a2unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
142
- 'rg11b10ufloat' : { renderable : false , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
143
- 'rgb9e5ufloat' : { renderable : false , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
145
+ 'rgb10a2unorm' : { renderable : true , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'unorm' , componentType : 'float' } ,
146
+ 'rg11b10ufloat' : { renderable : false , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'ufloat' , componentType : 'float' } ,
147
+ 'rgb9e5ufloat' : { renderable : false , color : true , depth : false , stencil : false , storage : false , copySrc : true , copyDst : true , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'ufloat' , componentType : 'float' } ,
144
148
// 64-bit formats
145
- 'rg32uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 } ,
146
- 'rg32sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 } ,
147
- 'rg32float' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 } ,
148
- 'rgba16uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 } ,
149
- 'rgba16sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 } ,
150
- 'rgba16float' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 } ,
149
+ 'rg32uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
150
+ 'rg32sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
151
+ 'rg32float' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 , dataType : 'float' , componentType : 'float' } ,
152
+ 'rgba16uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
153
+ 'rgba16sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
154
+ 'rgba16float' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 8 , blockWidth : 1 , blockHeight : 1 , dataType : 'float' , componentType : 'float' } ,
151
155
// 128-bit formats
152
- 'rgba32uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 16 , blockWidth : 1 , blockHeight : 1 } ,
153
- 'rgba32sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 16 , blockWidth : 1 , blockHeight : 1 } ,
154
- 'rgba32float' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 16 , blockWidth : 1 , blockHeight : 1 } ,
156
+ 'rgba32uint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 16 , blockWidth : 1 , blockHeight : 1 , dataType : 'uint' , componentType : 'uint' } ,
157
+ 'rgba32sint' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 16 , blockWidth : 1 , blockHeight : 1 , dataType : 'sint' , componentType : 'sint' } ,
158
+ 'rgba32float' : { renderable : true , color : true , depth : false , stencil : false , storage : true , copySrc : true , copyDst : true , bytesPerBlock : 16 , blockWidth : 1 , blockHeight : 1 , dataType : 'float' , componentType : 'float' } ,
155
159
} as const ;
156
160
export const kRegularTextureFormats = keysOf ( kRegularTextureFormatInfo ) ;
157
161
@@ -162,9 +166,11 @@ export const kSizedDepthStencilFormatInfo: {
162
166
readonly bytesPerBlock : number ;
163
167
readonly blockWidth : 1 ;
164
168
readonly blockHeight : 1 ;
169
+ dataType : TextureDataType ;
170
+ componentType : GPUTextureComponentType ;
165
171
} & TextureFormatInfo ;
166
172
} = /* prettier-ignore */ {
167
- 'depth32float' : { renderable : true , color : false , depth : true , stencil : false , storage : false , copySrc : true , copyDst : false , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 } ,
173
+ 'depth32float' : { renderable : true , color : false , depth : true , stencil : false , storage : false , copySrc : true , copyDst : false , bytesPerBlock : 4 , blockWidth : 1 , blockHeight : 1 , dataType : 'float' , componentType : 'float' } ,
168
174
} ;
169
175
export const kSizedDepthStencilFormats = keysOf ( kSizedDepthStencilFormatInfo ) ;
170
176
0 commit comments