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

Tracking issue for webgpu 0.8 upgrade #734

Closed
5 tasks done
AlexEne opened this issue May 13, 2021 · 4 comments
Closed
5 tasks done

Tracking issue for webgpu 0.8 upgrade #734

AlexEne opened this issue May 13, 2021 · 4 comments

Comments

@AlexEne
Copy link
Contributor

AlexEne commented May 13, 2021

I've started an upgrade to 0.8 here and I'm creating this issue to track the progress.
This is not a final list, just what I found so far.

  • Wait for conrod to upgrade: Bump webgpu to 0.8 PistonDevelopers/conrod#1416
  • Upgrade the nannou code-base to wgpu 0.8 (it's here: https://github.com/AlexEne/nannou)
  • Fix IMPLICIT_LEVEL in [27] is not fulfilled because of Expression([3]
  • Fix blending options for Min and Max they should both be using One.
  • timeline_demo fails because of colorable trait not being implemented by the Timeline. It seems conrod has added a special trait that you need to have in order to allow people to call color(...)
@AlexEne
Copy link
Contributor Author

AlexEne commented May 14, 2021

Running some examples I get:

error: process didn't exit successfully: `target\debug\examples\draw_texture_sampler.exe` (exit code: 0xc000041d)
PS G:\Rust\nannou> cargo run --example draw_blend
   Compiling examples v0.1.0 (G:\Rust\nannou\examples)
    Finished dev [unoptimized + debuginfo] target(s) in 4.99s
     Running `target\debug\examples\draw_blend.exe`
wgpu error: Validation Error

Caused by:
    In Device::create_shader_module
      note: label = `nannou_shader_module`
    Function [1] 'main' is invalid
    Required uniformity of control flow for IMPLICIT_LEVEL in [27] is not fulfilled because of Expression([3])

@AlexEne
Copy link
Contributor Author

AlexEne commented May 14, 2021

I've fixed that error above by modifying shader.frag to not sample a potentially mipmapped texture inside an if block:

void main() {
    vec4 f_color_texture = texture(sampler2D(tex, tex_sampler), v_tex_coords);
    float tex_a = texture(sampler2D(text, text_sampler), v_tex_coords).r;
    
    // Color
    if (v_mode == uint(0)) {
        f_color = v_color;
    // Texture
    } else if (v_mode == uint(1)) {
        f_color = f_color_texture;
    // Text
    } else if (v_mode == uint(2)) {
        f_color = vec4(v_color.rgb, v_color.a * tex_a);
    // Unhandled mode - Indicate error with red.
    } else {
        f_color = vec4(1.0, 0.0, 0.0, 1.0);
    }
}

The webgpu-rs devs also suggested I would leave inside the if and specify the lod level if I know exactly what level to sample from like so: textureLod(sampler2D(...), tex_coords, 0)

@AlexEne
Copy link
Contributor Author

AlexEne commented May 14, 2021

I've decided to try my luck here with sampling twice because we get textures from people experimenting with the framework so it's probably better to be more generic rather than limit it to 0.

@AlexEne AlexEne mentioned this issue May 15, 2021
@AlexEne
Copy link
Contributor Author

AlexEne commented May 27, 2021

Closing this as there's a PR ready to merge: #737

@AlexEne AlexEne closed this as completed May 27, 2021
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

No branches or pull requests

1 participant