From 46320c6238ab6acfecbb09b9da0fe2321625bb9b Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sat, 28 Oct 2023 20:18:52 -0400 Subject: [PATCH] wgpu: Round down Context3D sample count to nearest power of 2 (#13762) --- render/wgpu/src/context3d/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/render/wgpu/src/context3d/mod.rs b/render/wgpu/src/context3d/mod.rs index 54645612645a..4e8a96c7377a 100644 --- a/render/wgpu/src/context3d/mod.rs +++ b/render/wgpu/src/context3d/mod.rs @@ -545,6 +545,12 @@ impl Context3D for WgpuContext3D { if sample_count == 0 { sample_count = 1; } + let next_pot = sample_count.next_power_of_two(); + if sample_count != next_pot { + // Round down to nearest power of 2 + sample_count = next_pot / 2; + } + let texture_label = create_debug_label!("Render target texture"); let format = wgpu::TextureFormat::Rgba8Unorm;