OSDN Git Service

android-x86/external-swiftshader.git
5 years agoFix GN build.
Nicolas Capens [Mon, 15 Oct 2018 15:25:03 +0000 (11:25 -0400)]
Fix GN build.

Bug b/115344057
Bug chromium:881334

Change-Id: Ib54e43a106c17b4878780382c4a80415e8f3583b
Reviewed-on: https://swiftshader-review.googlesource.com/c/21508
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd GN build file for LLVM 7.0
Nicolas Capens [Fri, 12 Oct 2018 20:45:51 +0000 (16:45 -0400)]
Add GN build file for LLVM 7.0

This enables supporting ARM64 for Chromium.

Bug b/115344057
Bug chromium:881334

Change-Id: I45020e826684c6fa6e663a90b75703193ad670c3
Reviewed-on: https://swiftshader-review.googlesource.com/c/21451
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix depth/stencil read format validation.
Nicolas Capens [Sat, 13 Oct 2018 03:42:21 +0000 (23:42 -0400)]
Fix depth/stencil read format validation.

Bug b/117564133
Bug swiftshader:104

Change-Id: I6e5c4aca219e344df7b113fe445c5f1faeb7dd4b
Reviewed-on: https://swiftshader-review.googlesource.com/c/21488
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoRemove libGL project.
Nicolas Capens [Wed, 10 Oct 2018 15:11:34 +0000 (11:11 -0400)]
Remove libGL project.

Change-Id: I36237afe7b01070cd665f4ab990e9d7cc87a6360
Reviewed-on: https://swiftshader-review.googlesource.com/c/21390
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoRename SWIFTSHADER_LLVM_VERSION to REACTOR_LLVM_VERSION.
Nicolas Capens [Wed, 10 Oct 2018 14:49:30 +0000 (10:49 -0400)]
Rename SWIFTSHADER_LLVM_VERSION to REACTOR_LLVM_VERSION.

Bug b/115344057
Bug swiftshader:16

Change-Id: I0e7d49cb5f66cef7d8ccd80506deeae8aab1824c
Reviewed-on: https://swiftshader-review.googlesource.com/c/21389
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoRename Reactor/Memory.* to Reactor/ExecutableMemory.*
Nicolas Capens [Wed, 10 Oct 2018 14:42:36 +0000 (10:42 -0400)]
Rename Reactor/Memory.* to Reactor/ExecutableMemory.*

Bug b/115344057
Bug swiftshader:16

Change-Id: I2ef387ee237e964c089d9a7a5eb156a8733cc77f
Reviewed-on: https://swiftshader-review.googlesource.com/c/21388
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoDelete unused functionality.
Nicolas Capens [Tue, 9 Oct 2018 21:32:47 +0000 (17:32 -0400)]
Delete unused functionality.

Core SwiftShader should no longer be able to allocate executable
memory. That responsibility now falls entirely on Reactor.

Bug b/115344057
Bug swiftshader:16

Change-Id: If5dad25e52e661331ef0555b2d9de743cbfd3173
Reviewed-on: https://swiftshader-review.googlesource.com/c/21369
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoMake Reactor build stand-alone.
Nicolas Capens [Mon, 6 Aug 2018 18:20:45 +0000 (14:20 -0400)]
Make Reactor build stand-alone.

This is accomplished by duplicating files from the Common directory
that Reactor (both with LLVM and Subzero back-end) depended on. They
will be minimized in the next change.

Bug b/115344057
Bug swiftshader:16

Change-Id: I2dc087e91b761cc4402ed8594022551e9246b855
Reviewed-on: https://swiftshader-review.googlesource.com/c/20108
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoOutput intermediate build files to project independent directories.
Nicolas Capens [Tue, 9 Oct 2018 18:22:04 +0000 (14:22 -0400)]
Output intermediate build files to project independent directories.

This prevents clashes between intermediates. Also update the D3D8
project to not depend on debug macro implementations in the
SwiftShader layer.

Bug b/29024574

Change-Id: I206b750bf752e3b47867f35379a82f32549a7843
Reviewed-on: https://swiftshader-review.googlesource.com/c/21348
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRename Reactor namespace to rr.
Nicolas Capens [Mon, 6 Aug 2018 18:20:45 +0000 (14:20 -0400)]
Rename Reactor namespace to rr.

We were using sw, the namespace used in the rest of SwiftShader, as the
namespace for Reactor. Putting Reactor code into its own namespace
makes it easier to untangle dependencies.

Bug swiftshader:16
Bug b/115344057

Change-Id: Iea4e049a4796323bf80b4f5e6e17778ccf17b995
Reviewed-on: https://swiftshader-review.googlesource.com/c/21308
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd LLVM 7.0 as git subtree
Nicolas Capens [Fri, 12 Oct 2018 02:08:06 +0000 (02:08 +0000)]
Add LLVM 7.0 as git subtree

Adds commit '65ce2e56889' from https://git.llvm.org/git/llvm as
'third_party/llvm-7.0/llvm'

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

Bug b/115344057

Change-Id: I981f7e2fc47639ca8a8998b188e837bc3f268de5

5 years agoSquashed 'third_party/llvm-7.0/llvm/' content from commit 65ce2e56889
Nicolas Capens [Fri, 12 Oct 2018 02:08:06 +0000 (02:08 +0000)]
Squashed 'third_party/llvm-7.0/llvm/' content from commit 65ce2e56889

git-subtree-dir: third_party/llvm-7.0/llvm
git-subtree-split: 65ce2e56889af84e8be8e311f484a4dfe4b62d7a

5 years agoRemove LLVM 7.0 git submodule
Nicolas Capens [Thu, 11 Oct 2018 18:10:49 +0000 (14:10 -0400)]
Remove LLVM 7.0 git submodule

LLVM 7.0 will be added back as a subtree instead.

This reverts commit 1841c50cf0abab2a6d7b5e86b614fbcace7d57f7.

Bug b/115344057

Change-Id: I5fc51be1f107f3de0e97e8b53e282b0cc9557bed

5 years agoGrant more downstream SwiftShader approval rights.
Nicolas Capens [Tue, 9 Oct 2018 14:21:50 +0000 (10:21 -0400)]
Grant more downstream SwiftShader approval rights.

Change-Id: Idc041213e40c0650b52209de199a098bd26a1b39
Reviewed-on: https://swiftshader-review.googlesource.com/c/21328
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoDisable accidentally enabled OpenGL logging.
Nicolas Capens [Tue, 9 Oct 2018 19:56:12 +0000 (15:56 -0400)]
Disable accidentally enabled OpenGL logging.

This reverts part of https://swiftshader-review.googlesource.com/21108

Bug b/73656151

Change-Id: I35c91cb5b28ede65eadebcb5e8141be4cf3f2e0e
Reviewed-on: https://swiftshader-review.googlesource.com/c/21368
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Shannon Woods <shannonwoods@google.com>
5 years agoRemove unused preprocessor definitions.
Nicolas Capens [Wed, 3 Oct 2018 15:14:00 +0000 (11:14 -0400)]
Remove unused preprocessor definitions.

Bug b/116336664

Change-Id: I388b3c602d0b697ecedf19e390d8008ada0ea849
Reviewed-on: https://swiftshader-review.googlesource.com/c/21289
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoAdd renderer source to Vulkan project.
Nicolas Capens [Tue, 2 Oct 2018 18:35:57 +0000 (14:35 -0400)]
Add renderer source to Vulkan project.

Bug b/117152542

Change-Id: I8bfa40d0e912f90946109c6d80889889ef7c5c55
Reviewed-on: https://swiftshader-review.googlesource.com/c/21249
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoDuplicate source files for Vulkan.
Nicolas Capens [Tue, 2 Oct 2018 17:16:55 +0000 (13:16 -0400)]
Duplicate source files for Vulkan.

The Vulkan implementation needs a directory for each architectural
layer, similar to the OpenGL ES stack. The entire rendering stack is
duplicated, leaving only Reactor common between them:

Renderer -> Device
Shader -> Pipeline
Common -> System
Main -> WSI

Bug b/117152542

Change-Id: I9c26b23654016d637f88ec2416f019ef65b9afbd
Reviewed-on: https://swiftshader-review.googlesource.com/c/21248
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoChange build output directory to 'out'.
Nicolas Capens [Tue, 2 Oct 2018 16:40:12 +0000 (12:40 -0400)]
Change build output directory to 'out'.

Although we only produce libraries, 'lib' is confusing as an output
directory. We already used 'out' for the CMake build.

Bug b/116336664
Bug b/29024574

Change-Id: I2bc1015a72100f81f734fc969a32e9f5a967e17c
Reviewed-on: https://swiftshader-review.googlesource.com/c/21228
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoRemove environment-wide include paths.
Nicolas Capens [Mon, 1 Oct 2018 20:11:08 +0000 (16:11 -0400)]
Remove environment-wide include paths.

The Vulkan implementation shouldn't depend on any of the legacy
directories. Also, changes to the environment-wide include paths
may have undesired consequences.

Bug b/116336664

Change-Id: Ied3c8f4e56994379db3518a4fbf0268451d84079
Reviewed-on: https://swiftshader-review.googlesource.com/c/21188
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoFix CMake Subzero build.
Nicolas Capens [Tue, 2 Oct 2018 19:01:30 +0000 (15:01 -0400)]
Fix CMake Subzero build.

Bug swiftshader:116

Change-Id: I93208ea733cfe69474477ad2e00e52c8e86d1e25
Reviewed-on: https://swiftshader-review.googlesource.com/c/21268
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix preprocessor error.
Nicolas Capens [Tue, 2 Oct 2018 14:49:22 +0000 (10:49 -0400)]
Fix preprocessor error.

##__VA_ARGS__ causes an error with clang if it's not preceded by a comma. The ## is
wholly unnecessary in this case so it can just be removed.

Bug b/73656151

Change-Id: Icc8a67a91b270d0e9b006cae7a438cdefa412f87
Reviewed-on: https://swiftshader-review.googlesource.com/21208
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
5 years agoMigrate to using <log/log.h> since Android O (API 27)
Merck Hung [Fri, 28 Sep 2018 21:21:57 +0000 (05:21 +0800)]
Migrate to using <log/log.h> since Android O (API 27)

Starting from Android O, <cutils/log.h> is planned to be deprecated in the
future. The use of the original <cutils/log.h> is split into 2 header files.

Per Treble team's (b/78370064) description, <log/log.h> is for native shared
libs or executables, and <android/log.h> is for app JNI.

So a conditional preprocessor is put in place to look at the
ANDROID_PLATFORM_SDK_VERSION definition. If the value is less than 27, means
it's Android N or older, and it ought to include <cutils/log.h>.

Otherwise, it should be 27 (Android O) or any greater version, and it's
supposed to include the new <log/log.h> file.

If ANDROID_PLATFORM_SDK_VERSION is not definied, Andorid build system catches
it and stops the building process with an error message.

Bug: b/116855807
Test: pi-dev(28), oc-mr1-dev(27), and nyc-mr2-dev(26) branches
Test: aosp_arm-eng target
Change-Id: I732803e900144bf291feeb2cba1d632301c4fa21
Reviewed-on: https://swiftshader-review.googlesource.com/21130
Tested-by: Merck Hung <merckhung@google.com>
Reviewed-by: Merck Hung <merckhung@google.com>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRemove stray printfs.
Nicolas Capens [Fri, 28 Sep 2018 19:27:08 +0000 (15:27 -0400)]
Remove stray printfs.

SwiftShader shouldn't print anything to stdout in Release builds.

Also refactor UNIMPLEMENTED macro to be able to take a formatted string
with arguments.

Bug b/73656151

Change-Id: Ibadbfba3371324ba1bd608bd51bdac5e5923a20e
Reviewed-on: https://swiftshader-review.googlesource.com/21108
Reviewed-by: Merck Hung <merckhung@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRemove duplicates in LLVM 7.0 build.
Nicolas Capens [Mon, 1 Oct 2018 16:38:38 +0000 (12:38 -0400)]
Remove duplicates in LLVM 7.0 build.

Bug b/115344057

Change-Id: Iac34e89f56a1f67301beae3fcf492596522d08a2
Reviewed-on: https://swiftshader-review.googlesource.com/21168
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix stencil buffer memory leak.
Nicolas Capens [Sat, 29 Sep 2018 15:58:42 +0000 (11:58 -0400)]
Fix stencil buffer memory leak.

Locking stencil buffers with a NULL format resulted in nullptr being
returned without acquiring the resource lock, while unlocking did
release the lock.

Instead of not releasing it on unlock, we must acquire it on lock
because otherwise the object could get destroyed before draw operations
end and attempt to unlock.

Bug b/116876483

Change-Id: Ie883115a1d6df3b40eb7c1feb5dcfde7316ec970
Reviewed-on: https://swiftshader-review.googlesource.com/21148
Reviewed-by: Krzysztof Kosiński <krzysio@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Krzysztof Kosiński <krzysio@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoNotify team on Travis CI failures.
Nicolas Capens [Fri, 28 Sep 2018 18:17:07 +0000 (14:17 -0400)]
Notify team on Travis CI failures.

Bug b/115784742

Change-Id: Id3225adcaf77e1d26560151c506e885318bd0ff6
Reviewed-on: https://swiftshader-review.googlesource.com/21088
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoExplicitly include Android.mk for only OpenGL
Merck Hung [Fri, 28 Sep 2018 08:08:14 +0000 (16:08 +0800)]
Explicitly include Android.mk for only OpenGL

Replace all-makefiles-under makefile-macro with explicitly including
Android.mk(s) from subdirectories that are related to OpenGL and are
only needed by Android builds.

The change are mainly made to the top-level Android.mk and the
src/Android.mk. The other three sub-Android.mk(s) are deprecated and
deleted. Soong compile-time is expected to shorten with no use of
all-makefiles-under macros.

Since the project co-existed with both Android.bp and Android.mk.
The test was performed in absence of Android.bp on oc-mr1-dev branch
against aosp_arm-eng and aosp_arm64-eng targets.

NOTE: Android Pie uses Android.bp only.

Bug: b/29023322
Test: oc-mr1-dev branch, aosp_arm-eng (LLVM3) & aosp_arm64-eng (LLVM7) targets
Change-Id: I05ac46213f849747621c7084bca2549a22513881
Reviewed-on: https://swiftshader-review.googlesource.com/21068
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Merck Hung <merckhung@google.com>
5 years agoSilently ignore attempts to delete default VAO.
Nicolas Capens [Thu, 27 Sep 2018 17:54:27 +0000 (13:54 -0400)]
Silently ignore attempts to delete default VAO.

The spec for glDeleteVertexArrays states that "Unused names in arrays
are silently ignored, as is the value zero."

b/116699321

Change-Id: I7cca0336dd9841b360f8fa20f6c0ac9677ec3ce1
Reviewed-on: https://swiftshader-review.googlesource.com/21048
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoReactor: Fix Trunc generic code generation
Logan Chien [Thu, 27 Sep 2018 13:05:53 +0000 (21:05 +0800)]
Reactor: Fix Trunc generic code generation

This commit fixes `Trunc(Float)` and `Trunc(Float4)` generic LLVM code
generation.  If `Trunc(x)` is implemented with `Float(Int(x))`, it will
result in quality warning in dEQP.

Bug: b/115344057
Test: dEQP-GLES3.functional.shaders.builtin_functions.precision.trunc
Test: dEQP-GLES3.functional.shaders.builtin_functions.precision.modf
Change-Id: I62d2dd1907e345fb00307b6c0d4d74613237f94b
Reviewed-on: https://swiftshader-review.googlesource.com/21029
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoReactor: Fix Frac generic code generation
Logan Chien [Wed, 26 Sep 2018 14:18:16 +0000 (22:18 +0800)]
Reactor: Fix Frac generic code generation

This commit fixes `Frac(Float)` and `Frac(Float4)` generic LLVM code
generation.

See also: https://bugs.chromium.org/p/swiftshader/issues/detail?id=74

Bug: b/115344057
Test: functional.shaders.builtin_functions.precision.fract.highp_vertex
Test: functional.shaders.builtin_functions.precision.fract.highp_fragment
Change-Id: I027b7ab44ba3060dc100a220ba19e5275f41d4c9
Reviewed-on: https://swiftshader-review.googlesource.com/20933
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoReactor: Fix RoundInt generic code generation
Logan Chien [Wed, 26 Sep 2018 11:59:32 +0000 (19:59 +0800)]
Reactor: Fix RoundInt generic code generation

This commit fixes `RoundInt(Float)` and `RoundInt(Float4)` generic LLVM
code generation.

Bug: b/115344057
Test: functional.shaders.builtin_functions.precision.sinh.highp_vertex
Test: functional.shaders.builtin_functions.precision.sinh.highp_fragment
Test: functional.shaders.builtin_functions.precision.cosh.highp_vertex
Test: functional.shaders.builtin_functions.precision.cosh.highp_fragment
Change-Id: I35de5cf6bec6607725523a10ebf098333957f39a
Reviewed-on: https://swiftshader-review.googlesource.com/20931
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoReactor: Fix Round (float) generic code generation
Logan Chien [Wed, 26 Sep 2018 14:14:00 +0000 (22:14 +0800)]
Reactor: Fix Round (float) generic code generation

This commit fixes `Round(Float)` and `Round(Float4)` generic LLVM code
generation.

Bug: b/115344057
Test: dEQP-GLES3.functional.shaders.builtin_functions.precision.sin
Test: dEQP-GLES3.functional.shaders.builtin_functions.precision.cos
Change-Id: I9758ac4ca69bb0f5a5b192b4be3310827625fac0
Reviewed-on: https://swiftshader-review.googlesource.com/20932
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoReactor: Add check to SSE-specifc code for UShort4
Logan Chien [Wed, 26 Sep 2018 11:22:54 +0000 (19:22 +0800)]
Reactor: Add check to SSE-specifc code for UShort4

Bug: b/115344057
Change-Id: I57d9cc936349c9f788a9bf791f55958caa6cbb73
Reviewed-on: https://swiftshader-review.googlesource.com/20930
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoReactor: Fix Floor generic code generation
Logan Chien [Wed, 26 Sep 2018 11:03:53 +0000 (19:03 +0800)]
Reactor: Fix Floor generic code generation

This commit fixes Floor() generic LLVM code generation.

Bug: b/115344057
Test: dEQP-GLES3.functional.shaders.builtin_functions.precision.floor
Change-Id: I70ec0babfe9778b7963296734f1901a73b1f696f
Reviewed-on: https://swiftshader-review.googlesource.com/20929
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoReactor: Fix add/sub sat generic code generation
Logan Chien [Wed, 26 Sep 2018 10:58:03 +0000 (18:58 +0800)]
Reactor: Fix add/sub sat generic code generation

This commit fixes saturated add/sub instructions in generic LLVM code
generation path.

Bug: b/115344057
Test: dEQP-GLES3.functional.texture.wrap.rgba8
Change-Id: Ie3e3b708565b3ad255804090e8a3ee5521f42982
Reviewed-on: https://swiftshader-review.googlesource.com/20928
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoReactor: Cleanup indentations
Logan Chien [Thu, 27 Sep 2018 10:45:58 +0000 (18:45 +0800)]
Reactor: Cleanup indentations

Use mixed indentations so that the code are aligned regardless the tab
width.

Bug: b/115344057
Change-Id: I9476c1b8ba5a518787dc76f50e1805b1b9d06e82
Reviewed-on: https://swiftshader-review.googlesource.com/21028
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoInclude <string> for fixing undefined template on Mac.
Merck Hung [Thu, 27 Sep 2018 00:14:11 +0000 (09:14 +0900)]
Include <string> for fixing undefined template on Mac.

Change-Id: I4e8a860446bde7f76ea289888bf592d78c59b9c4
Reviewed-on: https://swiftshader-review.googlesource.com/21008
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Merck Hung <merckhung@google.com>
5 years agoInitial cmake support for vulkan target
Chris Forbes [Wed, 26 Sep 2018 16:24:39 +0000 (09:24 -0700)]
Initial cmake support for vulkan target

Change-Id: I34b47a5327055f804951793d9a8a58f771d9b792
Bug: b/116336664
Reviewed-on: https://swiftshader-review.googlesource.com/20988
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoRemove exit-time destructors.
Nicolas Capens [Tue, 25 Sep 2018 15:46:27 +0000 (11:46 -0400)]
Remove exit-time destructors.

Bug chromium:101600
Bug swiftshader:118

Change-Id: Id167a84c4d8781989d4d903384c4e6fe6f45fb85
Reviewed-on: https://swiftshader-review.googlesource.com/20868
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoVulkan API (GetProcAddr only)
Alexis Hetu [Fri, 21 Sep 2018 19:14:43 +0000 (15:14 -0400)]
Vulkan API (GetProcAddr only)

This patch contains an empty Vulkan shell with only GetProcAddr implemented

Initial version of the VulkanAPI, empty and unimplemented.
Successfully builds vk_swiftshader.dll for all platforms/configuration in Visual Studio.

To test using dEQP:
- Edit environment variables
- Define VK_ICD_FILENAMES to <SwiftShader's source directory>\src\Vulkan\vk_swiftshader_icd.json
- If the location of vk_swiftshader.dll you're using is different than the one specified in
  src\Vulkan\vk_swiftshader_icd.json, modify it to point to the vk_swiftshader.dll file you want to use

Bug b/116336664

Change-Id: I560b53c3e4340b9c5ccd244a6693ff2f9f994a6f
Reviewed-on: https://swiftshader-review.googlesource.com/20788
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoUse lower case for internal Makefile variables
Logan Chien [Tue, 25 Sep 2018 09:59:20 +0000 (17:59 +0800)]
Use lower case for internal Makefile variables

This commit switches several internal (implied) Makefile variables to
lower cases.  This follows the variable naming convention recommended by
GNU Makefile Manual.

Change-Id: I79819ef0cfd3828107dab665118f1511ef8a8337
Reviewed-on: https://swiftshader-review.googlesource.com/20848
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Logan Chien <loganchien@google.com>
5 years agoMore thread safety in ES2 & EGL APIs
Chris Forbes [Wed, 12 Sep 2018 00:31:52 +0000 (17:31 -0700)]
More thread safety in ES2 & EGL APIs

Tweak ContextPtr to handle move construction/assignment correctly.
This was overlooked when I made the last minute change to use explicit lock/unlock.

Tweak LockGuard to allow construction from ptr to MutexLock, and behave
correctly if mutex == nullptr. This is required because the locking
machinery for EGL is /outside/ the error generation for bad EGLDisplay.

Add 'Big EGL Lock' around most of the EGL API

Bug: b/112184433
Change-Id: Ic4cd5fa9e6a16ae81cbb2b46e1cb881a850749c5
Reviewed-on: https://swiftshader-review.googlesource.com/20628
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoAdd support for constant folding of clamp()
Chris Forbes [Sat, 22 Sep 2018 01:40:53 +0000 (18:40 -0700)]
Add support for constant folding of clamp()

Fixes: dEQP-GLES3.functional.shaders.constant_expressions.other.complex*
Bug: b/116598062
Change-Id: Ife2dd2edad17d6ebbd02653f484637672ce6af0a
Reviewed-on: https://swiftshader-review.googlesource.com/20828
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoFix constant folding of nonsquare mat * vec and vec * mat
Chris Forbes [Fri, 21 Sep 2018 20:24:17 +0000 (13:24 -0700)]
Fix constant folding of nonsquare mat * vec and vec * mat

Bug: b/116263076
Change-Id: Id8657fdefb988827f0d78556884c4f55eb096ca3
Reviewed-on: https://swiftshader-review.googlesource.com/20808
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoAvoid emitting nonsquare scale matrix entries where there is no main diagonal element
Chris Forbes [Fri, 21 Sep 2018 18:57:51 +0000 (11:57 -0700)]
Avoid emitting nonsquare scale matrix entries where there is no main diagonal element

As mentioned in the patch itself, this is fairly benign, but still junk that a later pass has to be able to eliminate. Is easier to just not produce it in the first place.

Bug: b/116263076
Change-Id: I199672bb9b53eb4ee9d4a8e3a23fc2ce42f0dec6
Reviewed-on: https://swiftshader-review.googlesource.com/20770
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoFix nonsquare matrix construction from scalar
Chris Forbes [Fri, 21 Sep 2018 18:30:15 +0000 (11:30 -0700)]
Fix nonsquare matrix construction from scalar

Matrix is laid out in column-major order, so the stride between elements
on the main diagonal is #rows + 1, not #columns + 1.

Bug: b/116263076
Change-Id: I00994b663bc4229e24f8ae1b7fa518caa0e7ea71
Reviewed-on: https://swiftshader-review.googlesource.com/20768
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoFix missing case for declarations in glslang AST dump
Chris Forbes [Fri, 21 Sep 2018 18:34:36 +0000 (11:34 -0700)]
Fix missing case for declarations in glslang AST dump

Cleans up some noise that appears in dumps of pretty much every GLSL
shader.

Change-Id: I602a6356110803e30fcd8ba9818e56efa70bf5d6
Reviewed-on: https://swiftshader-review.googlesource.com/20769
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoFix code generation for vec.swiz *= mat
Chris Forbes [Thu, 20 Sep 2018 00:07:39 +0000 (17:07 -0700)]
Fix code generation for vec.swiz *= mat

Khronos test CL: https://gerrit.khronos.org/#/c/2944/
Bug: b/116259485

Change-Id: Ie10b3eb16da39f332966a5b957acb0232140a942
Reviewed-on: https://swiftshader-review.googlesource.com/20748
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoAdd SWIFTSHADER prefix to Android.mk variables
Logan Chien [Mon, 10 Sep 2018 14:14:20 +0000 (22:14 +0800)]
Add SWIFTSHADER prefix to Android.mk variables

This commit replaces use_subzero with SWIFTSHADER_USE_SUBZERO and
unsupported_build with SWIFTSHADER_UNSUPPORTED_BUILD in Android.mk so
that it can be consistent with other variables.

Change-Id: Ia22cc88bc5804d7d2bea942bbceb2fc30c88aa18
Reviewed-on: https://swiftshader-review.googlesource.com/20588
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoBuild fix
Alexis Hetu [Fri, 14 Sep 2018 20:53:21 +0000 (16:53 -0400)]
Build fix

Made sure both LLVM and Subzero has the /src directory in their
include directory list. Removed unused ../ in front of "Common"
includes as a cleanup.

Change-Id: Ib4a6fb772fa03a9a3cad82594db1b1650007e47f
Reviewed-on: https://swiftshader-review.googlesource.com/20728
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoDisable unsafe FP math optimizations for LLVM 7.0.
Nicolas Capens [Thu, 13 Sep 2018 18:20:06 +0000 (14:20 -0400)]
Disable unsafe FP math optimizations for LLVM 7.0.

Failures in dEQP using SwiftShader with LLVM 7.0 were caused by unsafe
floating point math optimizations, which are more aggressive than with
LLVM 3.0.

Bug b/115344057

Change-Id: Idf564d0193efba37cd1192a188b18a5f8b4ed4f7
Reviewed-on: https://swiftshader-review.googlesource.com/20708
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Shannon Woods <shannonwoods@google.com>
5 years agoWork around stack probe issue.
Nicolas Capens [Thu, 13 Sep 2018 18:30:56 +0000 (14:30 -0400)]
Work around stack probe issue.

LLVM fails to resolve the __chkstck function for probing the stack when
it's larger than 4 kB. We don't need it for SwiftShader because newly
created threads have 1 MB of committed stack memory.

Bug b/115344057
Bug swiftshader:25

Change-Id: Ic6097376052b07ed6af950dfdac8499b5fc83053
Reviewed-on: https://swiftshader-review.googlesource.com/20688
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoUpdated issue tracker URL
Shannon Woods [Wed, 12 Sep 2018 21:02:44 +0000 (17:02 -0400)]
Updated issue tracker URL

Change-Id: Ia4b0f5b7911ddc1f425430e2f6b2e2a7c80fb684
Reviewed-on: https://swiftshader-review.googlesource.com/20668
Tested-by: Shannon Woods <shannonwoods@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd Windows configs for LLVM 7.0.
Nicolas Capens [Tue, 11 Sep 2018 17:09:28 +0000 (13:09 -0400)]
Add Windows configs for LLVM 7.0.

These were created by creating a Visual Studio solution for LLVM
itself and building it so it generates include\llvm\Config files.

Bug b/115344057

Change-Id: I22c93d63395fa27b8d8515d65c6bf4e09b3c16bb
Reviewed-on: https://swiftshader-review.googlesource.com/20608
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoUpdate BUILD.gn configs to support ARM[64] builds.
Stephen Lanham [Fri, 7 Sep 2018 18:59:54 +0000 (11:59 -0700)]
Update BUILD.gn configs to support ARM[64] builds.

Bug: b/114402930
Change-Id: Id7eedc6b01f40d24188d514755d5c89689b24abb
Reviewed-on: https://swiftshader-review.googlesource.com/20568
Tested-by: Stephen Lanham <slan@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd LLVM 7.0 Android.mk
Logan Chien [Mon, 27 Aug 2018 02:49:24 +0000 (10:49 +0800)]
Add LLVM 7.0 Android.mk

Change-Id: Ic1ae2c2872cc9f270557a6d4b701f870f82bd3cf
Reviewed-on: https://swiftshader-review.googlesource.com/20479
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Logan Chien <loganchien@google.com>
5 years agoAdd LLVM 7.0 ARM/AArch64 backend to CMakeLists.txt
Logan Chien [Tue, 21 Aug 2018 07:14:16 +0000 (15:14 +0800)]
Add LLVM 7.0 ARM/AArch64 backend to CMakeLists.txt

Change-Id: Id4209bfe44d9040e36fe4ea654197211aa1c7ead
Reviewed-on: https://swiftshader-review.googlesource.com/20478
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoMove atomicExchange under PERF_PROFILE
Logan Chien [Mon, 27 Aug 2018 02:44:42 +0000 (10:44 +0800)]
Move atomicExchange under PERF_PROFILE

Change-Id: Id5ae40d4b072c57cac1a8e6e7767d3ca03deebe1
Reviewed-on: https://swiftshader-review.googlesource.com/20477
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd the unimplemented non-x86 code generator
Logan Chien [Fri, 24 Aug 2018 14:01:50 +0000 (22:01 +0800)]
Add the unimplemented non-x86 code generator

This commit fills in the unimplemented non-x86 (generic) code generator.

Change-Id: I189b0ea523ecd9b18c29ad6ed6fa3f798382295b
Reviewed-on: https://swiftshader-review.googlesource.com/20476
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoPort SwiftShader to LLVM 7.0
Logan Chien [Tue, 21 Aug 2018 01:34:28 +0000 (09:34 +0800)]
Port SwiftShader to LLVM 7.0

Change-Id: I89601ef9e42e56cfaeb1cd5ece4daa3f32b39950
Reviewed-on: https://swiftshader-review.googlesource.com/20475
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd LLVM 7.0 configs for Linux and Android
Logan Chien [Mon, 3 Sep 2018 09:54:14 +0000 (17:54 +0800)]
Add LLVM 7.0 configs for Linux and Android

Change-Id: Icbacb2f63402b1d1c42fc4287b50ed0a3010cd4d
Reviewed-on: https://swiftshader-review.googlesource.com/20474
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd LLVM 7.0 config generation script
Logan Chien [Tue, 21 Aug 2018 06:56:45 +0000 (14:56 +0800)]
Add LLVM 7.0 config generation script

Change-Id: Ic67a43f5090c5004324ab300ce799c1206f3c4e3
Reviewed-on: https://swiftshader-review.googlesource.com/20473
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd LLVM 7.0 git submodule
Logan Chien [Tue, 21 Aug 2018 02:05:15 +0000 (10:05 +0800)]
Add LLVM 7.0 git submodule

Change-Id: I80b675f939f7eae95ad2fa637e77fc8d988bed3a
Reviewed-on: https://swiftshader-review.googlesource.com/20472
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRefactor LLVM initialization code
Logan Chien [Mon, 3 Sep 2018 11:37:57 +0000 (19:37 +0800)]
Refactor LLVM initialization code

Change-Id: Ie944a14c1d4ae30d7e30f84408c598c9e021ea66
Reviewed-on: https://swiftshader-review.googlesource.com/20471
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoWrap call arguments with ARGS macro
Logan Chien [Fri, 31 Aug 2018 09:19:45 +0000 (17:19 +0800)]
Wrap call arguments with ARGS macro

Change-Id: I239c906851412a667d2ab241eb20d8045baffb8f
Reviewed-on: https://swiftshader-review.googlesource.com/20470
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRemove sw::Value, sw::BasicBlock, and sw::SwitchCases
Logan Chien [Fri, 31 Aug 2018 08:57:15 +0000 (16:57 +0800)]
Remove sw::Value, sw::BasicBlock, and sw::SwitchCases

This commit removes `sw::Value`, `sw::BasicBlock`, and
`sw::SwitchCases`.  In LLVM 7.0, `llvm::Value`, `llvm::BasicBlock`, and
`llvm::SwitchCases` become final classes, thus we cannot derive from
those classes.  Fortunately, we don't have to derive from them.  We can
explicitly cast the pointers instead.

Change-Id: I2dc74485ebf4b399f8a41bb8fa94b7d8d299009e
Reviewed-on: https://swiftshader-review.googlesource.com/20469
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRemove stale LLVM include path
Logan Chien [Fri, 31 Aug 2018 04:02:18 +0000 (12:02 +0800)]
Remove stale LLVM include path

This commit removes stale LLVM include path in D3D8.vcxproj and it
seems that D3D8 does not rely on this include path.

Change-Id: Ieea962ccede9174ef190e1023722f65382cd6ce3
Reviewed-on: https://swiftshader-review.googlesource.com/20468
Tested-by: Logan Chien <loganchien@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoFix Visual Studio SubzeroTest build.
Nicolas Capens [Fri, 7 Sep 2018 03:55:17 +0000 (23:55 -0400)]
Fix Visual Studio SubzeroTest build.

Bug swiftshader:116

Change-Id: I34a86262817a7892c8e717d76fe30adf492d99d9
Reviewed-on: https://swiftshader-review.googlesource.com/20528
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoGuard against out of bounds accesses caused by a large base level
Alexis Hetu [Tue, 4 Sep 2018 15:30:22 +0000 (11:30 -0400)]
Guard against out of bounds accesses caused by a large base level

A texture's base level can be any positive integer, but SwiftShader
stores texture levels in a array that has an implementation
dependent size (IMPLEMENTATION_MAX_TEXTURE_LEVELS). To avoid
accessing this array out of bounds, a class was added to make sure
all accesses to the array are done within its bounds.

Change-Id: I9b439018f209a47371bd2959ba847345326964dd
Reviewed-on: https://swiftshader-review.googlesource.com/20488
Tested-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoFix texture completeness test when using sampler objects.
Nicolas Capens [Fri, 7 Sep 2018 04:03:22 +0000 (00:03 -0400)]
Fix texture completeness test when using sampler objects.

When a sampler object is bound to a texture unit, it overrides the
texture's filter modes. A texture without mipmaps can thus be complete
even if it has a filter mode which requires mipmaps, if there's a
sampler object with a filter mode which doesn't require mipmaps.

Fixes https://github.com/google/filament/pull/220

Change-Id: I200c0bba467d904ac0fd6d93b935e052c47b2030
Reviewed-on: https://swiftshader-review.googlesource.com/20529
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Jeff McGlynn <jwmcglynn@google.com>
Tested-by: Jeff McGlynn <jwmcglynn@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoUse custom executable memory allocator.
Nicolas Capens [Thu, 6 Sep 2018 19:34:46 +0000 (15:34 -0400)]
Use custom executable memory allocator.

On Linux this enables using named memory maps to assist profiling.

Change-Id: I96c36cf7b892237f4f7ed921d01f33454a9398f0
Reviewed-on: https://swiftshader-review.googlesource.com/20508
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix GL resource access thread safety
Chris Forbes [Fri, 31 Aug 2018 02:41:59 +0000 (19:41 -0700)]
Fix GL resource access thread safety

Add resource manager lock, and ContextPtr to automatically take it

Affects: Everything, dEQP-EGL.functional.sharing.gles2.multithread.*
Bug: b/112184433
Change-Id: Ifdc5b18c738f92bbab08217f672a8ed6093e1672
Reviewed-on: https://swiftshader-review.googlesource.com/20388
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoFix eglChooseConfig behavior to match CTS expectation
Chris Forbes [Sat, 1 Sep 2018 01:26:20 +0000 (18:26 -0700)]
Fix eglChooseConfig behavior to match CTS expectation

When multiple instances of the same attribute are provided, CTS expects
the last instance to win. Achieve this by:
1/ Reducing the attribute list in getConfigs()
2/ Adjusting the sort order's consideration of which color
components are "required" to allow a later 0 or EGL_DONT_CARE to
remove a component from consideration again.

Affects: dEQP-EGL.functional.choose_config.*
Bug: b/113679786

V2: Fix up the alignment I broke
V4: Style fix

Change-Id: If9375c9dc5aaadb0ee7b77ecf1e1098c82fa30ca
Reviewed-on: https://swiftshader-review.googlesource.com/20448
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoMove ConvertReadFormatType to utilities.
Nicolas Capens [Mon, 9 Apr 2018 20:27:20 +0000 (16:27 -0400)]
Move ConvertReadFormatType to utilities.

Bug swiftshader:104

Change-Id: Ifcdffd3f960d7bb4982495381465da15ef671c3f
Reviewed-on: https://swiftshader-review.googlesource.com/18429
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRemove quad-layout depth formats from sampler.
Nicolas Capens [Thu, 29 Mar 2018 18:50:24 +0000 (14:50 -0400)]
Remove quad-layout depth formats from sampler.

We can't sample from buffers with linear layout.

Bug swiftshader:104

Change-Id: I622786e9dac8faafeb7ef1745f02587bf43d67bd
Reviewed-on: https://swiftshader-review.googlesource.com/18168
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoImplement GL_NV_read_depth_stencil.
Nicolas Capens [Thu, 29 Mar 2018 18:29:55 +0000 (14:29 -0400)]
Implement GL_NV_read_depth_stencil.

Bug swiftshader:104

Change-Id: I9fcea0c76875de735c3bad0a5c587875d0ca4e26
Reviewed-on: https://swiftshader-review.googlesource.com/18089
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRefactor glReadPixels validation.
Nicolas Capens [Tue, 27 Mar 2018 21:24:38 +0000 (17:24 -0400)]
Refactor glReadPixels validation.

Bug swiftshader:104

Change-Id: I2e5ab18f400035ec3f2125fb001643ca1125c565
Reviewed-on: https://swiftshader-review.googlesource.com/18148
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoImplement GL_OES_fbo_render_mipmap.
Nicolas Capens [Fri, 23 Mar 2018 14:13:06 +0000 (10:13 -0400)]
Implement GL_OES_fbo_render_mipmap.

This enables binding any texture mipmap level as a framebuffer
attachment.

Bug swiftshader:104

Change-Id: I3d4ea637ddd38bb62ca1363fe2c69c569eea36e9
Reviewed-on: https://swiftshader-review.googlesource.com/18008
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
5 years agoDocument build and test instructions.
Nicolas Capens [Fri, 3 Aug 2018 20:01:48 +0000 (16:01 -0400)]
Document build and test instructions.

Also automatically download git submodules with CMake.

Change-Id: I3da095f49d0a9c577ea5dbb50d3db951417f4755
Reviewed-on: https://swiftshader-review.googlesource.com/20088
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoConsider context promotion when validating share context
Chris Forbes [Fri, 31 Aug 2018 00:28:59 +0000 (17:28 -0700)]
Consider context promotion when validating share context

We were comparing a pre-promotion version with the post-promotion
version stored in the share context. This doesn't work.

Affects: dEQP-EGL.functional.sharing.*

Change-Id: I02c14681b7743c6aaef4404291ac52a48890832c
Reviewed-on: https://swiftshader-review.googlesource.com/20368
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoResolve conflicts on Android.bp/.mk when building with O
Greg Hartman [Thu, 30 Aug 2018 03:21:34 +0000 (20:21 -0700)]
Resolve conflicts on Android.bp/.mk when building with O

BUG: 113551166
Change-Id: I0646638710abfc84707ca42faea10f94c87c1f4b
Test: oc and pi build and boot
Reviewed-on: https://swiftshader-review.googlesource.com/20329
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
5 years agoAllow SwiftShader to be moved to a non-default location
Greg Hartman [Thu, 30 Aug 2018 01:58:40 +0000 (18:58 -0700)]
Allow SwiftShader to be moved to a non-default location

BUG: 77218110
Change-Id: Iddaacc2d5fb826ad8b38b46cc9e7ef406b2cd01b
Test: oc and pi builds with I0646638710abfc84707ca42faea10f94c87c1f4b
Reviewed-on: https://swiftshader-review.googlesource.com/20328
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
5 years agoChecking in Vulkan headers
Alexis Hetu [Thu, 30 Aug 2018 18:49:34 +0000 (14:49 -0400)]
Checking in Vulkan headers

These vulkan headers are copied directly from their repo:
https://github.com/KhronosGroup/Vulkan-Headers
commit db09f95ac00e44149f3894bf82c918e58277cfdb
Version 1.1.83
Apache License 2.0

Change-Id: I593b6267dd35092fc9be243ac5209d47103c9a9d
Reviewed-on: https://swiftshader-review.googlesource.com/20348
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoAndroid: Add Android.bp files for a host build.
Alistair Strachan [Fri, 23 Mar 2018 00:37:55 +0000 (17:37 -0700)]
Android: Add Android.bp files for a host build.

This makes it possible to build swiftshader for the host.

The target build also works but it has been disabled.

Change-Id: I8aecf931f4ebf72c06d4e3423e2eafea6bfa7f6c
Reviewed-on: https://swiftshader-review.googlesource.com/17988
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
5 years agoAndroid: Add host versions of the Android platform headers.
Alistair Strachan [Sat, 24 Mar 2018 19:30:28 +0000 (12:30 -0700)]
Android: Add host versions of the Android platform headers.

These host versions will be used by a future change to enable
the build of SwiftShader on the host, using Android extensions,
without needing to pull in non-host-ported parts of the Android
framework.

These headers are derived from the framework versions, but modified
slightly to minimize their dependency on other headers, and to reduce
code size. If a feature is introduced in the platform that SwiftShader
needs, it will need to be added to these headers (however, even if these
headers were copies, they would still need to be updated.)

Change-Id: I51bf7a01fd782f724d98ff05930117ecacdcefb4
Reviewed-on: https://swiftshader-review.googlesource.com/18030
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
5 years agoAndroid: Introduce ANDROID_HOST_BUILD and rework logging.
Alistair Strachan [Sat, 24 Mar 2018 19:24:00 +0000 (12:24 -0700)]
Android: Introduce ANDROID_HOST_BUILD and rework logging.

Avoid using the Android logger directly. Instead, use the Common/Debug
and OpenGL/common/debug paths instead, which abstracts away use of the
logger.

Add ANDRIOD_HOST_BUILD to tell the build we are building an Android
swiftshader, but minimizing the use of platform features such as the
logger.

Change-Id: Ic6c70843d947c568d0e29fe66c55af74b8559a59
Reviewed-on: https://swiftshader-review.googlesource.com/18028
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoUpdate googletest to latest revision.
Nicolas Capens [Fri, 17 Aug 2018 16:57:43 +0000 (12:57 -0400)]
Update googletest to latest revision.

Fixes Visual Studio build issues.

Bug swiftshader:115

Change-Id: Ibd09f4de84a115ed1b264b36985d2d4f31fb3a97
Reviewed-on: https://swiftshader-review.googlesource.com/20269
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix braces warning treated as error.
Nicolas Capens [Tue, 14 Aug 2018 14:46:16 +0000 (14:46 +0000)]
Fix braces warning treated as error.

On some platforms, nested braces are required for nested initializers,
or a warning will be produced which is treated as an error.

Change-Id: I4806ee13869bfe5c5c41505552cd03ff6bdde85e
Reviewed-on: https://swiftshader-review.googlesource.com/20248
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix attribute layout location linking.
Nicolas Capens [Wed, 8 Aug 2018 03:57:21 +0000 (23:57 -0400)]
Fix attribute layout location linking.

When a vertex attribute has a GLSL layout location qualifier, it takes
precedence over the binding location provided through the
glBindAttribLocation API call.

OpenGL ES 3.0.5 spec:
"If an active attribute has a binding explicitly set within the shader
text and a different binding assigned by BindAttribLocation, the
assignment in the shader text is used."

Change-Id: If0bc0dc01a8ff6189703f2be26f1938fbff5f5ae
Reviewed-on: https://swiftshader-review.googlesource.com/20168
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoNon libX11 build fix
Alexis Hetu [Fri, 10 Aug 2018 15:48:33 +0000 (11:48 -0400)]
Non libX11 build fix

Reverted the portion of the following cl which broke the build:
https://swiftshader-review.googlesource.com/c/SwiftShader/+/15909

Change-Id: I4a0e7ef5507dd5502861ccf34c400f1feb54b0cc
Reviewed-on: https://swiftshader-review.googlesource.com/20228
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoSwiftShader on Fuchsia x64
Alexis Hetu [Thu, 9 Aug 2018 21:24:51 +0000 (17:24 -0400)]
SwiftShader on Fuchsia x64

This cl contains the necessary config and build changes
to make SwiftShader work on Fuchsia x64.

Passes all tests in content_unittests.

Bug: chromium:739182

Change-Id: I7df44bd6b12b2560f18e4375f16ada3850f1d8a5
Reviewed-on: https://swiftshader-review.googlesource.com/20208
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoFix platform display retrieval.
Nicolas Capens [Tue, 7 Aug 2018 16:24:10 +0000 (12:24 -0400)]
Fix platform display retrieval.

We were checking if the attrib_list was NULL to verify that no
unsupported attributes are provides, but a single EGL_NONE attribute
should also be allowed.

Also use operator& to avoid confusing implicit conversion to a pointer.

Change-Id: I3c30968fddfd4d1dfbdff9c4ff291abb258e304c
Reviewed-on: https://swiftshader-review.googlesource.com/20148
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoAdd EGL 1.5 entry points.
Nicolas Capens [Mon, 8 Jan 2018 18:07:14 +0000 (13:07 -0500)]
Add EGL 1.5 entry points.

This enables running dEQP on Linux when it was built against an EGL 1.5
capable driver. Note that this is not a complete EGL 1.5 implementation.

Change-Id: Ie29d9ec61e7e3694eb8862aad7432b77fe7c7bae
Reviewed-on: https://swiftshader-review.googlesource.com/15909
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoFix Direct3D 8 build.
Nicolas Capens [Mon, 6 Aug 2018 14:22:17 +0000 (10:22 -0400)]
Fix Direct3D 8 build.

Bug swiftshader:114

Change-Id: I4e69b85ff3fdf59cc340d3c149964d21bc4b1dd9
Reviewed-on: https://swiftshader-review.googlesource.com/20089
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix gl_FrontFacing to take GL_FRONT_FACE into account.
Nicolas Capens [Tue, 31 Jul 2018 19:33:28 +0000 (15:33 -0400)]
Fix gl_FrontFacing to take GL_FRONT_FACE into account.

Bug swiftshader:113

Change-Id: Ia1cbcdbb396eaabaa79e4c8651d7c025f73d028a
Reviewed-on: https://swiftshader-review.googlesource.com/20068
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoTSAN fix
Alexis Hetu [Mon, 30 Jul 2018 19:09:01 +0000 (15:09 -0400)]
TSAN fix

leadingVertexFirst is used within rendering threads and assigned in
the Renderer's constructor, so TSAN detects this as a data race. In
order to fix this, we can make sure any of these global rendering
settings are only set once (since they never change).

Change-Id: Ib4b43d181b140e500ca31e1ce48340c7f4ce500d
Reviewed-on: https://swiftshader-review.googlesource.com/20008
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix validation of uniform block size.
Nicolas Capens [Mon, 30 Jul 2018 20:42:49 +0000 (16:42 -0400)]
Fix validation of uniform block size.

Uniform block members should not be validated against the
GL_MAX_VERTEX_UNIFORM_VECTORS and GL_MAX_FRAGMENT_UNIFORM_VECTORS
limits. Instead, block sizes should not exceed MAX_UNIFORM_BLOCK_SIZE.

Also move uniform block index validation to the entry functions.

Bug b/111803744

Change-Id: I0ea530813d1f2c29141dc64a93aa10f50460885b
Reviewed-on: https://swiftshader-review.googlesource.com/20028
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd missing header.
Nicolas Capens [Fri, 20 Jul 2018 14:41:02 +0000 (10:41 -0400)]
Add missing header.

malloc/free are being used if SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC
is defined.

Change-Id: I213c9d614b38fecdc673be5058d5f6f2bc579ca6
Reviewed-on: https://swiftshader-review.googlesource.com/19968
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix leaking uniforms.
Nicolas Capens [Mon, 16 Jul 2018 15:13:49 +0000 (11:13 -0400)]
Fix leaking uniforms.

We were leaking memory for uniforms that were previously defined but
don't have a location, e.g. structures.

This change also verifies that such uniforms have the same type in both
shaders. Also, simplify uniform lookup.

Bug chromium:863682

Change-Id: I468aace4df6f5329dc7bb9f33bf9bf533a743ae1
Reviewed-on: https://swiftshader-review.googlesource.com/19928
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>