gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.8k stars 938 forks source link

Set `DownlevelFlags::CUBE_ARRAY_TEXTURES` properly on the GLES backend #3742

Open Archspect opened 1 year ago

Archspect commented 1 year ago

Here is the full code and log where I got this error https://gist.github.com/Archspect/02a2007bbc85f90dc89db30b58d1fce7

I am using Arch Linux with an intel integrated graphics card that supports OpenGL 3.3 The system is up to date as the time of this issue being written.

teoxoy commented 1 year ago

Thanks for the report! How did you check that it should support OpenGL 3.3?

Archspect commented 1 year ago

Thanks for the report! How did you check that it should support OpenGL 3.3?

Well I just ran minecraft :P

to be sure I ran the glxinfo | grep "OpenGL version" command and it returned this OpenGL version string: 3.3 (Compatibility Profile) Mesa 23.0.1

bwqr commented 1 year ago

Hi there,

I also encountered the same issue while running a bevy application. Here is the relevant part of the log

2023-04-05T11:29:22.205826Z  INFO bevy_render::renderer: AdapterInfo { name: "Mesa Intel(R) HD Graphics 3000 (SNB GT2)", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Gl }
2023-04-05T11:29:22.938895Z ERROR bevy_app:frame:renderer subapp:stage{name="render"}: wgpu::backend::direct: Shader translation error for stage VERTEX: The selected version doesn't support CUBE_TEXTURES_ARRAY
synesthesium commented 1 year ago

I second this error, also on Intel HD Graphics, of which support up to OpenGL 4.2. Here's the log gist, though it might not be very useful considering it's similarity to the last. https://gist.github.com/synesthesium/2bcb6db2a69b8e70aec3f2f3300eacad

Edit: Indeed, checked it just now.

┌[hex@ketabox-void] [/dev/pts/0] [master ⚡] 
└[~/workspaces/mvns]> glxinfo | grep "OpenGL version"
OpenGL version string: 4.2 (Compatibility Profile) Mesa 22.3.5
teoxoy commented 1 year ago

Ah, wgpu currently only supports OpenGL ES not OpenGL. CUBE_TEXTURES_ARRAY is only supported on OpenGL ES 3.1 + GL_EXT_texture_cube_map_array OR OpenGL ES 3.2.

@Archspect @bwqr @synesthesium could you confirm that this works as intended?

cwfitzgerald commented 1 year ago

We should boil this requirement up as a downlevel flag.

synesthesium commented 1 year ago

Ah, wgpu currently only supports OpenGL ES not OpenGL. CUBE_TEXTURES_ARRAY is only supported on OpenGL ES 3.1 + GL_EXT_texture_cube_map_array OR OpenGL ES 3.2.

@Archspect @bwqr @synesthesium could you confirm that this works as intended?

Hm. If that's the case then expectedly it might not work (My gpu only supports GLES 3.0)

Archspect commented 1 year ago

That makes sense, my GPU only supports up to 3.0 :/

❯ glxinfo | grep 'version'
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 3.3
    Max compat profile version: 3.3
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL core profile version string: 3.3 (Core Profile) Mesa 23.0.3
OpenGL core profile shading language version string: 3.30
OpenGL version string: 3.3 (Compatibility Profile) Mesa 23.0.3
OpenGL shading language version string: 3.30
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 23.0.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

Is it possible to downgrade things so It runs on 3.0 OpenGL ES?

teoxoy commented 1 year ago

We should boil this requirement up as a downlevel flag.

We already have one but it seems it's set regardless of version/extension.

https://github.com/gfx-rs/wgpu/blob/66c029f172af69d012d11f863d3c08eefa8f6395/wgpu-hal/src/gles/adapter.rs#L296

teoxoy commented 1 year ago

Is it possible to downgrade things so It runs on 3.0 OpenGL ES?

Maybe as a workaround but I don't imagine it being a nice one.

Archspect commented 1 year ago

How much features will be lost by sticking to OpenGL ES 3.0?

teoxoy commented 1 year ago

Most DownlevelFlags we have are because of GLES, you should check those.