Skip to content

Commit 0f5d575

Browse files
adrian17Wumpf
andauthored
Lower max_color_attachments limit for GL to 4 (#6994)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
1 parent 2f607d3 commit 0f5d575

File tree

6 files changed

+9
-4
lines changed

6 files changed

+9
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ By @brodycj in [#6924](https://github.com/gfx-rs/wgpu/pull/6924).
9393
- Add Flush to GL Queue::submit. By @cwfitzgerald in [#6941](https://github.com/gfx-rs/wgpu/pull/6941).
9494
- Fix `wgpu` not building with `--no-default-features` on when targeting `wasm32-unknown-unknown`. By @wumpf in [#6946](https://github.com/gfx-rs/wgpu/pull/6946).
9595
- Fix `CopyExternalImageDestInfo` not exported on `wgpu`. By @wumpf in [#6962](https://github.com/gfx-rs/wgpu/pull/6962).
96+
- Reduce downlevel `max_color_attachments` limit from 8 to 4 for better GLES compatibility. By @adrian17 in [#6994](https://github.com/gfx-rs/wgpu/pull/6994).
9697
- Fix drop order in `Surface`. By @ed-2100 in [#6997](https://github.com/gfx-rs/wgpu/pull/6997)
9798
- Fix a possible deadlock within `Queue::write_texture`. By @metamuffin in [#7004](https://github.com/gfx-rs/wgpu/pull/7004)
9899
- Fix building a BLAS with a transform buffer by adding a flag to indicate usage of the transform buffer. By @Vecvec in

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ wgpu = { version = "24.0.0", path = "./wgpu", default-features = false, features
6565
"dx12",
6666
"metal",
6767
"static-dxc",
68+
"webgl",
6869
] }
6970
wgpu-core = { version = "24.0.0", path = "./wgpu-core" }
7071
wgpu-hal = { version = "24.0.0", path = "./wgpu-hal" }

wgpu-hal/src/gles/adapter.rs

+1
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ impl super::Adapter {
825825
private_caps,
826826
workarounds,
827827
features,
828+
limits: limits.clone(),
828829
options: backend_options,
829830
shading_language_version,
830831
next_shader_id: Default::default(),

wgpu-hal/src/gles/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ struct AdapterShared {
274274
context: AdapterContext,
275275
private_caps: PrivateCapabilities,
276276
features: wgt::Features,
277+
limits: wgt::Limits,
277278
workarounds: Workarounds,
278279
options: wgt::GlBackendOptions,
279280
shading_language_version: naga::back::glsl::Version,

wgpu-hal/src/gles/queue.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1078,8 +1078,8 @@ impl super::Queue {
10781078
0,
10791079
)
10801080
};
1081-
for i in 0..crate::MAX_COLOR_ATTACHMENTS {
1082-
let target = glow::COLOR_ATTACHMENT0 + i as u32;
1081+
for i in 0..self.shared.limits.max_color_attachments {
1082+
let target = glow::COLOR_ATTACHMENT0 + i;
10831083
unsafe {
10841084
gl.framebuffer_texture_2d(
10851085
glow::DRAW_FRAMEBUFFER,

wgpu-types/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ impl Limits {
506506
/// min_uniform_buffer_offset_alignment: 256,
507507
/// min_storage_buffer_offset_alignment: 256,
508508
/// max_inter_stage_shader_components: 60,
509-
/// max_color_attachments: 8,
509+
/// max_color_attachments: 4,
510510
/// max_color_attachment_bytes_per_sample: 32,
511511
/// max_compute_workgroup_storage_size: 16352, // *
512512
/// max_compute_invocations_per_workgroup: 256,
@@ -526,6 +526,7 @@ impl Limits {
526526
max_texture_dimension_3d: 256,
527527
max_storage_buffers_per_shader_stage: 4,
528528
max_uniform_buffer_binding_size: 16 << 10, // (16 KiB)
529+
max_color_attachments: 4,
529530
// see: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf#page=7
530531
max_compute_workgroup_storage_size: 16352,
531532
..Self::defaults()
@@ -563,7 +564,7 @@ impl Limits {
563564
/// min_uniform_buffer_offset_alignment: 256,
564565
/// min_storage_buffer_offset_alignment: 256,
565566
/// max_inter_stage_shader_components: 31,
566-
/// max_color_attachments: 8,
567+
/// max_color_attachments: 4,
567568
/// max_color_attachment_bytes_per_sample: 32,
568569
/// max_compute_workgroup_storage_size: 0, // +
569570
/// max_compute_invocations_per_workgroup: 0, // +

0 commit comments

Comments
 (0)