Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
S
swiftshader
  • 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
  • swiftshader
  • Repository

Switch branch/tag
  • swiftshader
  • src
  • Pipeline
  • SetupRoutine.cpp
Find file
BlameHistoryPermalink
  • Nicolas Capens's avatar
    Fix back-face culling for vertices near w=0 · eeb81843
    Nicolas Capens authored Jan 12, 2021
    When the homogeneous w coordinate is near 0, the projected x or y
    coordinates (after viewport and subpixel scaling) may be larger than
    what's representable by 32-bit signed integers. On x86 this produces
    the "indefinite" integer value 0x80000000. This negative value is
    returned even for positive inputs. This causes the back-face culling
    calculations to reject triangles which are in fact visible.
    
    This change addresses that by introducing the rr::RoundIntClamped()
    function, which guarantees that very large positive floating-point
    values are converted to a positive integer value near INT_MAX.
    
    Note that the Vulkan spec states that "[the determination whether the
    triangle is back-facing or front-facing] is made based on the sign of
    the (clipped or unclipped) polygon’s area computed in framebuffer
    coordinates." Thus the alternative of performing culling using the
    unprojected coordinates would have to take negative viewport dimensions
    into account, and may not produce the same results as sub-pixel
    snapped coordinates.
    
    Adjust back-face culling of wireframe triangles to use the same
    calculations as solid triangles.
    
    Bug: b/177382194
    Change-Id: Ice8493d4cfd164638f091bf5a39b5396d65458e2
    Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/51648Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
    Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
    eeb81843
SetupRoutine.cpp 18.9 KB
EditWeb IDE
×

Replace SetupRoutine.cpp

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.