@@ -146,11 +146,7 @@ class WebGPUTextureUtils {
146146
147147 textureData . format = format ;
148148
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 ) ;
154150
155151 let usage = GPUTextureUsage . TEXTURE_BINDING | GPUTextureUsage . COPY_DST | GPUTextureUsage . COPY_SRC ;
156152
@@ -174,7 +170,7 @@ class WebGPUTextureUtils {
174170 depthOrArrayLayers : depth ,
175171 } ,
176172 mipLevelCount : levels ,
177- sampleCount : primarySampleCount ,
173+ sampleCount : primarySamples ,
178174 dimension : dimension ,
179175 format : format ,
180176 usage : usage
@@ -208,12 +204,12 @@ class WebGPUTextureUtils {
208204
209205 }
210206
211- if ( texture . isRenderTargetTexture && sampleCount > 1 && ! texture . isMultisampleRenderTargetTexture ) {
207+ if ( isMSAA ) {
212208
213209 const msaaTextureDescriptorGPU = Object . assign ( { } , textureDescriptorGPU ) ;
214210
215211 msaaTextureDescriptorGPU . label = msaaTextureDescriptorGPU . label + '-msaa' ;
216- msaaTextureDescriptorGPU . sampleCount = sampleCount ;
212+ msaaTextureDescriptorGPU . sampleCount = samples ;
217213
218214 textureData . msaaTexture = backend . device . createTexture ( msaaTextureDescriptorGPU ) ;
219215
@@ -336,7 +332,7 @@ class WebGPUTextureUtils {
336332 depthTexture . image . width = width ;
337333 depthTexture . image . height = height ;
338334
339- this . createTexture ( depthTexture , { sampleCount : backend . utils . getSampleCount ( backend . renderer . samples ) , width, height } ) ;
335+ this . createTexture ( depthTexture , { width, height } ) ;
340336
341337 return backend . get ( depthTexture ) . texture ;
342338
0 commit comments