Skip to content

vrend: workaround non-conformant sampler view pattern

Ryan Neph requested to merge ryanneph/virglrenderer:rn-wa-alpha-view into main

Works around a rendering artifact in clients that are presumed to be relying on implementation-defined behavior when sampling the alpha channel of imported textures without one. Do the simplest thing and pass the implementation-defined behavior decision to the native host driver.

Signed-off-by: Ryan Neph ryanneph@google.com


This is the particular bug for which this workaround is desired: https://github.com/ValveSoftware/steam-for-linux/issues/10546

On ChromeOS with virgl as the OpenGL driver, host-side triggers a GL_INVALID_OPERATION upon creating a glTextureView() as explained in the following log output:

texture view created for EGL-backed texture sampler (format: PIPE_FORMAT_B8G8R8X8_UNORM; view: PIPE_FORMAT_B8G8R8A8_UNORM)
...
[2024-02-28T00:18:18.750352240+00:00 DEBUG rutabaga_gfx::virgl_renderer] ERROR: GL_INVALID_OPERATION in glTextureView(internalformat GL_RGBA8 not compatible with origtexture GL_RGB8)
[2024-02-28T00:18:18.750407276+00:00 DEBUG rutabaga_gfx::virgl_renderer] vrend_check_no_error: context error reported 6 "Composite Threa" Unknown 1282
[2024-02-28T00:18:18.750421562+00:00 DEBUG rutabaga_gfx::virgl_renderer] context 6 failed to dispatch CREATE_OBJECT: 22
[2024-02-28T00:18:18.750432055+00:00 DEBUG rutabaga_gfx::virgl_renderer] vrend_decode_ctx_submit_cmd: context error reported 6 "Composite Threa" Illegal command buffer 394753
[2024-02-28T00:18:18.750443958+00:00 DEBUG devices::virtio::gpu] Some(CmdSubmit3d) -> ErrRutabaga(ComponentError(22))
Edited by Ryan Neph

Merge request reports