OSDN Git Service

android-x86/external-swiftshader.git
6 years agoPass the sampling lod/bias as a separate parameter.
Nicolas Capens [Tue, 7 Nov 2017 18:07:53 +0000 (13:07 -0500)]
Pass the sampling lod/bias as a separate parameter.

This is necessary for cube or 2D array shadow texture sampling
functions which need the fourth texture coordinate component for
depth comparison while also taking a lod or bias parameter.

Change-Id: I1e1399f134e22cecaff97a224df2c13c57ba3a40
Reviewed-on: https://swiftshader-review.googlesource.com/13551
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRefactor sampling functions to use a return value.
Nicolas Capens [Tue, 7 Nov 2017 18:05:20 +0000 (13:05 -0500)]
Refactor sampling functions to use a return value.

Change-Id: Ib62f310abecbc4cdaf6e9300791600f25af0eaf3
Reviewed-on: https://swiftshader-review.googlesource.com/13550
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoCreate SamplerCore on demand.
Nicolas Capens [Tue, 7 Nov 2017 14:20:53 +0000 (09:20 -0500)]
Create SamplerCore on demand.

Previously we dynamically allocated an array of SamplerCores. This
isn't necessary and we can just create one as a temporary object where
used. This has the added advantage that we could have Reactor variables
as class members and keep them short-lived.

Change-Id: Ifb2e6edbf275aa793bd7880bd35384e16000007d
Reviewed-on: https://swiftshader-review.googlesource.com/13548
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoPass down the texture compare state.
Nicolas Capens [Mon, 6 Nov 2017 20:29:46 +0000 (15:29 -0500)]
Pass down the texture compare state.

Depth format textures can have a comparison operation performed after
their texels have been sampled.

Change-Id: I49f6bb7fab9765265761144ee8b6b62439beb5a3
Reviewed-on: https://swiftshader-review.googlesource.com/5870
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoFixed Vertex Array Objects
Alexis Hetu [Tue, 7 Nov 2017 16:47:53 +0000 (11:47 -0500)]
Fixed Vertex Array Objects

Fixed glBindVertexArray. The early return was wrong,
binding vertex array 0 is perfectly valid.

All related dEQP tests pass.

Change-Id: Idd0ae745dc15877afb7c7323aab8253fb71e9017
Reviewed-on: https://swiftshader-review.googlesource.com/13549
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoStruct varyings implementation
Alexis Hetu [Thu, 2 Nov 2017 20:00:32 +0000 (16:00 -0400)]
Struct varyings implementation

Varying variables can be structure in OpenGL ES3.
This cl adds support for structure varyings.

Change-Id: I4d1d80c6afed0a86a23b0a467d4764a4e08f133d
Reviewed-on: https://swiftshader-review.googlesource.com/13529
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoPrevent initializing outline edges to out of bound values
Alexis Hetu [Thu, 2 Nov 2017 14:59:59 +0000 (10:59 -0400)]
Prevent initializing outline edges to out of bound values

When multisampling is enabled, outline edges were getting
initialized to one of the  primitive's X position. If the
primitive was out of bounds, then the default position was
out of bounds, which led to an initial out of bounds memory
access.

Added a clamp to fix the issue.

Bug chromium:779364

Change-Id: I4661f4229ee28a3032c763ed18dde799d3c3926b
Reviewed-on: https://swiftshader-review.googlesource.com/13528
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agotranslator: Add define to disable pool allocation.
Corentin Wallez [Tue, 31 Oct 2017 22:05:38 +0000 (18:05 -0400)]
translator: Add define to disable pool allocation.

This will help ASan find bugs in the translator when fuzzing, by making
separate allocations instead of using suballocations within the pool.

BUG=swiftshader:86

Change-Id: Ic59f7eef2c7985f7bf545d41be956df478331e2d
Reviewed-on: https://swiftshader-review.googlesource.com/13488
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Corentin Wallez <cwallez@google.com>
6 years agoFix Visual Studio warning treated as error.
Nicolas Capens [Tue, 31 Oct 2017 19:36:55 +0000 (15:36 -0400)]
Fix Visual Studio warning treated as error.

Was an implicit narrowing from size_t (64-bit) to unsigned int (32-bit).

Change-Id: I9726d70370d97da1bae2652bbce9db929179a292
Reviewed-on: https://swiftshader-review.googlesource.com/13469
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoFix pedantic Linux warning treated as error.
Nicolas Capens [Tue, 31 Oct 2017 18:09:52 +0000 (14:09 -0400)]
Fix pedantic Linux warning treated as error.

Unused variable 'entry'.

Change-Id: I115b7d599d871c0f130f72e32618a8ed29776b81
Reviewed-on: https://swiftshader-review.googlesource.com/13468
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoEnable executable code generation and linking.
Nicolas Capens [Tue, 31 Oct 2017 15:22:45 +0000 (11:22 -0400)]
Enable executable code generation and linking.

Bug swiftshader:86

Change-Id: If98cbf93e8b8d41246d9f06503da0752fe968ff8
Reviewed-on: https://swiftshader-review.googlesource.com/13448
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix vertex stream count and normalized data layout.
Nicolas Capens [Mon, 30 Oct 2017 20:13:52 +0000 (16:13 -0400)]
Fix vertex stream count and normalized data layout.

Bug swiftshader:86

Change-Id: Ide76f9e7d8c490e5057959e1a7c28dfc7119151a
Reviewed-on: https://swiftshader-review.googlesource.com/13428
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSupport for gl_MaxDrawBuffers in OpenGL ES 3.0
Alexis Hetu [Mon, 30 Oct 2017 18:21:12 +0000 (14:21 -0400)]
Support for gl_MaxDrawBuffers in OpenGL ES 3.0

gl_MaxDrawBuffers is still available in OpenGL ES 3.0.
It was just a matter of making it part of the common builtins.

Change-Id: Icd3ca9f4f50cba43c345974ef72603800155a573
Reviewed-on: https://swiftshader-review.googlesource.com/13389
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSwitching MacOS to use Subzero
Alexis Hetu [Wed, 2 Aug 2017 21:09:21 +0000 (17:09 -0400)]
Switching MacOS to use Subzero

Currently Windows and Linux already use the Subzero backend, while
MacOS still uses the LLVM backend. This cl switches MacOS to using
the Subzero backend.

Change-Id: Ibc20add93c5f413271832fd1dd7fe7ae00cda9f4
Reviewed-on: https://swiftshader-review.googlesource.com/11213
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agovertex_routine_fuzzer: Get source from `data`
Corentin Wallez [Fri, 27 Oct 2017 21:14:39 +0000 (17:14 -0400)]
vertex_routine_fuzzer: Get source from `data`

BUG=swiftshader:86

Change-Id: Ia57c894170e790cdd1ea2fe3b92bbba7f643ba64
Reviewed-on: https://swiftshader-review.googlesource.com/13368
Tested-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFill vertex routine state for fuzzer.
Nicolas Capens [Fri, 27 Oct 2017 18:36:52 +0000 (14:36 -0400)]
Fill vertex routine state for fuzzer.

Bug swiftshader:86

Change-Id: I8339f3882163daa078ac71034aaf37147e51d725
Reviewed-on: https://swiftshader-review.googlesource.com/13349
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix last stream type enum.
Nicolas Capens [Fri, 27 Oct 2017 18:36:36 +0000 (14:36 -0400)]
Fix last stream type enum.

Change-Id: I119c9bd65624035cbb0afb850b061e140b6a296f
Reviewed-on: https://swiftshader-review.googlesource.com/13348
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoFix MSVC compilation of the VertexRoutineFuzzer
Corentin Wallez [Fri, 27 Oct 2017 17:40:18 +0000 (13:40 -0400)]
Fix MSVC compilation of the VertexRoutineFuzzer

We should really have these suppressions in a shared config over all
swiftshader.

BUG=swiftshader:86

Change-Id: I1b8fa6342090e78e2338a7d748bcb29911f9e393
Reviewed-on: https://swiftshader-review.googlesource.com/13328
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Corentin Wallez <cwallez@google.com>
6 years agoVertexRoutineFuzzer: Add code able to compile a simple shader
Corentin Wallez [Tue, 24 Oct 2017 20:13:44 +0000 (16:13 -0400)]
VertexRoutineFuzzer: Add code able to compile a simple shader

The fuzzer still needs to parse state and source from `data` before it
can actually be useful.

Bug swiftshader:86

Change-Id: Iafcbce4748b83a4fb9f829e3e8a473d161d3a696
Reviewed-on: https://swiftshader-review.googlesource.com/13249
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agolibGLESv2: compile entry points in the shared library.
Corentin Wallez [Thu, 26 Oct 2017 23:27:22 +0000 (19:27 -0400)]
libGLESv2: compile entry points in the shared library.

Without this the GN shared library doesn't export any of the gl
entry-points making it useless.

Bug swiftshader:86

Change-Id: I97f6acf4204d6e908ad12c89c79d40769dc824a4
Reviewed-on: https://swiftshader-review.googlesource.com/13308
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUse more explicit include paths.
Nicolas Capens [Thu, 26 Oct 2017 17:07:10 +0000 (13:07 -0400)]
Use more explicit include paths.

This helps clarify dependencies and simplifies include paths.

Bug swiftshader:86

Change-Id: I564ee420bb9029fa6428e49b63a86d633301bec2
Reviewed-on: https://swiftshader-review.googlesource.com/13288
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoData race fix
Alexis Hetu [Thu, 26 Oct 2017 18:57:17 +0000 (14:57 -0400)]
Data race fix

There's a data race involving threadCount,
so it is now an AtomicInt object.

Also removed unused extern variables.

Bug chromium:778254 chromium:776621

Change-Id: I93174e8f4e5e48f26414ba9c81bb9a2c317dbf73
Reviewed-on: https://swiftshader-review.googlesource.com/13290
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoPrimitive restart implementation
Alexis Hetu [Wed, 25 Oct 2017 21:25:06 +0000 (17:25 -0400)]
Primitive restart implementation

Wrote a new version of primitive restart
entirely handled by the index data manager.

Passes all primitive_restart dEQP tests

Change-Id: I0ce28764a33300a6625f1c369f95d8d178e1e3c0
Reviewed-on: https://swiftshader-review.googlesource.com/10951
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix rendering to single-channel color buffers.
Nicolas Capens [Wed, 25 Oct 2017 21:18:55 +0000 (17:18 -0400)]
Fix rendering to single-channel color buffers.

Render targets with only a red or alpha component were getting swapped
values within pixel quads at the edge of primitives. Also provide
format mappings for GL_EXT_texture_rg.

Change-Id: Ifb395039fb2958400ab36d5d184d7952d60fa9c6
Reviewed-on: https://swiftshader-review.googlesource.com/13268
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd a stub "vertex routine" fuzzer
Corentin Wallez [Tue, 24 Oct 2017 19:17:18 +0000 (15:17 -0400)]
Add a stub "vertex routine" fuzzer

Bug: swiftshader:86

Change-Id: I351e433123abfaf010e3b1641383054e77dc6383
Reviewed-on: https://swiftshader-review.googlesource.com/13228
Tested-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUpdate the Windows Target Platform Version
Alexis Hetu [Thu, 19 Oct 2017 18:53:33 +0000 (14:53 -0400)]
Update the Windows Target Platform Version

Rather than have to download a previous version (10.0.15063.0),
we can update the solution to the current version (10.0.16299.0).
Built solution in 32b/64b release/debug with no failures.

Change-Id: If19d8f6edcce4bcfac21c005f647ab1619837d16
Reviewed-on: https://swiftshader-review.googlesource.com/13208
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoFix Visual Studio 2017 build of Debug D3D8.
Nicolas Capens [Wed, 11 Oct 2017 03:52:17 +0000 (23:52 -0400)]
Fix Visual Studio 2017 build of Debug D3D8.

Visual Studio 2017 doesn't like configuration elements with empty
content. Remove it to use the default value.

Change-Id: Idc4f281aff145c7e9a143c0a5dbdd54eb4658ee9
Reviewed-on: https://swiftshader-review.googlesource.com/13128
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
6 years agoUpgrade SwiftShader solution and projects to Visual Studio 2017.
Nicolas Capens [Wed, 4 Oct 2017 17:39:16 +0000 (13:39 -0400)]
Upgrade SwiftShader solution and projects to Visual Studio 2017.

Chrome now uses Visual Studio 2017 as the default compiler on Windows.
To ensure we maintain compatibility during standalone development, we
should use VS2017 for SwiftShader as well. The 'Community' edition of
Visual Studio 2017 is freely available.

Bug chromium:683729

Change-Id: I3ed1edaeb9fa786b575202ba5b9c86faf1daa3c0
Reviewed-on: https://swiftshader-review.googlesource.com/13048
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoDo not assign a location to uniform block members
Alexis Hetu [Fri, 6 Oct 2017 17:23:49 +0000 (13:23 -0400)]
Do not assign a location to uniform block members

Uniform block members do not get a uniform location, since they
cannot be set (or get) through regular glUniform* functions. These
are instead always set using uniform buffers.

Bug chromium:763675,chromium:763698,chromium:771639

Change-Id: Icf65eba3faab420c63f70af66f828a786e3fc446
Reviewed-on: https://swiftshader-review.googlesource.com/13068
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoRename version scripts to linker scripts.
Nicolas Capens [Fri, 6 Oct 2017 15:24:13 +0000 (11:24 -0400)]
Rename version scripts to linker scripts.

Blaze (Bazel) requires linker dependencies to have a .ld, .lds, or
.ldscript extension. Note that version scripts are just the contents of
the VERSION command in (true) linker scripts. However, the gold linker
used by Android does not support implicit linker scripts (which amend
the default linker script), nor the INSERT command. Therefore these
linker scripts are still actually just version scripts.

https://sourceware.org/binutils/docs/ld/VERSION.html

Bug b/67482470

Change-Id: I3bbe25dab6d916376bdc41bb723279ed2ef62fb0
Reviewed-on: https://swiftshader-review.googlesource.com/13108
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix depth clamping during 'very' early depth test.
Nicolas Capens [Thu, 5 Oct 2017 20:05:47 +0000 (16:05 -0400)]
Fix depth clamping during 'very' early depth test.

We perform depth testing before computing scanline invariants, as an
optimization. But it was not taking into account that the
fixed-function depth value may require clamping due to the depth bias.

Bug swiftshader:82

Change-Id: I6f8953f9d060c73b5fe209b8cbad70e7cb7588b4
Reviewed-on: https://swiftshader-review.googlesource.com/13088
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoIncrease coverage of Swizzle test in Reactor
Casey Dahlin [Tue, 3 Oct 2017 20:23:11 +0000 (13:23 -0700)]
Increase coverage of Swizzle test in Reactor

Test: Improved test passes
Bug: b/67106219
Change-Id: Iab15a2331a91dffaaeb1627a42d0fb88dfa841d0
Reviewed-on: https://swiftshader-review.googlesource.com/13028
Tested-by: Casey Dahlin <sadmac@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix for 3D texture sampling
Alexis Hetu [Tue, 3 Oct 2017 17:56:07 +0000 (13:56 -0400)]
Fix for 3D texture sampling

3D texture sampling did not support width*height > MAX_USHORT(65535).
Changed for 32 bit integer computation for that multiplication to
solve this issue.

Verified with 3D texture related dEQP tests.

Bug b/26105892 chromium:763382

Change-Id: Ifd07278f6263d000620a0b525c07ed4fcbdcf2e7
Reviewed-on: https://swiftshader-review.googlesource.com/12988
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoEnable use of NEON intrinsics on ARM.
Nicolas Capens [Tue, 3 Oct 2017 18:56:49 +0000 (14:56 -0400)]
Enable use of NEON intrinsics on ARM.

Bug b/37496338
Bug b/37495545
Bug b/37496078
Bug b/37496856
Bug b/37496321
Bug b/37496082

Change-Id: I173a296703fcc1f49810742d95ae6abe7c9bcf01
Reviewed-on: https://swiftshader-review.googlesource.com/12868
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSpill whole vector registers to the stack.
Nicolas Capens [Tue, 3 Oct 2017 18:26:07 +0000 (14:26 -0400)]
Spill whole vector registers to the stack.

Subzero assumes that stores and loads to/from stack memory can take an
immediate offset. This isn't true for sub-vector loads and stores. We
can just use regular full vector loads and stores instead.

Bug b/37496321

Change-Id: Iaffd60f8077a4c9d602665421f90a7288ab04050
Reviewed-on: https://swiftshader-review.googlesource.com/13008
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd test for MulAdd in Reactor
Casey Dahlin [Tue, 3 Oct 2017 18:24:01 +0000 (11:24 -0700)]
Add test for MulAdd in Reactor

Test: New test passes
Bug: b/37496078
Change-Id: Ieff1b080bdde3f9c86a0531566c8b08d7cdf24fe
Reviewed-on: https://swiftshader-review.googlesource.com/13009
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Casey Dahlin <sadmac@google.com>
6 years agoOptimize common vector shuffle patterns for ARM32.
Nicolas Capens [Mon, 2 Oct 2017 14:44:03 +0000 (10:44 -0400)]
Optimize common vector shuffle patterns for ARM32.

Use VDUP for replicating a single element.
Use VZIP for interleaving vectors.
Use VMOV Dd, Dm for rearranging quadword vectors.

Bug b/67106219

Change-Id: I0de1457454c1db6d467bf870288b7af7cb59ac09
Reviewed-on: https://chromium-review.googlesource.com/695004
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Reviewed-on: https://swiftshader-review.googlesource.com/12968
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix vector packing pseudo-instruction.
Nicolas Capens [Mon, 2 Oct 2017 21:41:13 +0000 (17:41 -0400)]
Fix vector packing pseudo-instruction.

When the first source register is different from the destination
register, but equal to the second source, we need to first narrow
the second source to prevent overwriting data we still need. Similar
when the destination is equal to the first source.

Bug b/37496082

Change-Id: I908a8e125a77ec4bf1eb5eab9e48c6112ee4ca13
Reviewed-on: https://chromium-review.googlesource.com/696032
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Reviewed-on: https://swiftshader-review.googlesource.com/12949
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdding support for more format/internalformat combinations
Alexis Hetu [Mon, 2 Oct 2017 19:27:03 +0000 (15:27 -0400)]
Adding support for more format/internalformat combinations

OpenGLES 3.0 allows for more combinations of format/internalformat
for floating point types. These types were already supported, just
not using the combinations added here.

Bug chromium:763384

Change-Id: I146548c2920799c7ea0d5d537d556ba562708147
Reviewed-on: https://swiftshader-review.googlesource.com/12928
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd test for MulHigh in Reactor
Casey Dahlin [Mon, 2 Oct 2017 22:02:02 +0000 (15:02 -0700)]
Add test for MulHigh in Reactor

Test: New tests pass
Bug: b/37496856
Change-Id: Ifae1f802d61a7d51f6e8f5c135e3c8c67be30125
Reviewed-on: https://swiftshader-review.googlesource.com/12950
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Casey Dahlin <sadmac@google.com>
6 years agoFix emulation of Short to Byte saturation.
Nicolas Capens [Mon, 2 Oct 2017 21:32:34 +0000 (17:32 -0400)]
Fix emulation of Short to Byte saturation.

We weren't clamping the value when less than zero.

Bug b/37496082

Change-Id: I3170d14a622f8571f0142dd4ce80f96617c7e0aa
Reviewed-on: https://swiftshader-review.googlesource.com/12948
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Casey Dahlin <sadmac@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix vector packing regression.
Nicolas Capens [Mon, 2 Oct 2017 19:26:11 +0000 (15:26 -0400)]
Fix vector packing regression.

When SSE4.1 isn't available, we were infinitely calling PackUnsigned()
recursively.

Bug b/37496082

Change-Id: Ie1fa8150d64740776c5b80baf07d997dde9d51be
Reviewed-on: https://swiftshader-review.googlesource.com/12929
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Casey Dahlin <sadmac@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd test for PackSigned/PackUnsigned in Reactor
Casey Dahlin [Fri, 29 Sep 2017 23:32:32 +0000 (16:32 -0700)]
Add test for PackSigned/PackUnsigned in Reactor

Test: New tests pass
Bug: b/37496082
Change-Id: I4a0aae14318f03b5ce59f12f7542db13270f52ab
Reviewed-on: https://swiftshader-review.googlesource.com/12848
Tested-by: Casey Dahlin <sadmac@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoFix for integer modulo operations
Alexis Hetu [Mon, 2 Oct 2017 17:48:19 +0000 (13:48 -0400)]
Fix for integer modulo operations

Integer division already had this modification, to avoid
division by 0, but integer modulo hadn't been modified
to match the other fix, which is now done here.

Bug chromium:763435

Change-Id: I40f4ed9f1c4b5889ddf47abc1bb7c70c21cbd7b8
Reviewed-on: https://swiftshader-review.googlesource.com/12908
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
6 years agoImplement vector intrinsics for ARM32.
Nicolas Capens [Wed, 27 Sep 2017 19:06:35 +0000 (15:06 -0400)]
Implement vector intrinsics for ARM32.

MultiplyAddPairs is implemented using VMULL+VPADD.
MultiplyHighSigned/Unsigned is implemented using VMULL+VSHRN.
SubVectorLoad/Store is implemented using VLDR/VLD1/VSTR/VST1.
VectorPackSigned/Unsigned is implemented using two VQMOVN.

Bug b/37496078
Bug b/37496856
Bug b/37496321
Bug b/37496082

Change-Id: I141fd901d53da24ce780f503dc7ad17b94fc6ba8
Reviewed-on: https://chromium-review.googlesource.com/693049
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Reviewed-on: https://swiftshader-review.googlesource.com/12709
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd test for Unpack in Reactor
Casey Dahlin [Fri, 29 Sep 2017 20:43:18 +0000 (13:43 -0700)]
Add test for Unpack in Reactor

Test: New test passes
Bug: b/67106219
Change-Id: Ib21f73d312d39cf2b3aa15a11d2a207885a58978
Reviewed-on: https://swiftshader-review.googlesource.com/12828
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Casey Dahlin <sadmac@google.com>
6 years agoPrevent division by 0
Alexis Hetu [Wed, 27 Sep 2017 18:43:38 +0000 (14:43 -0400)]
Prevent division by 0

If imageSize is 0, inputPitch may be 0, which would cause a division
by 0. In any case, if imageSize is 0, there's no work to perform, so
we just skip loadCompressedData() entirely in that case.

Bug:765094

Change-Id: Iedc6516ef6d025d24a8827597045cb3b83599e4a
Reviewed-on: https://swiftshader-review.googlesource.com/12648
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoHandle WindowSurface::checkForResize() errors gracefully
Alexis Hetu [Fri, 29 Sep 2017 17:13:14 +0000 (13:13 -0400)]
Handle WindowSurface::checkForResize() errors gracefully

WindowSurface::checkForResize() contained an assert which got
triggered in some tests. In order to avoid this issue, this cl
gracefully handles an invalid window handle.

Change-Id: I6bace88370980e94676d4af9de0d88e561175835
Reviewed-on: https://swiftshader-review.googlesource.com/12808
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd tests for AddSat/SubSat in Reactor
Casey Dahlin [Fri, 29 Sep 2017 00:18:41 +0000 (17:18 -0700)]
Add tests for AddSat/SubSat in Reactor

Bug b/37495545

Test: New tests pass
Change-Id: Icc81729d8c65aadccdd685490218d298e671b638
Reviewed-on: https://swiftshader-review.googlesource.com/12768
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Casey Dahlin <sadmac@google.com>
6 years agoSupport saturating vector add and subtract on ARM32.
Casey Dahlin [Wed, 28 Jun 2017 20:58:58 +0000 (13:58 -0700)]
Support saturating vector add and subtract on ARM32.

Bug b/37495545

Change-Id: I1d025f894bb7cf08dcaafd950605781633596ab3
Reviewed-on: https://chromium-review.googlesource.com/689098
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Reviewed-on: https://swiftshader-review.googlesource.com/12748
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoSupport vector shift by constant for ARM32.
Nicolas Capens [Wed, 27 Sep 2017 18:33:11 +0000 (14:33 -0400)]
Support vector shift by constant for ARM32.

This also fixes the encoding of right shifts with unsigned elements.

Bug b/37496338

Change-Id: I9a1dc91359daea5f4391a137b7f9e03bd941146b
Reviewed-on: https://chromium-review.googlesource.com/688057
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Reviewed-on: https://swiftshader-review.googlesource.com/12668
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoAdd intrinsic lowering stubs for ARM.
Nicolas Capens [Tue, 18 Apr 2017 19:14:16 +0000 (15:14 -0400)]
Add intrinsic lowering stubs for ARM.

Change-Id: I24a2ac536c24732538cc5c7f2aad4e7763989f9e
Reviewed-on: https://chromium-review.googlesource.com/568673
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Reviewed-on: https://swiftshader-review.googlesource.com/12690
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoUpload pnacl-subzero changes to Gerrit by default
Aaron Gable [Wed, 26 Jul 2017 22:11:04 +0000 (15:11 -0700)]
Upload pnacl-subzero changes to Gerrit by default

R=bradnelson@chromium.org

Bug: 665593
Change-Id: I1b9a5fd31c5e426bd193a32a2feb291eb17af5a6
Reviewed-on: https://chromium-review.googlesource.com/587993
Reviewed-by: Brad Nelson <bradnelson@chromium.org>
Reviewed-on: https://swiftshader-review.googlesource.com/12689
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoDo not inline GlobalContext TLS methods.
Lei Zhang [Tue, 23 May 2017 22:08:59 +0000 (15:08 -0700)]
Do not inline GlobalContext TLS methods.

The gold linker thinks that causes an ODR violation.

BUG=chromium:449754
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/2896133003 .

Patch from Lei Zhang <thestig@chromium.org>.

Change-Id: I7f39b1f6e638ad3462b9b462ebdb6348473b9fc5
Reviewed-on: https://swiftshader-review.googlesource.com/12688
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoRefactor vector packing.
Nicolas Capens [Wed, 27 Sep 2017 15:47:35 +0000 (11:47 -0400)]
Refactor vector packing.

x86 vector packing instructions always treat the input as having signed
integer components, but can perform signed or unsigned saturation on
the output. In Reactor the Pack() intrinsic has overloads which
differentiate between them based on the signedness of the input, but
this is confusing.

Also simplify emulation of saturating add/subtract.

Bug b/37496082

Change-Id: I0625fff429ffb40f42baf9600c7760d9858b5d89
Reviewed-on: https://swiftshader-review.googlesource.com/12548
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
6 years agoBreak on gtest failures in debug mode.
Nicolas Capens [Wed, 27 Sep 2017 16:56:26 +0000 (12:56 -0400)]
Break on gtest failures in debug mode.

Google Test by default disables breaking into the debugger to be able
to run to completion without interaction. Enable it for debug builds
within Visual Studio.

Change-Id: If36e3d74ab1ec98eefa221761e02a33bd8117151
Reviewed-on: https://swiftshader-review.googlesource.com/12588
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
6 years agoBuild before debugging with Visual Studio Code.
Nicolas Capens [Wed, 27 Sep 2017 14:44:13 +0000 (10:44 -0400)]
Build before debugging with Visual Studio Code.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This FPS counter is disabled by default.

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

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

Bug chromium:765912
Bug b/25351344

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

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

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

Bug swiftshader:82

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

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

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

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

Bug swiftshader:80

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

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

Bug b/64683344

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

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

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

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

Bug b/65124545

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

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

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

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

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

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

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

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

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

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

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

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

BUG=chromium:755195

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Switching SwiftShader on ChromeOS from LLVM to Subzero.

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

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

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

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

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

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

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

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

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

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

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

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