Skip to content

Setting a pipeline-overridable shader constant to f64::INFINITY results in a crash on certain platforms #6082

Closed as not planned
@polina4096

Description

@polina4096

Description
When setting a pipeline-overridable shader constant to f64::INFINITY, code fails with an error on certain platforms in various configurations. I've only been able to catch this on Windows as of now.

Repro steps

device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
  label: None,
  layout: Some(&pipeline_layout),
  vertex: wgpu::VertexState {
    module: &shader,
    entry_point: "vs_main",
    buffers: &[],
    compilation_options: wgpu::PipelineCompilationOptions {
      constants: &HashMap::new().tap_mut(|x| {
        x.insert(String::from("1000"), f64::INFINITY);
      }),
      ..Default::default()
    },
  },
  /* ... */
}

Expected vs observed behavior
This results in a crash with a message saying to report the issue. Not really sure which is the best way to handle this case otherwise, but at least it should not behave like that.

Extra materials
Screenshot 2024-08-06 at 05 07 51

Platform
Windows 11
wgpu = "22.1.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions