Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gles] fix: Set FORCE_POINT_SIZE if it is vertex shader with mesh consist of point list #3440

Merged
merged 4 commits into from Feb 15, 2023

Conversation

REASY
Copy link
Contributor

@REASY REASY commented Jan 31, 2023

fix: Set FORCE_POINT_SIZE if it is vertex shader with mesh consist of point list

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Fixes #3179
Blocked by gfx-rs/naga#2223

Description
PrimitiveTopology::PointList does not render on WebGL on Windows OS.

It is because gl_PointSize is not set. According to https://registry.khronos.org/OpenGL/specs/es/3.2/GLSL_ES_Specification_3.20.html#built-in-language-variables

The variable gl_PointSize is intended for a shader to write the size of the point to be rasterized. It is measured in pixels. If gl_PointSize is not written to, its value is undefined in subsequent pipe stages.

Testing
I'm pointing WGPU to use fixed version of naga from gfx-rs/naga#2223. Then I run hello-triangle

cargo run-wasm --example hello-triangle --features webgl --port 18000

And expect to see 64 red pixels as in the screenshot below:
image

Cargo.toml Outdated Show resolved Hide resolved
wgpu-hal/src/gles/device.rs Outdated Show resolved Hide resolved
wgpu/examples/hello-triangle/main.rs Outdated Show resolved Hide resolved
@REASY REASY force-pushed the fix/3179 branch 5 times, most recently from 6787e6d to 5352b3e Compare February 3, 2023 11:54
@REASY REASY requested review from teoxoy and cwfitzgerald and removed request for teoxoy and cwfitzgerald February 3, 2023 11:56
wgpu-hal/src/gles/device.rs Outdated Show resolved Hide resolved
wgpu-hal/src/gles/device.rs Outdated Show resolved Hide resolved
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@cwfitzgerald cwfitzgerald merged commit ee33f4d into gfx-rs:master Feb 15, 2023
@REASY REASY mentioned this pull request Mar 16, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PrimitiveTopology::PointList does not render on WebGL
3 participants