bevy_prototype_lyon icon indicating copy to clipboard operation
bevy_prototype_lyon copied to clipboard

Rendering breaks when used with bevy_webgl2

Open camblomquist opened this issue 3 years ago • 4 comments

I'm running the setup system from the readme example along with the bevy_webgl2_app_template. In the native build, the shape renders properly. In the wasm build, the shape is not visible on screen.

For giggles, we can add the shape to the webgl2 template scene. In native, the shape cuts the cube and plane in half as expected. In the wasm build, nothing renders at all!

For completeness, I've tested in Firefox and Edge. When the shape is included, I see the following warning in the Edge console: [.WebGL-0000177809F82080] GL_INVALID_OPERATION: It is undefined behaviour to have a used but unbound uniform buffer. and in the Firefox console: WebGL warning: drawElementsInstanced: Buffer for uniform block is smaller than UNIFORM_BLOCK_DATA_SIZE. Though to be honest I don't know if these are relevant.

camblomquist avatar Jun 17 '21 01:06 camblomquist

Given the latest news about the new renderer, I think it's best to wait for it, especially because bevy_webgl2 will be permanently broken by the new design (as bevyengine/bevy#2351 states).

However, if someone wants to fix this now, feel free to make a PR.

Nilirad avatar Jun 17 '21 16:06 Nilirad

After spending too long fiddling around, I have no solutions but will say that I was wrong in including those warning messages. I don't see them in the first test scenario, so they appear to be unrelated.

camblomquist avatar Jun 18 '21 14:06 camblomquist

I was able to reproduce this.

However, the main issue seems to be that bevy_webgl2_app_template is depending on an old release of bevy_webgl2. After updating that to 0.5.2, rendering generally works again.

There does seem to be some sort of issue when mixing in PbrBundles (z-fighting?), and with strokes and 3d cameras. But I think the first thing is pretty likely to be a bevy_webgl2 bug and I don't know if very many people are trying to do that.

image

rparrett avatar Aug 18 '21 14:08 rparrett

It seems bit odd, because it's my understanding thatbevy_webgl2 = {version="0.5.0", optional=true} should bring in 0.5.2.

But the steps of

  • Clone bevy_webgl2_app_template
  • Add bevy_protototype_lyon readme example (minus the 2d camera)
  • Build for web

Seem to get me

   Compiling bevy v0.5.0
   Compiling bevy_prototype_lyon v0.3.1
   Compiling bevy_webgl2 v0.5.0

And explicitly specifying

[dependencies]
bevy_webgl2 = {version="0.5.2", optional=true}

Makes things work

   Compiling bevy_webgl2 v0.5.2

rparrett avatar Aug 18 '21 14:08 rparrett