OSDN Git Service

android-x86/external-swiftshader.git
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 years agoRemove @chromium.org accounts from OWNERS.
Nicolas Capens [Tue, 11 Jul 2017 17:19:01 +0000 (13:19 -0400)]
Remove @chromium.org accounts from OWNERS.

Android now also uses OWNERS files for commit approval in Gerrit (see
b/33166666). But they don't recognize the @chromium.org accounts. We
shouldn't need them for Chromium if we just use our @google.com
accounts, so they can be removed. Also use full account names instead
of aliases.

Bug b/63147516

Change-Id: Ic5dfab1aad0025ec20f5a0f79b612c893fece8fc
Reviewed-on: https://swiftshader-review.googlesource.com/10548
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFix retrieving the current Display.
Nicolas Capens [Mon, 10 Jul 2017 18:26:17 +0000 (14:26 -0400)]
Fix retrieving the current Display.

eglGetCurrentDisplay() returned a pointer to the concrete egl::Display
object, instead of the opaque identifier obtained from eglGetDisplay.
This was a regression caused by
https://swiftshader-review.googlesource.com/10188

Bug chromium:738298

Change-Id: Id3a87fc3978f8f4efdc77d6c5eaa85743fa3672c
Reviewed-on: https://swiftshader-review.googlesource.com/10508
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoFix TLS for platforms without library constructors.
Nicolas Capens [Fri, 7 Jul 2017 21:01:16 +0000 (17:01 -0400)]
Fix TLS for platforms without library constructors.

Some platforms don't support constructors that get called when the
shared library gets loaded. This results in the thread-local-storage
key to never be allocated. Instead we can check if it was allocated on
each use. Also prevent creating new 'current' state if it already
exists, and avoid pthreads undefined behavior.

Bug b/25629882

Change-Id: I5e2486f88185150b976d88d0144e4d13a349eb79
Reviewed-on: https://swiftshader-review.googlesource.com/10451
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoMinor fix for log2
Alexis Hetu [Thu, 6 Jul 2017 21:12:47 +0000 (17:12 -0400)]
Minor fix for log2

No behavior is modified in this cl. log2() was calling logarithm2()
with the wrong options, but logarithm2() currently ignores all
options, so this had no consequence. Fixing to prevent future errors.

Change-Id: I6518d9d90fc1f34cadab2de12657064b2510b463
Reviewed-on: https://swiftshader-review.googlesource.com/10429
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoIntialize memory to zero to silence MSan.
Nicolas Capens [Fri, 7 Jul 2017 09:00:00 +0000 (05:00 -0400)]
Intialize memory to zero to silence MSan.

The MemorySanitizer tool can't instrument JIT-compiled code, so it's
unaware that the vertex processing routine writes the clip flags before
they're being read by triangle setup. This false positive can be
silenced by zeroing the memory at allocation. For good measure, zero
out all intermediate buffers.

Bug chromium:737875

Change-Id: Ic37ff5c64cb63bbddb151744af1d7dff0a254c2d
Reviewed-on: https://swiftshader-review.googlesource.com/10431
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoFix checking dimensions of surfaces.
Nicolas Capens [Wed, 5 Jul 2017 21:00:23 +0000 (17:00 -0400)]
Fix checking dimensions of surfaces.

We were only checking depth stencil surface height against
OUTLINE_RESOLUTION. Instead both color buffers and depth stencil
buffers should be checked against the GL implementation's limits.

Change-Id: I3784f80df4ea950760db7273185fb9312802bdd3
Reviewed-on: https://swiftshader-review.googlesource.com/10410
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFix memory leak of Subzero global inits.
Nicolas Capens [Wed, 5 Jul 2017 19:04:00 +0000 (15:04 -0400)]
Fix memory leak of Subzero global inits.

getGlobalInits() moves ownership of a unique_ptr<>, which we released
to obtain the raw pointer, but we didn't delete it afterwards. This is
fixed by keeping the unique_ptr<> and having it freed at the end of the
scope.

Bug chromium:732739

Change-Id: I4d8c9367f34790944daabc0417af08eb4b4c7c2e
Reviewed-on: https://swiftshader-review.googlesource.com/10409
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoFix memory leak when aborting routine generation.
Nicolas Capens [Wed, 5 Jul 2017 18:10:46 +0000 (14:10 -0400)]
Fix memory leak when aborting routine generation.

The blitter aborts generating a Reactor routine when a less common
format is being used (causing fallback to statically compiled code). But
the intermediate Reactor and Subzero structures were not being freed. It
is fixed by deleting the global routine when the Function<> goes out of
scope and it hasn't been acquired yet.

Bug chromium:732691

Change-Id: I4904a467454e8e8d2ff0dbf64545823c9fd15802
Reviewed-on: https://swiftshader-review.googlesource.com/10408
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFix allowing to make null EGL surfaces current.
Nicolas Capens [Fri, 30 Jun 2017 21:07:33 +0000 (17:07 -0400)]
Fix allowing to make null EGL surfaces current.

eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, context)
resulted in a null dereference. It should be supported and is a common
idiom for detaching the surfaces from the context before destroying
them.

Bug swiftshader:70

Change-Id: I5b4406c8d594bc5db34c51bd08371ce69bbd471b
Reviewed-on: https://swiftshader-review.googlesource.com/10389
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoPrettify documentation.
Nicolas Capens [Wed, 28 Jun 2017 15:13:55 +0000 (11:13 -0400)]
Prettify documentation.

Change-Id: Ief18bd1e251f84128660fd559d997e0d094c7abf
Reviewed-on: https://swiftshader-review.googlesource.com/10348
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoMake Blitter part of Renderer.
Nicolas Capens [Tue, 27 Jun 2017 21:08:08 +0000 (17:08 -0400)]
Make Blitter part of Renderer.

This fixes two issues. We had a global 'blitter' instance which doesn't
get destroyed until the library us unloaded. This is reported as a
memory leak (albeit benign). Potentially worse is that the singleton was
shared between all threads, and the Routine cache isn't thread safe.

Bug chromium:732691

Change-Id: I7b90d7d2bc67b4a9f78cdf4f54a76fa2f798b7cc
Reviewed-on: https://swiftshader-review.googlesource.com/10128
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoRefactor texture method overrides.
Nicolas Capens [Tue, 27 Jun 2017 21:03:24 +0000 (17:03 -0400)]
Refactor texture method overrides.

This also removes binding an EGL surface to a 3D texture image, which
is not supported by the API and which is unreachable.

Change-Id: I4a6cd17d731c28769e976b21ac46fe855d1c7b1c
Reviewed-on: https://swiftshader-review.googlesource.com/8351
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoAdd AppVeyor build status.
Nicolas Capens [Wed, 28 Jun 2017 04:58:48 +0000 (00:58 -0400)]
Add AppVeyor build status.

Change-Id: I97583d5b70bd0f9a2edf2e46943d6db58f326f68
Reviewed-on: https://swiftshader-review.googlesource.com/10328
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoDon't crash when using a buffer with no data.
Nicolas Capens [Tue, 27 Jun 2017 16:57:22 +0000 (12:57 -0400)]
Don't crash when using a buffer with no data.

It's undefined behavior when an application attempts to use a buffer
for which no data has been allocated yet, but this is trivial for us to
check for and produce a non-fatal error.

Bug chromium:736639

Change-Id: I795c22363ada1b5e325d1fb5061a9e7673609879
Reviewed-on: https://swiftshader-review.googlesource.com/10309
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoAdd Subzero documentation.
Nicolas Capens [Tue, 27 Jun 2017 14:24:22 +0000 (10:24 -0400)]
Add Subzero documentation.

Change-Id: I47fa608e8923605bd090d6216c9ccf7d5c4051e2
Reviewed-on: https://swiftshader-review.googlesource.com/10308
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFix resetting current display when no current context.
Nicolas Capens [Thu, 15 Jun 2017 21:15:30 +0000 (14:15 -0700)]
Fix resetting current display when no current context.

Bug swiftshader:65

Change-Id: I8454538d144ed37a56b98c46ed1e88ffdced387e
Reviewed-on: https://swiftshader-review.googlesource.com/10188
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoRename libraries on Mac OS to prevent conflicts.
Nicolas Capens [Fri, 23 Jun 2017 19:44:37 +0000 (15:44 -0400)]
Rename libraries on Mac OS to prevent conflicts.

ANGLE and SwiftShader produce libraries with the same name, which causes
conflicts for Chrome on Mac OS when creating unstripped libraries and
dSYM debug information. Renaming them temporarily works around the build
tools issue.

Bug chromium:735920

Change-Id: Icb4f484970ec75b8c5e7e784ce37e05ee4fbc7db
Reviewed-on: https://swiftshader-review.googlesource.com/10288
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoadd support for gralloc1 mapper
Jaesung Chung [Thu, 22 Jun 2017 11:02:09 +0000 (20:02 +0900)]
add support for gralloc1 mapper

Since N MR1, gralloc1 is newly arrived. In order to use gralloc1, the
caller should retrieve its functions via the getFunction method.
GrallocModule now supports for the gralloc0 and gralloc1 mappers both.
Also it makes FrameBufferAndroid to use common GrallocAndroid
implementation.

Bug b/62897956
Test: no errors on locking and unlocking via gralloc1
Change-Id: I1dbb5acd9a36775c642e0282b9b5017ebcec99ec
Reviewed-on: https://swiftshader-review.googlesource.com/10248
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Jaesung Chung <jaesung@google.com>
5 years agoFix non-component unittests on Mac OS.
Nicolas Capens [Thu, 22 Jun 2017 04:31:47 +0000 (00:31 -0400)]
Fix non-component unittests on Mac OS.

Component builds automatically set the rpath to include dependent libraries,
but with a non-component build these are assumed to be linked statically so the
rpath of where to find the libraries to collect install_name info from is
missing. Thus we set the rpath explicitly.

Related articles and documentation:
https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html
http://log.zyxar.com/blog/2012/03/10/install-name-on-os-x
https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath

Bug swiftshader:68

Change-Id: I0cfe0d26fccf80ff7911846ef013d47daaeb09fd
Reviewed-on: https://swiftshader-review.googlesource.com/10228
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoRevert workarounds for ThinLTO linker builds.
Nicolas Capens [Wed, 14 Jun 2017 23:45:12 +0000 (16:45 -0700)]
Revert workarounds for ThinLTO linker builds.

Fixing Issue swiftshader:31 makes the workarounds obsolete and since
they disabled some link-time optimizations they should be reverted.

This reverts commit 628a8496e44ec8a096125cb0cdc3e63bb7dd8380.
This reverts commit 158dcfc13fe3e36217f1bf0d4ccbd8bd80f6d5f1.
This reverts commit ad675fa1d6617ff7fe5965845152ba71f33caf61.

Bug chromium:686980
Bug chromium:735508

Change-Id: I4c4e2466fdfcddd12854b87e5a62d6ec8c823a05
Reviewed-on: https://swiftshader-review.googlesource.com/10168
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFix Mac OS library loading for unittests.
Nicolas Capens [Wed, 21 Jun 2017 17:12:42 +0000 (13:12 -0400)]
Fix Mac OS library loading for unittests.

On Mac OS there is no rpath to set for the executable to locate
libraries. Instead, dylibs themselves have an install_name which is the
path where executables can load them from (added to the executable at
link time).

Bug swiftshader:68

Change-Id: Ia72eba0076ec83fc4492a5c118b4f5420d03a640
Reviewed-on: https://swiftshader-review.googlesource.com/10208
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoTest build with LLVM and Subzero backend.
Nicolas Capens [Wed, 14 Jun 2017 21:03:38 +0000 (14:03 -0700)]
Test build with LLVM and Subzero backend.

Change-Id: Ic8e2360c044aac47447f6a7ae7071d4e3b181678
Reviewed-on: https://swiftshader-review.googlesource.com/10148
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoAdd OpenGL ES 2.0 initialization unit tests.
Nicolas Capens [Tue, 13 Jun 2017 18:37:07 +0000 (14:37 -0400)]
Add OpenGL ES 2.0 initialization unit tests.

Create an OpenGL ES 2.0 context and verify the renderer string. This
ensures the expected libGLESv2 get loaded and initialized correctly.
Also add unittests to the Visual Studio solution.

Change-Id: I848079215434ce1fb9a18564ce47de5b598b21d2
Reviewed-on: https://swiftshader-review.googlesource.com/10108
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoMake the EGL surface class abstract.
Nicolas Capens [Wed, 14 Jun 2017 03:44:13 +0000 (23:44 -0400)]
Make the EGL surface class abstract.

gl::Surface is now the pure abstract interface for egl::Surface, which
can be used by libGLESv2 without requiring typeinfo.

Bug chromium:732667
Bug swiftshader:31

Change-Id: I7d8a5892c5b6186541f84c3cf39e72ac1d6c613d
Reviewed-on: https://swiftshader-review.googlesource.com/10129
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoAdd Travis CI build status.
Nicolas Capens [Tue, 13 Jun 2017 14:10:22 +0000 (10:10 -0400)]
Add Travis CI build status.

Change-Id: Ia0ad3b10fc3e2617945fd0ca763f134ef7276fa4
Reviewed-on: https://swiftshader-review.googlesource.com/10088
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoAdd Travis CI configuration file.
Nicolas Capens [Tue, 13 Jun 2017 04:19:12 +0000 (00:19 -0400)]
Add Travis CI configuration file.

Change-Id: I07d3125d0d3b48f18b5752cdb8bd11869324bff0
Reviewed-on: https://swiftshader-review.googlesource.com/10068
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFix D3D8, D3D9, and GL builds.
Nicolas Capens [Mon, 12 Jun 2017 16:43:48 +0000 (12:43 -0400)]
Fix D3D8, D3D9, and GL builds.

Bug swiftshader:63
Bug swiftshader:31

Change-Id: I59d08cbc8379e2c30984b9ec0ed4d49317633ce8
Reviewed-on: https://swiftshader-review.googlesource.com/10048
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoSynchronize in ~ImageImplementation
Antoine Labour [Sat, 10 Jun 2017 01:14:05 +0000 (18:14 -0700)]
Synchronize in ~ImageImplementation

The egl::Image destructor synchronizes with the threads accessing that image.
However, that is too late because by the time ~Image runs, ImageImplementation
has already been destructed - concurrently with the other threads running, i.e.
data race. In particular, since those threads access virtual member functions on
Image, they may end up calling the base class ones (which are pure) instead of
the derived class ones.

So make sure to synchronize in ~ImageImplementation instead.

Bug: swiftshader:62

Change-Id: I91240d1dbb45dd126c65d86f9aecf77833b4488d
Reviewed-on: https://swiftshader-review.googlesource.com/10029
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFix CMake build for Mac OS X.
Nicolas Capens [Fri, 9 Jun 2017 15:21:48 +0000 (11:21 -0400)]
Fix CMake build for Mac OS X.

Recent versions of CMake omit adding Info.plist to the application
bundle due to an error attempting to parse a symbolic reference as a
CMake one. It is fixed by adding escape characters.
Also set CMAKE_MACOSX_RPATH to silence a warning.

Bug b/62380447

Change-Id: I6464fce7e3d4812d872343806138e44c269dd2da
Reviewed-on: https://swiftshader-review.googlesource.com/10008
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoFix symbol visibility for preemption.
Nicolas Capens [Fri, 9 Jun 2017 21:34:07 +0000 (17:34 -0400)]
Fix symbol visibility for preemption.

Entry functions need to have default visibility instead of protected
visibility to allow symbol preemption during linking (i.e. when not
using dlsym() to explicitly obtain pointers to entry functions). See:
https://bugs.llvm.org//show_bug.cgi?id=30960

Bug swiftshader:64

Change-Id: Ia2d3ae8fb4faec9a75d811c643e3164bfb7d0423
Reviewed-on: https://swiftshader-review.googlesource.com/10028
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoExpose EGL_EXT_platform_base on all platforms.
Nicolas Capens [Mon, 5 Jun 2017 21:43:46 +0000 (17:43 -0400)]
Expose EGL_EXT_platform_base on all platforms.

We're already exporting the entry functions (eglGetPlatformDisplayEXT(), etc.).
Valid platform enums are defined by separate KHR_platform_* extensions.

Bug swiftshader:58

Change-Id: I1eb030f76cd800be9ecb37bad36dd004aceeb1af
Reviewed-on: https://swiftshader-review.googlesource.com/9953
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoAdd Chromium global build dependency.
Nicolas Capens [Wed, 24 May 2017 21:41:30 +0000 (17:41 -0400)]
Add Chromium global build dependency.

All build targets must depend on //build/config:exe_and_shlib_deps.

Bug chromium:723069
Bug swiftshader:54

Change-Id: I7aaecd681ece1ed773239a88a5c4c93a75f7cd1f
Reviewed-on: https://swiftshader-review.googlesource.com/9829
Reviewed-by: Tom Anderson <thomasanderson@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoAvoid dummy key methods by using pure abstract classes.
Nicolas Capens [Tue, 30 May 2017 19:25:50 +0000 (15:25 -0400)]
Avoid dummy key methods by using pure abstract classes.

Sanitizer tools desire having the vtables of any class with non-pure
virtual methods, even when none of them are called in the current
linkage unit. Work around this by making the affected classes pure
abstract and implementing them in a derived class in the respective
library responsible for creating them.

Bug swiftshader:31

Change-Id: I40046f605731eb1cc3825c1ede2d8d9b5826d0f5
Reviewed-on: https://swiftshader-review.googlesource.com/9914
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoMake the FrameBuffer class pure abstract.
Nicolas Capens [Mon, 29 May 2017 21:20:36 +0000 (17:20 -0400)]
Make the FrameBuffer class pure abstract.

Sanitizer tools desire having the vtables of any class with non-pure
virtual methods, even when none of them are called in the current
linkage unit. In the case of sw::FrameBuffer, to work around this we can
make the class pure abstract by making the destructor pure virtual. Note
that the destructor still has a non-empty definition, since all non-
default destructors need a defintion, and it will get called as part of
the destructor chain.

Bug swiftshader:31

Change-Id: I7601b1a725c513ff484cd34a8965636b7f21513c
Reviewed-on: https://swiftshader-review.googlesource.com/9912
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFixed R8 and RG8 frambuffers for GLES2
Alexis Hetu [Wed, 7 Jun 2017 20:50:12 +0000 (16:50 -0400)]
Fixed R8 and RG8 frambuffers for GLES2

These were already available for GLES3 and exposed as texturable
formats for GLES2 when the GL_EXT_texture_rg extension was exposed,
but it should also have enabled these formats as renderable formats.

Bug swiftshader:60

Change-Id: I598d7645b04737dae19dc88b4229fa3d7d231714
Reviewed-on: https://swiftshader-review.googlesource.com/9990
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoIncrease OUTLINE_RESOLUTION to 8192
Alexis Hetu [Wed, 7 Jun 2017 17:47:08 +0000 (13:47 -0400)]
Increase OUTLINE_RESOLUTION to 8192

This is required by chromium tests. There is another cl
(https://swiftshader-review.googlesource.com/9952) which
will change internal uses of OUTLINE_RESOLUTION to adapt
to the rendertarget's height which will reduce the memory
usage increase caused by the current cl.

Change-Id: Iaabbbff07db9c3251ddf49cc534a1a91bab4e5f2
Reviewed-on: https://swiftshader-review.googlesource.com/9988
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoImplement EGL_EXT_client_extensions
Alexis Hetu [Mon, 5 Jun 2017 14:29:14 +0000 (10:29 -0400)]
Implement EGL_EXT_client_extensions

In EGLQueryString, it is now valid to query EGL_EXTENSIONS
with a display set to EGL_NO_DISPLAY, so the function
should proceed without returning an error in these cases.

Change-Id: I76ccd4f98f3d4180268b6b85b5b04a19bea59977
Reviewed-on: https://swiftshader-review.googlesource.com/9948
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoExpose GL_EXT_texture_rg extension
Alexis Hetu [Mon, 5 Jun 2017 14:32:46 +0000 (10:32 -0400)]
Expose GL_EXT_texture_rg extension

The extension was already implemented for GLES3, but simply required
a few cases to be added for support in GLES2.

Note that this extension is required to process filters using masks
with GLES2 in skia.

Change-Id: I196901ca19a4fd40a5a1ebd87040519b0de6eb5f
Reviewed-on: https://swiftshader-review.googlesource.com/9949
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoFix missing include for use_gold.
Nicolas Capens [Mon, 5 Jun 2017 17:59:55 +0000 (13:59 -0400)]
Fix missing include for use_gold.

Change-Id: I60096b0e70049d490ba8bd3c7514f19e8de0017b
Reviewed-on: https://swiftshader-review.googlesource.com/9951
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoWork around gold linker bug for 32-bit code.
Nicolas Capens [Mon, 5 Jun 2017 17:24:09 +0000 (13:24 -0400)]
Work around gold linker bug for 32-bit code.

Bug chromium:729532

Change-Id: Ie10edb39fdc61557f394cddca981f55e89b63cc4
Reviewed-on: https://swiftshader-review.googlesource.com/9950
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoAdded missing integer query
Alexis Hetu [Mon, 29 May 2017 20:46:42 +0000 (16:46 -0400)]
Added missing integer query

Recently, ES3 specific getIntegerv queries were removed from ES2.
Unfortunately, GL_MAX_COLOR_ATTACHMENTS was moved to the ES3
section, but was still supposed to be in the ES2 section,
since the GL_EXT_draw_buffers exposes it.

Change-Id: I2272ccf282558e10ee6cfb1be9d124cc59df14fa
Reviewed-on: https://swiftshader-review.googlesource.com/9911
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoSet permissions after loading image.
Nicolas Capens [Mon, 29 May 2017 14:00:32 +0000 (10:00 -0400)]
Set permissions after loading image.

Bug b/38514001

Change-Id: I6d2d891545840beee54db95a7456b6ede293d0eb
Reviewed-on: https://swiftshader-review.googlesource.com/9908
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoFix Linux build - remove TableGen from CMakeLists.txt
Lingfeng Yang [Thu, 25 May 2017 15:30:59 +0000 (08:30 -0700)]
Fix Linux build - remove TableGen from CMakeLists.txt

TableGen uses exceptions, but is not used.

Change-Id: I3a54c2f72784169804b3305c26f17c63c313931e
Reviewed-on: https://swiftshader-review.googlesource.com/9851
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Lingfeng Yang <lfy@google.com>
5 years agoFix floating-point sampling of YUV formats.
Nicolas Capens [Wed, 24 May 2017 21:39:49 +0000 (17:39 -0400)]
Fix floating-point sampling of YUV formats.

Bug b/38268007

Change-Id: I5a75b7ea475848739ca5f3717e2b42c89088dafb
Reviewed-on: https://swiftshader-review.googlesource.com/9828
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoDon't dynamically recurse when analyzing functions
Lingfeng Yang [Fri, 19 May 2017 21:00:38 +0000 (14:00 -0700)]
Don't dynamically recurse when analyzing functions

bug: 38257724

With this CL, dEQP-GLES3.functional.shaders.functions.invalid no longer results
in a stack overflow and system crash.

The fix is to explicitly loop over switch cases in the function call
depth analysis.

Later on, we probably want to change TIntermSwitch traversal to loop
over all cases of the switch statement as well, but that requires
a lot of changes; all traversers need to be changed to not have to loop over
switch statements themselves, which will break expectations and
perhaps functionality that critically depends on seeing/controlling iteration
over switch statement cases.

Not tested for regressions in dEQP-GLES2.functional.shaders.*

Test: dEQP-GLES3.functional.shaders.functions.invalid.dynamic_switch_recursion_vertex:
system crash, hang, or fail -> Pass

Change-Id: I5d13a5f3296579c8818975e103f5ed6e03a47b68
Reviewed-on: https://swiftshader-review.googlesource.com/9789
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Lingfeng Yang <lfy@google.com>
5 years agoAllow GL_TEXTURE_MAX_ANISOTROPY_EXT from sampler object.
Lingfeng Yang [Sat, 13 May 2017 00:28:04 +0000 (17:28 -0700)]
Allow GL_TEXTURE_MAX_ANISOTROPY_EXT from sampler object.

Bug b/38257724

Change-Id: I4157ef825ed4ed8f805e9dad35b43bb5780877b6
Reviewed-on: https://swiftshader-review.googlesource.com/9788
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Tested-by: Lingfeng Yang <lfy@google.com>
5 years agoRemove unused return value.
Nicolas Capens [Wed, 24 May 2017 19:46:48 +0000 (15:46 -0400)]
Remove unused return value.

Bug b/17893069

Change-Id: I78d582455192456625523d7bf2bdc5d16c88d68e
Reviewed-on: https://swiftshader-review.googlesource.com/9814
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
5 years agoAdded EGL display validity check
Alexis Hetu [Wed, 24 May 2017 18:06:27 +0000 (14:06 -0400)]
Added EGL display validity check

If the EGLDisplay input parameter to eglInitialize isn't
PRIMARY_DISPLAY or HEADLESS_DISPLAY, egl::Display::get()
will return null. Instead of crashing, we should return
an EGL_BAD_DISPLAY error.

Change-Id: Ie1e39f2807db5a38f8d21fd6e22270c02cbeba3a
Reviewed-on: https://swiftshader-review.googlesource.com/9813
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
5 years agoRemoved offending flags for Chromium
Alexis Hetu [Wed, 24 May 2017 15:16:26 +0000 (11:16 -0400)]
Removed offending flags for Chromium

Removed flags and verified Linux build / execution still works properly.

Change-Id: Ibad4ec5d1b89d8e9b826c57bf2d6dbd0d18b7a2e
Reviewed-on: https://swiftshader-review.googlesource.com/9812
Reviewed-by: Nico Weber <thakis@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
5 years agoImplement unrolling of loops using > or >=.
Nicolas Capens [Wed, 24 May 2017 14:45:56 +0000 (10:45 -0400)]
Implement unrolling of loops using > or >=.

Bug swiftshader:53

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