@@ -146,11 +146,7 @@ class WebGPUTextureUtils {
146
146
147
147
textureData . format = format ;
148
148
149
- let sampleCount = options . sampleCount !== undefined ? options . sampleCount : 1 ;
150
-
151
- sampleCount = backend . utils . getSampleCount ( sampleCount ) ;
152
-
153
- const primarySampleCount = texture . isRenderTargetTexture && ! texture . isMultisampleRenderTargetTexture ? 1 : sampleCount ;
149
+ const { samples, primarySamples, isMSAA } = backend . utils . getTextureSampleData ( texture ) ;
154
150
155
151
let usage = GPUTextureUsage . TEXTURE_BINDING | GPUTextureUsage . COPY_DST | GPUTextureUsage . COPY_SRC ;
156
152
@@ -174,7 +170,7 @@ class WebGPUTextureUtils {
174
170
depthOrArrayLayers : depth ,
175
171
} ,
176
172
mipLevelCount : levels ,
177
- sampleCount : primarySampleCount ,
173
+ sampleCount : primarySamples ,
178
174
dimension : dimension ,
179
175
format : format ,
180
176
usage : usage
@@ -208,12 +204,12 @@ class WebGPUTextureUtils {
208
204
209
205
}
210
206
211
- if ( texture . isRenderTargetTexture && sampleCount > 1 && ! texture . isMultisampleRenderTargetTexture ) {
207
+ if ( isMSAA ) {
212
208
213
209
const msaaTextureDescriptorGPU = Object . assign ( { } , textureDescriptorGPU ) ;
214
210
215
211
msaaTextureDescriptorGPU . label = msaaTextureDescriptorGPU . label + '-msaa' ;
216
- msaaTextureDescriptorGPU . sampleCount = sampleCount ;
212
+ msaaTextureDescriptorGPU . sampleCount = samples ;
217
213
218
214
textureData . msaaTexture = backend . device . createTexture ( msaaTextureDescriptorGPU ) ;
219
215
@@ -336,7 +332,7 @@ class WebGPUTextureUtils {
336
332
depthTexture . image . width = width ;
337
333
depthTexture . image . height = height ;
338
334
339
- this . createTexture ( depthTexture , { sampleCount : backend . utils . getSampleCount ( backend . renderer . samples ) , width, height } ) ;
335
+ this . createTexture ( depthTexture , { width, height } ) ;
340
336
341
337
return backend . get ( depthTexture ) . texture ;
342
338
0 commit comments