Skip to content

Commit c5f48e4

Browse files
authored
WebGPUUtils: Ensure sample count is valid (#31352)
* 1|4 * NaN to 1
1 parent 0908ac5 commit c5f48e4

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/renderers/webgpu/utils/WebGPUUtils.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -161,29 +161,14 @@ class WebGPUUtils {
161161
/**
162162
* Returns a modified sample count from the given sample count value.
163163
*
164-
* That is required since WebGPU does not support arbitrary sample counts.
164+
* That is required since WebGPU only supports either 1 or 4.
165165
*
166166
* @param {number} sampleCount - The input sample count.
167167
* @return {number} The (potentially updated) output sample count.
168168
*/
169169
getSampleCount( sampleCount ) {
170170

171-
let count = 1;
172-
173-
if ( sampleCount > 1 ) {
174-
175-
// WebGPU only supports power-of-two sample counts and 2 is not a valid value
176-
count = Math.pow( 2, Math.floor( Math.log2( sampleCount ) ) );
177-
178-
if ( count === 2 ) {
179-
180-
count = 4;
181-
182-
}
183-
184-
}
185-
186-
return count;
171+
return sampleCount >= 4 ? 4 : 1;
187172

188173
}
189174

0 commit comments

Comments
 (0)