1. 13 Jan, 2021 1 commit
    • Fix back-face culling for vertices near w=0 · eeb81843
      Nicolas Capens authored
      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>
  2. 11 Jan, 2021 3 commits
  3. 10 Jan, 2021 1 commit
  4. 08 Jan, 2021 5 commits
  5. 07 Jan, 2021 3 commits
  6. 05 Jan, 2021 1 commit
  7. 30 Dec, 2020 1 commit
    • Add support for Vulkan12Properties · ff29e249
      Sean Risser authored
      VkPhysicalDeviceVulkan12Properties was added to the core spec by Vulkan
      1.2. It allows users to query the following properties simultaneously:
          * VkPhysicalDeviceDriverProperties
          * VkPhysicalDeviceFloatControlsProperties
          * VkPhysicalDeviceDescriptorIndexingProperties
          * VkPhysicalDeviceDepthStencilResolveProperties
          * VkPhysicalDeviceSamplerFilterMinmaxProperties
          * VkPhysicalDeviceTimelineSemaphoreProperties
          * and framebufferIntegerColorSampleCounts
      
      All these structs are a part of the core spec and must be supported.
      
      Bug: b/176498010
      Change-Id: I82b06f219d2ee091139964ee8b19f05e1c64e3a8
      Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/51408
      Kokoro-Result: kokoro <noreply+kokoro@google.com>
      Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
      Tested-by: 's avatarSean Risser <srisser@google.com>
      Commit-Queue: Sean Risser <srisser@google.com>
  8. 17 Dec, 2020 2 commits
    • Optimize reciprocal sqrt operation · 1cc5b335
      Antonio Maiorano authored
      This change deprecates rr::RcpSqrt_pp with rr::RcpSqrt. As with Rcp,
      RcpSqrt computes the result using Newton-Rhapson if it's faster and the
      initial approximation intrinsic is available on the current target.
      Currently, only LLVM on Intel will use NR for RelaxedPrecision. Note
      that passing in Precision::Relaxed will produce a faster, but less
      precise reciprocal sqrt.
      
      Also made it so that SprivShader instruction GLSLstd450InverseSqrt now
      invokes RcpSqrt(x, Precision::Full) instead of performing 1/sqrt(x).
      Note that the Vulkan spec states that inversesqrt()'s precision is 2
      ULP, and sqrt()'s precision is inherited from 1.0 / inversesqrt();
      however, our rr::Sqrt is implemented in terms of x86's sqrt intrinsic on
      x86, or as calls to sqrt from Math.h.
      
      Bug: b/169760262
      Change-Id: I65ba9a64d1db934c523dda11c1a2c186059d220b
      Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/51268
      Commit-Queue: Antonio Maiorano <amaiorano@google.com>
      Kokoro-Result: kokoro <noreply+kokoro@google.com>
      Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
      Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com>
    • Optimize reciprocal operation · d1561871
      Antonio Maiorano authored
      This change deprecates rr::Rcp_pp with rr::Rcp, which makes sure to
      correctly compute the reciprocal using the Newton-Rhapson refinement
      only if the current target supports the required instrinsic, otherwise
      using 1 / x. Currently, only LLVM on Intel will use NR. Note that
      passing in Precision::Relaxed will produce a faster, but less precise
      reciprocal.
      
      Also removed PixelProgram::linearToSRGB as it's unused.
      
      Bug: b/169760262
      Bug: b/149574741
      Change-Id: I4a2f943aa60116c4397d7a8ae18583a260824788
      Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/50648Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
      Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
      Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com>
      Commit-Queue: Antonio Maiorano <amaiorano@google.com>
  9. 15 Dec, 2020 1 commit
  10. 14 Dec, 2020 5 commits
  11. 12 Dec, 2020 1 commit
  12. 11 Dec, 2020 7 commits
  13. 10 Dec, 2020 4 commits
  14. 09 Dec, 2020 5 commits