Skip to content

double precision trig and exponentials is not implemented #712

Backlog

Description

@joshuamday

There might just be nothing that can be done about this due to
https://registry.khronos.org/OpenGL/extensions/ARB/ARB_gpu_shader_fp64.txt
which says

Double-precision versions of angle, trigonometry, and exponential functions are not supported.

Expected Behaviour

64 bit trig functions should compile. If nothing can be done here, glam should use the libm sinf rather than a single spirv instr

Example & Steps To Reproduce

Attempt to compile a shader with something like:
DVec2::splat(0.0).sin();
(Float64 capability required)
The shader will not compile.

System Info

  • Rust: [rustc 1.98.1 (48a229cea 2026-09-01)]
  • OS: [Kubuntu 26.04 LTS]
  • GPU: [NVIDIA GeForce GTX 1650]
  • SPIR-V: [SPIRV-Tools v2026.4 v2026.4-0-gef96ed76]

Error message

cargo::warning=error: error:0:0 - GLSL.std.450 Sin: expected Result Type to be a 16 or 32-bit scalar or vector float type
cargo::warning=         %139 = OpExtInst %double %1 Sin %134

Activity

  1. added
    bug
    on Dec 2, 2026
  2. Firestar99 commented on Dec 2, 2026

    @Firestar99
    Member

    I don't think spirv can even express f64 sin / cos. And given my current time allotted to rust-gpu being effectively 0, there's little chance I can get around fixing this.

  3. joshuamday commented on Dec 2, 2026

    @joshuamday
    ContributorAuthor

    Glam uses libm (for spirv), and libm uses a fallback. I can't see why it isn't already using the fallback, but if it could use the fallback that would fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions