OSDN Git Service

android-x86/external-swiftshader.git
7 years agoFixed glGetIntegerv for OpenGL ES 2
Alexis Hetu [Fri, 17 Feb 2017 19:40:50 +0000 (14:40 -0500)]
Fixed glGetIntegerv for OpenGL ES 2

Many new OpenGL ES 3 specific entries in Context::getIntegerv
were not hidden when an OpenGL ES 2 context is created. The
switch statement was separated in 2 statements in order to
fix this.

Change-Id: Ib218b72e854f5857958cfa14ecdfef5ae03ee92b
Reviewed-on: https://swiftshader-review.googlesource.com/8851
Tested-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoUse rep stos x86 assembly for fast clears.
Nicolas Capens [Tue, 14 Feb 2017 22:23:54 +0000 (17:23 -0500)]
Use rep stos x86 assembly for fast clears.

Change-Id: I20b385c316f24b703da1d3071e393b4cde450173
Reviewed-on: https://swiftshader-review.googlesource.com/8811
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix for Subzero compilation on x86
Alexis Hetu [Wed, 15 Feb 2017 16:44:14 +0000 (11:44 -0500)]
Fix for Subzero compilation on x86

Silence a few warnings within the LLVM code used by Subzero
which ended up being treated as errors when compiling
Chromium for x86.

Change-Id: If4d3c13ce0b01185d59a2cd064b2bad537639b94
Reviewed-on: https://swiftshader-review.googlesource.com/8813
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix external surface pitch/slice retrieval.
Nicolas Capens [Wed, 15 Feb 2017 03:42:58 +0000 (22:42 -0500)]
Fix external surface pitch/slice retrieval.

Change-Id: I21ec9c20a594fd322d17f2bcd1c58b298d4c0ce9
Reviewed-on: https://swiftshader-review.googlesource.com/8812
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoEnabling Subzero compilation on Windows
Alexis Hetu [Mon, 13 Feb 2017 19:45:12 +0000 (14:45 -0500)]
Enabling Subzero compilation on Windows

Once Subzero is pulled by Chromium (see
https://codereview.chromium.org/2695813002/),
we'll enable Subzero compilation on Windows.

Change-Id: I3464dbd98224b3ac602aef3c4a27596366d275b3
Reviewed-on: https://swiftshader-review.googlesource.com/8772
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoRemoving a few UNIMPLEMENTED cases
Alexis Hetu [Mon, 13 Feb 2017 21:05:35 +0000 (16:05 -0500)]
Removing a few UNIMPLEMENTED cases

A few remaining cases in Context.cpp are actually
implemented, so we can remove the UNIMPLEMENTED()
calls in these cases: Primitive restart, uniform
blocks, fragment inputs and vertex outputs are all
implemented. Also, the implementation can legally
support 0 program binary formats.

Change-Id: I74b51b511c66170e284ac5d82f573453332872cc
Reviewed-on: https://swiftshader-review.googlesource.com/8788
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoDisable OpenGL ES 3.0 in Chromium builds.
Nicolas Capens [Tue, 14 Feb 2017 15:03:08 +0000 (10:03 -0500)]
Disable OpenGL ES 3.0 in Chromium builds.

Change-Id: I6077e9f439dc20217e9e7fb6c6f98f969e7d0b51
Reviewed-on: https://swiftshader-review.googlesource.com/8790
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix min/max signed zero and NaN handling.
Nicolas Capens [Mon, 13 Feb 2017 17:39:18 +0000 (12:39 -0500)]
Fix min/max signed zero and NaN handling.

Make min(x, y) equal to (x < y ? x : y) and max(x, y) equal to
(x > y ? x : y), including the behavior for signed zeros and NaNs.
This also enables optimizing them into min and max SSE2 instructions
on x86.

Bug swiftshader:19

Change-Id: I047b90e9da9f3c72657ab7c619bc91b92a700a45
Reviewed-on: https://swiftshader-review.googlesource.com/8771
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix for Chromium linux official build
Alexis Hetu [Mon, 13 Feb 2017 16:26:09 +0000 (11:26 -0500)]
Fix for Chromium linux official build

Bug chromium:691427

The official build uses the LLVM gold linker, which seems
to have an issue with some visibility settings. Restoring
these settings for now to solve the issue.

Change-Id: I4f448c38bb7c964b2a53d19e064ecb23c119ab61
Reviewed-on: https://swiftshader-review.googlesource.com/8770
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
7 years agoFixing the Linux build without breaking the Mac build
Alexis Hetu [Fri, 10 Feb 2017 21:08:39 +0000 (16:08 -0500)]
Fixing the Linux build without breaking the Mac build

This change adds 2 platform specific files for Linux, which
are used to define the typeinfo() functions used in some
classes in order to satisfy the ubsan compiler on Linux.
Unfortunately, adding those definitions on all platforms
breaks the build on Mac. Those aren't necessary on Windows,
so the Linux specific files are enough to make the build
work properly on all platforms.

Change-Id: If731ab2e5df47731695412da04f9b2db576ea140
Reviewed-on: https://swiftshader-review.googlesource.com/8768
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFixed Mac build
Alexis Hetu [Thu, 9 Feb 2017 22:14:34 +0000 (17:14 -0500)]
Fixed Mac build

The Linux build fix had broken the Mac build, so the new
"typeinfo" virtual function were moved from the header files
to the source files to fix both builds simultaneously.

Change-Id: I37f5ef4bd5ec4da34a19531dcb85df6a98728aa1
Reviewed-on: https://swiftshader-review.googlesource.com/8748
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoFixing Chromium build all
Alexis Hetu [Thu, 9 Feb 2017 16:23:23 +0000 (11:23 -0500)]
Fixing Chromium build all

To prevent Chromium from building the "swiftshader_subzero"
source set when building all, the source set is now located
within an "if (use_swiftshader_with_subzero)" statement.

Change-Id: I4363487103ec8cd6856b1afb0dd861146a3e56bd
Reviewed-on: https://swiftshader-review.googlesource.com/8728
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix ignored gn local variable
Alexis Hetu [Wed, 8 Feb 2017 20:01:45 +0000 (15:01 -0500)]
Fix ignored gn local variable

The current way "use_subzero" was used seems to fail when
compiling with goma (I don't see why, honestly). Anyway,
most build configuration related booleans are declared in
a declare_args() section, so I moved the setting there,
which will hopefully solve the issue.

Change-Id: I063d9938d04bfdf8140878a740f3710309f8bf1e
Reviewed-on: https://swiftshader-review.googlesource.com/8714
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoPull out SWIFTSHADER_OPTIM
Greg Hartman [Wed, 8 Feb 2017 18:55:05 +0000 (10:55 -0800)]
Pull out SWIFTSHADER_OPTIM

Bug b/34268167
Change-Id: Id2200a9c7d6fea522e3405829447e031e2da15b3
Reviewed-on: https://swiftshader-review.googlesource.com/8711
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
7 years agoFix predicating instructions before return in loops.
Nicolas Capens [Fri, 22 Apr 2016 18:58:52 +0000 (14:58 -0400)]
Fix predicating instructions before return in loops.

Only the instructions following a return statement were being marked as
affected by it so predication would be applied. But in a loop the instructions
above the return statement are also affected by it.

Bug b/25220690

Change-Id: If2490a6e0b4e9cf8b6e28b33cbbbcec8b4ebfdaa
Reviewed-on: https://swiftshader-review.googlesource.com/5183
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoCleaning up BUILD.gn file before Chromium DEPS update
Alexis Hetu [Tue, 7 Feb 2017 20:47:27 +0000 (15:47 -0500)]
Cleaning up BUILD.gn file before Chromium DEPS update

Cleaned up a few things before updating SwiftShader's version
in Chromium's DEPS file:
- Added Windows Subzero fix
- Removed commented out sysroot related lines
- Fixed formatting using git
- Temporarily disabled Subzero compilation for now

Change-Id: Ib6ae75c20869522675d28086ab170f01fd730f93
Reviewed-on: https://swiftshader-review.googlesource.com/8709
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoAdd dummy key methods for UBSan RTTI.
Nicolas Capens [Tue, 7 Feb 2017 18:44:24 +0000 (13:44 -0500)]
Add dummy key methods for UBSan RTTI.

Chromium UBSan builds require RTTI, for which GCC/Clang requires each
class' first non-inline virtual method (the "key method") to have a known
definition so that its address can be used as a unique type identifier:
https://gcc.gnu.org/onlinedocs/gcc/Vague-Linkage.html

libEGL and libGLESv2 each use objects who's full definition only exists
within one or the other. Methods for which the definition is unknown can
still be called if they are virtual, because the compiler/linker only needs
to know the vtable entry offset. But because of the GCC/Clang requirement
of having the first non-inline virtual method be fully defined, we need to
add dummy virtual methods and their definitions.

Bug swiftshader:31

Change-Id: Ib146cac811388086b29dbb099266c43795d6ed31
Reviewed-on: https://swiftshader-review.googlesource.com/8708
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoModified MutexLock to use a pthread mutex on Android.
Jorge E. Moreira [Sat, 3 Dec 2016 01:03:54 +0000 (17:03 -0800)]
Modified MutexLock to use a pthread mutex on Android.

The BackoffLock spins idle for a while when waiting for a locked mutex
before yielding the core, thus wasting many CPU cycles. Modern pthread
implementations have low overhead mutexes which make the thread sleep
if the lock is already held, and efficiently resume them it becomes
available.

Change-Id: I26b64c86db620739671373fd0d82085744d34fa8
Reviewed-on: https://swiftshader-review.googlesource.com/8648
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoOptimize replication.
Nicolas Capens [Fri, 27 Jan 2017 10:55:44 +0000 (02:55 -0800)]
Optimize replication.

Since floating-point scalars are stored in vector registers, Subzero
allows us to just bitcast between them, eliminating a load and insert
before shuffling.

Change-Id: Ibccf242fd4cfc28604f35f420a04fd4ee6eabe52
Reviewed-on: https://swiftshader-review.googlesource.com/8575
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoUse unsigned index array accesses for texture sampling.
Nicolas Capens [Fri, 27 Jan 2017 05:49:04 +0000 (21:49 -0800)]
Use unsigned index array accesses for texture sampling.

Array accesses with unsigned indices can be faster on x86-64 because
we can take advantage of implicit zero-extension of 32-bit integers to
64-bit during pointer arithmetic.

Change-Id: I17d531d9ad05c2d2994f007d5444b2a514a591b8
Reviewed-on: https://swiftshader-review.googlesource.com/8571
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoAdd README files
Greg Hartman [Fri, 19 Aug 2016 22:33:55 +0000 (22:33 +0000)]
Add README files

BUG: 30979264

Change-Id: I315bc6e6b64a012896542667d7db58f3516b29de
Reviewed-on: https://swiftshader-review.googlesource.com/8649
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
7 years agoRemove obsolete vendor rules
Greg Hartman [Fri, 3 Feb 2017 09:11:40 +0000 (01:11 -0800)]
Remove obsolete vendor rules

Test: foo
Change-Id: I27a139266d34d26f5d3468e3993a502f0596ae7d
Reviewed-on: https://swiftshader-review.googlesource.com/8650
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
7 years agoGuard against threads joining twice.
Nicolas Capens [Thu, 2 Feb 2017 18:54:09 +0000 (13:54 -0500)]
Guard against threads joining twice.

After a pthread_join() call the handle becomes invalid or could be
recycled by another thread, leading to undefined behavior when
attempting to join it again. Also, on Windows the handle has to be
closed to free it.

Bug b/34883464

Change-Id: Ib20d0539b6b46e331c6378b3a9f0c2a334d34892
Reviewed-on: https://swiftshader-review.googlesource.com/8612
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoAdding Subzero to Chromium on Windows
Alexis Hetu [Wed, 1 Feb 2017 16:23:30 +0000 (11:23 -0500)]
Adding Subzero to Chromium on Windows

Modified the BUILD.gn files in order to be able to easily switch
between Subzero and LLVM back ends. Note that Subzero
compilation should already work on Linux, as soon as the Wheezy
to Jessie update lands. For now, only Windows will build Subzero.

Also removed linux hack from libEGL build file.

Change-Id: Ic584b604496c4b4f745b05d72a752f056495055b
Reviewed-on: https://swiftshader-review.googlesource.com/8630
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoRemoved extra / from DEPS file
Alexis Hetu [Wed, 1 Feb 2017 16:17:20 +0000 (11:17 -0500)]
Removed extra / from DEPS file

Linux handled the extra / properly, but Windows did not,
so it had to be removed.

Change-Id: Ie42d8777aef83c0024bc9b3e5c631ece7e87e236
Reviewed-on: https://swiftshader-review.googlesource.com/8629
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoSupport TARGET_TRANSLATE_2ND_ARCH case
Victor Khimenko [Fri, 30 Sep 2016 19:31:01 +0000 (21:31 +0200)]
Support TARGET_TRANSLATE_2ND_ARCH case

When second arch is translated we don't have 32-bit platform and
64-bit platform.  Instead we have two 32-bit ones, just one is
translated.

Test: Build system refactoring CL. Existing unit tests still pass.

BUG=31422117
BUG=27526885

Change-Id: Ia5fdd2f485dd5e4e8bc6799f0691cd03c2bff1a0
Reviewed-on: https://swiftshader-review.googlesource.com/8609
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
(cherry picked from commit f24b1b445274b0dbb4ffc860847a26d0b33d3a21)
Reviewed-on: https://swiftshader-review.googlesource.com/8611

7 years agoSupport HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED as RGBX8888
Greg Hartman [Fri, 27 Jan 2017 17:22:31 +0000 (09:22 -0800)]
Support HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED as RGBX8888

The 3.0 camera HAL makes extensive use of
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, which Android defines as the
format that is best for the hardware. The fake camera implementation
decided that that was RGBX8888, so it seem like that is what we should
use.

Test: untested
Change-Id: Ia02ebbefd015f9ca099b4393daf5d464f38fe8fc
Reviewed-on: https://swiftshader-review.googlesource.com/8588
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix using sized internal formats for EGL images.
Nicolas Capens [Mon, 30 Jan 2017 20:45:44 +0000 (15:45 -0500)]
Fix using sized internal formats for EGL images.

Bug b/34799114

Change-Id: Id42d3b784946291d8754774a7916a186a4694ba1
Reviewed-on: https://swiftshader-review.googlesource.com/8591
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoRefactor Byte4 unpacking.
Nicolas Capens [Thu, 26 Jan 2017 23:13:36 +0000 (15:13 -0800)]
Refactor Byte4 unpacking.

Change-Id: I82f8215ce4366e0795ce249b4d8f6c8e391af96c
Reviewed-on: https://swiftshader-review.googlesource.com/8568
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoMacOS build fix
Alexis Hetu [Mon, 30 Jan 2017 18:46:08 +0000 (13:46 -0500)]
MacOS build fix

Fixed MacOS build after the recent Linux fix caused an issue on
MacOS. Removed a few flags and changed visibility to fix it.

Change-Id: Ic9d08d8ec0ccf8a2002f2787c3ec79861bb59139
Reviewed-on: https://swiftshader-review.googlesource.com/8589
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoSupport unsigned array indices.
Nicolas Capens [Fri, 27 Jan 2017 01:44:37 +0000 (17:44 -0800)]
Support unsigned array indices.

Change-Id: I4136781005cbd0551461adecdd94d8e3cc8688d0
Reviewed-on: https://swiftshader-review.googlesource.com/8570
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix array addressing of emulated vector types.
Nicolas Capens [Fri, 27 Jan 2017 00:05:18 +0000 (16:05 -0800)]
Fix array addressing of emulated vector types.

operator[] on a pointer was using the vector register size (16 bytes)
instead of the size of the (emulated) vector type.

Change-Id: Ice8677b41a3af81176fe9495fd02ede9f8b0482f
Reviewed-on: https://swiftshader-review.googlesource.com/8569
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoGeneralize dead stores.
Nicolas Capens [Fri, 27 Jan 2017 10:29:00 +0000 (02:29 -0800)]
Generalize dead stores.

Stores are dead if the address is from an alloca and all uses of the
address are stores, not just when it's a single store.

Change-Id: I5b65a64e21b9e398922e5440c35f0d318c03e911
Reviewed-on: https://swiftshader-review.googlesource.com/8574
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix eliminating stores to pointer arguments.
Nicolas Capens [Fri, 27 Jan 2017 10:26:12 +0000 (02:26 -0800)]
Fix eliminating stores to pointer arguments.

If a store address has no definition, it must be a pointer argument.
Unlike stores to alloca's, these are not dead.

Change-Id: I66e50b14ffea1cfc61fc756b5545ab8ae28b4bf8
Reviewed-on: https://swiftshader-review.googlesource.com/8573
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoAdding Subzero in Chromium
Alexis Hetu [Thu, 19 Jan 2017 15:59:25 +0000 (10:59 -0500)]
Adding Subzero in Chromium

In order to add Subzero as a dependency in Chromium, Chromium's
DEPS file will be modified to use SwiftShader's DEPS file in
order to pull SwiftShader's desired revision of Subzero. This
will ensure that SwiftShader and Subzero are always in sync.

Change-Id: I0b24845c0ddbf974baac4ef6cc3ff6ab397d5f69
Reviewed-on: https://swiftshader-review.googlesource.com/8529
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoUpdate to Linux build files for Chromium
Alexis Hetu [Fri, 27 Jan 2017 16:38:59 +0000 (11:38 -0500)]
Update to Linux build files for Chromium

Although SwiftShader was building properly on the build bots, it
wasn't exporting its symbols properly. I compared the flags used in
the BUILD.gn files and in the CMakeLists.txt file and attempted to
get both build systems to use the same flags and options.

Change-Id: Idc73d4ad5b45311881e88720bf611e25110dcc70
Reviewed-on: https://swiftshader-review.googlesource.com/8576
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoOptimize constant operand order.
Nicolas Capens [Wed, 25 Jan 2017 19:35:00 +0000 (11:35 -0800)]
Optimize constant operand order.

Constant operands of commutative operations preferably go on the right
hand side to avoid requiring an extra register for two operand
instructions. Also, Subzero assumes constants in pointer arithmetic are
on the right hand side to consider optimizing it into an addressing
mode.

Change-Id: Ife5a471903d5f4bef0c19b6c908d75715f06bfec
Reviewed-on: https://swiftshader-review.googlesource.com/8548
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoVectorize R5G6B5 framebuffer present.
Nicolas Capens [Tue, 24 Jan 2017 16:53:47 +0000 (08:53 -0800)]
Vectorize R5G6B5 framebuffer present.

Change-Id: I40922c89056cacd00f9d728dfe1f3f12824c81a1
Reviewed-on: https://swiftshader-review.googlesource.com/3253
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoAdd a mutex around SyncSet operations
Greg Hartman [Fri, 26 Aug 2016 03:18:01 +0000 (20:18 -0700)]
Add a mutex around SyncSet operations

BUG: 31072273
Change-Id: I037505ad3ab1ba80aecab4e24ec8d1932df2dcf7
Reviewed-on: https://swiftshader-review.googlesource.com/7030
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Lingfeng Yang <lfy@google.com>
7 years agoUse MAP_ANON if MAP_ANONYMOUS is not defined.
Nicolas Capens [Fri, 20 Jan 2017 22:11:41 +0000 (17:11 -0500)]
Use MAP_ANON if MAP_ANONYMOUS is not defined.

MAP_ANON has been deprecated in favor of MAP_ANONYMOUS, but Mac OS only
defines MAP_ANON.

Bug chromium:630728

Change-Id: I7345a5f9227acbc0caa29d8103855ab531f16499
Reviewed-on: https://swiftshader-review.googlesource.com/8531
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFixed warnings in Reactor
Alexis Hetu [Thu, 19 Jan 2017 15:49:19 +0000 (10:49 -0500)]
Fixed warnings in Reactor

Fixed:
- type comparison mismatch
- redefined macros
- unused functions
- line endings

Change-Id: I965ca4b887aee968e6cf95feb36c3cbf90b85580
Reviewed-on: https://swiftshader-review.googlesource.com/8528
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoSupport building with Subzero on Mac OS.
Nicolas Capens [Wed, 18 Jan 2017 21:24:09 +0000 (16:24 -0500)]
Support building with Subzero on Mac OS.

Change-Id: I7979eb2557a6103ad10b7be3c274fadf12d27ae7
Reviewed-on: https://swiftshader-review.googlesource.com/8508
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoEmit SSE2 compatible operations if SSE4.1 is not supported.
Nicolas Capens [Sat, 14 Jan 2017 17:52:55 +0000 (12:52 -0500)]
Emit SSE2 compatible operations if SSE4.1 is not supported.

Bug swiftshader:20

Change-Id: I67818bfe10cb29211559fb2ee047f6bec6ce46d4
Reviewed-on: https://swiftshader-review.googlesource.com/8451
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoDetect SSE4.1 support for Subzero.
Nicolas Capens [Sat, 14 Jan 2017 17:52:55 +0000 (12:52 -0500)]
Detect SSE4.1 support for Subzero.

Bug swiftshader:20

Change-Id: I20c2ab7cb4c00c365520ff8b8500f7594127498b
Reviewed-on: https://swiftshader-review.googlesource.com/8468
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix loading uninitialized data in loops.
Nicolas Capens [Wed, 18 Jan 2017 15:18:03 +0000 (10:18 -0500)]
Fix loading uninitialized data in loops.

When we have an uninitialized variable that is declared outside of a
loop and is read and written to inside the loop, we should not eliminate
the load and replace it with an undefined value, because in the next
iteration we want the value from the previous iteration.

Change-Id: Ic996c796307f62fc835079af6c58adf1eb288259
Reviewed-on: https://swiftshader-review.googlesource.com/8488
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix packusdw SSE2 fallback.
Nicolas Capens [Tue, 17 Jan 2017 19:01:33 +0000 (14:01 -0500)]
Fix packusdw SSE2 fallback.

Bug swiftshader:20

Change-Id: I81ad267d450713ffe2a5a84e1d7f7f140b515c85
Reviewed-on: https://swiftshader-review.googlesource.com/8454
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoRefactor Reactor type constructors.
Nicolas Capens [Mon, 16 Jan 2017 22:19:00 +0000 (17:19 -0500)]
Refactor Reactor type constructors.

Provide default constructors for each type, and initialize the swizzle
parent in a less bug prone manner.

Change-Id: Ia7f406a66274c7b1737cbe82db733e2e3ab65175
Reviewed-on: https://swiftshader-review.googlesource.com/8453
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix the vector element extraction type for Short4.
Nicolas Capens [Mon, 16 Jan 2017 21:25:08 +0000 (16:25 -0500)]
Fix the vector element extraction type for Short4.

Change-Id: Ic8785bd56ac7303b0502f0303f9270a6999a1df9
Reviewed-on: https://swiftshader-review.googlesource.com/8452
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoAvoid vector element insert type mismatch.
Nicolas Capens [Fri, 13 Jan 2017 22:37:45 +0000 (17:37 -0500)]
Avoid vector element insert type mismatch.

Subzero silently allows inserting a 32-bit integer into a vector with
16-bit elements. This generates a pinsrd instruction, which requires
SSE4.1, even when specifying to only support SSE2. This change emits
a pinsrw instruction instead, which is SSE2.

Bug swiftshader:20

Change-Id: I37bd0ebb6d9cfdd2cdef4788e89e9672386c685e
Reviewed-on: https://swiftshader-review.googlesource.com/8450
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix Subzero vector comparison.
Nicolas Capens [Fri, 13 Jan 2017 20:09:21 +0000 (15:09 -0500)]
Fix Subzero vector comparison.

Subzero returns vNi1 type results for vector comparisons, which we were
sign-extending to v4i32, even for smaller fields. We don't actually
ever have to sign-extend these results.

Change-Id: Ifdd30edd498d66fc4c557804035794a659eacd87
Reviewed-on: https://swiftshader-review.googlesource.com/8449
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoManually convert unsigned integer to floating-point.
Nicolas Capens [Thu, 15 Dec 2016 19:45:13 +0000 (14:45 -0500)]
Manually convert unsigned integer to floating-point.

Subzero uses a helper function to convert uint to float. It's faster to
just emit a sequence of operations to perform the cast manually.
This implementation converts the lower 31 bits as a signed integer, and
adds 0x80000000 as a floating-point value when the upper bit is set.
This approach does not produce the correct rounding in rare cases, but
should still be adequate. For consistency, we're also using this method
with the LLVM back-end.

Change-Id: Ic5d7b73cd2a9e154056365cdbe9af0962bdbe1cb
Reviewed-on: https://swiftshader-review.googlesource.com/8312
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix resource include file path capitalization.
Nicolas Capens [Fri, 13 Jan 2017 17:34:41 +0000 (12:34 -0500)]
Fix resource include file path capitalization.

Change-Id: I01d1e3a5464ba81440cc144ac50beae2c8b3f3c8
Reviewed-on: https://swiftshader-review.googlesource.com/8448
Reviewed-by: Nico Weber <thakis@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoAdding OWNERS file for Chromium
Alexis Hetu [Thu, 12 Jan 2017 14:41:49 +0000 (09:41 -0500)]
Adding OWNERS file for Chromium

Whenever we land a SwiftShader related change in Chromium,
it will look for owners of SwiftShader to make sure the cl
is properly LGTMed before landing, so the file was added
here.

Also fixed a case typo in an rc file.

Change-Id: I282a39764654a08b06320360dd66a5d877f368d3
Reviewed-on: https://swiftshader-review.googlesource.com/8428
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoFix SubzeroTest compilation.
Nicolas Capens [Tue, 10 Jan 2017 21:41:11 +0000 (16:41 -0500)]
Fix SubzeroTest compilation.

Change-Id: Ie5f7d782764fbc40d4e3ed9cdce0110bbb9da80d
Reviewed-on: https://swiftshader-review.googlesource.com/8408
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoAdding swiftshader unittests to chromium
Alexis Hetu [Tue, 10 Jan 2017 21:58:04 +0000 (16:58 -0500)]
Adding swiftshader unittests to chromium

Chromium does not allow any third_party code to depend on base,
so the main test runner for swiftshader's tests in chromium can't
live inside the swiftshader repo. To solve this:

1) Added a test environment for swiftshader that will be used
for testing in chromium. Currently, it is simply empty.
2) Split unit tests in 2 files, unittests.cpp, which will
contain the tests ran by both chromium and swiftshader and
main.cpp, which will be used as the swiftshader test runner,
but NOT as the chromium test runner (that one will be added
in chromium at the same time I do the swiftshader update).
3) The BUILD.gn file was updated to make the chromium version
of the test depend on base and on the chromium version of the
swiftshader test runner (swiftshader_tests_main.cc, to be added).

Change-Id: I1128bb482565908bc285dcd6818d90d1d881a50e
Reviewed-on: https://swiftshader-review.googlesource.com/8409
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoExplicitly use the Microsoft ABI on Win32 builds.
Nicolas Capens [Mon, 9 Jan 2017 18:35:14 +0000 (13:35 -0500)]
Explicitly use the Microsoft ABI on Win32 builds.

PNaCl does not use the Microsoft x86-64 calling convention on Windows,
so the System V convention is the new default for Subzero. We need to
set a compile definition to explicitly request the use of the
Microsoft convention.

Change-Id: Ic70f5015d4b5753aa08a1247b6ac73eb9a9d278c
Reviewed-on: https://swiftshader-review.googlesource.com/8378
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoTry resolving existing X11 symbols before loading libX11.
Nicolas Capens [Thu, 22 Dec 2016 03:50:26 +0000 (22:50 -0500)]
Try resolving existing X11 symbols before loading libX11.

libX11 may have already been loaded (dynamically or statically) by the
application. Attempting to load it again could result in a different
version being loaded, causing various compatibility issues.

Bug b/32880157

Change-Id: Ica8e6b1c85b82469885a20dcef31e25e6b598132
Reviewed-on: https://swiftshader-review.googlesource.com/8348
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoSet the CMake default build type to Release.
Nicolas Capens [Mon, 9 Jan 2017 16:48:31 +0000 (11:48 -0500)]
Set the CMake default build type to Release.

CMake considers built-in configuration variables to be predefined, thus
setting CMAKE_BUILD_TYPE with a default value doesn't work because it
already exists. The FORCE attribute overrides it, but we have to guard
against overriding user-specified values.

Change-Id: Icf1cad6af15e788c5ae9ac8424f1ef0d29f9a1ff
Reviewed-on: https://swiftshader-review.googlesource.com/8377
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix determining the loop iteration count.
Nicolas Capens [Fri, 6 Jan 2017 22:22:13 +0000 (17:22 -0500)]
Fix determining the loop iteration count.

Bug b/34128224

Change-Id: I4aebcda840baa8ceef2ae99c98a80a83e32b89b3
Reviewed-on: https://swiftshader-review.googlesource.com/8376
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoAdd a CMake option to build with Subzero.
Nicolas Capens [Fri, 6 Jan 2017 17:47:46 +0000 (12:47 -0500)]
Add a CMake option to build with Subzero.

This enables building with either LLVM or Subzero as the Reactor JIT
compiler back-end, on both Linux and Windows.

Change-Id: I4c052d224cd1302b7de412df58b07ee275ba924f
Reviewed-on: https://swiftshader-review.googlesource.com/8375
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoImplement executable memory allocation for Subzero on Unix.
Nicolas Capens [Thu, 5 Jan 2017 21:31:06 +0000 (16:31 -0500)]
Implement executable memory allocation for Subzero on Unix.

Change-Id: I82b6a3f5336ca64dea30a8d9541fcf43c7ead81a
Reviewed-on: https://swiftshader-review.googlesource.com/8373
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoAdd LLVM dependencies for Subzero on Android and Linux.
Nicolas Capens [Mon, 5 Dec 2016 22:30:34 +0000 (17:30 -0500)]
Add LLVM dependencies for Subzero on Android and Linux.

Change-Id: I3ad40f5c0f9faf8aa27356b72b4d98763b9711d7
Reviewed-on: https://swiftshader-review.googlesource.com/8372
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoUpdate Subzero LLVM dependencies to 759dd39154f0bbf1adc87bf613c95f9564f64aa8
Nicolas Capens [Tue, 3 Jan 2017 19:02:05 +0000 (14:02 -0500)]
Update Subzero LLVM dependencies to 759dd39154f0bbf1adc87bf613c95f9564f64aa8

Change-Id: I03c5ebf799af288558d08190058d03f1ac2922b7
Reviewed-on: https://swiftshader-review.googlesource.com/8355
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix CMake sample include directory and libraries.
Nicolas Capens [Wed, 26 Oct 2016 20:57:35 +0000 (16:57 -0400)]
Fix CMake sample include directory and libraries.

Change-Id: Ib1339f5a40523007ca5832ed1bc7b7d096e6c1f2
Reviewed-on: https://swiftshader-review.googlesource.com/8374
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoOnly add non-conformant configs on Android.
Nicolas Capens [Fri, 6 Jan 2017 14:41:21 +0000 (09:41 -0500)]
Only add non-conformant configs on Android.

This silences a benign assert in the config sorting operator which
checks for unique configs. On platforms other than Android, all of the
configs are marked as conformant.

Bug b/34029810

Change-Id: I600d67747ba24f153a0316609e5a783991093ebd
Reviewed-on: https://swiftshader-review.googlesource.com/8388
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoFix clamping viewport dimensions on specification.
Nicolas Capens [Thu, 5 Jan 2017 19:37:22 +0000 (14:37 -0500)]
Fix clamping viewport dimensions on specification.

The spec states that glViewport() silently clamps the viewport
width and height to GL_MAX_VIEWPORT_DIMS[0] and
GL_MAX_VIEWPORT_DIMS[1], respectively.

Bug b/34078120

Change-Id: Ifeec0d6b601ce8a3825796fa551eea1f46150002
Reviewed-on: https://swiftshader-review.googlesource.com/8371
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix integer overflow in rasterization.
Nicolas Capens [Thu, 5 Jan 2017 18:18:39 +0000 (13:18 -0500)]
Fix integer overflow in rasterization.

Rasterization of very large triangles was causing signed 32-bit
integer overflow due to multiplying two unsigned 12.4 fixed-point
coordinates. The equations have been reworked to only require
multiplication of 12.4 by 0.4 fixed-point.

Bug b/34078120

Change-Id: I227b81254559af04baf50fbfec6a7f123bd230e3
Reviewed-on: https://swiftshader-review.googlesource.com/8370
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoOptimize flat triangle edge rasterization.
Nicolas Capens [Thu, 5 Jan 2017 15:11:01 +0000 (10:11 -0500)]
Optimize flat triangle edge rasterization.

Change-Id: Ibfd483ce3cba6ec036327b32cba1460d68f8c9e8
Reviewed-on: https://swiftshader-review.googlesource.com/3542
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoFix the type used for structure field write masks.
Nicolas Capens [Wed, 4 Jan 2017 16:30:45 +0000 (11:30 -0500)]
Fix the type used for structure field write masks.

The index used to index into a structure (a scalar) used to have the
vector size of the resulting type. This changed recently to always be
1, so the field type size needs to be determined from the fields
themselves, which is also the type of the indexing result.

Change-Id: I2dc373d8d31b02c0f69879cb0a3feacd83d6e473
Reviewed-on: https://swiftshader-review.googlesource.com/8368
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years ago[emulator] Delete VAOs starting from highest
Lingfeng Yang [Fri, 23 Dec 2016 02:00:35 +0000 (18:00 -0800)]
[emulator] Delete VAOs starting from highest

If VAOs are deleted starting from 0, then the
following happens when an app's context has
genned two VAO's that are both != 0,
and the first of the two nonzero VAOs
is the current one:

VAO 0
VAO 1 <- current
VAO 2

in context dtor loop over vao map:
delete vao 0 (done)
delete vao 1:
is current, so bind 0:
in bind 0, we create a new map entry since 0 was deleted
next loop iter deletes vao 0 again (done)
*** at this point, vao 0 pointer refers to freed memory ***
next loop iter wants to delete vao 2,
but the current vao is 0 and refers to freed memory.
then, in Context::deleteVertexArray:
if (getCurrentVertexArray()->name...) <- Segmentation fault (core dumped)

This CL deletes VAO 0 last.

Change-Id: Ifa606ad7517cd213f21606577d3bdd8d810b640d
Reviewed-on: https://swiftshader-review.googlesource.com/8350
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Lingfeng Yang <lfy@google.com>
7 years agoEnable OpenGL ES 3.0 context creation from non-conformant configs.
Nicolas Capens [Mon, 2 Jan 2017 21:21:39 +0000 (16:21 -0500)]
Enable OpenGL ES 3.0 context creation from non-conformant configs.

Allow experimental access to OpenGL ES 3.0 for Android, when the
application explicitly sets the EGL_CONFIG_CAVEAT config attribute
to EGL_NON_CONFORMANT_CONFIG or EGL_DONT_CARE.

Bug b/34029810

Change-Id: I942a6d4812d89446f7045f020df974489c4c0ab3
Reviewed-on: https://swiftshader-review.googlesource.com/8352
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFixed attribute location
Alexis Hetu [Fri, 16 Dec 2016 16:42:38 +0000 (11:42 -0500)]
Fixed attribute location

Attribute location wasn't working properly.
This faulty constructor explains why.

Change-Id: I7701ad316df0684ad02ed405bd2905d56a848bd6
Reviewed-on: https://swiftshader-review.googlesource.com/8328
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFixed using GL_SAMPLE_ALPHA_TO_COVERAGE
Alexis Hetu [Tue, 13 Dec 2016 21:48:01 +0000 (16:48 -0500)]
Fixed using GL_SAMPLE_ALPHA_TO_COVERAGE

A few things were failing when trying to use
GL_SAMPLE_ALPHA_TO_COVERAGE:
- The alpha test should not be skipped when
  GL_SAMPLE_ALPHA_TO_COVERAGE is set, otherwise
  no computation is performed.
- The alpha reference value was wrong
  (the alpha-to-coverage ramp is centered around it)

Change-Id: Ib9849868d267ca49fb3f0112192af8f207d34307
Reviewed-on: https://swiftshader-review.googlesource.com/8308
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
7 years agoConsistently treat non-existant components as unsigned.
Nicolas Capens [Wed, 14 Dec 2016 15:32:36 +0000 (10:32 -0500)]
Consistently treat non-existant components as unsigned.

Change-Id: I6554202f899559903062155833d49fe43456149b
Reviewed-on: https://swiftshader-review.googlesource.com/8310
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoEliminate dead code.
Nicolas Capens [Mon, 12 Dec 2016 20:07:39 +0000 (15:07 -0500)]
Eliminate dead code.

Bug swiftshader:23

Change-Id: Ifb2862e8358141f67a7974d3fa0a11e6fe41b904
Reviewed-on: https://swiftshader-review.googlesource.com/8290
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoOptimize stores in a single basic block.
Nicolas Capens [Wed, 30 Nov 2016 21:15:28 +0000 (16:15 -0500)]
Optimize stores in a single basic block.

Bug swiftshader:27

Change-Id: Ia5f7da431902c3e87aab47b1dd388e05ced74cd3
Reviewed-on: https://swiftshader-review.googlesource.com/8274
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoEliminate loads following a single store.
Nicolas Capens [Wed, 30 Nov 2016 20:14:28 +0000 (15:14 -0500)]
Eliminate loads following a single store.

Bug swiftshader:27

Change-Id: I11238decf114381126a7465c462d918a3f16b0d8
Reviewed-on: https://swiftshader-review.googlesource.com/8273
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoEliminate loading of uninitialized variables.
Nicolas Capens [Mon, 12 Dec 2016 18:08:06 +0000 (13:08 -0500)]
Eliminate loading of uninitialized variables.

Bug swiftshader:27

Change-Id: I58259e00204550a397522fc26578c9f4d847f502
Reviewed-on: https://swiftshader-review.googlesource.com/8272
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoEliminate unused allocas.
Nicolas Capens [Thu, 24 Nov 2016 19:43:05 +0000 (14:43 -0500)]
Eliminate unused allocas.

Bug swiftshader:27

Change-Id: If085323dc6cc4325c6ff55c1021e98db94a75302
Reviewed-on: https://swiftshader-review.googlesource.com/8228
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFixed using default attributes
Alexis Hetu [Tue, 13 Dec 2016 16:18:54 +0000 (11:18 -0500)]
Fixed using default attributes

2 issues affected default attributes:
1) The stream type did not match the attributes' internal
   representation
2) The normalized flag was left uninitialized, meaning it was
   using whatever had been set in the previous draw call.

Change-Id: I25b425944e6f59206bf3ef4db35b56d26ef83168
Reviewed-on: https://swiftshader-review.googlesource.com/8292
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix missing switch cases for blitting B32G32R32F.
Nicolas Capens [Tue, 13 Dec 2016 15:19:33 +0000 (10:19 -0500)]
Fix missing switch cases for blitting B32G32R32F.

Change-Id: I09e3615399db4db256d94ba83d44a7b6b17ee2ec
Reviewed-on: https://swiftshader-review.googlesource.com/8291
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoImported a few ES3 fixes from Angle
Alexis Hetu [Fri, 9 Dec 2016 21:01:29 +0000 (16:01 -0500)]
Imported a few ES3 fixes from Angle

Imported some of the more trivial bug fixes:
- Added a few missing interface block cases
- Added checks for varying structs
- Added checks for unsized arrays
- Added first-class array check for pre ES3 compilation
- Added check that ES3 functions do not use builtin names (ES3 only)
- Added more binary operator checks

Change-Id: I3d75453f17e1123478ef7da0998e869970a7fb7d
Reviewed-on: https://swiftshader-review.googlesource.com/8289
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoEliminate assign operations for constants.
Nicolas Capens [Tue, 6 Dec 2016 03:17:19 +0000 (22:17 -0500)]
Eliminate assign operations for constants.

We were using Ice::Variable as the implementation type for Reactor's
abstract Value class only because shuffle operations required them.

Bug swiftshader:24

Change-Id: If87ab5f0b0bca5fbffe2df250ed03b7a1b1490c6
Reviewed-on: https://swiftshader-review.googlesource.com/8258
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix transpose2x4().
Nicolas Capens [Fri, 9 Dec 2016 19:07:50 +0000 (14:07 -0500)]
Fix transpose2x4().

Change-Id: I079991d257be4aa00a0aef938ccf0110cd005bcd
Reviewed-on: https://swiftshader-review.googlesource.com/8288
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoFix rvalue types.
Nicolas Capens [Thu, 8 Dec 2016 19:34:00 +0000 (14:34 -0500)]
Fix rvalue types.

Change-Id: I98853d4858136553be730b07b02db95d1800035c
Reviewed-on: https://swiftshader-review.googlesource.com/8275
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoMatch sub-vector load/store operand order to regular load/store.
Nicolas Capens [Thu, 24 Nov 2016 19:45:06 +0000 (14:45 -0500)]
Match sub-vector load/store operand order to regular load/store.

Bug swiftshader:27

Change-Id: Ic116a804fed80222ad9a41f219c937f28104f225
Reviewed-on: https://swiftshader-review.googlesource.com/8271
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoDeprecate support for constant pointers.
Nicolas Capens [Tue, 6 Dec 2016 02:38:09 +0000 (21:38 -0500)]
Deprecate support for constant pointers.

The use of constant pointers produces code that cannot be relocated.
They also cause issues in Subzero when offsetting them due to not having
constant folding support. We only used them for Direct3D cursor
rendering, which can just pass in the data as an argument instead.

Bug swiftshader:14

Change-Id: Id7f16c3fcaeed3fe64b569af6a49c32f6baec483
Reviewed-on: https://swiftshader-review.googlesource.com/8257
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix doc formatting.
Nicolas Capens [Thu, 8 Dec 2016 15:57:43 +0000 (10:57 -0500)]
Fix doc formatting.

Change-Id: I1387cd9c1666bbb736f75d84679672f1b6964f48
Reviewed-on: https://swiftshader-review.googlesource.com/8270
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFix rounding to nearest integer.
Nicolas Capens [Thu, 8 Dec 2016 13:58:54 +0000 (08:58 -0500)]
Fix rounding to nearest integer.

Change-Id: I2fbd6524f1975f2c76ae0b5e544f323e7c7e4537
Reviewed-on: https://swiftshader-review.googlesource.com/8269
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoBuild fix
Alexis Hetu [Tue, 6 Dec 2016 21:56:04 +0000 (16:56 -0500)]
Build fix

A few things needed to be fixed:
- Removed unused local variables in Sampler.cpp
- Local tests showed that newly added files for ubsan build fix
  broke Mac and Windows builds. Moved files to Linux non debug
  only to fix the issue on all platforms.

Change-Id: I4d6d0d162603fdf36c581e84e177e6d042bf2d6e
Reviewed-on: https://swiftshader-review.googlesource.com/8268
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoRenamed libEGL/Surface.* to libEGL/EGLSurface.*
Alexis Hetu [Mon, 5 Dec 2016 17:43:27 +0000 (12:43 -0500)]
Renamed libEGL/Surface.* to libEGL/EGLSurface.*

In order to build libEGL without explicitly setting a dependency
on the Renderer and Reactor projects, the Renderer's Surface class
must be linked with libEGL. That was causing an issue where the 2
Surface.so objects were colliding on Linux. In order to solve the
issue, libEGL/Surface.* was renamed to libEGL/EGLSurface.*

Change-Id: I2e230dd770be56fd29f7aecd5133183a7d2f20b5
Reviewed-on: https://swiftshader-review.googlesource.com/8254
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoRemoving Code::Blocks build files
Alexis Hetu [Mon, 5 Dec 2016 22:03:53 +0000 (17:03 -0500)]
Removing Code::Blocks build files

We no longer support Code::Blocks, so removing the build files for it.
CMake can be used for Linux builds instead.

Change-Id: I1af29904078270898a3c07915cf32ca4ee4da25a
Reviewed-on: https://swiftshader-review.googlesource.com/8255
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
7 years agoGLSL const arrays are allowed in OpenGL ES 3.0
Alexis Hetu [Thu, 1 Dec 2016 22:02:33 +0000 (17:02 -0500)]
GLSL const arrays are allowed in OpenGL ES 3.0

Change-Id: I54161aaeaa29fe26c246c61f2e27ccda5ef4a5f1
Reviewed-on: https://swiftshader-review.googlesource.com/8234
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoImplement missing vector operations.
Nicolas Capens [Sat, 3 Dec 2016 05:16:14 +0000 (00:16 -0500)]
Implement missing vector operations.

Bug swiftshader:15

Change-Id: I2116fa6ad368c801e921becd89259b02b4ca68ce
Reviewed-on: https://swiftshader-review.googlesource.com/8251
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoDeprecate the Long1 type.
Nicolas Capens [Fri, 2 Dec 2016 20:30:56 +0000 (15:30 -0500)]
Deprecate the Long1 type.

It corresponds to a scalar MMX type, used mainly for vector shifts.
We no longer need these shifts, and they would have been non-trivial
to emulate with SSE2.

Change-Id: I77a94ff5a62e043b991d4d6fa9ddd436d450181d
Reviewed-on: https://swiftshader-review.googlesource.com/8249
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoDeprecate handling power-of-two texture sampling separately.
Nicolas Capens [Fri, 2 Dec 2016 19:22:32 +0000 (14:22 -0500)]
Deprecate handling power-of-two texture sampling separately.

NPOT texture sampling is slightly slower, but with OpenGL we were
already treating every mipmapped texture as NPOT due to requiring
padding at the 1x1 level for renderability. Seamless cube maps are
also NPOT due to the border. Furthermore, the vector shifts by scalar
required for POT texel address calculation would require 128-bit
values when we deprecate MMX.

Change-Id: Ie2e68f632bea7c6f3e599015c14be50392ea7e9a
Reviewed-on: https://swiftshader-review.googlesource.com/8248
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
7 years agoFixed sys/time.h vs time.h issue on Linux
Alexis Hetu [Mon, 5 Dec 2016 16:25:24 +0000 (11:25 -0500)]
Fixed sys/time.h vs time.h issue on Linux

There was a compilation issue on some bots on Linux related to
time functions which was fixable with a simple config setting.

Change-Id: I8bc71f4298d662e48dd12a4c8963ed5ef3211949
Reviewed-on: https://swiftshader-review.googlesource.com/8252
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
7 years agoSupport integer rvalues as return value.
Nicolas Capens [Fri, 18 Nov 2016 19:40:40 +0000 (14:40 -0500)]
Support integer rvalues as return value.

Change-Id: I23e9b8de20dae93e7aa5ea7f5ff90abeba672b2b
Reviewed-on: https://swiftshader-review.googlesource.com/8091
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/8233
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoMake Reactor destination variables non-const.
Nicolas Capens [Fri, 18 Nov 2016 19:22:38 +0000 (14:22 -0500)]
Make Reactor destination variables non-const.

Bug swiftshader:27

Change-Id: I53e2e4858b10d810f649907fda98dc7863752551
Reviewed-on: https://swiftshader-review.googlesource.com/8090
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/8232
Reviewed-by: Alexis Hétu <sugoi@google.com>
7 years agoHold LValue address in a non-template Variable class.
Nicolas Capens [Fri, 18 Nov 2016 17:52:17 +0000 (12:52 -0500)]
Hold LValue address in a non-template Variable class.

Variable<> was redundant after LValue became a template class. We can
recycle it as a container for Values.

Bug swiftshader:27

Change-Id: Ic5ed6f3f7e26579fd38f0e809f8bada1e3639d00
Reviewed-on: https://swiftshader-review.googlesource.com/8071
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/8231
Reviewed-by: Alexis Hétu <sugoi@google.com>