OSDN Git Service

android-x86/external-swiftshader.git
5 years agoAdd SPIRV-Tools to the Vulkan build.
Nicolas Capens [Mon, 4 Feb 2019 21:23:25 +0000 (16:23 -0500)]
Add SPIRV-Tools to the Vulkan build.

Bug b/123642959

Change-Id: I8edc9ac199b2d212b9e563dcc31f9f46757ed596
Reviewed-on: https://swiftshader-review.googlesource.com/c/24351
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd Visual Studio project files for SPIRV-Tools.
Nicolas Capens [Fri, 1 Feb 2019 03:09:03 +0000 (22:09 -0500)]
Add Visual Studio project files for SPIRV-Tools.

SPIRV-Tools comes with CMake build files. Integrating it into our
custom Visual Studio solution requires making the project files that
it generates path independent so that they can be checked into the
repository.

This is achieved by the build/cmake.sh shell script that is intended
to be run from the Git Bash shell. It needs to be re-run when any
CMakeLists.txt file changes.

.gitignore was modified to allow for build files under the build/
directory to be checked in. CMakeFiles/ and CMakeCache.txt are ignored
because they contain absolute paths and aren't necessary for building.

Bug b/123642959

Change-Id: I0706e3302d16144ecb9c0802cec897aa66affe6f
Reviewed-on: https://swiftshader-review.googlesource.com/c/24349
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoSwitch to SPIRV-Headers from subtree.
Nicolas Capens [Thu, 31 Jan 2019 20:17:13 +0000 (15:17 -0500)]
Switch to SPIRV-Headers from subtree.

Use the SPIRV-Headers files from the subtree copy in third_party,
instead of the ones in include/spirv.

Bug b/123642959

Change-Id: I79f77d2f659d5623583b2de40536dec0c79e2f7f
Reviewed-on: https://swiftshader-review.googlesource.com/c/24348
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSuppress Clang warning for unsupported warning.
Nicolas Capens [Tue, 5 Feb 2019 20:13:08 +0000 (15:13 -0500)]
Suppress Clang warning for unsupported warning.

Clang doesn't support the unused-lambda-capture warning until version
5.0: http://releases.llvm.org/5.0.0/tools/clang/docs/DiagnosticsReference.html#wunused-lambda-capture

Bug b/123933266

Change-Id: I6c5681a64e08ab479d726679ec18447dec926630
Reviewed-on: https://swiftshader-review.googlesource.com/c/24448
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSilence clang warning spewed by every .cpp compile
Ben Clayton [Tue, 5 Feb 2019 17:58:38 +0000 (17:58 +0000)]
Silence clang warning spewed by every .cpp compile

clang: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]

Bug: b/123933266
Change-Id: I809458fa08b9b6b3af7d31c19a90206462d0b0c6
Reviewed-on: https://swiftshader-review.googlesource.com/c/24429
Kokoro-Presubmit: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoCMake: Fix logic that automatically fetches submodules.
Ben Clayton [Mon, 4 Feb 2019 22:40:45 +0000 (22:40 +0000)]
CMake: Fix logic that automatically fetches submodules.

Bug: b/123894424
Change-Id: I9d3d24241d929cb80f9f28062537b50093009530
Reviewed-on: https://swiftshader-review.googlesource.com/c/24408
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoGCC: use Wno-error=header-hygiene only with clang.
Maksim Sisov [Tue, 5 Feb 2019 08:20:55 +0000 (10:20 +0200)]
GCC: use Wno-error=header-hygiene only with clang.

There is no sense in passing -Wno-error=header-hygiene
if -Wno-header-hygiene is not passed (gcc case). Thus,
use -Wno-error=header-hygiene only with clang.

Bug: chromium:819294
Change-Id: I01bd9771352ab2e8827f1fdd493eb89bb719dd0f
Reviewed-on: https://swiftshader-review.googlesource.com/c/24428
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoFix linux link error when using LLVM reactor backend.
Ben Clayton [Fri, 1 Feb 2019 09:38:45 +0000 (09:38 +0000)]
Fix linux link error when using LLVM reactor backend.

Seen building on Ubuntu 18.04.1:

```
libllvm.a(DynamicLibrary.cpp.o): In function `llvm::sys::DynamicLibrary::HandleSet::~HandleSet()':
DynamicLibrary.cpp:(.text._ZN4llvm3sys14DynamicLibrary9HandleSetD2Ev+0x1c): undefined reference to `dlclose'
DynamicLibrary.cpp:(.text._ZN4llvm3sys14DynamicLibrary9HandleSetD2Ev+0x2c): undefined reference to `dlclose'
libllvm.a(DynamicLibrary.cpp.o): In function `llvm::sys::DynamicLibrary::HandleSet::DLSym(void*, char const*)':
DynamicLibrary.cpp:(.text._ZN4llvm3sys14DynamicLibrary9HandleSet5DLSymEPvPKc+0x1): undefined reference to `dlsym'
```

Also removes --no-as-needed hack.

Bug: b/123360006
Change-Id: Icef1078e68cbf68af991e52f7fbb6e8d449e0809
Reviewed-on: https://swiftshader-review.googlesource.com/c/24310
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSplit Object::Kind::Variable
Chris Forbes [Sat, 2 Feb 2019 23:16:43 +0000 (15:16 -0800)]
Split Object::Kind::Variable

We have two kinds of "variable" -- those that are directly backed by an
lvalue, and those that are subsets of an indexed location, etc space.

Split them so we don't have to rediscover it later at emit time.

Bug: b/120799499
Change-Id: I7403f76d615d7afa1ee50c014172f07b90262c40
Reviewed-on: https://swiftshader-review.googlesource.com/c/24374
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoSupport for usage in memory requirements
Alexis Hetu [Mon, 21 Jan 2019 22:22:51 +0000 (17:22 -0500)]
Support for usage in memory requirements

Buffer usage was ignored in memory requirements. Usage support
was added for the purpose of computing the proper required alignment.

Fixes:
dEQP-VK.memory.requirements.core.buffer.regular

Bug b/118383648

Change-Id: Ib66e8d85f1b468765e24edba598fa06f4b5888c9
Reviewed-on: https://swiftshader-review.googlesource.com/c/23928
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoAdjust interface extraction to account for split types
Chris Forbes [Sat, 2 Feb 2019 01:12:25 +0000 (17:12 -0800)]
Adjust interface extraction to account for split types

OpVariable handling needs to be split out; variables are clearly not
present in the type tree. Take care to apply the OpVariable's
decorations in the right place.

Bug: b/123779863

Change-Id: I2761a604683cf8b025f6b9ba1efa5383f53d7ed1
Reviewed-on: https://swiftshader-review.googlesource.com/c/24372
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agovkCmdSetEvent/vkCmdResetEvent implementation
Alexis Hetu [Fri, 1 Feb 2019 22:49:55 +0000 (17:49 -0500)]
vkCmdSetEvent/vkCmdResetEvent implementation

This implementation of vkCmdSetEvent and vkCmdResetEvent assumes:
- There's only one queue (which currently is the case)
- Everything in the queue is executed linearly (which is currently the case)
- VkPipelineStageFlags can be ignored for now

Taking VkPipelineStageFlags into account could be used to avoid unnecessary
stalls or cache flushing. This will come at the optimization phase after
full conformance is achieved.

Bug b/117835459

Change-Id: Icb08a8b8e3fe63e827c9ba994a5e4353603e4ac9
Reviewed-on: https://swiftshader-review.googlesource.com/c/24371
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoCommandPool reset and trim
Alexis Hetu [Fri, 1 Feb 2019 21:47:51 +0000 (16:47 -0500)]
CommandPool reset and trim

Implemented vkResetCommandPool and vkTrimCommandPool.
The reset command out all command buffers in the command
pool back to the initial state. It also frees up the entire pool.

The trim command is a potential future memory usage optimization.
It is currently a noop.

Passes a few tests in dEQP-VK.api.command_buffers.

Bug b/119827933

Change-Id: Ic974f63a8dfca014462ac904218b9dcc3035fc8a
Reviewed-on: https://swiftshader-review.googlesource.com/c/24370
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoAdd presubmit config for kokoro
Raymond Chiu [Fri, 1 Feb 2019 01:54:55 +0000 (17:54 -0800)]
Add presubmit config for kokoro

BUG b/123360006

Change-Id: Ib986b6409d7ac1d2ced6ea3b9995b026f960fa3e
Reviewed-on: https://swiftshader-review.googlesource.com/c/24289
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoInclude Vulkan version of debug support in vulkan files
Chris Forbes [Wed, 16 Jan 2019 18:38:34 +0000 (10:38 -0800)]
Include Vulkan version of debug support in vulkan files

Bug: b/73656151
Change-Id: I93a4ad7c28f2177224ba3b3ae39c9eaba6c72f39
Reviewed-on: https://swiftshader-review.googlesource.com/c/23690
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoSupport for device groups
Alexis Hetu [Tue, 22 Jan 2019 22:17:27 +0000 (17:17 -0500)]
Support for device groups

This cl properly parses VkDeviceGroupDeviceCreateInfo,
but only allows the already supported default case.

Fixes all tests in:
dEQP-VK.api.object_management.*.device_group

Bug b/117974925

Change-Id: I42851f10bb9fc94848414bbd09b65ab8b807ae0e
Reviewed-on: https://swiftshader-review.googlesource.com/c/23968
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd -Wl,--no-as-needed to ld flags
Raymond Chiu [Thu, 31 Jan 2019 00:00:08 +0000 (16:00 -0800)]
Add -Wl,--no-as-needed to ld flags

Older version of gcc mistakenly missed out on linking libdl without it.

Change-Id: I5c12972c140348fa504e4ff4acb81655b445b4a5
Reviewed-on: https://swiftshader-review.googlesource.com/c/24268
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years ago[fuchsia] Ensure VMO has execute rights
Matthew Dempsky [Wed, 30 Jan 2019 01:51:59 +0000 (17:51 -0800)]
[fuchsia] Ensure VMO has execute rights

Currently VMOs on Fuchsia are allocated with execute rights, but soon
that will not be the case, so the calls later to re-map memory as
executable will fail. Add zx_vmo_replace_as_executable call to ensure
they don't.

Change-Id: I45c5f5527bc36ed898b29095788006239bb2b0b3
Reviewed-on: https://swiftshader-review.googlesource.com/c/24188
Reviewed-by: Wez <wez@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Matthew Dempsky <mdempsky@google.com>
5 years agoAdd SPIRV-Tools as git subtree
Chris Forbes [Wed, 30 Jan 2019 19:54:08 +0000 (11:54 -0800)]
Add SPIRV-Tools as git subtree

Adds commit 'd14db341b834cfb3c574a258c331b3a6b1c2cbc5' from
https://github.com/KhronosGroup/SPIRV-Tools as 'third_party/SPIRV-Tools'

Commands:
git subtree add --prefix third_party/SPIRV-Tools
https://github.com/KhronosGroup/SPIRV-Tools
d14db341b834cfb3c574a258c331b3a6b1c2cbc5 --squash

Bug: b/123642959
Change-Id: I9de28ed72f80a4ed6280ac1b990a57eed92b9667

5 years agoSquashed 'third_party/SPIRV-Tools/' content from commit d14db341b
Chris Forbes [Wed, 30 Jan 2019 19:54:08 +0000 (11:54 -0800)]
Squashed 'third_party/SPIRV-Tools/' content from commit d14db341b

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

5 years agoAdd SPIRV-Headers as git subtree
Chris Forbes [Wed, 30 Jan 2019 19:45:07 +0000 (11:45 -0800)]
Add SPIRV-Headers as git subtree

Adds commit '79b6681aadcb53c27d1052e5f8a0e82a981dbf2f' from
https://github.com/KhronosGroup/SPIRV-Headers as
'third_party/SPIRV-Headers'

Commands:
git subtree add --prefix third_party/SPIRV-Headers
https://github.com/KhronosGroup/SPIRV-Headers
79b6681aadcb53c27d1052e5f8a0e82a981dbf2f --squash

Bug: b/123642959
Change-Id: I39d6f1aff817ec9ed527c01eb631c99d81a17a95

5 years agoSquashed 'third_party/SPIRV-Headers/' content from commit 79b6681aa
Chris Forbes [Wed, 30 Jan 2019 19:45:07 +0000 (11:45 -0800)]
Squashed 'third_party/SPIRV-Headers/' content from commit 79b6681aa

git-subtree-dir: third_party/SPIRV-Headers
git-subtree-split: 79b6681aadcb53c27d1052e5f8a0e82a981dbf2f

5 years agovkQueueWaitIdle and vkDeviceWaitIdle as noops
Alexis Hetu [Thu, 24 Jan 2019 20:48:55 +0000 (15:48 -0500)]
vkQueueWaitIdle and vkDeviceWaitIdle as noops

Added the implementation for vkDeviceWaitIdle, which calls
into a noop vkQueueWaitIdle for now, until we have a non
noop implementation of Fence objects.

This allows many tests to run properly.

Bug b/117835459

Change-Id: I39be52f9462d87591bbb0bccee1e9e41b5a744b9
Reviewed-on: https://swiftshader-review.googlesource.com/c/24048
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRe-enable -Wno-defaulted-function-deleted warnings.
Nicolas Capens [Tue, 29 Jan 2019 21:51:16 +0000 (16:51 -0500)]
Re-enable -Wno-defaulted-function-deleted warnings.

LLVM was updated to the latest 7.0.1 revision, which includes the proper
fix.

Reverts "Fixed build on Arm 64"
This reverts commit fed67899a7b44c9409e94442eaca0deab2f809e3.

Bug b/123026156
Bug chromium:922089

Change-Id: I1f6ee4d3869e642e6ce2bd8cbf2c8f7553e4a607
Reviewed-on: https://swiftshader-review.googlesource.com/c/24150
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoMerge changes If2de3cbd,Ia12719e9
Nicolas Capens [Wed, 30 Jan 2019 15:14:02 +0000 (15:14 +0000)]
Merge changes If2de3cbd,Ia12719e9

* changes:
  Update to latest LLVM 7.0 release branch revision.
  Squashed 'third_party/llvm-7.0/llvm/' changes from 65ce2e56889..cd98f42d074

5 years agoSupport for instanceCount, firstVertex and firstInstance in Draw
Alexis Hetu [Thu, 24 Jan 2019 21:36:53 +0000 (16:36 -0500)]
Support for instanceCount, firstVertex and firstInstance in Draw

The simple Draw command now supports all of the input parameters.

Bug b/118619338

Change-Id: I51c3680dcc6497296e00000ad3e80f302629af3c
Reviewed-on: https://swiftshader-review.googlesource.com/c/24049
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoIntentionally ignore pipeline cache for now
Alexis Hetu [Tue, 29 Jan 2019 21:13:17 +0000 (16:13 -0500)]
Intentionally ignore pipeline cache for now

Since PipelineCache is a potential optimization, unmarking it as
UNIMPLEMENTED() and leaving a TODO instead. This can be addressed
much later, but for now, this shouldn't make tests fail.

Bug b/118386749 b/123588002

Change-Id: I5bdc15aedd9a01e35a457eef1a70c450083fd577
Reviewed-on: https://swiftshader-review.googlesource.com/c/23969
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoUpdate to latest LLVM 7.0 release branch revision.
Nicolas Capens [Tue, 29 Jan 2019 21:30:34 +0000 (16:30 -0500)]
Update to latest LLVM 7.0 release branch revision.

Merge commit '6583d4f19c0bb3eceafa776a0f102d9a9ac75694'

Commands:
git remote add llvm https://git.llvm.org/git/llvm.git
git subtree pull --prefix third_party/llvm-7.0/llvm llvm release_70 --squash

Bug b/123026156
Bug chromium:922089

Change-Id: If2de3cbde48d6acf02db68844bd16317869bf548

5 years agoSquashed 'third_party/llvm-7.0/llvm/' changes from 65ce2e56889..cd98f42d074
Nicolas Capens [Tue, 29 Jan 2019 21:30:33 +0000 (16:30 -0500)]
Squashed 'third_party/llvm-7.0/llvm/' changes from 65ce2e56889..cd98f42d074

cd98f42d074 Merging r348444:
4a684f7170a Merging r346203:
06a6c330784 Merging r340125:
cc39aee5288 Merging r348462:
fa099fd85c1 Merging r348461:
a3ee448a5f6 Merging r348181:
3315ebed51e Merging r343369:
08f7943cf05 Merging r344589:
e8af9b4c407 Merging r339260:
f8ee49e3d8b Merging r347431:
92101a335c5 Merging r342865:
5993754bccb Merging r345353:
05998067a2e Merging r344591:
7515784defa Merging r344516:
7d87789bb6f Merging r342946:
2673179dd31 Merging r342884:
6ef29028d44 Merging r341919:
b7cd010ff5e Merging r341221:
aaf6ddfa1c7 Merging r340932:
b023def3de6 Merging r340931:
fe809519b1b Merging r340927:
d0abf8be7d1 Bump version to 7.0.1
2e8411d207a Merging r342354:
5ab8235732b Merging r344454, r344455, r344645:
4c946b7981d Merging r344325:
eb0722e28e7 Merging r342461:
888225e7bee Merging r343373:
b2504eaa1be Merging r343428:
9a0352f0c5e Merging r343443:
6c2e5a132cd Merging r343347:

git-subtree-dir: third_party/llvm-7.0/llvm
git-subtree-split: cd98f42d0747826062fc3d2d2fad383aedf58dd6

5 years agoSetup Kokoro linux build
Raymond Chiu [Wed, 2 Jan 2019 22:36:36 +0000 (14:36 -0800)]
Setup Kokoro linux build

Bug b/123360006

Change-Id: I90ebde7968135f136f010d1f526aca26bc2b9418
Reviewed-on: https://swiftshader-review.googlesource.com/c/23988
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoFramebuffer clear assert fix
Alexis Hetu [Thu, 24 Jan 2019 21:42:22 +0000 (16:42 -0500)]
Framebuffer clear assert fix

Respect loadOp when clearing attachments in beginRenderPass().

Bug b/119621736

Change-Id: Id9ad0f1ad9dc6116264782be3370c37c078d6846
Reviewed-on: https://swiftshader-review.googlesource.com/c/24050
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years ago[Fuchsia] Use the read/write permission flag names when mapping VMOs.
Wez [Sat, 26 Jan 2019 04:52:45 +0000 (20:52 -0800)]
[Fuchsia] Use the read/write permission flag names when mapping VMOs.

The ZX_VM_FLAG_PERM_* names have been deprecated in favour of the
ZX_VM_PERM_* form, and will shortly be removed from the Fuchsia SDK.

Bug: chromium:925597
Change-Id: Ibb2d5c364fa62c9f7a0a9bb0cd715c41fd757522
Reviewed-on: https://swiftshader-review.googlesource.com/c/24068
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Wez <wez@google.com>
5 years agoFix LLVM 3.0 build issue.
Nicolas Capens [Mon, 28 Jan 2019 16:36:01 +0000 (11:36 -0500)]
Fix LLVM 3.0 build issue.

LLVM 3.0's raw_fd_ostream doesn't take an std::string as file name.

Bug swiftshader:123
Bug b/123193054

Change-Id: I994f6fe5ce98c573d4be48737934b7c6c0127434
Reviewed-on: https://swiftshader-review.googlesource.com/c/24088
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoImplementation of partial clear
Alexis Hetu [Fri, 18 Jan 2019 21:08:45 +0000 (16:08 -0500)]
Implementation of partial clear

Implemented subregion clears.
The quad layout had to be disabled to depth/stencil textures,
as it was not expected by dEQP.

Passes all tests in api.image_clearing.dedicated_allocation.
- partial_clear_color_attachment.*
- partial_clear_depth_stencil_attachment.*

Bug b/119621736

Change-Id: I9e854eceeef4a72b2ae507d62dbdbfa0b56c96f3
Reviewed-on: https://swiftshader-review.googlesource.com/c/23829
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoSupport for clearing Framebuffer attachments
Alexis Hetu [Thu, 17 Jan 2019 22:14:57 +0000 (17:14 -0500)]
Support for clearing Framebuffer attachments

This is the implementation for vkCmdClearAttachments.

It includes the new command along with the plumbing to
get the information to the Image clear function.

The only non trivial behavior here is that the provided
baseArrayLayer for the clear command is to be offset by
the ImageView's subresourceRange's baseArrayLayer so
that it clears the correct layers.

Bug b/119621736

Passes all tests in:
api.image_clearing.dedicated_allocation.clear_color_attachment.*

Change-Id: I19f86b63239ca2fb4d53f2c6c9cb75185794f061
Reviewed-on: https://swiftshader-review.googlesource.com/c/23748
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoBasic RenderPass implementation
Alexis Hetu [Fri, 18 Jan 2019 15:35:51 +0000 (10:35 -0500)]
Basic RenderPass implementation

RenderPass information is required for RenderPass related commands,
like clearing attachments. This cl adds storage for attachments,
subpasses and dependencies related information in the RenderPass
objects and stores all this information in new class members.

Bug b/119620965

Change-Id: I19d8b8465c807755881de6471700a119082575f8
Reviewed-on: https://swiftshader-review.googlesource.com/c/23788
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoQueryPool object creation
Alexis Hetu [Tue, 22 Jan 2019 17:07:24 +0000 (12:07 -0500)]
QueryPool object creation

Added QueryPool object.

Fixes all tests in:
dEQP-VK.api.object_management.*.query_pool

Change-Id: Ie564848b616714c39961e7a80bc421ec7bb0ef58
Reviewed-on: https://swiftshader-review.googlesource.com/c/23948
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agovkGetImageSubresourceLayout implementation
Alexis Hetu [Thu, 24 Jan 2019 22:02:45 +0000 (17:02 -0500)]
vkGetImageSubresourceLayout implementation

The Image class now contains all the required functions to fill
out the VkSubresourceLayout structure, so this simply hooks the
proper calls to implement vkGetImageSubresourceLayout.

Bug b/119620767

Change-Id: I104811be4a5be31ef5db7ad55965ba263dd110ed
Reviewed-on: https://swiftshader-review.googlesource.com/c/24051
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoFixed a crash using TransformFeedback with DrawArraysInstanced
Alexis Hetu [Thu, 10 Jan 2019 20:22:37 +0000 (15:22 -0500)]
Fixed a crash using TransformFeedback with DrawArraysInstanced

When using TransformFeedback with DrawArraysInstanced, a crash
would occur if no varyings were set to use transform feedback
due to a null transform feedback buffer. Added a null pointer
check and an assert to fix this.

Bug b/117080493

Change-Id: Ieb226bfb70ae837bdb206bdbefe84f62dc1f2204
Reviewed-on: https://swiftshader-review.googlesource.com/c/23569
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoAdd GL_OES_EGL_image_external_essl3
Lingfeng Yang [Sat, 19 Jan 2019 22:40:08 +0000 (14:40 -0800)]
Add GL_OES_EGL_image_external_essl3

Bug b/120382288

Change-Id: I506920a1ff5f68c2ece7c3e8327525c0bd5609ce
Reviewed-on: https://swiftshader-review.googlesource.com/c/23889
Tested-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoUse unique names for each LLVM IR dump
Chris Forbes [Fri, 28 Dec 2018 17:58:24 +0000 (09:58 -0800)]
Use unique names for each LLVM IR dump

Previously this would just repeatedly overwrite the one file, which
makes it difficult to see what's happening when you compile a pipeline
that needs 3 routines.

Change-Id: Ibab115f5ccbb17333d504e4e7948be54ca304f9d
Bug: b/123193054
Reviewed-on: https://swiftshader-review.googlesource.com/c/23469
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoChange routine names to be strings of char
Chris Forbes [Mon, 21 Jan 2019 18:48:35 +0000 (10:48 -0800)]
Change routine names to be strings of char

Routine names were passed as wide strings for the integration with
CodeAnalyst, which no longer exists.

- Rip out the remnants of the CodeAnalyst support
- Change Reactor interface to take routine names as const char *

Bug: b/123193048
Change-Id: I919ce3a55c59c3a08057f85cac994fbffad37614
Reviewed-on: https://swiftshader-review.googlesource.com/c/23908
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agomake NDEBUG version of UNIMPLEMENTED() macro variadic too
Chris Forbes [Fri, 18 Jan 2019 19:21:53 +0000 (11:21 -0800)]
make NDEBUG version of UNIMPLEMENTED() macro variadic too

Change-Id: Ib5e2ec3c443955aefe8b001b926469b9ce5accff
Reviewed-on: https://swiftshader-review.googlesource.com/c/23828
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix compilation error on android build.
Cody Schuffelen [Fri, 18 Jan 2019 02:12:47 +0000 (18:12 -0800)]
Fix compilation error on android build.

The error that appears when trying to build swiftshader master as part
of android is:
external/swiftshader/src/Shader/Shader.cpp:1886:51: error: expected '(' for function-style cast or type construction

Change-Id: I667f249e46ed99c3c598490182e495c0862c64a9
Reviewed-on: https://swiftshader-review.googlesource.com/c/23768
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agodrop c++ version for cmake build to 11
Chris Forbes [Fri, 18 Jan 2019 16:11:03 +0000 (08:11 -0800)]
drop c++ version for cmake build to 11

Change-Id: If4f1d021a19c7be43fa1996705a493bf33ec1dbe
Reviewed-on: https://swiftshader-review.googlesource.com/c/23809
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoremove remaining make_unique usage
Chris Forbes [Fri, 18 Jan 2019 16:33:15 +0000 (08:33 -0800)]
remove remaining make_unique usage

Change-Id: I2dfc8e09daaea0f93f9737b8738fdcd2c2fae539
Reviewed-on: https://swiftshader-review.googlesource.com/c/23808
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoReplaced std::make_unique with std::unique_ptr
Alexis Hetu [Mon, 7 Jan 2019 19:47:32 +0000 (14:47 -0500)]
Replaced std::make_unique with std::unique_ptr

std::make_unique is C++14, so for strict C++11, we have
to use std::unique_ptr. Added a new utility function,
CommandBuffer::addCommand, to make this change more
readable.

Change-Id: Icc62874a107543fa2c0599a338dbc6676047ad77
Reviewed-on: https://swiftshader-review.googlesource.com/c/23548
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoSplit types from other kinds of definitions
Chris Forbes [Mon, 14 Jan 2019 22:30:20 +0000 (14:30 -0800)]
Split types from other kinds of definitions

We always know from the context whether a particular id refers to a type
or something else. Split types out into their own map, and add an
accessor which ensures the type actually exists. This isn't so much
about checking for the provided code being valid, and more about
catching likely foul-ups in our own code.

Change-Id: If18831b1b604eed03fbbeaf352272b5ba15b37a9
Reviewed-on: https://swiftshader-review.googlesource.com/c/23608
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoAdd support for builtin blocks
Chris Forbes [Fri, 28 Dec 2018 20:03:10 +0000 (12:03 -0800)]
Add support for builtin blocks

Problem of supporting builtin blocks boils down to how you refer to them
from the API side -- if the reference is ONLY a SPIRV id, then block
members are difficult to work with. Instead, represent a builtin
variable binding as (id, first component, num components). For a single
variable, first component == 0 always.

Bug: b/120799499
Change-Id: If9e99f4c10f73a008e2f5071a95785920c7fbed1
Reviewed-on: https://swiftshader-review.googlesource.com/c/23488
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoAdd support for arrays to interface and size analyses
Chris Forbes [Fri, 28 Dec 2018 00:12:31 +0000 (16:12 -0800)]
Add support for arrays to interface and size analyses

Only missing piece here was the array size, which is available since
we support integer constants now.

Bug: b/120799499
Change-Id: I8c42aa2ced86e8358be1ffbfaa14ca87b58cc138
Reviewed-on: https://swiftshader-review.googlesource.com/c/23449
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoAdd minimal support for integer constants
Chris Forbes [Fri, 28 Dec 2018 00:02:58 +0000 (16:02 -0800)]
Add minimal support for integer constants

This is just enough support to be able to handle array sizes, etc.

Bug: b/120799499

Change-Id: I790d6accabe55efab9fd5e0c23c93b5d10b72e36
Reviewed-on: https://swiftshader-review.googlesource.com/c/23448
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoImplemented depth and stencil clear command
Alexis Hetu [Thu, 17 Jan 2019 19:51:43 +0000 (14:51 -0500)]
Implemented depth and stencil clear command

Added the ClearDepthStencilImage command and made some minor adjustments
to Image clear functions to make the depth and stencil clears work.

Passes all test in:
api.image_clearing.dedicated_allocation.clear_depth_stencil_image.*

Bug b/119620767

Change-Id: If4cfe6aa97b955c9bc7881bba89ab725897c36f9
Reviewed-on: https://swiftshader-review.googlesource.com/c/23728
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoAdded clear color image command
Alexis Hetu [Wed, 16 Jan 2019 20:54:55 +0000 (15:54 -0500)]
Added clear color image command

Added the command to send the clear color image command
to the Image object.

Bug b/118619338

Change-Id: Ic4e00fbd49e8e043df1d2e707e3c26dadf159790
Reviewed-on: https://swiftshader-review.googlesource.com/c/23653
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoSupport for array layers and mip levels in VkImage objects
Alexis Hetu [Wed, 16 Jan 2019 19:21:33 +0000 (14:21 -0500)]
Support for array layers and mip levels in VkImage objects

Support for allocating, copying and clearing separate array
layers and/or mip levels in VkImage objects. As part of that,
most functions that compute memory offsets or sizes now all
take mip levels and array layers into account.

Also, since this can cause many consecutive calls to the
blitter, the blitter object is now a VkImage member rather
than being create in each function, in order to better use
the blitter cache.

Bug b/119620767

Change-Id: Ib29b66cc936b0734c8173a1b8b5b9ef157fc7956
Reviewed-on: https://swiftshader-review.googlesource.com/c/23648
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoAllow clearing image arrays in ImageView
Alexis Hetu [Wed, 16 Jan 2019 20:47:19 +0000 (15:47 -0500)]
Allow clearing image arrays in ImageView

Allow an image of type VK_IMAGE_VIEW_TYPE_(?)D with multiple array
layers to count as VK_IMAGE_VIEW_TYPE_(X)D_ARRAY in ImageView.

Bug b/119620767

Change-Id: I2d6ba3d960c531949529d72f5347442bb53990d6
Reviewed-on: https://swiftshader-review.googlesource.com/c/23651
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoCollect input/output interfaces
Chris Forbes [Tue, 11 Dec 2018 03:02:58 +0000 (19:02 -0800)]
Collect input/output interfaces

I'm still on the fence about leaving complex input/output definitions
intact. However, this provides enough support to walk such structures
all the way down to the leaves and determine exactly which components
are in use, what their types are, and what the interpolation qualifiers
etc should be.

Bug: b/120799499

Change-Id: Ia1e46a571126088e29bfdab6bc5ece0343e294e4
Reviewed-on: https://swiftshader-review.googlesource.com/c/23176
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoPort LLVM change rL350655
Tom Tan [Thu, 17 Jan 2019 00:27:58 +0000 (16:27 -0800)]
Port LLVM change rL350655

Chromium enabled warning -Wmicrosoft-include which complains the line "#include "Windows/WindowsSupport.h""
in lib/Support/Windows/Threading.inc because both files are under the same folder (see below error message). The fix was
merged to Clang master at https://reviews.llvm.org/rL350655. Port the change to unblock Windows ARM64 build before
a new rolling of LLVM to swiftshader.

error: #include resolved using non-portable Microsoft search rules as:
../../third_party/swiftshader/third_party/llvm-7.0/llvm/lib/Support/Windows/WindowsSupport.h [-Werror,-Wmicrosoft-include]

Bug: chromium:893460
Change-Id: I9eb32fd92e4d96f7d22a07a7c2da70b98eba19d3
Reviewed-on: https://swiftshader-review.googlesource.com/c/23669
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Tom Tan <Tom.Tan@microsoft.com>
5 years agoAdd support for SPIRV decorations
Chris Forbes [Mon, 10 Dec 2018 23:10:39 +0000 (15:10 -0800)]
Add support for SPIRV decorations

This works in a single pass, and supports both toplevel and member
decorations. Includes support for 5 new opcodes:

- OpDecorate introduces a single decoration for a toplevel id.

- OpMemberDecorate introduces a single decoration for a <id,
  memberIndex> pair.

- OpDecorationGroup introduces a new value category which has no
  representation downstream at all. This is safely implemented by
  doing nothing at all [we don't need to be able to introspect later].

- OpGroupDecorate applies all decorations in a decoration group to each
  of a list of other ids.

- OpGroupMemberDecorate applies all decorations in a decoration group to
  each of a list of members (<id>, memberIndex pairs).

Bug: b/120799499

Change-Id: Iaea970b23348e70d57ddb96a4df0726cfb511e03
Reviewed-on: https://swiftshader-review.googlesource.com/c/23174
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFixed all OOB accesses in VertexProgram and PixelProgram
Alexis Hetu [Thu, 10 Jan 2019 19:04:26 +0000 (14:04 -0500)]
Fixed all OOB accesses in VertexProgram and PixelProgram

A lot of arrays in VertexProgram and PixelProgram have fixed sizes,
so programs that have more nested loops or ifs or deeper call stacks
can cause OOB accesses, which causes security issues in Chromium.

Index clamping was added to prevent any OOB memory accesses here.

This could eventually be fixed properly by first verifying these sizes
and giving shader compile errors when these limits are exceeded.

Bug chromium:915197 chromium:915206 chromium:915218 b/116373662

Change-Id: I2d0710ed0ce6585f139cba49d5b5d8c909ae6391
Reviewed-on: https://swiftshader-review.googlesource.com/c/23568
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoAdd builtin interface to spirv shader
Chris Forbes [Thu, 17 Jan 2019 18:10:09 +0000 (10:10 -0800)]
Add builtin interface to spirv shader

Initial structures to bridge the shader's use of particular builtins to
behavior of the "fixed function" logic wrapped around it.

Bug: b/120799499

Change-Id: I5cb360909c62615efab2e500f5c24109737e4ab7
Reviewed-on: https://swiftshader-review.googlesource.com/c/23709
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoMove AttribType enum to SpirvShader
Chris Forbes [Thu, 17 Jan 2019 17:51:39 +0000 (09:51 -0800)]
Move AttribType enum to SpirvShader

We're about to remove VertexShader, but we still care about types of
vertex attributes.

Bug: b/120799499

Change-Id: I80bed181479651e9d2470b81c7223e3381fbf4a7
Reviewed-on: https://swiftshader-review.googlesource.com/c/23708
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoAdd size calculation for spirv types
Chris Forbes [Sat, 8 Dec 2018 21:09:40 +0000 (13:09 -0800)]
Add size calculation for spirv types

SPIRV objects have arbitrary sizes -- they are not tied to previous
shader APIs' vec4-centric view of the world. In order to be able to
allocate space for both variables and ssavalues, we need to know how
many scalar components are present in each object.

Bug: b/120799499

Change-Id: I58551264eba5011be9bd01135cb35d541463993b
Reviewed-on: https://swiftshader-review.googlesource.com/c/23168
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFormatting-only change: conform better with swiftshader style
Chris Forbes [Thu, 17 Jan 2019 17:36:46 +0000 (09:36 -0800)]
Formatting-only change: conform better with swiftshader style

Change-Id: I5241cb398aa294a702c0f70980b80d399dfbc5b0
Reviewed-on: https://swiftshader-review.googlesource.com/c/23689
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix build
Chris Forbes [Thu, 17 Jan 2019 17:14:45 +0000 (09:14 -0800)]
Fix build

Half.hpp now requires <cmath>

Change-Id: Iab086681cfd3ed850ad184c77f88d13b5716e859
Reviewed-on: https://swiftshader-review.googlesource.com/c/23688
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoCollect type and variable definitions from SPIRV shader
Chris Forbes [Thu, 27 Dec 2018 19:48:21 +0000 (11:48 -0800)]
Collect type and variable definitions from SPIRV shader

Many other pieces will need an index of spirv-id to defining
instruction. Start building that up.

Bug: b/120799499

Change-Id: Ief6583f45c49fce02cb5dc40d12c6ba928e48fd7
Reviewed-on: https://swiftshader-review.googlesource.com/c/23428
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoInitial stub implementation of SpirvShader
Chris Forbes [Fri, 7 Dec 2018 02:33:27 +0000 (18:33 -0800)]
Initial stub implementation of SpirvShader

This will eventually replace Shader and related subclasses. The
interesting bit here is the instruction iterator, which allows fairly
safe access to the instruction stream without needing the rest of the
code to care too much about the physical layout.

Bug: b/120799499

Change-Id: Id0d94c4b807ddb1e4325de147ca1f651171779b7
Reviewed-on: https://swiftshader-review.googlesource.com/c/23049
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoProduce correct error result for unsupported formats
Chris Forbes [Wed, 16 Jan 2019 23:17:24 +0000 (15:17 -0800)]
Produce correct error result for unsupported formats

vkGetPhysicalDeviceImageFormatProperties is required to return
VK_ERROR_FORMAT_NOT_SUPPORTED when the format is not supported.

CTS (validly) assumes that the format /is/ supported if this function
returns VK_SUCCESS.

Bug: b/119620767
Change-Id: I1f7d3ff8dbbfbc2dd100af7c3c4d7204f350dd06
Reviewed-on: https://swiftshader-review.googlesource.com/c/23668
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoMake the B10G11R11 and E5B9G9R9 formats fast clearable
Alexis Hetu [Wed, 16 Jan 2019 19:58:33 +0000 (14:58 -0500)]
Make the B10G11R11 and E5B9G9R9 formats fast clearable

Shamelessly copied the FP32 -> B10G11R11 and FP32 -> E5B9G9R9
conversion functions from Angle. This allows packing the clear
color for these formats into a single 32 bit integer, which can
then be used within the fast clear function.

Tested using:
api.image_clearing.core.clear_color_image.*.b10g11r11_ufloat_pack32
api.image_clearing.core.clear_color_image.*.e5b9g9r9_ufloat_pack32

Bug b/119620767

Change-Id: Ic268da62959582f084245e88181374213734760f
Reviewed-on: https://swiftshader-review.googlesource.com/c/23650
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoAdded the ability to write to many new formats in the Blitter
Alexis Hetu [Wed, 16 Jan 2019 19:42:24 +0000 (14:42 -0500)]
Added the ability to write to many new formats in the Blitter

Added the missing 5_6_5, 2_10_10_10, 4, 8, 16 and 32 bit formats
that have integer based internal representation. Most of these
are the same as existing formats or trivial modification of
existing formats.

This only adds the ability to WRITE to these formats for now, as
these codepaths were tested using:
dEQP-VK.api.image_clearing.core.clear_color_image

If reading these formats becomes exercised by other tests, they
will be added at that point.

Bug b/119620767

Change-Id: I85317d7cfab6b1e708d6e6500ff44b83065a1d16
Reviewed-on: https://swiftshader-review.googlesource.com/c/23649
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoFixed build on Arm 64
Alexis Hetu [Tue, 15 Jan 2019 21:14:38 +0000 (16:14 -0500)]
Fixed build on Arm 64

A few warnings were causing build errors on Arm 64.
Since we don't want to modify the LLVM code itself,
the warnings in the LLVM code are now suppressed.

Bug chromium:922089

Change-Id: I7e8827cda5117e8817342930dca8d7b7f90d339c
Reviewed-on: https://swiftshader-review.googlesource.com/c/23628
Tested-by: Alexis Hétu <sugoi@google.com>
Tested-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoRemove VK support for GL-style symmetric clip space
Chris Forbes [Sat, 12 Jan 2019 00:51:12 +0000 (16:51 -0800)]
Remove VK support for GL-style symmetric clip space

Change-Id: Idb38063e6d8f7c6345118b2acddba4dcb99d0831
Reviewed-on: https://swiftshader-review.googlesource.com/c/23588
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agofix mismatched new/delete[] in BeginRenderPass
Chris Forbes [Sat, 29 Dec 2018 00:06:16 +0000 (16:06 -0800)]
fix mismatched new/delete[] in BeginRenderPass

Change-Id: I065e79f9ea676eaec25e89063908cae6f3854e4c
Reviewed-on: https://swiftshader-review.googlesource.com/c/23489
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years ago[Fuchsia] Implement ExecutableMemory support on Fuchsia.
Sergey Ulanov [Mon, 7 Jan 2019 18:29:18 +0000 (10:29 -0800)]
[Fuchsia] Implement ExecutableMemory support on Fuchsia.

Added fuchsia-specific versions of allocateExecutable() and
markExecutable().

Bug: chromium: 778467
Change-Id: I027f1409f7b0343e102f98fcc34f2e93c2d626e4
Reviewed-on: https://swiftshader-review.googlesource.com/c/23408
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Sergey Ulanov <sergeyu@chromium.org>
5 years agoAdd intrinsics and missing LLVM AsmParser files for Windows ARM64
Tom Tan [Thu, 3 Jan 2019 06:01:55 +0000 (22:01 -0800)]
Add intrinsics and missing LLVM AsmParser files for Windows ARM64

llvm::parseIR in llvm-7.0\llvm\lib\IRReader\IRReader.cpp calls parseAssembly
which is defined in lib/AsmParser/Parser.cpp, but the latter file is not
included in swiftshader_llvm which causes unresovled symbol for linking.
This CL added the necessary source files under llvm\AsmParser to
swiftshader_llvm.

This CL also changed __rdtsc() to use Windows ARM64 intrinsic _ReadStatusReg
to get cycle counter as alternative of __rdtsc().

Bug: chromium:893460
Change-Id: I269662f2e4249a3ec5495ecad02bc759139e1d4f
Reviewed-on: https://swiftshader-review.googlesource.com/c/23508
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Tom Tan <Tom.Tan@microsoft.com>
5 years agoRemove unnecessary ldflags.
Nico Weber [Fri, 4 Jan 2019 20:28:34 +0000 (15:28 -0500)]
Remove unnecessary ldflags.

The .def file is already in sources, which means GN will already add
this flag automatically (cf `gn help sources`).

No intended behavior change.

Bug: none
Change-Id: Ic8204bbdd9da47f3731d48e62ccfeb880ac9eddc
Reviewed-on: https://swiftshader-review.googlesource.com/c/23528
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nico Weber <thakis@chromium.org>
5 years ago[MIPS] Add support for mips32r1 arch variant
Milko Leporis [Tue, 18 Dec 2018 15:04:15 +0000 (16:04 +0100)]
[MIPS] Add support for mips32r1 arch variant

Change-Id: I37dfecd8c92f3f34c117432956d169f4b191c849
Reviewed-on: https://swiftshader-review.googlesource.com/c/23248
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Milko Leporis <milko.leporis@mips.com>
5 years agoFix for true integer blit to lower bit depth image
Alexis Hetu [Fri, 21 Dec 2018 17:03:31 +0000 (12:03 -0500)]
Fix for true integer blit to lower bit depth image

Blitting from a higher bit depth source to a lower bit depth
destination was not working properly because Vulkan expects
clamping, while the blitter was truncating the values.

From section 19.5. Image Copies with Scaling:
"Signed and unsigned integers are converted by first
 clamping to the representable range of the destination
 format, then casting the value."

This fixes all remaining failures in:
dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.color.*

Bug b/119620767

Change-Id: Ibd1c1e4be4f5107e7d423781b46021f4c5df1070
Reviewed-on: https://swiftshader-review.googlesource.com/c/23368
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoSupport for reading low-bitdepth float formats in Blitter
Alexis Hetu [Thu, 20 Dec 2018 21:14:21 +0000 (16:14 -0500)]
Support for reading low-bitdepth float formats in Blitter

Added support for reading the following formats in the Blitter:
- VK_FORMAT_B10G11R11_UFLOAT_PACK32
- VK_FORMAT_E5B9G9R9_UFLOAT_PACK32

Fixes all failures in:
[dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.color]
.b10g11r11_ufloat_pack32.*
.e5b9g9r9_ufloat_pack32.*

Bug b/119620767

Change-Id: Ie5824b59b0193115cc7d142efc41cc3ac516c05c
Reviewed-on: https://swiftshader-review.googlesource.com/c/23348
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoAdded support for half float in the Blitter
Alexis Hetu [Thu, 20 Dec 2018 19:00:49 +0000 (14:00 -0500)]
Added support for half float in the Blitter

Implemented Float <-> Half conversion. The conversion is copied from
Half.cpp and is the same as the C++ code, converted to Reactor code.
The conversion is NOT optimized. Optimizing this code path will be
done later, this cl only cares about correctness.

Passes all conversion tests to and from half float in the following
patterns:

[dEQP-VK.api.copy_and_blit.core.blit_image]
.all_formats.color.[supported format].r16_sfloat.*
.all_formats.color.[supported format].r16g16_sfloat.*
.all_formats.color.[supported format].r16g16b16a16_sfloat.*
.all_formats.color.r16_sfloat.*
.all_formats.color.r16g16_sfloat.*
.all_formats.color.r16g16b16a16_sfloat.*

Bug b/119620767

Change-Id: Icd725dcd2ddd8c54e6657a2c3210da270210a149
Reviewed-on: https://swiftshader-review.googlesource.com/c/23329
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoSupport for VK_FORMAT_A1R5G5B5_UNORM_PACK16 in Blitter
Alexis Hetu [Thu, 20 Dec 2018 18:18:18 +0000 (13:18 -0500)]
Support for VK_FORMAT_A1R5G5B5_UNORM_PACK16 in Blitter

Added support for VK_FORMAT_A1R5G5B5_UNORM_PACK16 in the Blitter.

Passes all tests in:
[dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.color]
.b4g4r4a4_unorm_pack16.a1r5g5b5_unorm_pack16.*
.r8g8_snorm.a1r5g5b5_unorm_pack16.*
.a8b8g8r8_unorm_pack32.a1r5g5b5_unorm_pack16.*
.a8b8g8r8_snorm_pack32.a1r5g5b5_unorm_pack16.*

Bug b/119620767

Change-Id: I366cb5697b60b4f0fb51931a6be7b8732cf789ec
Reviewed-on: https://swiftshader-review.googlesource.com/c/23328
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoAdded missing formats to Blitter
Alexis Hetu [Wed, 19 Dec 2018 22:23:26 +0000 (17:23 -0500)]
Added missing formats to Blitter

Added enums for mostly implemented format, along
with the implementation for 2 new formats:
VK_FORMAT_B4G4R4A4_UNORM_PACK16
VK_FORMAT_A2B10G10R10_UINT_PACK32 (as a true integer format)

Bug b/119620767

Change-Id: I139408609cdbc35f7d9b0a8220e86a598c70a9e9
Reviewed-on: https://swiftshader-review.googlesource.com/c/23309
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoAdded missing VkFormat entries to Surface utility functions
Alexis Hetu [Wed, 19 Dec 2018 22:17:04 +0000 (17:17 -0500)]
Added missing VkFormat entries to Surface utility functions

Added missing VkFormat entries to the following functions:
Surface::hasQuadLayout
Surface::isFloatFormat
Surface::isUnsignedComponent
Surface::isSRGBformat
Surface::isCompressed
Surface::isSignedNonNormalizedInteger
Surface::isUnsignedNonNormalizedInteger
Surface::componentCount
Surface::selectInternalFormat

Bug b/118429780

Change-Id: I46f8fb3f8a14f82a2b6615e129e4de0443666eca
Reviewed-on: https://swiftshader-review.googlesource.com/c/23308
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoImplement image blitting
Alexis Hetu [Mon, 17 Dec 2018 22:00:28 +0000 (17:00 -0500)]
Implement image blitting

First simple implementation of image blitting.
Note that layers are not yet taken into account.

Passes almost all tests in (There are only 2 failures,
which both have an off by 1 error on a single pixel):
dEQP-VK.api.copy_and_blit.core.blit_image.simple_tests.*

Bug b/118619338 b/119620767

Change-Id: I1e0ac88089d6159924569099ea6345804a219d2c
Reviewed-on: https://swiftshader-review.googlesource.com/c/23268
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoImplement buffer to buffer copy command
Alexis Hetu [Fri, 14 Dec 2018 21:50:43 +0000 (16:50 -0500)]
Implement buffer to buffer copy command

Added buffer copy command and support for VkBufferCopy regions.

Passes all tests in:
dEQP-VK.api.copy_and_blit.core.buffer_to_buffer

Bug b/118619338

Change-Id: Id69cd3f089b07343a7209290808c11d4c17f1a49
Reviewed-on: https://swiftshader-review.googlesource.com/c/23229
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoSupport regions in Buffer to/from Image copy
Alexis Hetu [Fri, 14 Dec 2018 21:42:24 +0000 (16:42 -0500)]
Support regions in Buffer to/from Image copy

Added support for image regions and buffer rowLength/imageHeight
for Image to Buffer copies or Buffer to Image copies.

Passes all tests in:
dEQP-VK.api.copy_and_blit.core.image_to_buffer
dEQP-VK.api.copy_and_blit.core.buffer_to_image

Bug b/119620767

Change-Id: I2b2592c06d52609c3f9c51fa164a0335f58f361f
Reviewed-on: https://swiftshader-review.googlesource.com/c/23228
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoSupport for combined Depth and Stencil formats
Alexis Hetu [Fri, 14 Dec 2018 17:11:02 +0000 (12:11 -0500)]
Support for combined Depth and Stencil formats

Added implementation for Depth and Stencil which currently allocates
Depth and Stencil as 2 contiguous image planes in memory.

Copying to and from depth and stencil planes is now supported which
fixes all failures in:
dEQP-VK.api.copy_and_blit.core.image_to_image.all_formats.depth_stencil
Which were the last remaining failures in:
dEQP-VK.api.copy_and_blit.core.image_to_image

Bug b/119620767

Change-Id: Ie90737c219c70d9c8a68c024ed33292812a3b7f4
Reviewed-on: https://swiftshader-review.googlesource.com/c/23209
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoSupport for array layers in Image objects
Alexis Hetu [Fri, 14 Dec 2018 16:07:39 +0000 (11:07 -0500)]
Support for array layers in Image objects

Added basic support for array layers in Image objects.
This allows allocating the memory for multiple layers,
copying between a 2D image with multiple layers to and
from a 3D image.

Passes all tests in:
dEQP-VK.api.copy_and_blit.core.image_to_image.3d_images.*

Bug b/119620767

Change-Id: I305650ba89f90dcd527b484fc3ed095a309506d1
Reviewed-on: https://swiftshader-review.googlesource.com/c/23208
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoProperly dispose of the sw::Renderer object
Alexis Hetu [Wed, 12 Dec 2018 18:26:15 +0000 (13:26 -0500)]
Properly dispose of the sw::Renderer object

This fixes a memory leak in the Queue object. The sw::Renderer
object has a non trivial destructor, which means we need to call
it before deallocating the Queue objects.

Bug b/117974925

Change-Id: I1e13c6108e77d5cdcbea337d572f72fdd32530a1
Reviewed-on: https://swiftshader-review.googlesource.com/c/23188
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoFix CMake-based build
Chris Forbes [Sat, 8 Dec 2018 01:54:31 +0000 (17:54 -0800)]
Fix CMake-based build

Change-Id: I5feee7fb928a49762faa8154804fc4b0e86f60b8
Reviewed-on: https://swiftshader-review.googlesource.com/c/23169
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agovkCmdDraw implementation
Alexis Hetu [Fri, 7 Dec 2018 21:26:05 +0000 (16:26 -0500)]
vkCmdDraw implementation

Piped all the information from the vertex buffers and
the pipeline to the renderer to perform a draw.

In order for the renderer and the context to have proper
lifetimes, they both reside in the Queue object for now.

Bug b/118619338

Change-Id: Ifa03acd13ceb065a856b50f2cffadd4ee6b9a163
Reviewed-on: https://swiftshader-review.googlesource.com/c/23111
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoRenderPass begin and end
Alexis Hetu [Fri, 7 Dec 2018 21:13:34 +0000 (16:13 -0500)]
RenderPass begin and end

Implemented vkCmdBeginRenderPass and vkCmdEndRenderPass.
The RenderPass object begin and end are noop for now, but
the framebuffer gets cleared within vkCmdBeginRenderPass.

Bug b/119620965 b/118619338

Change-Id: I8e1f2932d9d52b3dcb5c10d4e60cba83b28bb95d
Reviewed-on: https://swiftshader-review.googlesource.com/c/23108
Reviewed-by: Corentin Wallez <cwallez@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoAdd missing checks in the GraphicsPipeline constructor
Alexis Hetu [Fri, 7 Dec 2018 21:26:05 +0000 (16:26 -0500)]
Add missing checks in the GraphicsPipeline constructor

Adjusted a few checks in the GraphicsPipeline constructor,
specifically stages' specialization info and sample mask,
which can either be null or default.

Also fixed destroying Pipeline objects, making sure there's
no confusion between GraphicsPipeline and ComputePipeline's
destroy() methods inherited from their 2 base classes
(Pipeline::destroy() and ObjectBase::destroy()).

Bug b/118386749

Change-Id: I78be9f0bbb735518e07d52f7372dbf08b9834abf
Reviewed-on: https://swiftshader-review.googlesource.com/c/23110
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoImplement Image clear
Alexis Hetu [Fri, 7 Dec 2018 21:20:44 +0000 (16:20 -0500)]
Implement Image clear

Use the blitter to implement Image::clear.

The image can be easily packed into a sw::Surface. For now,
the surface is a temporary, but it may become a member in
the future if it makes sense.

Bug b/119620767

Change-Id: I122a321509dc8cc5b624ddd776bd9059eee0cbc4
Reviewed-on: https://swiftshader-review.googlesource.com/c/23109
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoVkImageView initial implementation
Alexis Hetu [Mon, 19 Nov 2018 16:30:43 +0000 (11:30 -0500)]
VkImageView initial implementation

Added VkImageView object.
Added "clear" function to illustrate the link between VkFramebuffer
attachments, VkImageView and VkImage, along with the minimal set of
class members to allows the function arguments to be used properly.

Bug b/119620767 b/119621736

Change-Id: I0e7e6017979960bacbdf888d632c83edda3483cf
Reviewed-on: https://swiftshader-review.googlesource.com/c/22668
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoImage to Image copy command
Alexis Hetu [Fri, 7 Dec 2018 17:40:00 +0000 (12:40 -0500)]
Image to Image copy command

Implemented Image to Image copy, Image to Buffer copy and
Buffer to Image copy commands which are required in order
to run the dEQP-VK.api.copy_and_blit.core.image_to_image.*
tests.

Passes over 99.7% of the 10907 tests in:
dEQP-VK.api.copy_and_blit.core.image_to_image.*

Bug b/118619338 b/119620767

Change-Id: Id4d3aa5186bed84d0925e4424399716efbd241ee
Reviewed-on: https://swiftshader-review.googlesource.com/c/23071
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoFixed command buffer reset and added implicit reset
Alexis Hetu [Mon, 10 Dec 2018 19:41:03 +0000 (14:41 -0500)]
Fixed command buffer reset and added implicit reset

A call to vkBeginCommandBuffer implicitly resets the command buffer.

Bug b/118619338

Change-Id: I020a2d15915cbb309dbcd012b2dbbf34ca2f63c6
Reviewed-on: https://swiftshader-review.googlesource.com/c/23148
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoImage copy
Alexis Hetu [Fri, 7 Dec 2018 16:53:19 +0000 (11:53 -0500)]
Image copy

Image objects now have the ability to copy their content to another
image object. They can also copy their content to or from Buffer
objects.

Bug b\119620767

Change-Id: I047e9ecdcc11e264589de1d9461ef448f22a4d9e
Reviewed-on: https://swiftshader-review.googlesource.com/c/23070
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoImport snapshot of spirv headers
Chris Forbes [Fri, 7 Dec 2018 02:33:06 +0000 (18:33 -0800)]
Import snapshot of spirv headers

Includes only the include/spirv/unified1 subtree.

Based on git://github.com/KhronosGroup/spirv-tools revision 17da9f8231f78cf519b4958c2229463a63ead9e2

Bug: b/120799499
Change-Id: Ifb790bf95035d7feb2d54d07e1475013dfd298b1
Reviewed-on: https://swiftshader-review.googlesource.com/c/23048
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoFix implicit fallthrough warnings treated as errors
Nicolas Capens [Sat, 8 Dec 2018 20:35:32 +0000 (12:35 -0800)]
Fix implicit fallthrough warnings treated as errors

Ideally we'd use the [[fallthrough]] attribute to silence this, but that
isn't supported until C++17 and we're sticking with C++11 for now.

Bug b/120382288

Change-Id: I98f28e42505ed496b0b35c29a7dc03fca18cf4ff
Reviewed-on: https://swiftshader-review.googlesource.com/c/23128
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoBuffer copy
Alexis Hetu [Fri, 7 Dec 2018 16:36:34 +0000 (11:36 -0500)]
Buffer copy

Buffer now has the ability to copy its content to or from memory.

Bug b/118383648

Change-Id: Ic01bf049fe054559299830ca750263c2277e4d86
Reviewed-on: https://swiftshader-review.googlesource.com/c/23069
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>