Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
G
glslang
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Chen Yisong
  • glslang
  • Repository

Switch branch/tag
  • glslang
  • Test
  • hlsl.intrinsics.promote.frag
Find file
BlameHistoryPermalink
  • steve-lunarg's avatar
    HLSL: add intrinsic function implicit promotions · ef33ec09
    steve-lunarg authored Nov 02, 2016
    This PR handles implicit promotions for intrinsics when there is no exact match,
    such as for example clamp(int, bool, float).  In this case the int and bool will
    be promoted to a float, and the clamp(float, float, float) form used.
    
    These promotions can be mixed with shape conversions, e.g, clamp(int, bool2, float2).
    
    Output conversions are handled either via the existing addOutputArgumentConversion
    function, which this PR generalizes to handle either aggregates or unaries, or by
    intrinsic decomposition.  If there are methods or intrinsics to be decomposed,
    then decomposition is responsible for any output conversions, which turns out to
    happen automatically in all current cases.  This can be revisited once inout
    conversions are in place.
    
    Some cases of actual ambiguity were fixed in several tests, e.g, spv.register.autoassign.*
    
    Some intrinsics with only uint versions were expanded to signed ints natively, where the
    underlying AST and SPIR-V supports that.  E.g, countbits.  This avoids extraneous
    conversion nodes.
    
    A new function promoteAggregate is added, and used by findFunction.  This is essentially
    a generalization of the "promote 1st or 2nd arg" algorithm in promoteBinary.
    
    The actual selection proceeds in three steps, as described in the comments in
    hlslParseContext::findFunction:
    
    1. Attempt an exact match.  If found, use it.
    2. If not, obtain the operator from step 1, and promote arguments.
    3. Re-select the intrinsic overload from the results of step 2.
    ef33ec09
hlsl.intrinsics.promote.frag 1.68 KB
EditWeb IDE
×

Replace hlsl.intrinsics.promote.frag

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.