OSDN Git Service

android-x86/external-swiftshader.git
6 years agoBuild before debugging with Visual Studio Code.
Nicolas Capens [Wed, 27 Sep 2017 14:44:13 +0000 (10:44 -0400)]
Build before debugging with Visual Studio Code.

Call make before launching a debug session. Also move from the 'build'
subdirectory to the 'debug' subdirectory to allow for a separate
release build or other configuration.

Change-Id: I6db00a5bb0a707ebbf9c160897852526a8bb73e1
Reviewed-on: https://swiftshader-review.googlesource.com/12528
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix initial framerate and show maximum.
Nicolas Capens [Wed, 27 Sep 2017 14:22:08 +0000 (10:22 -0400)]
Fix initial framerate and show maximum.

We don't start timing until after the first frame finished rendering
and is presented, so the frame count has to be 0 at that point.

Change-Id: Ic242bb5625c6c50694e7625008565ee421859624
Reviewed-on: https://swiftshader-review.googlesource.com/12488
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFixed crash in Renderer
Alexis Hetu [Wed, 27 Sep 2017 17:15:59 +0000 (13:15 -0400)]
Fixed crash in Renderer

The problem was at line 827, where "(qHead - qSize) % 32" could give
unexpected results if qSize > gHead (which wasn't a problem with
unsigned values). Also removed other % operations which could have
cause some issues.

Change-Id: Ia443e05ce1add3879720e90f7dbac771e712d2ab
Reviewed-on: https://swiftshader-review.googlesource.com/12568
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoLinux build fix
Alexis Hetu [Wed, 27 Sep 2017 14:31:28 +0000 (10:31 -0400)]
Linux build fix

The copy constructor of std::atomic is not allowed, so initialization
through operator= is not allowed. Explicitly using the AtomicInt
constructor to fix this issue.

Change-Id: If77763e89e0d958d8a4b5a83d5d7bd9e3ba08ff6
Reviewed-on: https://swiftshader-review.googlesource.com/12508
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoProperly initializing image's memory
Alexis Hetu [Mon, 25 Sep 2017 19:56:44 +0000 (15:56 -0400)]
Properly initializing image's memory

MSAN detected uninitialized memory which caused many test failures.
This can be easily fixed by zeroing out the memory before calling
XCreateImage.

Change-Id: I913c818ef38446055af7fd6aa885028e5f3f8bfb
Reviewed-on: https://swiftshader-review.googlesource.com/12388
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoMore data races fixed
Alexis Hetu [Fri, 22 Sep 2017 21:02:24 +0000 (17:02 -0400)]
More data races fixed

A few more variables were causing possible data races,
so they were changed to AtomicInt variables.

Change-Id: Icf233482528e086fc58f6919232ab2e3f0784689
Reviewed-on: https://swiftshader-review.googlesource.com/12368
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUse atomic operations to specify shared memory access order
Alexis Hetu [Wed, 20 Sep 2017 15:24:52 +0000 (11:24 -0400)]
Use atomic operations to specify shared memory access order

TSAN detected many data race errors in the SwiftShader Renderer
class. x86 has a strong memory ordering model which guarantees
that changes are observed in the same order by other threads.
However, C++ does not provide such guarantees unless specified
using atomic operations. In order to fix these, a new AtomicInt
class was added which is a basically a wrapper class for
std::atomic<int> and which only exposes the portion of the API
required by SwiftShader.

Since std::atomic isn't available on older versions of Android,
a fallback class was implemented without using std::atomic, which
is closer to the previous implementation. Both classes appear to
work properly after performing a few dEQP tests. Both also perform
similarly.

A few minor changes were made in order to attempt to reduce the use
of atomic integer operations when possible.

Change-Id: Ife6d3a2b6113346f8f8163b692e79c2a0e03b22f
Reviewed-on: https://swiftshader-review.googlesource.com/12308
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEnable more checks on Chromium trybots
Alexis Hetu [Wed, 20 Sep 2017 19:55:08 +0000 (15:55 -0400)]
Enable more checks on Chromium trybots

In order to catch errors faster, this change enables asserts on
Chromium trybots.

Change-Id: Ifdc4c9e0ec7d54aa7f6f333d992054c4e0062efe
Reviewed-on: https://swiftshader-review.googlesource.com/12328
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoImplement X11 onscreen framerate counter.
Nicolas Capens [Fri, 15 Sep 2017 18:59:38 +0000 (14:59 -0400)]
Implement X11 onscreen framerate counter.

This FPS counter is disabled by default.

Change-Id: Ida04352dece25a212cb678c9ceca4c31d654f373
Reviewed-on: https://swiftshader-review.googlesource.com/12128
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix implementation format for default renderbuffer.
Nicolas Capens [Mon, 18 Sep 2017 15:33:59 +0000 (11:33 -0400)]
Fix implementation format for default renderbuffer.

The spec defines that the initial state for a newly bound renderbuffer
has a format of RGBA4. However, when querying the number of red/green/
blue/alpha/depth/stencil bits, we should report the actual number of
bits allocated (0), and not assert.

Bug chromium:765912
Bug b/25351344

Change-Id: Icc3eb59e76bcbd6f0f2f16a2a75ace706ae17251
Reviewed-on: https://swiftshader-review.googlesource.com/12148
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix polygon offset depth clamp and units resolution.
Nicolas Capens [Fri, 15 Sep 2017 15:49:31 +0000 (11:49 -0400)]
Fix polygon offset depth clamp and units resolution.

OpenGL requires depth values to be clamped to the [0, 1] range. Due to
frustum clipping already limiting the range, this can only happen when
non-zero polygon offset parameters are active.

Also fix the 'minimum resolvable difference' for the 32-bit floating-
point internal depth format that we use.

Bug swiftshader:82

Change-Id: Ic9ebcac182a2bc81ab51d79cfe0bb451d340bd1e
Reviewed-on: https://swiftshader-review.googlesource.com/12108
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix libGL build.
Nicolas Capens [Thu, 14 Sep 2017 15:11:07 +0000 (11:11 -0400)]
Fix libGL build.

This does not fix the OGLSimpleCube sample. See swiftshader:81.

Change-Id: I4bb5755d8b63f234965c3d12f774706968f2d34e
Reviewed-on: https://swiftshader-review.googlesource.com/12088
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFree thread-local storage implicitly on thread termination.
Nicolas Capens [Tue, 12 Sep 2017 20:39:42 +0000 (16:39 -0400)]
Free thread-local storage implicitly on thread termination.

Some applications may not call eglReleaseThread() before terminating a
thread, which can cause a minor memory leak. pthread_key_create()
supports specifying a destructor callback to implicitly free the
thread-local storage on thread termination. On Windows we use the
DLL_THREAD_DETACH signal to free it explicitly. This change also
simplifies TLS management by removing the ability to set a new value.

Bug swiftshader:80

Change-Id: I249ca519c1c9ab722e570516d0931cb17ea081bb
Reviewed-on: https://swiftshader-review.googlesource.com/12068
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix sign-correcting of masked stencil reference.
Nicolas Capens [Mon, 11 Sep 2017 16:19:51 +0000 (12:19 -0400)]
Fix sign-correcting of masked stencil reference.

The stencil test compares the unsigned masked reference value against
the unsigned masked stencil value. But because x86 vector instructions
only support signed comparison, we have to add 0x80 to both sides.
However, this offset was incorrectly added before the masking.

Bug b/64683344

Change-Id: I49748e25d8d99e1c2b3c87d3dbe74a9dba75fb1c
Reviewed-on: https://swiftshader-review.googlesource.com/12028
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix thread-local storage memory leak.
Nicolas Capens [Tue, 5 Sep 2017 18:06:06 +0000 (14:06 -0400)]
Fix thread-local storage memory leak.

eglReleaseThread() was leaking some memory because even though it
deletes the 'current' thread state, it was inadvertently getting
re-allocated when recording the success error state.

Change-Id: I92efb1b34e62a21998b4fc19aaeba6473b06548b
Reviewed-on: https://swiftshader-review.googlesource.com/11968
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix constant vector construction for emulated types.
Nicolas Capens [Fri, 1 Sep 2017 15:08:44 +0000 (11:08 -0400)]
Fix constant vector construction for emulated types.

Emulated vectors have fewer elements than their underlying type, e.g.
v4i16 is stored in the lower half of a v8i16 vector, but for constant
vector construction we need to provide values for all the elements of
the underlying vector.

Bug b/65124545

Change-Id: Iaf942c4d517b1d4d464894ec501f7d339ae86438
Reviewed-on: https://swiftshader-review.googlesource.com/11908
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoClarify new dependencies since project Treble.
Nicolas Capens [Thu, 31 Aug 2017 16:41:40 +0000 (12:41 -0400)]
Clarify new dependencies since project Treble.

Change-Id: Ia4feb6791c6da8dc4beef86aab7eb4fa06af461b
Reviewed-on: https://swiftshader-review.googlesource.com/11869
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoBuild lib*_swiftshader with BOARD_VNDK_VERSION
Jiyong Park [Fri, 18 Aug 2017 10:07:26 +0000 (19:07 +0900)]
Build lib*_swiftshader with BOARD_VNDK_VERSION

When BOARD_VNDK_VERSION is set, a vendor lib cannot link against a
platform lib and is not provided with global include path. So, some
internal libraries such as swiftshader_top_[release|debug] were also
marked as vendor module and dependency to some header libs
(libhardware_headers, libnativebase_headers, etc.) were added
explicitly.

Bug: 64704866
Test: lunch sdk_gphone_x86-user, BOARD_VNDK_VERSION=current m -j
libEGL_swiftshader libGLESv1_CM_swiftshader libGLESv2_swiftshader
successful

Change-Id: I37851c9876f7f7c247bbc5d6e18946cb5bf72fa2
Reviewed-on: https://swiftshader-review.googlesource.com/11868
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAllow Chromium to create an OpenGL ES3 context android-x86-7.1-r1 android-x86-7.1-r2
Alexis Hetu [Wed, 16 Aug 2017 21:15:48 +0000 (17:15 -0400)]
Allow Chromium to create an OpenGL ES3 context

Removing the "STRICT_CONFORMANCE" restriction from Chromium.
This allows OpenGL ES3 context creation when using the flag
"--use-gl=swiftshader", which is the case when running layout
tests.
This does not allow WebGL 2 content to be used when using the
flag "--disable-gpu". This will require extra validation on the
Chromium side.

Change-Id: Ic4770c1acbc454a954e1ce813ebed9ed3aee5cd2
Reviewed-on: https://swiftshader-review.googlesource.com/11750
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoglGetFragDataLocation implementation
Alexis Hetu [Wed, 16 Aug 2017 20:37:19 +0000 (16:37 -0400)]
glGetFragDataLocation implementation

Implemented glGetFragDataLocation. There's very little coverage for
this function in dEQP, but the one test that uses it passes.

Change-Id: I6cfc93d7eaad54f23c922e45dafee9cba3401c83
Note: Chromium's ES3 path requires this function to be implemented.
Reviewed-on: https://swiftshader-review.googlesource.com/11728
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoImplement GL_MAX_PROGRAM_TEXEL_OFFSET and GL_MAX_TEXTURE_LOD_BIAS
Alexis Hetu [Wed, 16 Aug 2017 17:43:33 +0000 (13:43 -0400)]
Implement GL_MAX_PROGRAM_TEXEL_OFFSET and GL_MAX_TEXTURE_LOD_BIAS

- GL_MAX_PROGRAM_TEXEL_OFFSET and GL_MIN_PROGRAM_TEXEL_OFFSET were
  technically already properly implemented, since the spec mentions
  that the behavior outside of these limits is undefined, and
  SwiftShader has no actual hard limit for these parameters.
- GL_MAX_TEXTURE_LOD_BIAS also has no hard limit in SwiftShader,
  other than the limit imposed on LOD itself, so that limit was
  used for GL_MAX_TEXTURE_LOD_BIAS.

Change-Id: I60b15b7f7a0febbc3e6582caff6c6a414a5d4964
Reviewed-on: https://swiftshader-review.googlesource.com/11709
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoRemove /RTC1 for Windows Debug Builds
Robert Liao [Mon, 14 Aug 2017 17:51:58 +0000 (10:51 -0700)]
Remove /RTC1 for Windows Debug Builds

SwiftShader requests the optimized flags for debug buidls for
performance. This leads to an incompatible use of /O1 and /RTC1.

BUG=chromium:755195

Change-Id: I53b6f99a67d0b8d5fc5932b677ee278aca300702
Reviewed-on: https://swiftshader-review.googlesource.com/11594
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Robert Liao <robliao@chromium.org>
6 years agoBuild with a newer version of XCode.
Nicolas Capens [Sat, 12 Aug 2017 12:49:04 +0000 (08:49 -0400)]
Build with a newer version of XCode.

Travis CI by default uses XCode 7.3 on Mac OS X, which does not support
the C++11 thread_local keyword expected by Subzero. Request XCode 8 GM
instead.

Change-Id: I0afa7804997ff5b5a6bbfe7829ba6134fe3d54ca
Reviewed-on: https://swiftshader-review.googlesource.com/11548
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRestrict the Travis CI Linux distro to Trusty.
Nicolas Capens [Sat, 12 Aug 2017 03:21:29 +0000 (23:21 -0400)]
Restrict the Travis CI Linux distro to Trusty.

matrix.include adds to the default builds which use Ubuntu Precise
which doesn't come with C++11 support by default.

Change-Id: I3c009bedc62aefd3363f749bb3cb22e9bc36fb9a
Reviewed-on: https://swiftshader-review.googlesource.com/11528
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEnable Travis CI builds on Mac OS X.
Nicolas Capens [Fri, 11 Aug 2017 21:07:51 +0000 (17:07 -0400)]
Enable Travis CI builds on Mac OS X.

Change-Id: I36a39720b34ccc58276f9943bf6ef289b1af9b1e
Reviewed-on: https://swiftshader-review.googlesource.com/11511
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRestrict building Subzero to Marshmallow and up.
Nicolas Capens [Thu, 10 Aug 2017 20:57:25 +0000 (16:57 -0400)]
Restrict building Subzero to Marshmallow and up.

Subzero requires full C++11 support, which isn't available on Android
versions prior to Marshmallow.

Change-Id: Icf09a51b525a1503f72441c969a9e364306096bd
Reviewed-on: https://swiftshader-review.googlesource.com/11488
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAlways produce an optimized library on Chromium
Alexis Hetu [Thu, 10 Aug 2017 17:52:42 +0000 (13:52 -0400)]
Always produce an optimized library on Chromium

The SwiftShader library, when used to render Layout Tests in Debug,
causes too many timeouts. For that reason, we need the Debug version
of the library have better overall performance. In Debug, the
"default_optimization" defaults to "no_optimization". See:
https://cs.chromium.org/chromium/src/build/config/compiler/BUILD.gn?l=1698
In Release, "default_optimization" defaults to "optimize", so in
order to at least use the same optimization flags in both case, we
replace "default_optimization" by "optimize" in Debug.

The Win 7 (dbg) bot ran successfully with this change (the
telemetry_tests were failing when building the full Release version
of the SwiftShader library with the Debug version of Chromium).

Change-Id: I3529160b539319e26f9898d2588536d378c3ee01
Reviewed-on: https://swiftshader-review.googlesource.com/11469
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoRestrict GLSL globals to be initialized with constant expressions.
Nicolas Capens [Thu, 7 Apr 2016 05:03:14 +0000 (01:03 -0400)]
Restrict GLSL globals to be initialized with constant expressions.

This follows the GLSL ES 1.0 and 3.0 specs more strictly.

Change-Id: I323e90ef0a1588109e2cb7988136a9520e501a6d
Reviewed-on: https://swiftshader-review.googlesource.com/5065
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEliminate unnecessary inverse masks.
Nicolas Capens [Tue, 26 May 2015 06:09:27 +0000 (02:09 -0400)]
Eliminate unnecessary inverse masks.

~mask[i % size] is the same as mask[~i % size] because it's just an
expansion of i, so there's no need for invMask[] to store the former.

Change-Id: I754732a2c4978281d35037941ecb74448ab78a8e
Reviewed-on: https://swiftshader-review.googlesource.com/3258
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFixed D3DQUERYTYPE_TIMESTAMP behaviour.
Branimir Karadžić [Fri, 1 Jul 2016 16:34:28 +0000 (09:34 -0700)]
Fixed D3DQUERYTYPE_TIMESTAMP behaviour.

A timestamp query records the current time when it's issued, not when
the data is being retrieved.

Change-Id: Idb6e7fe6736a5b54bd23ef1613eaf953da86aa08
Reviewed-on: https://swiftshader-review.googlesource.com/5771
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSkeleton for Ozone FrameBuffer implementation
Alexis Hetu [Tue, 8 Aug 2017 15:31:11 +0000 (11:31 -0400)]
Skeleton for Ozone FrameBuffer implementation

This cl simply makes the code compile on Ozone. It does not implement
the FrameBufferOzone class, but provides a skeleton for it, which can
be implemented by people on the ChromeOS team.

Change-Id: Ib77e20b00e8208d992c80f47b5ba55e00254c812
Reviewed-on: https://swiftshader-review.googlesource.com/11348
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRollback debug specific changes to build files
Alexis Hetu [Tue, 8 Aug 2017 12:31:13 +0000 (08:31 -0400)]
Rollback debug specific changes to build files

There's an issue with the new debug specific path in the build files.
Rolling back these changes in order to do the DEPS roll while the
investigation on this issue continues.

Change-Id: I9c2174d3ec2ab4e8f817c7cae32f69af1728c6c2
Reviewed-on: https://swiftshader-review.googlesource.com/11328
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoGeneralize 4x32-bit vector swizzling.
Nicolas Capens [Fri, 20 Jan 2017 16:34:37 +0000 (11:34 -0500)]
Generalize 4x32-bit vector swizzling.

This enables swizzling of Int4 and UInt4 types using swizzle operators.

Change-Id: I83fe5b472433d84a7b092e18eb78a919fb39b03b
Reviewed-on: https://swiftshader-review.googlesource.com/8530
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoLog an error when unsupported Android pixel formats are used.
Nicolas Capens [Fri, 4 Aug 2017 21:19:08 +0000 (17:19 -0400)]
Log an error when unsupported Android pixel formats are used.

Known projects avoid using HAL_PIXEL_FORMAT_RGB_888 because we have no
immediate desire to support it (for performance reasons), but other
users may run into unexpected issues that previously would leave no
trace.

Change-Id: Idc606809117f8e0b200b4b38c58ba24696e7193c
Reviewed-on: https://swiftshader-review.googlesource.com/11311
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoCheck against sRGB formats for eglBindTexImage().
Nicolas Capens [Fri, 4 Aug 2017 13:13:37 +0000 (09:13 -0400)]
Check against sRGB formats for eglBindTexImage().

We currently don't support EGL configs/surfaces with sRGB formats.

Change-Id: Ie23a5121bec784fe807c03feae19442fece3f1d7
Reviewed-on: https://swiftshader-review.googlesource.com/11268
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEGL header fix for OZONE
Alexis Hetu [Fri, 4 Aug 2017 17:26:44 +0000 (13:26 -0400)]
EGL header fix for OZONE

This should allow to compile on the OZONE platform
without hitting the X11 include library problem.

The change is imported from:
https://cs.chromium.org/chromium/src/third_party/khronos/EGL/eglplatform.h

Change-Id: I3b3acc139865797ce6c4173991f15840e91f5935
Reviewed-on: https://swiftshader-review.googlesource.com/11308
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoUpdate EGL and KHR headers to Khronos's current version
Alexis Hetu [Fri, 4 Aug 2017 18:13:01 +0000 (14:13 -0400)]
Update EGL and KHR headers to Khronos's current version

Updated EGL and KHR headers as is, with one minor patch
applied in the ANDROID section of the eglplatform.h files.
Other files are unmodified from their Khronos version.

Change-Id: I2147df6bf36c7ec4c5cd6d32f8863b512a356112
Reviewed-on: https://swiftshader-review.googlesource.com/11310
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoEnable Subzero on ChromeOS
Alexis Hetu [Fri, 4 Aug 2017 17:29:28 +0000 (13:29 -0400)]
Enable Subzero on ChromeOS

Switching SwiftShader on ChromeOS from LLVM to Subzero.

Change-Id: Ica9ac278272f99b94d365f03fbd7a4860ad3503d
Reviewed-on: https://swiftshader-review.googlesource.com/11309
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFixed some function signatures
Alexis Hetu [Thu, 2 Jun 2016 15:50:47 +0000 (11:50 -0400)]
Fixed some function signatures

Fixed a few types in function signatures so that base and
derived classes signatures match.

Change-Id: Ide9b9c78ff05be785b512451a36c836f35bd1f3d
Reviewed-on: https://swiftshader-review.googlesource.com/5463
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFixed 'truncation of constant value' warning
Alexis Hetu [Fri, 4 Aug 2017 15:48:17 +0000 (11:48 -0400)]
Fixed 'truncation of constant value' warning

Change-Id: I4e0e956bd34f5ec2a3c38208cb99ac476ec26623
Reviewed-on: https://swiftshader-review.googlesource.com/11290
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd libnativewindow dependency.
Nicolas Capens [Thu, 3 Aug 2017 19:53:25 +0000 (15:53 -0400)]
Add libnativewindow dependency.

The functions relating to ANativeWindow have been split off from
libandroid into libnativewindow as part of project Treble.

Change-Id: I59850e4ba4145e49735698901dc2ba3480c68509
Reviewed-on: https://swiftshader-review.googlesource.com/11229
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSuppress attributes warnings.
Nicolas Capens [Fri, 4 Aug 2017 13:40:46 +0000 (09:40 -0400)]
Suppress attributes warnings.

Older compiler versions warned about unknown attributes with
-Wattributes instead of -Wunknown-attributes. Use both and suppress
warnings about unknown warnings options too.

Change-Id: I22252426e73d4984471b9b8415479bd7b57ba0c5
Reviewed-on: https://swiftshader-review.googlesource.com/11289
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRefactor Android includes.
Nicolas Capens [Fri, 4 Aug 2017 13:36:32 +0000 (09:36 -0400)]
Refactor Android includes.

Forward declare ANativeWindow, and remove <hardware/gralloc.h> where
GrallocAndroid.hpp already includes it.

Change-Id: Idebd4c40280960ff00cd51b6633c1c84a8cf7de2
Reviewed-on: https://swiftshader-review.googlesource.com/11288
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoWork around stlport build bug.
Nicolas Capens [Fri, 4 Aug 2017 13:33:04 +0000 (09:33 -0400)]
Work around stlport build bug.

Older versions of Android using stlport were failing to compile with an
"assert has been defined before inclusion of assert.h header" error.

Change-Id: If8e13eb08c35a34d082d99f8f57188bc55697f59
Reviewed-on: https://swiftshader-review.googlesource.com/11270
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUpdate eglplatform.h to match Android NDK.
Nicolas Capens [Fri, 4 Aug 2017 13:18:52 +0000 (09:18 -0400)]
Update eglplatform.h to match Android NDK.

This change has been part of the Android NDK since API 18, corresponding
with Android 4.3 Jelly Bean MR2.

Change-Id: I6df06f46c286ce89ea56913684e43d558917d1a8
Reviewed-on: https://swiftshader-review.googlesource.com/11269
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoMerge recent changes from LLVM's lib/Support/Atomic.cpp
Nico Weber [Thu, 3 Aug 2017 20:13:45 +0000 (16:13 -0400)]
Merge recent changes from LLVM's lib/Support/Atomic.cpp

In particular, https://reviews.llvm.org/D36281

Bug: chromium:495204
Change-Id: I48afb5b8dd594ce1b43c6ca9fb20638d40119236
Reviewed-on: https://swiftshader-review.googlesource.com/11248
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nico Weber <thakis@google.com>
6 years agoChanged 'optimize_max' for 'optimize' compile option on Chromium
Alexis Hetu [Thu, 3 Aug 2017 19:15:58 +0000 (15:15 -0400)]
Changed 'optimize_max' for 'optimize' compile option on Chromium

The 'optimize_max' option is not meant to be used by default for
Release builds. These use the 'optimize' config. See comment here
for explanation:
https://cs.chromium.org/chromium/src/build/config/compiler/BUILD.gn?l=1572

Change-Id: I7af8e3e4c7e92c60f38841b75998e2b488a5ffde
Reviewed-on: https://swiftshader-review.googlesource.com/11228
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoImplement GL_OES_vertex_half_float.
Nicolas Capens [Thu, 3 Aug 2017 16:53:47 +0000 (12:53 -0400)]
Implement GL_OES_vertex_half_float.

This enables using half-float vertex data for OpenGL ES 2.0.
Note that GL_HALF_FLOAT_OES does not have the same value as
GL_HALF_FLOAT.

Change-Id: I0a7a55b7904fe797cdbb86627c8d0a1cc07d2d0a
Reviewed-on: https://swiftshader-review.googlesource.com/1500
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAttempt to fix the MacOS build
Alexis Hetu [Wed, 2 Aug 2017 21:00:55 +0000 (17:00 -0400)]
Attempt to fix the MacOS build

On the mac_optional_gpu_tests_rel bot, a -Wall flag cancels out the
-Wno-unused-local-typedef warning suppression and causes the build
to fail. Attempting to reorder the configs order to solve the issue.

Change-Id: Ic790f5cb7803be4749616d826e1368ef76e2c889
Reviewed-on: https://swiftshader-review.googlesource.com/11212
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoGL_R11F_G11F_B10F is a color renderable format in OpenGL ES 3.0
Alexis Hetu [Wed, 2 Aug 2017 20:36:30 +0000 (16:36 -0400)]
GL_R11F_G11F_B10F is a color renderable format in OpenGL ES 3.0

GL_R11F_G11F_B10F was missing from a utility function, causing some
dEQP tests to fail. Simply adding it fixes most R11F_G11F_B10F
related tests in:
functional.fbo.*
functional.fragment_out.*
functional.pbo.*

Change-Id: I0d77f1c9c01aff106e266853e81b4cf45f748bc1
Reviewed-on: https://swiftshader-review.googlesource.com/11211
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoExtra warnings suppression for Chromium
Alexis Hetu [Wed, 2 Aug 2017 20:06:29 +0000 (16:06 -0400)]
Extra warnings suppression for Chromium

A few more warnings suppression were missing after the last build
file change. Added them here to hopefully fix build issues.

Change-Id: I80371a3ae59920dccf9c64a36c96d0341e7e39f5
Reviewed-on: https://swiftshader-review.googlesource.com/11210
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRemoved extra '-Wall' flag
Alexis Hetu [Wed, 2 Aug 2017 17:25:10 +0000 (13:25 -0400)]
Removed extra '-Wall' flag

The '-Wall' flag is already specified in Chromium and this '-Wall'
flag invalidates any previous '-Wno-*' flags. Removing it solves
the compilation issue.

Change-Id: Iceefb63ff7e04c55884cf26bbde0d62ffb74b217
Reviewed-on: https://swiftshader-review.googlesource.com/11208
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSwiftShader always builds its release version in Chromium
Alexis Hetu [Wed, 2 Aug 2017 12:40:37 +0000 (08:40 -0400)]
SwiftShader always builds its release version in Chromium

SwiftShader's debug version was too slow for Chromium's debug
trybots. To solve this issue, SwiftShader now always builds
its release version in Chromium.

'git cl format' was ran in Chromium to ensure proper formatting
of the gn files.

Change-Id: I346045b68b566813ab6ab739aaa6eeb243d51853
Reviewed-on: https://swiftshader-review.googlesource.com/11188
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRefactor sampleTexel() to use a return value.
Nicolas Capens [Tue, 1 Aug 2017 21:00:36 +0000 (17:00 -0400)]
Refactor sampleTexel() to use a return value.

We can rely on return value optimization to return Reactor types at the
same cost as passing them by reference.

Change-Id: I9f092bcefd17131a07bef32032c5f2ab98392328
Reviewed-on: https://swiftshader-review.googlesource.com/10569
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFixed loading GL_RGB10_A2UI texture format
Alexis Hetu [Tue, 1 Aug 2017 20:49:17 +0000 (16:49 -0400)]
Fixed loading GL_RGB10_A2UI texture format

The GL_RGB10_A2UI was being unpacked as a double sized version of
GL_UNSIGNED_SHORT_5_5_5_1, which it is not. The channels are not
stored in the same order for these 2 formats.

This fixes all "rgb10_a2ui" related test in:
dEQP-GLES3.functional.texture.format.sized.*
dEQP-GLES3.functional.texture.specification.*

Change-Id: I0d398d0537a440906e9ef3aeb01fe4e782f778b6
Reviewed-on: https://swiftshader-review.googlesource.com/11168
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRemove recursive Chromium DEPS file.
Nicolas Capens [Thu, 4 May 2017 16:09:19 +0000 (12:09 -0400)]
Remove recursive Chromium DEPS file.

Chromium pulled Subzero into third_party/pnacl-subzero using the recursive
DEPS file. We now have the Subzero source code in the SwiftShader repository
using Git subtree.

Bug swiftshader:47

Change-Id: I2c4c5e8c3413ccd187e4da11fbd014fb76ec572f
Reviewed-on: https://swiftshader-review.googlesource.com/9628
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUse unorderer_map<> for def/use information.
Nicolas Capens [Tue, 1 Aug 2017 03:12:19 +0000 (23:12 -0400)]
Use unorderer_map<> for def/use information.

Bug swiftshader:69

Change-Id: Ib4611e2326741688969137f0610980f899b8ee48
Reviewed-on: https://swiftshader-review.googlesource.com/11148
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate 64-bit vectors using 128-bit vectors.
Nicolas Capens [Fri, 28 Jul 2017 21:30:51 +0000 (17:30 -0400)]
Emulate 64-bit vectors using 128-bit vectors.

This effectively eliminates all use of MMX instructions, using SSE ones
instead.

Bug swiftshader:78

Change-Id: I3e519a0c5172688ff711654bf430a9d1dd058d0b
Reviewed-on: https://swiftshader-review.googlesource.com/11049
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAssume SSE2 support is available.
Nicolas Capens [Fri, 28 Jul 2017 21:26:14 +0000 (17:26 -0400)]
Assume SSE2 support is available.

Chrome and many other products require SSE2 support as a minimum. Note
that MMX checks are left in place for now. Dead code paths are removed.

Bug swiftshader:78

Change-Id: Iabd8b1dc2092949d5dba29a78e75d014e808f12c
Reviewed-on: https://swiftshader-review.googlesource.com/11068
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAbstract LLVM types to enable emulation.
Nicolas Capens [Wed, 26 Jul 2017 21:26:17 +0000 (17:26 -0400)]
Abstract LLVM types to enable emulation.

This is just a refactoring, where the 'emulated' types still map to
the same types as before. They are represented using small integer
values reinterpret-casted as sw::Type*, while non-emulated types
correspond directly to llvm::Type pointers.

Bug swiftshader:78

Change-Id: I88c0b932a45119ce500821068d8fb5faa2ccbb92
Reviewed-on: https://swiftshader-review.googlesource.com/11048
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAssume local variables are naturally aligned.
Nicolas Capens [Wed, 26 Jul 2017 17:34:36 +0000 (13:34 -0400)]
Assume local variables are naturally aligned.

Using alignment = 0 to signify natural alignment will allow to discern
between loads/stores for stack variables, and dereferencing generic
pointers.

Bug swiftshader:78

Change-Id: I6d9c1728fb9858ca57380bc6bfafc7fb2fa5feae
Reviewed-on: https://swiftshader-review.googlesource.com/10968
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRemove sub-vector load/store address hack.
Nicolas Capens [Thu, 27 Jul 2017 18:21:46 +0000 (14:21 -0400)]
Remove sub-vector load/store address hack.

The Optimizer used to assume that loads and stores using the same
address are of the same tpe. This is false for emulated sub-vector
load/store, and thus we tricked it into thinking the addresses are
different by performing some redundant arithmetic. This is no longer
necessary now that the Optimizer checks the types being loaded/stored.

Bug swiftshader:48

Change-Id: Ic212d67fefd9e8dd902ff576b69458208c3c379d
Reviewed-on: https://swiftshader-review.googlesource.com/11088
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoGLSL bitwise NOT implementation
Alexis Hetu [Fri, 28 Jul 2017 17:43:25 +0000 (13:43 -0400)]
GLSL bitwise NOT implementation

The bitwise NOT operation is supported for integer types in GLSL.
All the plumbing was already there, only the actual call was missing.

In dEQP, all shaders.operator.unary_operator.bitwise_not tests pass.

Change-Id: I938104b860441f6b2df6c807d578f651e5cd2516
Reviewed-on: https://swiftshader-review.googlesource.com/11108
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agogl_VertexID implementation
Alexis Hetu [Tue, 25 Jul 2017 21:48:00 +0000 (17:48 -0400)]
gl_VertexID implementation

This cl implements support for gl_VertexID.

Passes the functional.shaders.builtin_variable.vertex_id test.

Change-Id: I5550e3ecba30e29f1e38ace608d730833a1e9598
Reviewed-on: https://swiftshader-review.googlesource.com/10958
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix sign masks of narrow vectors.
Nicolas Capens [Wed, 26 Jul 2017 17:50:04 +0000 (13:50 -0400)]
Fix sign masks of narrow vectors.

The SignMask intrinsic returns the most significant bit of each byte in
a 128-bit vector. For 'emulated' 8-byte vectors we expect the upper
half to be ignored.

Change-Id: I994e35fb9c21710c35a89add42297c3c9bad07a4
Reviewed-on: https://swiftshader-review.googlesource.com/10988
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate vector square root intrinsic.
Nicolas Capens [Tue, 25 Jul 2017 21:26:14 +0000 (17:26 -0400)]
Emulate vector square root intrinsic.

Bug b/64034197

Change-Id: I2d77dcb2f93b21abeb0eac1dcb8ca02ef6e5796b
Reviewed-on: https://swiftshader-review.googlesource.com/10957
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate MultiplyAddPairs intrinsic.
Nicolas Capens [Tue, 25 Jul 2017 19:32:12 +0000 (15:32 -0400)]
Emulate MultiplyAddPairs intrinsic.

Bug b/37496078

Change-Id: I2940cee7a7b174c98f28282831c414c1f524702d
Reviewed-on: https://swiftshader-review.googlesource.com/10933
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate MultiplyHigh intrinsics.
Nicolas Capens [Tue, 25 Jul 2017 19:32:12 +0000 (15:32 -0400)]
Emulate MultiplyHigh intrinsics.

Bug b/37496856

Change-Id: Ifea992edcb97d178e079a39d2a1b6b604cfa657e
Reviewed-on: https://swiftshader-review.googlesource.com/10956
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate vector packing intrinsics.
Nicolas Capens [Tue, 25 Jul 2017 19:32:12 +0000 (15:32 -0400)]
Emulate vector packing intrinsics.

Bug b/37496082

Change-Id: I993f34baf6169b0bc3c37742f6238dba38a67d0a
Reviewed-on: https://swiftshader-review.googlesource.com/10955
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate saturated vector add/subtract.
Nicolas Capens [Tue, 25 Jul 2017 19:32:12 +0000 (15:32 -0400)]
Emulate saturated vector add/subtract.

Bug b/37495545

Change-Id: I767f7b5555706cd42b80863fe1ae04b36f4f1189
Reviewed-on: https://swiftshader-review.googlesource.com/10932
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate SignMask intrinsics.
Nicolas Capens [Tue, 25 Jul 2017 19:32:12 +0000 (15:32 -0400)]
Emulate SignMask intrinsics.

Bug b/37496809

Change-Id: I34d0d511bd50890c36d292ab431115f5d2e65a58
Reviewed-on: https://swiftshader-review.googlesource.com/9492
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate vector shift by immediate intrinsics.
Nicolas Capens [Tue, 25 Jul 2017 19:32:12 +0000 (15:32 -0400)]
Emulate vector shift by immediate intrinsics.

Bug b/37496338

Change-Id: I01e4aaf49e86d9c2f11647a0e84bf1ee388a90cf
Reviewed-on: https://swiftshader-review.googlesource.com/10931
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEmulate sub-vector load/store intrinsics.
Nicolas Capens [Wed, 26 Apr 2017 17:36:33 +0000 (13:36 -0400)]
Emulate sub-vector load/store intrinsics.

Bug b/37496321

Change-Id: I173b458a0d1d477ad75deaa33508ae1766c182c0
Reviewed-on: https://swiftshader-review.googlesource.com/9491
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoDefault to Subzero for ARM CMake build.
Nicolas Capens [Tue, 25 Jul 2017 19:31:45 +0000 (15:31 -0400)]
Default to Subzero for ARM CMake build.

Change-Id: I4eaee73caca1e2552cd63901a6c9107efbeaa2f8
Reviewed-on: https://swiftshader-review.googlesource.com/10930
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSupport bitcasts between scalars and short vectors.
Nicolas Capens [Tue, 25 Jul 2017 17:56:46 +0000 (13:56 -0400)]
Support bitcasts between scalars and short vectors.

Subzero only supports 128-bit vectors currently, but we need to support
bitcasting between scalars and (emulated) short vectors of the same
size. Subzero implicitly supports it on x86 by using movd instructions,
but on ARM we have to emulate it in Reactor until support for it is
added in Subzero.

Bug swiftshader:48

Change-Id: I95accbc3665815a46dac8e52ce30939ac64aaf44
Reviewed-on: https://swiftshader-review.googlesource.com/10929
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoReplace only loads matching the store type.
Nicolas Capens [Tue, 25 Jul 2017 17:24:40 +0000 (13:24 -0400)]
Replace only loads matching the store type.

If a load uses the same address as a previous store, we can only
replace it with the store's data when their types match. Also,
stores can only be eliminated when all the loads following them have
been replaced.

Bug swiftshader:48

Change-Id: I5968b256cb295243c30df3598e49015bccb5bff1
Reviewed-on: https://swiftshader-review.googlesource.com/10950
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoDon't eliminate wide store followed by a narrow one.
Nicolas Capens [Tue, 25 Jul 2017 16:57:12 +0000 (12:57 -0400)]
Don't eliminate wide store followed by a narrow one.

If the previous store operation is wider than the next one, we can't
eliminate it because there could be a subsequent wide load reading its
non-overwritten data.

Bug swiftshader:48

Change-Id: Iccb9cabad8ab8503140061ec4ce711a2959de33d
Reviewed-on: https://swiftshader-review.googlesource.com/10948
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRefactor checking for sub-vector intrinsics.
Nicolas Capens [Wed, 26 Jul 2017 15:30:33 +0000 (11:30 -0400)]
Refactor checking for sub-vector intrinsics.

Bug swiftshader:48

Change-Id: I05352fd64cb2e5a929295ff6a8f6196da7fdbb4b
Reviewed-on: https://swiftshader-review.googlesource.com/10949
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix RValue<T> construction from incorrect types.
Nicolas Capens [Mon, 24 Jul 2017 20:54:44 +0000 (16:54 -0400)]
Fix RValue<T> construction from incorrect types.

When constructing an RValue<T> from a Value, the types should match.
Else a bitcast is required.

Bug swiftshader:48

Change-Id: I5073091524d2f56681dab052c9f84a06b3be7b4f
Reviewed-on: https://swiftshader-review.googlesource.com/10908
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd license badge.
Nicolas Capens [Wed, 26 Jul 2017 17:55:52 +0000 (13:55 -0400)]
Add license badge.

Change-Id: I0d25174bc92b6228f433f5d6840d3d94223c683e
Reviewed-on: https://swiftshader-review.googlesource.com/11008
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoglGetString fix
Alexis Hetu [Tue, 25 Jul 2017 20:04:45 +0000 (16:04 -0400)]
glGetString fix

glGetString wasn't returning es3 specific extensions.

Change-Id: Ief89eb448b3e821bfb7919ece97c03976569060c
Reviewed-on: https://swiftshader-review.googlesource.com/10954
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSuppress UBSan false positives.
Nicolas Capens [Mon, 24 Jul 2017 15:30:55 +0000 (11:30 -0400)]
Suppress UBSan false positives.

Function pointers from exported functions are wrongly flagged as being
of incorrect type. This happens both on libEGL and libGLESv2 entry
functions, as well as functions called between them.

Bug chromium:746914

Change-Id: I2bf5a8f06546c233ede7a4820c0cda3e997f096e
Reviewed-on: https://swiftshader-review.googlesource.com/10868
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdded UInt to FP cast
Alexis Hetu [Mon, 24 Jul 2017 18:44:33 +0000 (14:44 -0400)]
Added UInt to FP cast

UInt4 -> Float4 already existed, but not UInt -> Float.

Added the scalar conversion code and used it in the
Blitter where appropriate.

Change-Id: I9ebf63fdf8b139b960237b269f2da088f6ecac86
Reviewed-on: https://swiftshader-review.googlesource.com/10888
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix clearing all samples of multisample render targets.
Nicolas Capens [Thu, 20 Jul 2017 18:14:09 +0000 (14:14 -0400)]
Fix clearing all samples of multisample render targets.

Only libGLESv2 was clearing all the samples of a multisample buffer.
Since all known APIs always clear all the samples, this could be
handled in the Renderer.

Bug swiftshader:77

Change-Id: Ib9adc3c61d263420ed0a0ae4828a693bd360b076
Reviewed-on: https://swiftshader-review.googlesource.com/10788
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFixed default color values for R and RG types
Alexis Hetu [Fri, 21 Jul 2017 15:41:13 +0000 (11:41 -0400)]
Fixed default color values for R and RG types

By default, in D3D, R, G or B channels default to 1 when no
value is assigned to them. In OpenGL, these channels default
to 0. Added an entry to Conventions to fix this issue.

In dEQP, this fixes all R and RG types tests from:
functional.texture.format.*

Change-Id: Ib5552aa36eaf4e3e1132f016f002250b40436227
Reviewed-on: https://swiftshader-review.googlesource.com/10828
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFP32 linear filtering computation now available to most formats
Alexis Hetu [Thu, 20 Jul 2017 20:56:30 +0000 (16:56 -0400)]
FP32 linear filtering computation now available to most formats

All texture formats, except YUV or sRGB formats, now have access
to the floating point path for texture filtering. High precision
filtering can be enabled using:
glHint(GL_TEXTURE_FILTERING_HINT_CHROMIUM, GL_NICEST)

Bug swiftshader:76

Change-Id: Iabbe86d1bbf43070bfc5f61254c101a75c744401
Reviewed-on: https://swiftshader-review.googlesource.com/10808
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUnnormalized integer formats now all use the same path
Alexis Hetu [Tue, 18 Jul 2017 17:03:42 +0000 (13:03 -0400)]
Unnormalized integer formats now all use the same path

Integer formats are: UInt32/Int32/UInt16/Int16/UInt8/Int8
The 32 bit formats required using the floating point path for precision,
while the 16 bit and 8 bit formats were going through the short integer
path. Since all formats need to be treated as Int within a 32 bit Float
in the end, this cl unifies all integer formats under the same path.

Related dEQP tests are: functional.texture.format.sized.2d.*

Bug swiftshader:76

Change-Id: Ia2e0972243290e8b1139081222a3f19ab9e65c9f
Reviewed-on: https://swiftshader-review.googlesource.com/10748
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix file descriptor leak.
Nicolas Capens [Thu, 20 Jul 2017 13:53:31 +0000 (09:53 -0400)]
Fix file descriptor leak.

Change-Id: Ie02591ba84ba8a4b204a2cb05179718e397e5c21
Reviewed-on: https://swiftshader-review.googlesource.com/10768
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoCompute texture coordinates using floating point operations
Alexis Hetu [Fri, 14 Jul 2017 18:17:14 +0000 (14:17 -0400)]
Compute texture coordinates using floating point operations

Modified the texture coordinate computation to use floating
point operations when sampling floating point textures to
increase accuracy and remove useless type conversions.

Bug swiftshader:76

Change-Id: I76e5fd9a68aa6ba5eb21524edb8c6c6183e5430e
Reviewed-on: https://swiftshader-review.googlesource.com/10628
Tested-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoImprove mipmap LOD calculation precision.
Nicolas Capens [Fri, 7 Jul 2017 16:46:21 +0000 (12:46 -0400)]
Improve mipmap LOD calculation precision.

Our approximation for log2() linearly interpolates between powers of
two. This is not accurate enough for some use cases. Squaring the input
effectively doubles the number of piecewise linear segments.

Bug swiftshader:71

Change-Id: Ie7a1da6b93cb5fbed018b61cf8510393964b5aa4
Reviewed-on: https://swiftshader-review.googlesource.com/10450
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd texture filtering precision hint
Alexis Hetu [Tue, 18 Jul 2017 18:33:04 +0000 (14:33 -0400)]
Add texture filtering precision hint

A new extension will be added to SwiftShader in order to allow
Chromium to trigger high precision filtering when necessary.
This extension is documented in:
extensions/CHROMIUM_texture_filtering_hint.txt

Bug swiftshader:76

Change-Id: I7c5b5c5fd01afbd7079e7949ecbd9c18fc539f2b
Reviewed-on: https://swiftshader-review.googlesource.com/10708
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoExport type-info symbols.
Nicolas Capens [Wed, 19 Jul 2017 15:39:28 +0000 (11:39 -0400)]
Export type-info symbols.

Sanitizer tools require type information to catch undefined behavior and
other issues. This wasn't available accross libraries due to the version
script giving them hidden visibility, leading to false positives.

Bug chromium:737384

Change-Id: Iab3e25f4da3672f694e32c1c89278a3fe677d51a
Reviewed-on: https://swiftshader-review.googlesource.com/10728
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdded support for most formats to FP sampleTexel
Alexis Hetu [Mon, 17 Jul 2017 15:19:12 +0000 (11:19 -0400)]
Added support for most formats to FP sampleTexel

This change is effectively noop by itself, but allows the
floating point path to read all texture formats (except YUV).
This is required by the floating point path to be able to
perform higher precision filtering on all formats (except YUV).

Bug swiftshader:76

Change-Id: I5d0d24c00357b4b77cca2ca8a65d082db7635b40
Reviewed-on: https://swiftshader-review.googlesource.com/10668
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUse real snprintf when available.
Nicolas Capens [Mon, 17 Jul 2017 18:34:55 +0000 (14:34 -0400)]
Use real snprintf when available.

Visual C++ 2015 provides an actual snprintf implementation, so we
shouldn't use _snprintf, which does not guarantee null-termination.

Bug swiftshader:75

Change-Id: Ia45e49e77a6076e8f9f12ad74c6ad50dbdbf2dbd
Reviewed-on: https://swiftshader-review.googlesource.com/10688
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix Frac() returning 1.0.
Nicolas Capens [Mon, 17 Jul 2017 14:27:33 +0000 (10:27 -0400)]
Fix Frac() returning 1.0.

Frac() should always produce results in the range [0.0, 1.0), and thus
never produce a 1.0. However, the current implementation uses
x - floor(x) and this returns 1.0 for very small negative values due to
catastrophic cancellation.

Bug swiftshader:74

Change-Id: I942dd7cfb1f7ee3a260070e748704f005eed0b13
Reviewed-on: https://swiftshader-review.googlesource.com/10648
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoRemove redundant R5G6R5 conversions
Alexis Hetu [Fri, 14 Jul 2017 14:44:10 +0000 (10:44 -0400)]
Remove redundant R5G6R5 conversions

The code to compute the final RGB565 conversion is now
generated once instead of being generated 4 times.

Change-Id: Id90ddd28d6ec4fb957d8093e6b9689462751002b
Reviewed-on: https://swiftshader-review.googlesource.com/10609
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoMaking debug object tracking thread safe.
Ben Vanik [Mon, 10 Jul 2017 23:18:41 +0000 (16:18 -0700)]
Making debug object tracking thread safe.
Currently in debug builds swiftshader is not thread safe because of this
tracking code. This change makes it safe to create/delete objects from
multiple threads.

Change-Id: I9c8d3efc370687891b1acc786499bda02c86ad01
Reviewed-on: https://swiftshader-review.googlesource.com/10528
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Vanik <benvanik@google.com>
6 years agoMaking Program use the currently active context device.
Ben Vanik [Mon, 10 Jul 2017 21:08:12 +0000 (14:08 -0700)]
Making Program use the currently active context device.
Fixes bug swiftshader:73.

Change-Id: I6d36348996d22cf507a4badc3af90ce8d654eb71
Reviewed-on: https://swiftshader-review.googlesource.com/10510
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUnbinding uniform buffers on context shutdown.
Ben Vanik [Mon, 10 Jul 2017 21:21:01 +0000 (14:21 -0700)]
Unbinding uniform buffers on context shutdown.
Fixes bug swiftshader:72.

Change-Id: I4fcc6c47ec8561150c88fea200aeb6baf9534c00
Reviewed-on: https://swiftshader-review.googlesource.com/10511
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Ben Vanik <benvanik@google.com>
6 years agoFix signed/unsigned comparison warning.
Nicolas Capens [Tue, 11 Jul 2017 17:49:26 +0000 (13:49 -0400)]
Fix signed/unsigned comparison warning.

Change-Id: Ibec89dd4463274db4ed7381cf20320a0c9f46a57
Reviewed-on: https://swiftshader-review.googlesource.com/10549
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>