Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • mesa mesa
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2,879
    • Issues 2,879
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 905
    • Merge requests 905
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mesa
  • mesamesa
  • Merge requests
  • !1757

Merged
Created Aug 23, 2019 by Neil Roberts@nrobertsDeveloper

Store the precision qualifier for the return type in the function signature

  • Overview 3
  • Commits 1
  • Pipelines 2
  • Changes 3

The precision qualifiers from GLSL ES do not form part of the glsl_type. Instead they are stored out-of-band in various places. For example for variables they are stored in ir_variable_data and for struct members they are stored in glsl_struct_field. The return type of a function is stored in ir_function_signature which previously didn’t have a place to store the precision. This patch adds that in.

This will eventually be useful when we want to take advantage of the mediump information to lower to float16 types (see MR1043). However I thought it might make sense as a separate MR because this patch is not specific to that approach to lowering. Rather it just extends the existing support for tracking precision qualifiers.

The patch additionally adds a compile check to verify that multiple declarations of the same function have the same return precision in addition to checking the return type. I think this is backed up by the following quote from GLSL ES 3.20 spec:

Only a precision qualifier is allowed on the return type of a function. […] If a function name is declared twice with the same parameter types, then the return types and all qualifiers must also match, and it is the same function being declared.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: function-return-precision