OSDN Git Service

android-x86/external-swiftshader.git
2 years agoFix fragments depth values not being clamped q-x86
Alexis Hetu [Tue, 14 Apr 2020 19:57:03 +0000 (15:57 -0400)]
Fix fragments depth values not being clamped

According to the Vulkan 1.2 spec:
"For fixed-point depth buffers, fragment depth values are
 always limited to the range [0,1] by clamping after depth
 bias addition is performed. Fragment depth values are
 clamped even when the depth buffer uses a floating-point
 representation."

So, unless the VK_EXT_depth_range_unrestricted extension
is enabled, clamping should always occur.

Bug: b/152634772
Change-Id: I2aee2aeb91efed7399580689fc0ffc0634b2f487
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43869
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>

2 years agoCMake: split out Vulkan sources into separate CMakeLists
Antonio Maiorano [Thu, 9 Apr 2020 03:18:13 +0000 (23:18 -0400)]
CMake: split out Vulkan sources into separate CMakeLists

Add CMakeLists.txt to the following folders under src that create the
following targets:

Device -> vk_device
Pipeline -> vk_pipeline
WSI -> vk_wsi
System -> vk_system
Vulkan -> vk_swiftshader

Dependencies (by folder):

System --> n/a
Pipeline --> System Device* Vulkan*
WSI --> System Pipeline Vulkan*
Device --> System Pipeline Vulkan*
Vulkan --> Device Pipeline WSI System

* = dependency by include directory only (should fix this in the future)

Also make system-unittests and system-benchmarks depend on vk_system
rather than build part of System source files.

Bug: b/145758253
Change-Id: I9cce59ca90d91601696f6195326b5fd7dde517d5
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43690
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoDevice: Rename RoutineCacheT to RoutineCache
Ben Clayton [Mon, 13 Apr 2020 07:24:45 +0000 (08:24 +0100)]
Device: Rename RoutineCacheT to RoutineCache

`RoutineCache` was not used, remove it.
Rename `RoutineCacheT` to the now unused name `RoutineCache`.

Bug: b/126126820
Change-Id: I656c1727446754b2063033806634678b14485b6f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43816
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoDevice: Don't inherit [Vertex,Setup,Pixel]Processor.
Ben Clayton [Tue, 14 Apr 2020 08:22:14 +0000 (09:22 +0100)]
Device: Don't inherit [Vertex,Setup,Pixel]Processor.

Prefer composition over inheritance.
Makes it clear that the virtual destructors on these processors are unnecessary.

Bug: b/126126820
Change-Id: I062c06191ec1cdfb81f2a2773a976bf5c596e658
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43817
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>

2 years ago[vulkan] Implement VK_FUCHSIA_external_memory extension.
David 'Digit' Turner [Mon, 9 Sep 2019 15:58:46 +0000 (17:58 +0200)]
[vulkan] Implement VK_FUCHSIA_external_memory extension.

This implements external memory using a Zircon VMO handle
that can be transferred between Fuchsia processes easily.

Bug: b/140419396
Change-Id: I81cecec35b218eb22f3318ddec7b790b89e5ce09
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/36168
Tested-by: David Turner <digit@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoReuse Store logic for Modf and Frexp output parameters
Nicolas Capens [Thu, 9 Apr 2020 06:48:16 +0000 (02:48 -0400)]
Reuse Store logic for Modf and Frexp output parameters

The Modf and Frexp instructions from the GLSL.std.450 extended SPIR-V
instruction set take a pointer argument to write one of their results
to. This makes them the only arithmetic instructions which need to know
how to explicitly access memory.

This change replaces the partial duplication of store logic with a call
to the underlying implementation of OpStore. To support storing
intermediate values not associated with SPIR-V objects, the Operand
class can now also wrap an independent Intermediate instance.

Bug: b/153641251
Change-Id: Iebab43640b45ed6c27a77576168481d1a27158b6
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43728
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
2 years agoSeparate Operand store logic from EmitStore()
Nicolas Capens [Thu, 9 Apr 2020 06:48:16 +0000 (02:48 -0400)]
Separate Operand store logic from EmitStore()

The new Store() helper function can store Operand instances independent
from SPIR-V instructions. This allows reuse of this logic for other
instructions that need to store to memory, like Modf and Frexp.

Bug: b/153641251
Change-Id: I453bb7cd24ba26b9a23d73568dc3374a52a36073
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43695
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2 years agoOnly store component count in Operand
Nicolas Capens [Thu, 9 Apr 2020 06:01:50 +0000 (02:01 -0400)]
Only store component count in Operand

The Operand class is a low-level abstraction of rvalues and constants.
It should not carry the SPIR-V type ID. We only need the size in
components.

Bug: b/129000021
Change-Id: I6cb3ed6341b1ccf5ef759075d7410ba447617c8b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43693
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
2 years agoRename size/sizeInComponents to componentCount
Nicolas Capens [Tue, 14 Apr 2020 04:46:38 +0000 (00:46 -0400)]
Rename size/sizeInComponents to componentCount

Bug: b/129000021
Change-Id: I36401de649eb53474ca74acb069351ce37f7529f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43828
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
2 years agoUse the type and result ID helpers
Nicolas Capens [Thu, 9 Apr 2020 05:05:31 +0000 (01:05 -0400)]
Use the type and result ID helpers

Avoid directly accessing SPIR-V instruction words. The helper methods
provide self-explanatory semantics so we can eliminate local variables
to store these IDs.

Bug: b/129000021
Change-Id: Ie42782d53b9c24014b6a1b1f51b82085b6c2ebef
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43694
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>

2 years agoObtain type ID from instruction
Nicolas Capens [Thu, 9 Apr 2020 03:37:08 +0000 (23:37 -0400)]
Obtain type ID from instruction

The defining instruction already contains the type ID.

Bug: b/129000021
Change-Id: I0b29fda73964f5f4a73181a61a0f30cd1c47f404
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43692
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
2 years agoAdd helper methods for obtaining type and result ID
Nicolas Capens [Thu, 9 Apr 2020 03:44:07 +0000 (23:44 -0400)]
Add helper methods for obtaining type and result ID

For instructions which define objects, the type ID and result ID are
always the second and third SPIR-V instruction word, respectively.

Bug: b/129000021
Change-Id: I6879251732860b80e1f7780d9078ad7bc9751b4c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43691
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
2 years agoLLVMReactor: Replace deprecated CreateCall overload
Ben Clayton [Sat, 11 Apr 2020 14:17:05 +0000 (15:17 +0100)]
LLVMReactor: Replace deprecated CreateCall overload

This has been removed in LLVM master.

Bug: b/152339534
Change-Id: I613bae6c31944457bd52278228e33af6f85cce97
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43810
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years ago[cmake] Add support for CMAKE_SYSTEM_NAME == "Fuchsia"
David 'Digit' Turner [Tue, 19 Nov 2019 16:54:00 +0000 (17:54 +0100)]
[cmake] Add support for CMAKE_SYSTEM_NAME == "Fuchsia"

This patch modifies the CMakeLists.txt file and a few sources
in order to build the SwiftShader Vulkan ICD for Fuchsia with
CMake.

Note that building EGL/GLES_CM/GLESv2 and tests is not supported,
and should be explicitly disabled when configuring the build,
e.g.:

  mkdir build-fuchsia && build-fuchsia
  cmake .. \
    -DCMAKE_TOOLCHAIN_FILE=.../FuchsiaSdkToolchain.cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DSWIFTSHADER_BUILD_TESTS=0 \
    -DSWIFTSHADER_BUILD_EGL=0 \
    -DSWIFTSHADER_BUILD_GLES_CM=0 \
    -DSWIFTSHADER_BUILD_GLESv2=0 \
    <other-cmake-options>

  make  # or ninja

NOTE: This should not affect the build for other platforms!

This will make it easier to conditionally add Fuchsia-specific
sources to the build (see discussion on b/144687651 for details).

The BUILD.gn file will still be maintained in parallel for
Fuchsia-specific changes.

NOTE: As of now, the Fuchsia SDK doesn't provide a way for
      third-party code to access the framebuffer directly.

      Instead, client code should rely on Vulkan presentation
      surfaces or higher-level APIs provided by the compositor
      that are still in flux / unstable. Hence this will appear
      in a future CL.

Bug: b/143122483
Bug: b/144687651
Change-Id: Ica3b98f5a8eb1370287e2bb4ff22ef938aaa4b49
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/38488
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: David Turner <digit@google.com>
2 years agoRename GenericValue to Operand
Nicolas Capens [Thu, 9 Apr 2020 01:55:43 +0000 (21:55 -0400)]
Rename GenericValue to Operand

Bug: b/129000021
Change-Id: I0000fc5e65bde87e9037400002db37cb6d50960d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43688
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2 years agoCMake: Fix linux build with SWIFTSHADER_BUILD_PVR
Ben Clayton [Thu, 9 Apr 2020 11:06:19 +0000 (12:06 +0100)]
CMake: Fix linux build with SWIFTSHADER_BUILD_PVR

The targets `libGLESv2` and `libEGL` are no longer public to the root cmake list.
Just move these copy ops into the subdirectory cmake rules without the PVR condition - the copy is cheap enough to do whether we're building PVR or not.

Bug: b/145758253
Change-Id: Ic28331e3797c78e4910332fce934c06c132c3aa8
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43710
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoVulkan/Debug: Fix clang-10 warning
Ben Clayton [Thu, 9 Apr 2020 10:30:40 +0000 (11:30 +0100)]
Vulkan/Debug: Fix clang-10 warning

It correctly points out that despite `Type() = default;`, there's non-assigned const fields, so there's no way to generate a default constructor.

Bug: b/145351270
Change-Id: I1c680982d960df278b5fcca5b29e837a4c82b70d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43709
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agothird_party/cppdap: Roll forward to 4dcca577
Ben Clayton [Thu, 9 Apr 2020 10:29:12 +0000 (11:29 +0100)]
third_party/cppdap: Roll forward to 4dcca577

Changes:
    de7dffa Socket: Use SO_REUSEADDR, disable SO_LINGER
    9a9d46f Fix bad usage of std::move
    3e6cfd6 CMake: Make the cppdap target's include directory public
    4abe43c optional: Remove the value() method that returns non-const-ref.
    ced82a0 examples: Change stdin and stdout to binary mode
    96b25aa src/io.cpp: Fix uninitialized variable.
    93b8610 examples: Suffix package exe with .exe on Windows
    cdc19ac Serialization: Correctly encode structs with no fields
    3a10d4c Format all source files
    8633aba Add clang-format-all.sh to format all project sources
    1be9bb6 launch.json - fix name of unittests to launch
    d19d8f8 Address #7 nits and fix compiler warning (#9)
    73d697e Fix Response type info, make response 'body' field optional
    eab43f3 net::Server: Fix onError parameter default.

Bug: b/145351270
Change-Id: I6a7767f8b763e8029571d65aa5446f5043ad83ac
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43708
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoClamp _SNORM formats to -1.0
Corentin Wallez [Wed, 8 Apr 2020 13:26:26 +0000 (15:26 +0200)]
Clamp _SNORM formats to -1.0

Following the Vulkan 1.1 specification Section 2.9.1. "Conversion from
Normalized Fixed-Point to Floating-Point":

Note that while zero is exactly expressible in this representation, one
value (-128 in the example) is outside the representable range, and must be
clamped before use.

https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#fundamentals-fixedfpconv

Bug: dawn:283
Change-Id: Id548c6d67132ac36f33bc020954c5511de624ffc
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43648
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Corentin Wallez <cwallez@google.com>
2 years agoRemove debug only code limiting the number of primitives
Alexis Hetu [Wed, 8 Apr 2020 20:20:44 +0000 (16:20 -0400)]
Remove debug only code limiting the number of primitives

A test in dEQP was failing using SwANGLE in debug.
The test was using a 1200x1200 grid
 -> 1,44M squares
 -> 2,88M triangles

This was exceeding our hardcoded limit of 1 << 21 (2,097,152).

Removing this code makes the test pass.

Bug: b/152958809
Change-Id: I43fc3c0c9d78378911ab0238a908367ba310c09e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43668
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
2 years agoRegres: Post coverage results even if the test lists have not changed.
Ben Clayton [Wed, 8 Apr 2020 13:47:28 +0000 (14:47 +0100)]
Regres: Post coverage results even if the test lists have not changed.

Do this by breaking up the monolithic `runDaily()` function, and combining errors from the new `postDailyResults()` and `postCoverageResults()` functions.

Bug: b/152192800
Change-Id: I031b37fa32d6d05ae1c38dff27a180c809aa4fe1
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43649
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoCMake: split out all src/OpenGL targets into their own CMakeLists
Antonio Maiorano [Tue, 7 Apr 2020 14:09:41 +0000 (10:09 -0400)]
CMake: split out all src/OpenGL targets into their own CMakeLists

Added CMakeLists.txt to the following folders that produce the
following targets:

src/OpenGL/common -> libGLESCommon (new)
src/OpenGL/compiler -> GLCompiler
src/OpenGL/libEGL -> libEGL
src/OpenGL/libGLESv2 ->libGLESv2
src/OpenGL/libGLES_CM -> libGLES_CM

Change-Id: I8217918b13b6963d18d1e6f89b4fa9e806bb36db
Bug: b/145758253
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43588
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoCMake: split out SwiftShader GL deps into separate files
Antonio Maiorano [Mon, 6 Apr 2020 20:16:21 +0000 (16:16 -0400)]
CMake: split out SwiftShader GL deps into separate files

This change add a CMakeLists in each of the following folders, and
creates the following targets:

src/Common -> gl_common
src/Main -> gl_main
src/Renderer -> gl_renderer
src/Shader -> gl_shader

Bug: b/145758253
Change-Id: Ia1f68d0689f80955586235e125e0197da25d692d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43550
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoCMake: clean up dependencies
Antonio Maiorano [Mon, 6 Apr 2020 16:22:44 +0000 (12:22 -0400)]
CMake: clean up dependencies

This change makes it so that source/Common and source/Main are only
referenced by the SwiftShader target. This will allow for better
target-based sub CMakeLists.

* Remove SharedLibrary.hpp/cpp from source list of libGLESv2 and
  libGLES_CM, as both of these depend on SwiftShader, which already
  builds these files.

* Make libEGL depend on SwiftShader, so we can remove
  SharedLibrary.hpp/cpp and Main/libX11.hpp/cpp from its
  source list.

Bug: b/145758253
Change-Id: If3d8e12cd09fb40d699080c2eeaa8243abe50512
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43528
Tested-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoAdd SystemBenchmarks.
Ben Clayton [Mon, 6 Apr 2020 17:10:25 +0000 (18:10 +0100)]
Add SystemBenchmarks.

This benchmarks `sw::LRUCache`, which currently resides in the `src/Device` folder (but will be moved to `src/System`) with 43489.

Bug: b/153338950
Change-Id: I169b6ecb4a35349726a01b1da52472eaef3dfd74
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43492
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>

2 years agoVkCommandBuffer: Remove static Cast() method
Ben Clayton [Tue, 7 Apr 2020 19:20:56 +0000 (20:20 +0100)]
VkCommandBuffer: Remove static Cast() method

This isn't used.

There's another Cast() declared at vk scope, below VkCommandBuffer that actually is used.

Bug: b/153462569
Change-Id: Id348676c9bb00aa934a972a2833ac6a1d3af54c1
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43575
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRemove src/Device/Config.cpp
Ben Clayton [Tue, 7 Apr 2020 18:56:41 +0000 (19:56 +0100)]
Remove src/Device/Config.cpp

Holds sw::Profiler that is entirely dead code.
There's little here that looks worthy of keeping. Let's remove it.

Bug: b/153462569
Change-Id: I4330781e8ba362461f164f0a52f764d4fe8f4dc4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43574
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoKokoro: Check that build files don't reference non-existent files
Ben Clayton [Tue, 7 Apr 2020 15:24:35 +0000 (16:24 +0100)]
Kokoro: Check that build files don't reference non-existent files

This is a primitive check to ensure that .bp, .gn and .bazel files don't have source references to missing files.

This can catch a common build breakage.

Fixes: b/153439736
Change-Id: I95621f8775a0e536015d4da9897785935f130884
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43572
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Fix uncovered calculations after optimizations
Ben Clayton [Tue, 7 Apr 2020 18:17:22 +0000 (19:17 +0100)]
Regres: Fix uncovered calculations after optimizations

The uncovered span calculations were ignoring span groups and inverted spans.
This is now correctly handled by Tree.allSpans().

Bug: b/152192800
Change-Id: I2bd8afa3c956b03b598a3d5297cb775fd19da35d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43573
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Optimize coverage processing
Ben Clayton [Tue, 7 Apr 2020 13:33:26 +0000 (14:33 +0100)]
Regres: Optimize coverage processing

This had regressed mostly due to a single thread processing a huge number of `Span.Add()`s.

Optimize for the common case, avoid `Span.Add()` in places where the data is already sorted, don't scan the entire file system for every test run.

Bug: b/152192800
Change-Id: Id183468263e65bfbcf387ec1c978d8b9de547cee
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43570
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Re-populate treeFile.allSpans on parse.
Ben Clayton [Tue, 7 Apr 2020 13:12:17 +0000 (14:12 +0100)]
Regres: Re-populate treeFile.allSpans on parse.

This caused `TestTreeEncodeDecode` to fail, and would make the reparsing of a coverage file incorrect.

Bug: b/152192800
Change-Id: Ic9f4c49c58350509f74755fec20f22b6c1213877
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43569
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoUpdate third_party/marl/BUILD.gn with new files
Ben Clayton [Tue, 7 Apr 2020 13:41:15 +0000 (14:41 +0100)]
Update third_party/marl/BUILD.gn with new files

`include/marl/sal.h` was replaced with `include/marl/tsa.h`.
Also add other missing files.

Bug: b/140546382
Change-Id: I7f766b3c362de2ce6e4e317762de98db50467d8f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43571
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoUpdate Marl to 539094011
Ben Clayton [Tue, 7 Apr 2020 09:43:07 +0000 (10:43 +0100)]
Update Marl to 539094011

Includes new Thread Safety Analysis helpers

Changes:
    539094011 CMake: Export MARL_THREAD_SAFETY_ANALYSIS_SUPPORTED
    c7f70ba7a CMake: Bump min version + include(CheckCXXSourceCompiles)
    658a204fc Replace SAL annotations with clang's TSA annotations
    9630bec2f Fix CMake warning: "Policy CMP0023 is not set"
    9f369ad5d Update yarn:: to marl:: in an example

Commands:
    ./third_party/update-marl.sh --squash

Bug: b/140546382
Change-Id: Idb4253c11cece99ea4b22f965b974b63e26b51a7

2 years agoSquashed 'third_party/marl/' changes from 16e1dc37c..539094011
Ben Clayton [Tue, 7 Apr 2020 09:43:07 +0000 (10:43 +0100)]
Squashed 'third_party/marl/' changes from 16e1dc37c..539094011

539094011 CMake: Export MARL_THREAD_SAFETY_ANALYSIS_SUPPORTED
c7f70ba7a CMake: Bump min version + include(CheckCXXSourceCompiles)
658a204fc Replace SAL annotations with clang's TSA annotations
9630bec2f Fix CMake warning: "Policy CMP0023 is not set"
9f369ad5d Update yarn:: to marl:: in an example

git-subtree-dir: third_party/marl
git-subtree-split: 53909401165022553ed9d1f0c572178559dc25ec

2 years agoCoverage: Improve uncovered visualizations
Ben Clayton [Mon, 6 Apr 2020 16:21:20 +0000 (17:21 +0100)]
Coverage: Improve uncovered visualizations

List all files, including those that have no coverage.
Emit spans that were compiled, but not covered.
Emit a % coverage per file.

Bug: b/152192800
Fixes: b/153182184
Change-Id: I31c831273a8d3ee89c7ce0737b6e05398ff4f51b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43491
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoDon't blend integer formats
Alexis Hetu [Mon, 6 Apr 2020 19:19:27 +0000 (15:19 -0400)]
Don't blend integer formats

True integer formats should not use blend modes.
This cl explicitly disables any blend operation
on render targets using integer formats.

Bug: b/153203552
Change-Id: Ia756953c61caef8e32e55aa31126044973ae1870
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43548
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
2 years agoClamp GLES sine/cosine to [-1,1]
Antonio Maiorano [Fri, 3 Apr 2020 20:46:32 +0000 (16:46 -0400)]
Clamp GLES sine/cosine to [-1,1]

Hack for minor precision issues with current implementation. Fixes
8 quality warnings from deqp-gles3 when run against
SwiftShaderGL/Subzero.

Bug: b/151461290
Change-Id: I4a3148add2c0987dcccca96e7c877ea4fb16ca89
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43470
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoDelete Plane.cpp and Plane.hpp
Alexis Hetu [Fri, 3 Apr 2020 19:38:32 +0000 (15:38 -0400)]
Delete Plane.cpp and Plane.hpp

Cleaning up unused code

Bug: b/153177839
Change-Id: I42479778f0f6ec9a955ba7f863766429b68c73a3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43468
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
2 years agoCMake / Kokoro: Build and run system-unittests.
Ben Clayton [Fri, 3 Apr 2020 23:29:56 +0000 (00:29 +0100)]
CMake / Kokoro: Build and run system-unittests.

These were added for the .gn build, but were never enabled for the CMake build.

Test these as part of the Kokoro presubmits.

Bug: b/153193374
Change-Id: I36e7428bfe1a4867bea39b2fbb302aed6c3dff7b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43488
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoVulkan: Destruct the list of vk::Query in QueryPool
Ben Clayton [Sat, 4 Apr 2020 10:22:35 +0000 (11:22 +0100)]
Vulkan: Destruct the list of vk::Query in QueryPool

Bug: b/153168751
Bug: b/153206490
Change-Id: I2822f60aa380ae3885bc674d9f7b1f283c087e95
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43490
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoReally fix Android build
Antonio Maiorano [Fri, 3 Apr 2020 19:47:30 +0000 (15:47 -0400)]
Really fix Android build

Bug: none
Change-Id: I9f58cc3bf6b457fc8b916a98242138865f89c577
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43469
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
2 years agoFix Chromium and Android build
Antonio Maiorano [Fri, 3 Apr 2020 17:58:36 +0000 (13:58 -0400)]
Fix Chromium and Android build

I broke this when I removed the relative path to the third_party astc
include file in this change:
https://swiftshader-review.googlesource.com/c/SwiftShader/+/43269

Bug: none
Change-Id: I45de8a6159c69c893df4449f6c6e10b09a9e6fe4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43448
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
2 years agoDebug: Add missing include.
Ben Clayton [Fri, 3 Apr 2020 12:21:24 +0000 (13:21 +0100)]
Debug: Add missing include.

When `ENABLE_VK_DEBUGGER` is defined, VkDevice needs to be declared in order to build.

Bug: b/148401179
Change-Id: If35f3a1425ec0d739750d632305a625c7e12b721
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43432
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoVulkan/Debug: Create a PhysicalFile if DebugSource has no content
Ben Clayton [Fri, 3 Apr 2020 12:03:40 +0000 (13:03 +0100)]
Vulkan/Debug: Create a PhysicalFile if DebugSource has no content

`VirtualFile`s are typically used for files with no physical backing.
Use `PhysicalFile` if there's no content provided in the debug info.

Bug: b/148401179
Change-Id: I1e1ed75ce9a9fb0965420267aba7f6d8de958012
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43430
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoVulkan/Debug: Always provide the dap::Source::path
Ben Clayton [Fri, 3 Apr 2020 12:02:04 +0000 (13:02 +0100)]
Vulkan/Debug: Always provide the dap::Source::path

This is common for virtual and physical files.

Bug: b/148401179
Change-Id: I266097382098c1daf776ae64d878f08febee5d0e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43429
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoCMake: Don't always regenerate OpenCLDebugInfo100.h
Ben Clayton [Fri, 3 Apr 2020 11:58:32 +0000 (12:58 +0100)]
CMake: Don't always regenerate OpenCLDebugInfo100.h

https://github.com/KhronosGroup/SPIRV-Headers/issues/137 is still ongoing.

Fixes: b/15093697
Change-Id: I2498f35a8049fb2a1a86aa0efe6fbd6e59ad6493
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43428
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoCMake: use gtest and gmock targets
Antonio Maiorano [Tue, 31 Mar 2020 15:01:43 +0000 (11:01 -0400)]
CMake: use gtest and gmock targets

Bug: b/145758253
Bug: b/152606052
Change-Id: I826225ed393ed324301555ebaea14947997632cf
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43289
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
2 years agoCMake: split out atsc-encoder into its own CMakeLists
Antonio Maiorano [Tue, 31 Mar 2020 01:55:20 +0000 (21:55 -0400)]
CMake: split out atsc-encoder into its own CMakeLists

Also remove dependency of third_party/astc-encoder on
src/System/Debug.hpp.

Bug: b/145758253
Change-Id: I329928d9221c99a416fcdb1b0dd44d2578a22cb8
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43269
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoCMake: clean up cppdap usage
Antonio Maiorano [Tue, 31 Mar 2020 01:29:07 +0000 (21:29 -0400)]
CMake: clean up cppdap usage

Remove unused and useless variables. Also fix the build when
SWIFTSHADER_ENABLE_VULKAN_DEBUGGER is enabled.

Bug: b/145758253
Change-Id: Ie49dd88d6716b24fe31baa8f8d162e7dacfa5a3c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43268
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoCMake: split out Reactor into its own CMakeLists
Antonio Maiorano [Mon, 30 Mar 2020 20:41:48 +0000 (16:41 -0400)]
CMake: split out Reactor into its own CMakeLists

Bug: b/145758253
Change-Id: I36f1bbf599389c27e084fea9af3d732225567076
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43230
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
2 years agoCMake: split out boost into its own CMakeLists
Antonio Maiorano [Mon, 30 Mar 2020 17:28:34 +0000 (13:28 -0400)]
CMake: split out boost into its own CMakeLists

This adds a third_party/boost folder with a CMakeLists.txt. If this
folder is added via add_subdirectory, it downloads boost to the
binary directory and exposes the Boost::boost target.

Bug: b/145758253
Change-Id: I7d4e383630cb84da928cf0622a641e9e0efc2ad8
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43191
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
2 years agoCMake: split out libbacktrace into its own CMakeLists
Antonio Maiorano [Mon, 30 Mar 2020 15:11:16 +0000 (11:11 -0400)]
CMake: split out libbacktrace into its own CMakeLists

This change also fixes compilation on Linux when REACTOR_EMIT_DEBUG_INFO
is enabled, which has been broken since "-fno-exceptions" was added to
SWIFTSHADER_COMPILE_OPTIONS. Also, at some point,
LIBBACKTRACE_CONFIG_DIR stopped being used, which further broke
compiling libbacktrace.

Bug: b/145758253
Change-Id: I50f0e2c2c1dabc357dfc255a471eaf1e9fed1c2e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43189
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
2 years agoCMake: split out subzero and llvm-subzero into their own CMakeLists
Antonio Maiorano [Fri, 27 Mar 2020 19:01:53 +0000 (15:01 -0400)]
CMake: split out subzero and llvm-subzero into their own CMakeLists

Bug: b/145758253
Change-Id: Ife32c322cf87c9b1b98b4b50f591b75db6ea51e2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43148
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
2 years agoKokoro: Add the ppa:ubuntu-toolchain-r/test apt-repository
Ben Clayton [Fri, 3 Apr 2020 12:10:05 +0000 (13:10 +0100)]
Kokoro: Add the ppa:ubuntu-toolchain-r/test apt-repository

Bug: None - Fix Kokoro presubmits.
Change-Id: I16074e733edd257647840d1bf51ebdc14dd4fb89
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43431
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRemove the D3D9 and D3D8 source code
Nicolas Capens [Mon, 30 Mar 2020 21:28:59 +0000 (17:28 -0400)]
Remove the D3D9 and D3D8 source code

This code has no remaining known active uses. It has been archived in
the 'legacy-d3d9' branch.

Bug: b/139189696
Change-Id: I64bf27ff6c02be560963d7eab36c9c328bb280c5
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43232
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
2 years agoRemove the custom Visual Studio solution and projects
Nicolas Capens [Mon, 30 Mar 2020 21:18:05 +0000 (17:18 -0400)]
Remove the custom Visual Studio solution and projects

CMake should be used instead.

Note that the CMake build does not support the D3D9 and D3D8 targets.
They can still be built with Visual Studio 2019 from the 'legacy-d3d9'
branch.

Bug: b/139189696
Change-Id: I7b5006fa98e479d6d1a3bb75d379a5818a560c20
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43231
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
2 years agoFix GN build
Nicolas Capens [Thu, 2 Apr 2020 20:36:27 +0000 (16:36 -0400)]
Fix GN build

cf. https://swiftshader-review.googlesource.com/c/SwiftShader/+/43388

Bug: build fix
Change-Id: I8d2acc0bbb19fa71748aafeebd6c0d500673ed93
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43408
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
2 years agoReactor: Fix remove_if brokenness
Ben Clayton [Wed, 1 Apr 2020 18:49:44 +0000 (19:49 +0100)]
Reactor: Fix remove_if brokenness

Spotted by Chris Forbes:
* `std::remove_if` wasn't introduced in C++20, it's been there since 98. I just can't read docs.
* Also fix the lack of `list.erase()`.

Bug: None. drive-by-code-reviewing-fixes.
Change-Id: I456d540ba973640747d6e4cb23faec65a4a9c83d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43348
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRemove the sw::Color<> class
Nicolas Capens [Thu, 2 Apr 2020 09:22:04 +0000 (05:22 -0400)]
Remove the sw::Color<> class

It was only still being used to store framebuffer blend constants.
Use sw::float4 instead.

Bug: b/146224130
Change-Id: Ie5660e237f4b675564d5a492f9d0a38505d07953
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43388
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoChange for loops to use const refs, per performance-for-range-copy clang-tidy.
Ben Clayton [Thu, 2 Apr 2020 09:12:11 +0000 (10:12 +0100)]
Change for loops to use const refs, per performance-for-range-copy clang-tidy.

This CL optimizes C++11 range-based for loops where the variable is copied in each iteration but it would suffice to obtain it by const reference.  This is only applied to loop variables of types that are expensive to copy which means they are not trivially copyable or have a non-trivial copy constructor or destructor.

To ensure that it is safe to replace the copy with a const reference the following heuristic is employed:
  The loop variable is const qualified.
  The loop variable is not const, but only const methods or operators are invoked on it, or it is used as const reference or value argument in constructors or function calls.

See cl/304001946 for more information.

Bug: None.
Change-Id: Idbb5a0dbf19c6dccb16a0d525900aa99419a8527
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43368
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoFix ImageView size computation
Alexis Hetu [Wed, 1 Apr 2020 20:49:03 +0000 (16:49 -0400)]
Fix ImageView size computation

Erroneous ImageView size computation was causing out of bounds
memory accesses whenever an ImageView only represents a subsection
of an Image. The getSizeInBytes() function now only returns the
size in bytes within the Image object from the beginning to the
end of the bytes used by the ImageView.

Bug: b/150464740
Change-Id: I0985af9cdfbb85b10336a7691f76009496bb2ae5
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43329
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
2 years agoMetalSurface: set layer.device to a ref of the system default device.
Corentin Wallez [Fri, 27 Mar 2020 16:38:29 +0000 (17:38 +0100)]
MetalSurface: set layer.device to a ref of the system default device.

If layer.device is null, [layer nextDrawable] returns nil, so on surface
initialization we set layer.device to a dummy MTLDevice by getting a
reference of the system default device.

MTLCreateSystemDefaultDevice() requires linking against
Metal.framework but Chromium needs to ship on platforms that don't have
Metal. This means we can't directly link against the framework, instead
we "weakly" link against it so that if it is not present, the function
pointers are just null (instead of failing to launch).

Bug: dawn:269
Change-Id: I5984613f576849c6f219c253da7eb277fa75ef52
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43209
Kokoro-Presubmit: Corentin Wallez <cwallez@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Corentin Wallez <cwallez@google.com>
2 years agoRegres: Add invertCommon optimization.
Ben Clayton [Tue, 31 Mar 2020 11:29:21 +0000 (12:29 +0100)]
Regres: Add invertCommon optimization.

invertCommon looks for tree nodes with the majority of the child nodes with the same spans.
This span is promoted up to the parent, and the children have the
span inverted.

This causes the span IDs to flip (inclusive / exlusive) each time they're seen while decending the tree. This adds a bit of complexity to the parsing of the data, but the file size reduction is significant.

Bug: b/152192800
Change-Id: I5ec294d42004d936004c27ef15bf94a7143372ba
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43311
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Move optimization logic to separate file
Ben Clayton [Tue, 31 Mar 2020 10:44:53 +0000 (11:44 +0100)]
Regres: Move optimization logic to separate file

There's more to come.

Bug: b/152192800
Change-Id: Icc0928fa0051269f9ca14e9177a9a8ef56d05a34
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43310
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Keep coverage span groups stable.
Ben Clayton [Tue, 31 Mar 2020 10:41:53 +0000 (11:41 +0100)]
Regres: Keep coverage span groups stable.

Update tests.

Bug: b/152192800
Change-Id: I4e57f0d2b049f0bce7459b29f7ffc3a2ca03534a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43309
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Split coverage.go into multiple files
Ben Clayton [Tue, 31 Mar 2020 10:07:42 +0000 (11:07 +0100)]
Regres: Split coverage.go into multiple files

This was getting unruly.

Bug: b/152192800
Change-Id: I41a393e0548367ea4d69c3982b89a6ffe198e9f7
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43308
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Further optimizations for coverage
Ben Clayton [Mon, 30 Mar 2020 19:53:21 +0000 (20:53 +0100)]
Regres: Further optimizations for coverage

Compress common spans into groups and index these.
Reduces the full coverage json from ~500MB to just under 100MB.

Use zlib compression on the final file instead of a zip. The compression algorithm is the same, and produces roughly the same sized output, but a raw zlib file is much quicker to decompress with pako instead of jszip.

Bug: b/152192800
Change-Id: Id444ddf4027b6ace03570719f159ae14e481cd37
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43249
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Add cov.ReadJSON()
Ben Clayton [Mon, 30 Mar 2020 11:52:32 +0000 (12:52 +0100)]
Regres: Add cov.ReadJSON()

And add test to check it behaves as expected.

While currently nothing golang actually parses these files, this allows me to experiment with compression schemes on the full data set without needing to rebuild the coverage data from scratch each time.

Bug: b/152192800
Change-Id: I8070abe2bbebaef3e5889991060f1d1342078eb2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43248
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoFix implicit narrowing cast
Nicolas Capens [Mon, 30 Mar 2020 19:09:16 +0000 (15:09 -0400)]
Fix implicit narrowing cast

Bug: b/152777669
Change-Id: I271ca0ecb5ff8461530fd6388378524970a2bc2b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43228
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
2 years agoEliminate the legacy PowerVR SDK
Nicolas Capens [Mon, 30 Mar 2020 16:42:40 +0000 (12:42 -0400)]
Eliminate the legacy PowerVR SDK

We now have an up-to-date third_party/PowerVR_Examples submodule for
these sample applications.

Bug: b/141361933
Change-Id: I216b94d0c3263bf85a6b0a7fca52a2e5b7beefa2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43190
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoIntegrate PowerVR OpenGL ES samples
Nicolas Capens [Mon, 30 Mar 2020 13:08:47 +0000 (09:08 -0400)]
Integrate PowerVR OpenGL ES samples

Also add some additional Vulkan samples to the 'good' set.

Bug: b/141361933
Change-Id: I32fe2d691ca2fd176a8c470fdb34b25a55840cd6
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42389
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoFix completeness test of OpenGL ES immutable textures
Nicolas Capens [Mon, 30 Mar 2020 13:06:15 +0000 (09:06 -0400)]
Fix completeness test of OpenGL ES immutable textures

Immutable textures created with glTexStorage*() are always mipmap and
sampler complete. The spec states that

"Array levels k where k < levelbase or k > q arebinsignificant to the
definition ofcompleteness."

Where q is no larger than levelmax, which is in turn limited to
levelimmut - 1 which was specified at glTexStorage.

Change-Id: Ieaa6be856fd35cf2827e753d7c777ebf784027ef
Tests: dEQP-GLES*
Fixes: b/152740217
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43188
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
2 years agoRevert "MetalSurface: set layer.device to a ref of the system default device."
Corentin Wallez [Mon, 30 Mar 2020 16:08:43 +0000 (16:08 +0000)]
Revert "MetalSurface: set layer.device to a ref of the system default device."

This reverts commit 81d8c2ada561340400ccda0c560dc8f61ffb9a30.

Reason for revert: Breaks macOS swiftshader build

Change-Id: I1c54aaf772f651d731d90e843c85549a4f7a38b8
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43208
Tested-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
2 years agoMetalSurface: set layer.device to a ref of the system default device.
Corentin Wallez [Fri, 27 Mar 2020 16:38:29 +0000 (17:38 +0100)]
MetalSurface: set layer.device to a ref of the system default device.

If layer.device is null, [layer nextDrawable] returns nil, so on surface
initialization we set layer.device to a dummy MTLDevice by getting a
reference of the system default device.

Using MTLCreateSystemDefaultDevice() requires linking against
Metal.framework but Chromium needs to ship on platforms that don't have
Metal. This means we can't directly link against the framework, instead
we "weakly" link against it so that if it is not present, the function
pointers are just null (instead of failing to launch).

Bug: dawn:269
Change-Id: I8719c45a19718ff79ef21f47515fe1c15b99628b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43112
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Corentin Wallez <cwallez@google.com>
2 years agoDon't expose the sampling routine cache's mutex
Nicolas Capens [Sun, 29 Mar 2020 03:04:55 +0000 (23:04 -0400)]
Don't expose the sampling routine cache's mutex

The getOrCreate() method takes care of the mutex locking and unlocking,
and takes the function for creating the routine as a callback argument.

Bug: b/131246679
Change-Id: I0873f6be94c92a11181ce575d1b44ed040177d43
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42869
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2 years agoCreate PowerVR targets if submodule already exists
Nicolas Capens [Wed, 18 Mar 2020 02:36:24 +0000 (22:36 -0400)]
Create PowerVR targets if submodule already exists

If the PowerVR_Examples submodule has been checked out, enable creating
the CMake targets for them. This helps make them available in all
configurations in Visual Studio, without editing the cache for each of
them individually.

Bug: b/141361933
Change-Id: I700407be4c6b89866856b0c4f2d6ae55180c4fcd
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42488
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2 years agoRegres: Generate coverage data on nightly runs
Ben Clayton [Sat, 28 Mar 2020 00:45:19 +0000 (00:45 +0000)]
Regres: Generate coverage data on nightly runs

Push this to https://github.com/swiftshader-regres/swiftshader-coverage so that it can be viewed at:
https://swiftshader-regres.github.io/swiftshader-coverage/

There's quite a lot of new code and fixes in this change. The most notable:
* The regres daily run for the subzero backend now produces combined coverage information for all the test runs. The LLVM backend does not produce coverage information.
* Regres now takes two additional command line arguments: `gh-user` and `gh-pass` for the swiftshader-regres account. If you omit these, then coverage will not be produced.
* test.srcDir has been renamed to checkoutDir, as this was confusing with the `src` directory in the repo.
* The coverage JSON now contains a root field to describe the git revision to which it relates. This prevents the coverage going out of sync with the source.
* `git.CheckoutRemoteBranch()` drops back to a depth of 1 again. This was only increased to 99 to deal with issues checking out from gitlab, which we don't do any more.
* Regres  now builds using `third_party/llvm-10.0`
* Fixed the `--limit` regres command line flag which wasn't actually limiting, as it was using the len() on the number of groups, not the number of tests.

Bug: b/152192800
Bug: b/152339534
Change-Id: I2d25735f485097d4efb080546d989056a3a8aab3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43168
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoSubzero Coroutines: Use ultra-low-level marl APIs
Ben Clayton [Tue, 24 Mar 2020 11:54:05 +0000 (11:54 +0000)]
Subzero Coroutines: Use ultra-low-level marl APIs

Instead of using the `marl::Event` synchronization primitives, drop all the way down to using `marl::Scheduler::Fiber` APIs directly, and use the new `marl::Scheduler::Fiber::wait()` function that does not take a lock.

Provides around another 2x performance boost:

```
go run ./third_party/marl/tools/cmd/benchdiff/main.go pre.json post.json
Delta                | Test name                                | (A) pre.json | (B) post.json
-2.08x -81.186µs     | Coroutines/Fibonacci/iterations:512      | 156.202µs    | 75.016µs
-2.10x -668.201µs    | Coroutines/Fibonacci/iterations:4096     | 1.275069ms   | 606.868µs
-2.11x -5.359326ms   | Coroutines/Fibonacci/iterations:32768    | 10.166126ms  | 4.8068ms
-2.12x -10.342µs     | Coroutines/Fibonacci/iterations:64       | 19.585µs     | 9.243µs
-2.13x -2.784542745s | Coroutines/Fibonacci/iterations:16777216 | 5.251299045s | 2.4667563s
-2.13x -347.220746ms | Coroutines/Fibonacci/iterations:2097152  | 653.812928ms | 306.592182ms
-2.14x -43.615678ms  | Coroutines/Fibonacci/iterations:262144   | 82.017312ms  | 38.401634ms
```

Bug: b/145754674
Change-Id: I5f6b0c8c92af645cc2a825c6f1e2769b2440638e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42850
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoSubzero: Ensure coroutines are same-thread.
Ben Clayton [Mon, 16 Mar 2020 20:35:04 +0000 (20:35 +0000)]
Subzero: Ensure coroutines are same-thread.

Marl now has a new flag on the task to say that it should be run on the same thread that calls `marl::schedule()`.

This can dramatically reduce the scheduling overhead when bouncing between two tasks, as other threads do not have to be woken.

```
> go run ./third_party/marl/tools/cmd/benchdiff/main.go pre.json post.json
Delta                    | Test name                                | (A) pre.json    | (B) post.json
-15.53x -1m16.299750679s | Coroutines/Fibonacci/iterations:16777216 | 1m21.551049724s | 5.251299045s
-15.71x -1.206771937s    | Coroutines/Fibonacci/iterations:262144   | 1.288789249s    | 82.017312ms
-15.72x -9.624071378s    | Coroutines/Fibonacci/iterations:2097152  | 10.277884306s   | 653.812928ms
-15.77x -35.755µs        | Coroutines/Fibonacci/iterations:8        | 38.176µs        | 2.421µs
-15.77x -150.190662ms    | Coroutines/Fibonacci/iterations:32768    | 160.356788ms    | 10.166126ms
-15.79x -18.864275ms     | Coroutines/Fibonacci/iterations:4096     | 20.139344ms     | 1.275069ms
-15.93x -2.332202ms      | Coroutines/Fibonacci/iterations:512      | 2.488404ms      | 156.202µs
-15.96x -292.896µs       | Coroutines/Fibonacci/iterations:64       | 312.481µs       | 19.585µs
```

Bug: b/145754674
Change-Id: I0e014083e1dbc9f5cdf51e7abc378df6be22d805
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42410
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoRename constant cache to snapshot cache
Nicolas Capens [Thu, 19 Mar 2020 17:31:41 +0000 (13:31 -0400)]
Rename constant cache to snapshot cache

This helps clarify that the cache is able to take snapshots of its
contents, and this snapshot can be queried without the overhead of
acquiring a mutex.

Bug: b/131246679
Change-Id: I4317628a22f70d37309908b24df62dc5ec5a946c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42568
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
2 years agoAdd sampling routine documentation
Nicolas Capens [Wed, 25 Mar 2020 19:32:58 +0000 (15:32 -0400)]
Add sampling routine documentation

Bug: b/152424696
Change-Id: Ib064ff7f6d88bf965e58c0b640cd90f7f1bc2d83
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42988
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Sean Risser <srisser@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoFix Android.bp following the SPIRV-Tools update
Alexis Hetu [Fri, 27 Mar 2020 20:25:45 +0000 (16:25 -0400)]
Fix Android.bp following the SPIRV-Tools update

Following the SPIRV-Tools update, Android.bp needs to be manually
updated to reflect the changes made in SPIRV-Tools.

This change was tested with SwANGLE on Android.

Bug: b/123642959
Change-Id: I3ba86796a0a5e75d642ef13a0f06735035f1bd5c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43128
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
2 years agoRegres: Switch to building with LLVM 10
Ben Clayton [Fri, 27 Mar 2020 16:15:52 +0000 (16:15 +0000)]
Regres: Switch to building with LLVM 10

This is automatically downloaded and cached.
This is another step towards having hermetic builds, and is required for generating code coverage.

Bug: b/152192800
Change-Id: I7c35d92f5844b41ad326e7b11a7725cc6ea9696b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43111
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoRegres: Add llvm.Version.Download() to download and verify a LLVM toolchain
Ben Clayton [Fri, 27 Mar 2020 14:42:50 +0000 (14:42 +0000)]
Regres: Add llvm.Version.Download() to download and verify a LLVM toolchain

Will be used to have regres switch to LLVM 10.

Change-Id: Ia425e5d357f4877c5608b9afc89d659ebb38f701
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43110
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoKokoro: Test LLVM 10 backend for ubuntu
Ben Clayton [Fri, 27 Mar 2020 13:12:15 +0000 (13:12 +0000)]
Kokoro: Test LLVM 10 backend for ubuntu

Bug: b/152339534
Change-Id: Iff7d6d8955ce88beb6d9b98545c8d626ccb93801
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43108
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoCoverage: Add 'turbo-cov': a faster reimplementation of llvm-cov
Ben Clayton [Tue, 24 Mar 2020 22:35:34 +0000 (22:35 +0000)]
Coverage: Add 'turbo-cov': a faster reimplementation of llvm-cov

`llvm-cov` can either emit data in json or lcov formats, where json is the faster of the two.
`llvm-cov`'s output is directly piped into regres, where the json is immediately deserialized again.
The cost of serializing and deserializing is surprisingly high.

This change replaces the use of `llvm-cov` with `turbo-cov`, which simply emits a binary stream and offers up to 3x speed improvement, dramatically lowering the time taken to produce coverage for a full deqp test run.

Bug: b/152339534
Change-Id: I9292f3c27e016cf508557edf4da7656db81c2b07
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42948
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoDon't download all submodules for Kokoro tests
Nicolas Capens [Fri, 27 Mar 2020 03:51:32 +0000 (23:51 -0400)]
Don't download all submodules for Kokoro tests

The necessary submodules should be downloaded automatically.

Bug: b/141361933
Change-Id: Icd4690dccb851ecdc67a8f216a5727f1d8b7142a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43068
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
2 years agoReactor: Disable more warnings to get LLVM 10 building
Ben Clayton [Thu, 26 Mar 2020 11:24:49 +0000 (11:24 +0000)]
Reactor: Disable more warnings to get LLVM 10 building

There's yet more unnecessary semicolons knocking around in the public LLVM headers, which are purely stylistic issues. Just silence them.

`LegacyIRCompileLayer` is now annotated with deprecated, so we need to disable the warning for that too (and move to the new JIT in time).

Bug: b/152339534
Change-Id: Id84fe88fd2f6b50000e37a8b84f52742ca9db646
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43010
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoLLVM 10: Add configs/common and configs/darwin.
Ben Clayton [Thu, 26 Mar 2020 15:59:25 +0000 (15:59 +0000)]
LLVM 10: Add configs/common and configs/darwin.

Configs still to add: android, fuchsia, windows

Bug: b/152339534
Change-Id: Ieb743e50459114343e72f3be43cf6c215f1f03fe
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43013
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
2 years agoLLVM 10: Add configs/common and configs/linux.
Ben Clayton [Thu, 26 Mar 2020 11:20:35 +0000 (11:20 +0000)]
LLVM 10: Add configs/common and configs/linux.

Configs still to add: android, darwin, fuchsia, windows

Bug: b/152339534
Change-Id: I721b7a69a0a1e84f09158329557264bf2af9c5d6
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43009
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoUpdate SPIR-V Tools to fd773eb50
Alexis Hetu [Fri, 27 Mar 2020 11:59:13 +0000 (07:59 -0400)]
Update SPIR-V Tools to fd773eb50

Includes fix #3253, which fixed the following SwANGLE test:
KHR-GLES31.core.compute_shader.resources-max

Changes:
    fd773eb50 Start SPIRV-Tools v2020.3
    fd8e13051 Finalize SPIRV-Tools v2020.2
    3ef8fe9a5 Update CHANGES
    022da4d0e Fix identification of Vulkan images and buffers (#3253)
    1346dd5de Disallow phis of images, samplers and sampled images (#3246)
    1c8bda372 Add data structure for DebugScope, DebugDeclare in spirv-opt (#3183)
    e6f372c5c Whitelist SPV_KHR_ray_tracing (#3241)
    7f341ffee Make file formatting comply with POSIX standards (#3242)
    60104cd97 Add opt::Operand::AsCString and AsString (#3240)
    da52d0875 Add RayQueryProvisionalKHR to opt types (#3239)
    18d3896a1 Whitelist SPV_EXT_demote_to_helper_invocation for opt passes (#3236)
    5a97e3a39 Add support for KHR_ray_{query,tracing} extensions (#3235)
    25ede1ced Roll external/spirv-headers/ 30ef660ce..a17e17e36 (1 commit) (#3230)
    7a8f79762 Update dependencies (#3228)
    1fe9bcc10 Instrument: Debug Printf support (#3215)
    6428ad05e spirv-fuzz: Support OpPhi when adding dead break and continue (#3225)
    1af1df3b2 spirv-fuzz: Fix vector width issue in 'add equation instructions' pass (#3223)
    dd3d91691 Allow sampledimage types as operand of OpCopyObject (#3222)
    7c3de218f spirv-fuzz: Remove duplicated functionality (#3220)
    659470446 spirv-fuzz: Allow OpPhi operand to be replaced with a composite synonym (#3221)
    4c027048d spirv-fuzz: Add toggle access chain instruction transformation (#3211)
    533af4981 spirv-fuzz: Add fuzzer pass to permute function parameters (#3212)
    da4cd2148 spirv-fuzz: Use better function name (#3207)
    66a682b6a spirv-fuzz: Add swap commutable operands transformation (#3205)
    044ecc0b2 spirv-fuzz: Fuzzer pass to add equation instructions (#3202)
    a6d3a2dd4 Refactor FuzzerPass::ApplyTransformation code duplication. (#3206)
    e1688b60c Avoid use of Python distutils.dir_util (#3203)
    661e79eec Adding WebGPU specific Workgroup scope rule (#3204)
    70f888131 Add validation rules for OpenCL.DebugInfo.100 extension (#3133)
    fb6e3e48d Combine extinst-name and extinst-output-base into one arg. (#3200)

Commands:
    ./third_party/update-spirvtools.sh

Bug: b/123642959
Bug: b/148460089
Change-Id: I8fa5d3609de1c6ae786c84b93cba7ac015b4f56e

2 years agoSquashed 'third_party/SPIRV-Tools/' changes from 8910ea5f1..fd773eb50
Alexis Hetu [Fri, 27 Mar 2020 11:59:09 +0000 (07:59 -0400)]
Squashed 'third_party/SPIRV-Tools/' changes from 8910ea5f1..fd773eb50

fd773eb50 Start SPIRV-Tools v2020.3
fd8e13051 Finalize SPIRV-Tools v2020.2
3ef8fe9a5 Update CHANGES
022da4d0e Fix identification of Vulkan images and buffers (#3253)
1346dd5de Disallow phis of images, samplers and sampled images (#3246)
1c8bda372 Add data structure for DebugScope, DebugDeclare in spirv-opt (#3183)
e6f372c5c Whitelist SPV_KHR_ray_tracing (#3241)
7f341ffee Make file formatting comply with POSIX standards (#3242)
60104cd97 Add opt::Operand::AsCString and AsString (#3240)
da52d0875 Add RayQueryProvisionalKHR to opt types (#3239)
18d3896a1 Whitelist SPV_EXT_demote_to_helper_invocation for opt passes (#3236)
5a97e3a39 Add support for KHR_ray_{query,tracing} extensions (#3235)
25ede1ced Roll external/spirv-headers/ 30ef660ce..a17e17e36 (1 commit) (#3230)
7a8f79762 Update dependencies (#3228)
1fe9bcc10 Instrument: Debug Printf support (#3215)
6428ad05e spirv-fuzz: Support OpPhi when adding dead break and continue (#3225)
1af1df3b2 spirv-fuzz: Fix vector width issue in 'add equation instructions' pass (#3223)
dd3d91691 Allow sampledimage types as operand of OpCopyObject (#3222)
7c3de218f spirv-fuzz: Remove duplicated functionality (#3220)
659470446 spirv-fuzz: Allow OpPhi operand to be replaced with a composite synonym (#3221)
4c027048d spirv-fuzz: Add toggle access chain instruction transformation (#3211)
533af4981 spirv-fuzz: Add fuzzer pass to permute function parameters (#3212)
da4cd2148 spirv-fuzz: Use better function name (#3207)
66a682b6a spirv-fuzz: Add swap commutable operands transformation (#3205)
044ecc0b2 spirv-fuzz: Fuzzer pass to add equation instructions (#3202)
a6d3a2dd4 Refactor FuzzerPass::ApplyTransformation code duplication. (#3206)
e1688b60c Avoid use of Python distutils.dir_util (#3203)
661e79eec Adding WebGPU specific Workgroup scope rule (#3204)
70f888131 Add validation rules for OpenCL.DebugInfo.100 extension (#3133)
fb6e3e48d Combine extinst-name and extinst-output-base into one arg. (#3200)

git-subtree-dir: third_party/SPIRV-Tools
git-subtree-split: fd773eb50d628c1981338addc093df879757c2cf

2 years agoUpdate SPIR-V Headers to f8bf11a02
Alexis Hetu [Fri, 27 Mar 2020 11:57:21 +0000 (07:57 -0400)]
Update SPIR-V Headers to f8bf11a02

Changes:
    f8bf11a02 Merge pull request #149 from dgkoch/prov_ray_tracing
    fdbc0d1c4 Add shadercalls scope
    9a186c772 Added ray flags, primitive culling flags, queries
    9e8e6aff3 Non-functional: Update header build to match Khronos spec. builder.
    8830d1d77 Merge pull request #135 from vulturm/patch-1
    95b48cedd Update headers for SPV_KHR_ray_tracing.
    a17e17e36 Merge pull request #148 from null77/fix-gn
    976926d58 Add missing header to BUILD.gn.
    30ef660ce Merge pull request #146 from s-perron/bazel
    0d334e4ad Export NonSemanticDebugPrintf.h in bazel build
    d9ce9ca52 Merge pull request #145 from jeffbolznv/nonsemantic_debugprintf
    e814bf006 Add NonSemantic.DebugPrintf JSON/header
    89bef4096 Fix max enum value
    0a7fc4525 Add grammars, C header, and header generator for vendor and KHR extended instruction sets (#143)
    5dbc1c321 Merge pull request #142 from mkinsner/additional_loop_control_bits
    4b013f0fd Allocate three bits for upcoming Intel extension
    dc77030ac Merge pull request #141 from dneto0/update-buildgn-lic
    9c63d5773 Fix the license to match LICENSE
    0125ae61b Merge pull request #140 from ShabbyX/add_build_gn
    c7f52d34c Add BUILD.gn
    927aae4dc Also propagate SPIRV-Headers version to CMakeLists.txt

Commands:
    ./third_party/update-spirvheaders.sh

Bug: b/123642959
Change-Id: Iaacec0b1b56e49b53a16e27ddea851ee02cf6d3f

2 years agoSquashed 'third_party/SPIRV-Headers/' changes from 204cd131c..f8bf11a02
Alexis Hetu [Fri, 27 Mar 2020 11:57:20 +0000 (07:57 -0400)]
Squashed 'third_party/SPIRV-Headers/' changes from 204cd131c..f8bf11a02

f8bf11a02 Merge pull request #149 from dgkoch/prov_ray_tracing
fdbc0d1c4 Add shadercalls scope
9a186c772 Added ray flags, primitive culling flags, queries
9e8e6aff3 Non-functional: Update header build to match Khronos spec. builder.
8830d1d77 Merge pull request #135 from vulturm/patch-1
95b48cedd Update headers for SPV_KHR_ray_tracing.
a17e17e36 Merge pull request #148 from null77/fix-gn
976926d58 Add missing header to BUILD.gn.
30ef660ce Merge pull request #146 from s-perron/bazel
0d334e4ad Export NonSemanticDebugPrintf.h in bazel build
d9ce9ca52 Merge pull request #145 from jeffbolznv/nonsemantic_debugprintf
e814bf006 Add NonSemantic.DebugPrintf JSON/header
89bef4096 Fix max enum value
0a7fc4525 Add grammars, C header, and header generator for vendor and KHR extended instruction sets (#143)
5dbc1c321 Merge pull request #142 from mkinsner/additional_loop_control_bits
4b013f0fd Allocate three bits for upcoming Intel extension
dc77030ac Merge pull request #141 from dneto0/update-buildgn-lic
9c63d5773 Fix the license to match LICENSE
0125ae61b Merge pull request #140 from ShabbyX/add_build_gn
c7f52d34c Add BUILD.gn
927aae4dc Also propagate SPIRV-Headers version to CMakeLists.txt

git-subtree-dir: third_party/SPIRV-Headers
git-subtree-split: f8bf11a0253a32375c32cad92c841237b96696c0

2 years agoRemove two minor compiler warnings/errors:
David 'Digit' Turner [Mon, 23 Mar 2020 13:23:10 +0000 (14:23 +0100)]
Remove two minor compiler warnings/errors:

Found when building with the Fuchsia toolchain, which
uses a recent clang version:

- The constants '1.0f / 0x7FFFFFFF' and
  '1.0f / 0xFFFFFFFF' cannot be computed directly without
  losing one bit of accuracy, and the compiler was complaining
  about it, so use intermediate double values
  to get the correct, final result.

- The MemoryMapped class needs to be declared final to
  have a final destructor, otherwise the compiler complains
  with:

    error: class with destructor marked 'final' cannot be inherited from
    [-Werror,-Wfinal-dtor-non-final-class]

Bug: None
Change-Id: I9728df87fd5d12418ef7d73aa651eca02b0e36f9
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42888
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agothird_party: Create scripts for updating spirv-[tools|headers]
Ben Clayton [Thu, 26 Mar 2020 20:19:56 +0000 (20:19 +0000)]
third_party: Create scripts for updating spirv-[tools|headers]

Bug: None
Change-Id: I8a2a39894f022d93ad159fbfd20e34fbc06fa73d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43050
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
2 years agoFix taking aspect into account for image view identifiers
Nicolas Capens [Thu, 26 Mar 2020 16:00:35 +0000 (12:00 -0400)]
Fix taking aspect into account for image view identifiers

Tests like dEQP.GLES3/functional_fbo_blit_depth_stencil_depth24_stencil8_basic
were not passing when running on SWANGLE.

Bug: b/151235334
Change-Id: Icc3c4709a50c96d4552af4e4835f1e5eb43dd653
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43028
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
2 years agoKokoro: Move llvm configs into 7.0 subdirectory, create 10.0 copies.
Ben Clayton [Thu, 26 Mar 2020 11:50:48 +0000 (11:50 +0000)]
Kokoro: Move llvm configs into 7.0 subdirectory, create 10.0 copies.

And add the LLVM_VERSION env var and plumb this into the shell scripts.
Stub building the 10.0 builds for now. We'll enable them one at a time.

Bug: b/152339534
Change-Id: I645a6d748dec956505ba550ce96ff85a21f9f73e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43012
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2 years agoRegres: Add support for generating collated coverage info
Ben Clayton [Tue, 24 Mar 2020 17:55:40 +0000 (17:55 +0000)]
Regres: Add support for generating collated coverage info

`run_testlist` now supports the `--coverage` flag, which will collate the coverage information from each and every deqp test that's run.
This information is written to a `coverage.json` file which can be consumed by a html browser.

An early version of this can be found here (likely to move):
https://ben-clayton.github.io/swiftshader-coverage/

Bug: b/152192800
Change-Id: I52434f1ce30e6a091d2932fbae309cd81809cb79
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42890
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

2 years agoCMake: Emit coverage-toolchain.txt file next to ICD json
Ben Clayton [Tue, 24 Mar 2020 17:48:31 +0000 (17:48 +0000)]
CMake: Emit coverage-toolchain.txt file next to ICD json

When `SWIFTSHADER_EMIT_COVERAGE` is enabled, generate a new `coverage-toolchain.txt` text file next to the `vk_swiftshader_icd.json` file. This file contains a path to the C++ compiler toolchain used to build swiftshader, so that the regres tooling can locate the llvm tools used to parse the coverage data.

Bug: b/152192800
Change-Id: I3aa718206c3262bcd05e13e854002dea8f40801f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42889
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>