OSDN Git Service

android-x86/external-swiftshader.git
8 years agoTreat unsized RGBA/RGB textures as renderable.
Nicolas Capens [Tue, 24 May 2016 18:45:55 +0000 (14:45 -0400)]
Treat unsized RGBA/RGB textures as renderable.

Bug 28929520

Change-Id: I94fcac3149fafd422e1879360109b668a2ca6029
Reviewed-on: https://swiftshader-review.googlesource.com/5410
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoEnabling Transform Feedback
Alexis Hetu [Wed, 4 May 2016 20:43:21 +0000 (16:43 -0400)]
Enabling Transform Feedback

This cl enables transform feedback in Context by calling
Program::applyTransformFeedback(). It also adds the code
required to compute vertex offsets between different draw
calls, when multiple successive draw calls write into the
same transform feedback buffer(s).

Change-Id: Ib3bc4bdd1308486642f233f425d0088a55cb1333
Reviewed-on: https://swiftshader-review.googlesource.com/5301
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoVertexRoutine code for Transform Feedback
Alexis Hetu [Wed, 20 Apr 2016 19:29:51 +0000 (15:29 -0400)]
VertexRoutine code for Transform Feedback

This cl adds the code that actually performs the copy of the
vertex shader outputs into transform feedback buffers. It
also contains a fix for symmetricNormalizedDepth, which must
be computed after the information was copied into the
transform feedback buffers, when transform feedback is active.

Change-Id: I418f94a15b9425bba0905c840f8cf4828233d0fb
Reviewed-on: https://swiftshader-review.googlesource.com/5172
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoLoop count crash fixed
Alexis Hetu [Wed, 11 May 2016 14:56:43 +0000 (10:56 -0400)]
Loop count crash fixed

The loopCount function was expecting the left side of a binary op
to always be a symbol, which isn't necessarily the case, so a null
pointer check was added to prevent the crash.

Change-Id: I1fe6626bf52ecbb05664d1d2fa18f7ed830a7ee6
Reviewed-on: https://swiftshader-review.googlesource.com/5344
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMake the number of vertex inputs configurable.
Nicolas Capens [Wed, 18 May 2016 18:44:21 +0000 (14:44 -0400)]
Make the number of vertex inputs configurable.

Change-Id: Ic078acae24dd2b2361a32498b49238b98e0ac0d1
Reviewed-on: https://swiftshader-review.googlesource.com/5386
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoMake the number of fragment inputs configurable.
Nicolas Capens [Wed, 18 May 2016 16:51:37 +0000 (12:51 -0400)]
Make the number of fragment inputs configurable.

Change-Id: I2c618c03d00718951907e81fcd600155751aac89
Reviewed-on: https://swiftshader-review.googlesource.com/5385
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoMake the number of vertex outputs configurable.
Nicolas Capens [Wed, 18 May 2016 16:32:02 +0000 (12:32 -0400)]
Make the number of vertex outputs configurable.

Change-Id: I17ae53e5274232e9e3b482daac56d507788e822c
Reviewed-on: https://swiftshader-review.googlesource.com/5383
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix overwriting clip flags with varyings.
Nicolas Capens [Tue, 17 May 2016 17:04:01 +0000 (13:04 -0400)]
Fix overwriting clip flags with varyings.

Previously the 12'th generic varying's w component would overwrite the
clipFlags member field.

Change-Id: I499979a2bbc653c0d95b35512a7a9e36667c2e4d
Reviewed-on: https://swiftshader-review.googlesource.com/5382
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoRename color output semantic.
Nicolas Capens [Tue, 17 May 2016 15:48:56 +0000 (11:48 -0400)]
Rename color output semantic.

Change-Id: Iaa6cf9367f291a4bc3bde899484ca323ff54a0d4
Reviewed-on: https://swiftshader-review.googlesource.com/5381
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoImplemented the EGL_KHR_create_context extension
Alexis Hetu [Wed, 18 May 2016 15:43:43 +0000 (11:43 -0400)]
Implemented the EGL_KHR_create_context extension

Implemented EGL_KHR_create_context as described here:
www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_create_context.txt

A small part of it was already implemented, which was to add
support for the EGL_OPENGL_ES3_BIT bit in the EGL_RENDERABLE_TYPE
bitfield. Note that the EGL_OPENGL_ES3_BIT is explicitly disabled
on Android right now.

Change-Id: I10e6222511b29f2d91bd55bfeb0f39bc5b884f89
Reviewed-on: https://swiftshader-review.googlesource.com/5380
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix the CMake build for Linux.
Nicolas Capens [Tue, 17 May 2016 20:02:32 +0000 (16:02 -0400)]
Fix the CMake build for Linux.

Bug 27225594

Change-Id: Ice38ce8ca8ef157e24d309fe6ac9ce2f69e9e816
Reviewed-on: https://swiftshader-review.googlesource.com/5363
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUpdate version.
Nicolas Capens [Mon, 16 May 2016 19:44:15 +0000 (15:44 -0400)]
Update version.

Change-Id: I47447de635055f9fadf43a71f5423e8fcba884aa
Reviewed-on: https://swiftshader-review.googlesource.com/5358
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoMove Khronos OpenGL headers to top-level include directory.
Nicolas Capens [Mon, 16 May 2016 17:16:32 +0000 (13:16 -0400)]
Move Khronos OpenGL headers to top-level include directory.

Change-Id: If473b7d83e54ccdca710dffe353b539213ae2046
Reviewed-on: https://swiftshader-review.googlesource.com/5357
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoSwitch implementation
Alexis Hetu [Mon, 2 May 2016 21:34:46 +0000 (17:34 -0400)]
Switch implementation

Implemented switch/case for glsl in OpenGL ES 3.0.
For simplicity, it is implemented as a loop without a condition,
so break statements work properly like so:

begin switch
  if(...) // 1st case
  ...
  else if(...) // other cases
  ...
  else // default case
  ...
end switch // Anchor point for break statements

All related dEQP tests pass, except 7 tests where vertex shaders
contain a switch or a loop within another switch. These 7 failures
have only about 5% of bad pixel and seem to be related to an issue
with int(floor(...)), since the equivalent tests inside the fragment
shader pass.

KNOWN ISSUE: If a switch is within a loop and one of the cases
             contains a "continue" statement, this will not be
             handled correctly at the moment. There are no dEQP
             tests for this at the moment, AFAIK.

Change-Id: I3ba34ab06a759d07e8520f6a87d75036a5cdaef5
Reviewed-on: https://swiftshader-review.googlesource.com/5272
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdded vertex attribute types
Alexis Hetu [Sat, 14 May 2016 02:40:02 +0000 (22:40 -0400)]
Added vertex attribute types

Added a few types:
- Half float
- 2_10_10_10_INT
- 2_10_10_10_UINT

Related dEQP tests pass.

Change-Id: I2fb04fee89c3d69367dc2e401ac53d9758add9bf
Reviewed-on: https://swiftshader-review.googlesource.com/5356
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdd missing license headers.
Nicolas Capens [Fri, 13 May 2016 23:30:12 +0000 (19:30 -0400)]
Add missing license headers.

Change-Id: I093be383c0c5b111592acad4cc9301711c75ab88
Reviewed-on: https://swiftshader-review.googlesource.com/5362
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoAdd readme file.
Nicolas Capens [Thu, 12 May 2016 21:27:05 +0000 (17:27 -0400)]
Add readme file.

Change-Id: I3aaf4819fa629282ebeb9f7e70fbae53c261c25d
Reviewed-on: https://swiftshader-review.googlesource.com/5355
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoOutput builds to top-level obj and bin folder.
Nicolas Capens [Thu, 12 May 2016 19:51:10 +0000 (15:51 -0400)]
Output builds to top-level obj and bin folder.

Change-Id: I1444a3d15977c2617866f293e0ac0ccbd253d878
Reviewed-on: https://swiftshader-review.googlesource.com/5353
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMove Visual Studio solution to root directory.
Nicolas Capens [Thu, 12 May 2016 03:23:15 +0000 (23:23 -0400)]
Move Visual Studio solution to root directory.

Change-Id: Ifb474e6ab12b254599b6d1713f9f2a01b869e09d
Reviewed-on: https://swiftshader-review.googlesource.com/5361
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix CMake symbolic path and lower version requirement.
Nicolas Capens [Thu, 12 May 2016 20:43:33 +0000 (16:43 -0400)]
Fix CMake symbolic path and lower version requirement.

Change-Id: I7c854c0c357f480b0686b0ed12e371adca8a738f
Reviewed-on: https://swiftshader-review.googlesource.com/5354
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoCopy d3d9.dll builds to lib directory.
Nicolas Capens [Thu, 12 May 2016 02:17:26 +0000 (22:17 -0400)]
Copy d3d9.dll builds to lib directory.

Change-Id: Iea408eb9beb6aa3eec4d4e64a3bd34510411dfaa
Reviewed-on: https://swiftshader-review.googlesource.com/5360
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoDisable all LLVM signal handlers.
Nicolas Capens [Wed, 11 May 2016 18:12:49 +0000 (14:12 -0400)]
Disable all LLVM signal handlers.

This fixes issues on Android where applications use these signals in their
normal course of execution. The Mono C# framework uses SIGXCPU for garbage
collection, and ART uses SIGSEGV, SIGQUIT, and SIGUSR1.

Bug 27555932

Change-Id: I4977b8f0419da660a57a8eeef20a7fe747921a63
Reviewed-on: https://swiftshader-review.googlesource.com/5345
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoRemove MemoryManager.
Nicolas Capens [Thu, 12 May 2016 01:42:16 +0000 (21:42 -0400)]
Remove MemoryManager.

Change-Id: I8158c0bb2c19d6cdee12a970f24785fae609d5fc
Reviewed-on: https://swiftshader-review.googlesource.com/5352
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoUpdate D3DCAPS2 descriptions to match MSDN documentation.
Nicolas Capens [Thu, 12 May 2016 01:30:03 +0000 (21:30 -0400)]
Update D3DCAPS2 descriptions to match MSDN documentation.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb172511(v=vs.85).aspx

Change-Id: I2bc8251bce77aacb55fbad1c677f865395f5a986
Reviewed-on: https://swiftshader-review.googlesource.com/5351
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoAdd authors and contributors files.
Nicolas Capens [Tue, 10 May 2016 21:26:19 +0000 (17:26 -0400)]
Add authors and contributors files.

Change-Id: I192d8fe104c3734c9c37108312f1dc93470d8d9e
Reviewed-on: https://swiftshader-review.googlesource.com/5342
Reviewed-by: Shannon Woods <shannonwoods@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoAdd contributing instructions.
Nicolas Capens [Tue, 10 May 2016 20:32:58 +0000 (16:32 -0400)]
Add contributing instructions.

Change-Id: I9fe9bd339f2aacb04394259ee8753dbc8e041430
Reviewed-on: https://swiftshader-review.googlesource.com/5340
Reviewed-by: Shannon Woods <shannonwoods@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFixed expected state when using different images for depth and stencil
Alexis Hetu [Mon, 2 May 2016 14:49:04 +0000 (10:49 -0400)]
Fixed expected state when using different images for depth and stencil

When depth and stencil are both present, they must be the same image,
or return GL_FRAMEBUFFER_UNSUPPORTED, according to the GLES 3.0 spec,
section 4.4.4, Framebuffer Completeness.

Change-Id: I607c05617fb55743635eda987da6de523385d92b
Reviewed-on: https://swiftshader-review.googlesource.com/5262
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoApply the Apache 2.0 license.
Nicolas Capens [Sat, 7 May 2016 10:09:58 +0000 (06:09 -0400)]
Apply the Apache 2.0 license.

Change-Id: I4a7aeefedcd2d891093520d5a10ebefadcddb5be
Reviewed-on: https://swiftshader-review.googlesource.com/5320
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoRemove the watermark logo.
Nicolas Capens [Thu, 28 Apr 2016 03:18:01 +0000 (23:18 -0400)]
Remove the watermark logo.

Change-Id: I72439a60850add0600face13c94cc481a7083792
Reviewed-on: https://swiftshader-review.googlesource.com/5221
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoMove LLVM to /third_party.
Nicolas Capens [Thu, 5 May 2016 23:02:54 +0000 (19:02 -0400)]
Move LLVM to /third_party.

Bug 28616401

Change-Id: Ia54134e6e1dc6b101c7f81d9047e9bcc9fab3061
Reviewed-on: https://swiftshader-review.googlesource.com/5311
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMove PowerVR samples to /third_party/PowerVR_SDK.
Nicolas Capens [Thu, 5 May 2016 19:09:49 +0000 (15:09 -0400)]
Move PowerVR samples to /third_party/PowerVR_SDK.

Bug 28616401

Change-Id: I888ac3dd3186206c7745c23a542b91510a461f45
Reviewed-on: https://swiftshader-review.googlesource.com/5310
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix log2() accuracy.
Nicolas Capens [Mon, 9 May 2016 15:37:02 +0000 (11:37 -0400)]
Fix log2() accuracy.

Bug 28474248

Change-Id: I61bf28687623437c6b9b383dc189ffa28ad24c22
Reviewed-on: https://swiftshader-review.googlesource.com/5330
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix validating the current context on eglSwapInterval.
Nicolas Capens [Wed, 4 May 2016 05:59:24 +0000 (01:59 -0400)]
Fix validating the current context on eglSwapInterval.

Change-Id: I7f62eae32d2122ec14f400841eaefa3712cf582d
Reviewed-on: https://swiftshader-review.googlesource.com/5291
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix validating sync object pointers.
Nicolas Capens [Wed, 4 May 2016 01:12:29 +0000 (21:12 -0400)]
Fix validating sync object pointers.

The spec states that "If <sync> is not a valid sync object for <dpy>,
EGL_FALSE is returned and an EGL_BAD_PARAMETER error is generated."

Change-Id: I4bbd2ddfefd7baba9c301decb644bfb545e66f01
Reviewed-on: https://swiftshader-review.googlesource.com/5290
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agomodf implementation
Alexis Hetu [Tue, 3 May 2016 15:30:57 +0000 (11:30 -0400)]
modf implementation

Implemented modf as trunc + sub
Passes all related dEQP tests

Change-Id: I43656c51a670d235153e5fac390a8db311b14f8d
Reviewed-on: https://swiftshader-review.googlesource.com/5280
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoImporting log2f fix for JB-MR1
Alexis Hetu [Mon, 2 May 2016 15:20:52 +0000 (11:20 -0400)]
Importing log2f fix for JB-MR1

Bug 28474248

Change-Id: Id5b93f3494c918cb344e5da7010dfa48a25cdde1
Reviewed-on: https://swiftshader-review.googlesource.com/5263
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix scoping of function parameters for GLSL ES 1.0
Nicolas Capens [Tue, 26 Apr 2016 14:18:31 +0000 (14:18 +0000)]
Fix scoping of function parameters for GLSL ES 1.0

This reverts commit 0637eac3b8fd276596b303aaa7e5d59a3accccf8.
It's considered a spec bug:
https://cvs.khronos.org/bugzilla/show_bug.cgi?id=8656

Change-Id: Id49121d5adf91ecab3d261c3c12e2f879f47e856
Reviewed-on: https://swiftshader-review.googlesource.com/5192
Reviewed-by: Shannon Woods <shannonwoods@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix sampler-array-using-loop-index.html regression.
Nicolas Capens [Fri, 29 Apr 2016 17:35:00 +0000 (13:35 -0400)]
Fix sampler-array-using-loop-index.html regression.

Change-Id: I1d1a716bd9bd5b636c5b263a7094ff13ac9aa549
Reviewed-on: https://swiftshader-review.googlesource.com/5260
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoUse a wildcard for detecting GCE builds.
Nicolas Capens [Fri, 29 Apr 2016 18:17:00 +0000 (14:17 -0400)]
Use a wildcard for detecting GCE builds.

Change-Id: Iddd9acf8496abe4dfa147f8a59b4cfb2f23df3a7
Reviewed-on: https://swiftshader-review.googlesource.com/5261
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoTransform feedback buffer assignment
Alexis Hetu [Thu, 21 Apr 2016 17:17:07 +0000 (13:17 -0400)]
Transform feedback buffer assignment

This cl adds a utility function that assigns the correct buffer
for each linked transform feedback variable. All the information
about location and size is sent to the VertexProcessor for use
during rendering.

Change-Id: I942805250804f56805de1fc117024c20976e83a0
Reviewed-on: https://swiftshader-review.googlesource.com/5174
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoDon't continue looping when having returned from shader function.
Nicolas Capens [Thu, 28 Apr 2016 19:28:02 +0000 (15:28 -0400)]
Don't continue looping when having returned from shader function.

Previously we would mask instruction execution after hitting a LEAVE,
but still jump back on every loop iteration (even if infinite). This
change applies the enableLeave mask to the loop test condition so we
break out of the loop when all strands have hit LEAVE.

Change-Id: Ia331a91fb363d20743d5b87a468c3cfcaa7b481e
Reviewed-on: https://swiftshader-review.googlesource.com/5250
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed not equal folding
Alexis Hetu [Thu, 28 Apr 2016 16:45:48 +0000 (12:45 -0400)]
Fixed not equal folding

The not equal folding logic was wrong. It would end the loop
as soon as it found equal components, which was checking if
ALL components are not equal, but that's not how not equal
works, it should return true if ANY component is not equal.

I also refactored it because it was hard to follow, with the
boolNodeFlag variable being used upside down of the result.

Change-Id: I704f26f2fd31a1cc637f5d7601409de8161c5b80
Reviewed-on: https://swiftshader-review.googlesource.com/5211
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoSRGB implementation
Alexis Hetu [Mon, 25 Apr 2016 20:59:58 +0000 (16:59 -0400)]
SRGB implementation

The SRGB conversion code was already available, but wasn't used
specifically for the SRGB type framebuffers. Also, the SRGB
conversion should always be applied after blending.

According to the GLES 3.0 spec, section 4.1.8 - sRGB Conversion:
"the R, G, and B values after blending are converted
 into the non-linear sRGB color space by computing."

All related dEQP tests pass.

Change-Id: I9342d2f74aa650f28835a951bdfa8bd371bc6924
Reviewed-on: https://swiftshader-review.googlesource.com/5189
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix indexing of samplers in structures.
Nicolas Capens [Tue, 26 Apr 2016 05:10:24 +0000 (01:10 -0400)]
Fix indexing of samplers in structures.

Change-Id: I0bde678865902d549d4260bf8f6c1a368a46f4d4
Reviewed-on: https://swiftshader-review.googlesource.com/5191
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoWork around LLVM integer vector compare bug.
Nicolas Capens [Thu, 28 Apr 2016 03:08:50 +0000 (23:08 -0400)]
Work around LLVM integer vector compare bug.

Change-Id: If90d45b5f0c83620486dd7b6decc2f0f5fc7e558
Reviewed-on: https://swiftshader-review.googlesource.com/5220
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoTexture projection constant folding
Alexis Hetu [Wed, 27 Apr 2016 18:43:08 +0000 (14:43 -0400)]
Texture projection constant folding

Whenever texture projection is used with a constant texture
coordinate, folding allows to use the full precision reciprocal
and not generate the lower precision reciprocal operation.

Change-Id: I6cab6567d63ecd9abe1cedbd7e46e1fd9099a3d3
Reviewed-on: https://swiftshader-review.googlesource.com/5210
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMore constant folding
Alexis Hetu [Tue, 26 Apr 2016 20:30:22 +0000 (16:30 -0400)]
More constant folding

Added constant folding for:
rad, deg, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh,
asinh, acosh, atanh, log, log2, exp, exp2, sqrt, inverstsqrt

Change-Id: Ifc6b089e5981da9a3739d4ed7636953a682ce220
Reviewed-on: https://swiftshader-review.googlesource.com/5200
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoStruct equality comparison fixed
Alexis Hetu [Tue, 26 Apr 2016 15:50:40 +0000 (11:50 -0400)]
Struct equality comparison fixed

There's an LLVM bug currently that prevents us from using ICMP_EQ,
but ICMP_NE works fine, so the "equality" test has been changed to
"!inequality" to fix the issue. The fix should be reverted once
LLVM is updated to a version where the ICMP_EQ issue is fixed.

Change-Id: I79d6ca99554317cc64ffa2905ae2804bd4805e2a
Reviewed-on: https://swiftshader-review.googlesource.com/5193
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
8 years agoFix implementation read format for RGB formats.
Nicolas Capens [Mon, 25 Apr 2016 22:05:15 +0000 (18:05 -0400)]
Fix implementation read format for RGB formats.

Bug 27690616

Change-Id: I28b62fc56b0b572c1c9e94499d8a0c4c56737f3c
Reviewed-on: https://swiftshader-review.googlesource.com/5190
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix operator precedence issue.
Nicolas Capens [Mon, 25 Apr 2016 20:12:57 +0000 (16:12 -0400)]
Fix operator precedence issue.

Addition evaluates before the ternary operator, which resulted in the wrong
sizes being computed.

Bug 28346104

Change-Id: Id28843132097a4fb1599eed19c05f479f16f1315
Reviewed-on: https://swiftshader-review.googlesource.com/5187
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix unrolling loops with return statements.
Nicolas Capens [Fri, 22 Apr 2016 19:39:29 +0000 (15:39 -0400)]
Fix unrolling loops with return statements.

Change-Id: I8974a6bb4137d1dfad9f5dd3a92cc9306c38294c
Reviewed-on: https://swiftshader-review.googlesource.com/5184
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoSupport parsing defined operator generated by macro expansion
Nicolas Capens [Fri, 22 Apr 2016 15:00:31 +0000 (11:00 -0400)]
Support parsing defined operator generated by macro expansion

dEQP tests enforce that the defined operator should be parsed even when
it is generated as a result of macro expansion, even though this is
undefined according to the C++ preprocessor spec.

Implement support for this by putting the parsing for the defined
operator inside MacroExpander. The operator gets processed right after
it is generated by macro expansion. Parsing the defined operator is
toggled with a boolean according to the context where MacroExpander
is used.

Change-Id: I8557e829f4278ab6cb27eb4a0f84ca0c0dd18d1a
Reviewed-on: https://swiftshader-review.googlesource.com/5182
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoUnexpected tokens after conditionals should be an error instead of a warning.
Nicolas Capens [Fri, 22 Apr 2016 14:04:12 +0000 (10:04 -0400)]
Unexpected tokens after conditionals should be an error instead of a warning.

Change-Id: I49d6d36ecf9a5f0d3d333422b3e4970192617c05
Reviewed-on: https://swiftshader-review.googlesource.com/5180
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoValidate that all function-like-macro arguments are unique.
Nicolas Capens [Fri, 22 Apr 2016 13:49:29 +0000 (09:49 -0400)]
Validate that all function-like-macro arguments are unique.

Change-Id: Idc8c2a241af91916857ba015b061ce655b33e866
Reviewed-on: https://swiftshader-review.googlesource.com/5179
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix potentially uninitialized variable warning.
Nicolas Capens [Fri, 22 Apr 2016 14:14:59 +0000 (10:14 -0400)]
Fix potentially uninitialized variable warning.

Change-Id: I29172c0c5423750db2665c350746b82fd2a34653
Reviewed-on: https://swiftshader-review.googlesource.com/5181
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMaking proper use of size_t
Alexis Hetu [Thu, 21 Apr 2016 20:11:31 +0000 (16:11 -0400)]
Making proper use of size_t

In a lot of cases, int was being used instead of size_to represent
sizes. That led to some warnings about inconsistencies between int
and size_t usage. While this cl doesn't solve all warnings, it tries
to use size_t and int where it should be appropriate to use them.

Change-Id: Id760df1360f65b2bba60f4075cdf4954fc6bbaf3
Reviewed-on: https://swiftshader-review.googlesource.com/5177
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
8 years agoFix error code on invalid shader/program operation
Nicolas Capens [Thu, 21 Apr 2016 19:59:38 +0000 (15:59 -0400)]
Fix error code on invalid shader/program operation

The spec states that GL_INVALID_OPERATION is generated when a shader or
program function is called on the wrong object type. GL_INVALID_VALUE is
generated when there's no shader nor program object by that name.

Change-Id: Id9d922b390ca5d2db233eb60b6a44992105cb933
Reviewed-on: https://swiftshader-review.googlesource.com/5176
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix checking all mipmap levels for padding.
Nicolas Capens [Thu, 21 Apr 2016 17:59:20 +0000 (13:59 -0400)]
Fix checking all mipmap levels for padding.

When textures have padding after a row of pixels, we can't use the sampler's
fast path which uses shift operations. We have to treat it as an NPOT texture.
Previously only mipmap level 0 was checked for padding, but when a texture is
also a render target we allocate 2x2 pixel blocks so a 1x1 mipmap has stride 2.

Change-Id: I7421fddbe5ed0d330d881f09c2161d9c42348600
Reviewed-on: https://swiftshader-review.googlesource.com/5175
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoTransform feedback varying validation code
Alexis Hetu [Thu, 7 Apr 2016 14:12:10 +0000 (10:12 -0400)]
Transform feedback varying validation code

Proper validation of varyings used for transform feedback was added.
Simple types, as well as arrays and array elements are allowed.

Change-Id: I83ceb5eb19bf5691264ab0e142c3cc6a7debda4c
Reviewed-on: https://swiftshader-review.googlesource.com/5058
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoCompute cube LOD from 3D cube intersection distance.
Nicolas Capens [Tue, 19 Apr 2016 13:09:29 +0000 (09:09 -0400)]
Compute cube LOD from 3D cube intersection distance.

We used to compute the cube map LOD by projecting all sampling rays onto the
same face (arbitrarily chosen). This changes it to intersect the rays with the
cube and use the 3D distance between them.

Change-Id: If90b29cb4c13e6128ce6642eb28bb92602e783df
Reviewed-on: https://swiftshader-review.googlesource.com/5160
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFixed a couple of regressions from namespace refactoring
Alexis Hetu [Tue, 19 Apr 2016 15:16:34 +0000 (11:16 -0400)]
Fixed a couple of regressions from namespace refactoring

From the ES3 spec, section 4.4.2 (about DeleteRenderbuffers):
"Unused names in renderbuffers are silently ignored, as is
 the value zero."

And from section 6.1.5:
"IsSampler will return TRUE if sampler is the name of a
 sampler object previously returned from a call to
 GenSamplers and FALSE otherwise".

Also, glIsSampler can use Context::isSampler(), which uses
ResourceManager::isSampler(), which should only look whether a
name has been reserved, not whether the object is allocated.

Note: Even though the spec mentions (about Sampler objects):
"they acquire state only when they are first used as a parameter
to BindSampler, SamplerParameter*, GetSamplerParameter*, or
IsSampler", it shouldn't hurt to not allocate the object when
calling IsSampler, since a subsequent call to any other Sampler
object related function should allocate it.

Change-Id: I69c9d8bbcf93231747b913c0afbd970c78d02cf1
Reviewed-on: https://swiftshader-review.googlesource.com/5161
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix signed/unsigned compiler warning.
Nicolas Capens [Mon, 18 Apr 2016 21:52:30 +0000 (17:52 -0400)]
Fix signed/unsigned compiler warning.

Change-Id: Id82e8dba0d934f5c4bb2eefe1647839f25917898
Reviewed-on: https://swiftshader-review.googlesource.com/5150
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdd support for GL_NV_read_depth
John Sheu [Tue, 19 Apr 2016 01:53:47 +0000 (18:53 -0700)]
Add support for GL_NV_read_depth

Change-Id: If2f96b4cc1c09cd28771740f09be5f84875033ab
Reviewed-on: https://swiftshader-review.googlesource.com/5091
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoImplement GL_EXT_draw_buffers.
Nicolas Capens [Mon, 18 Apr 2016 18:34:24 +0000 (14:34 -0400)]
Implement GL_EXT_draw_buffers.

Bug 19353282

Change-Id: I4a1782c2f1e9ae52b731ef447e97c353cc41044e
Reviewed-on: https://swiftshader-review.googlesource.com/5123
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix draw buffers support.
Nicolas Capens [Mon, 18 Apr 2016 18:32:22 +0000 (14:32 -0400)]
Fix draw buffers support.

Bug 19353282

Change-Id: I6d1022c42a3347b8deb01af15078769d794050cb
Reviewed-on: https://swiftshader-review.googlesource.com/5146
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoImplement broadcasting of gl_FragColor.
Nicolas Capens [Mon, 18 Apr 2016 18:09:37 +0000 (14:09 -0400)]
Implement broadcasting of gl_FragColor.

Bug 19353282

Change-Id: I4319ad1836de36cc4b91b04ed226f925f82013ee
Reviewed-on: https://swiftshader-review.googlesource.com/5145
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix support for variable number of render targets.
Nicolas Capens [Mon, 18 Apr 2016 16:07:22 +0000 (12:07 -0400)]
Fix support for variable number of render targets.

Bug 19353282

Change-Id: I4e99589477de32bb8004feec673e1dbddb675047
Reviewed-on: https://swiftshader-review.googlesource.com/5144
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRefactor implementation constants.
Nicolas Capens [Mon, 18 Apr 2016 16:02:39 +0000 (12:02 -0400)]
Refactor implementation constants.

Bug 19353282

Change-Id: If2eb9f2d78c3a44b720bb1f223711411b576d710
Reviewed-on: https://swiftshader-review.googlesource.com/5140
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRGB32F texture sampling fix
Alexis Hetu [Mon, 18 Apr 2016 20:27:28 +0000 (16:27 -0400)]
RGB32F texture sampling fix

A cl recently introduced the XRB32F internal format, but while it
fixed some cases where this format is used as a rendertarget, it
seems to have caused regressions in sampling. A new case has been
added in the sampling code to handle this new format properly.

Change-Id: I7aa537a410d7b68c47771a72dec487e4b4c4e8be
Reviewed-on: https://swiftshader-review.googlesource.com/5147
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed bad assert
Alexis Hetu [Mon, 18 Apr 2016 18:00:11 +0000 (14:00 -0400)]
Fixed bad assert

UInt <-> Int conversions are noop (bitwise), so it's allowed
to simply perform a move operation in that case.

Change-Id: I2078b2cf2933f5ced25b8ea81933e543a017faaf
Reviewed-on: https://swiftshader-review.googlesource.com/5143
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAllowed BGRA textures to be copied
Alexis Hetu [Mon, 18 Apr 2016 17:56:01 +0000 (13:56 -0400)]
Allowed BGRA textures to be copied

BGRA8 texture support also applies to texture copy operations.

Change-Id: Ie3920585904c67ddf1b5b308eff60bc83f9e195b
Reviewed-on: https://swiftshader-review.googlesource.com/5142
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed loading UInt textures
Alexis Hetu [Mon, 18 Apr 2016 17:40:23 +0000 (13:40 -0400)]
Fixed loading UInt textures

Fixed a copy-paste error where only half
the required number of bytes were loaded.

Change-Id: I43ea2e1b5368137e19fb6bb20c03b5c9ca10ba3b
Reviewed-on: https://swiftshader-review.googlesource.com/5141
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdding task data for transform feedback
Alexis Hetu [Thu, 7 Apr 2016 15:21:54 +0000 (11:21 -0400)]
Adding task data for transform feedback

Transform feedback requires a bit of extra data to write properly
into the transform feedback buffers. First it needs to know where
in the buffer to read, which can be derived from the vertex number
provided in vertexStart. Also, since SwiftShader always processes 3
vertices per primitive, regardless of the primitive type, transform
feedback needs to know which vertices to use, and that information
can be derived from verticesPerPrimitive.

Change-Id: I820d99949d7b2955794cc143ffb178e76dd418d7
Reviewed-on: https://swiftshader-review.googlesource.com/5062
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdded FORMAT_X32B32G32R32F as a renderable format
Alexis Hetu [Wed, 13 Apr 2016 15:40:30 +0000 (11:40 -0400)]
Added FORMAT_X32B32G32R32F as a renderable format

Added code to properly render to alphaless floating point formats.

Change-Id: I2e226fb787d8456f61a2946fb9c0d8a9dbb58243
Reviewed-on: https://swiftshader-review.googlesource.com/5128
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoValidate renderability of texture formats.
Nicolas Capens [Thu, 14 Apr 2016 18:53:24 +0000 (14:53 -0400)]
Validate renderability of texture formats.

Change-Id: I49c0f7b78a131c0d78c2cfb207bb3019b2b93a15
Reviewed-on: https://swiftshader-review.googlesource.com/5129
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix renderability test.
Nicolas Capens [Thu, 14 Apr 2016 18:18:58 +0000 (14:18 -0400)]
Fix renderability test.

Half-float formats are renderable due to GL_EXT_color_buffer_half_float.

Change-Id: I4c3716f578cb4a5dd32f2b22265df4263e9834cc
Reviewed-on: https://swiftshader-review.googlesource.com/5127
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix framebuffer attachment parameter query error.
Nicolas Capens [Thu, 14 Apr 2016 04:10:42 +0000 (00:10 -0400)]
Fix framebuffer attachment parameter query error.

OpenGL ES 2.0 expects GL_INVALID_OPERATION when querying default framebuffer
attachment parameters.

Change-Id: Ie0e0c35ad835e06b16c7aaaea48f7ec7eb64c663
Reviewed-on: https://swiftshader-review.googlesource.com/5124
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoValidate internalformat and combinations.
Nicolas Capens [Wed, 13 Apr 2016 19:26:14 +0000 (15:26 -0400)]
Validate internalformat and combinations.

Change-Id: Ibd2c6ae673be34e7a6e701454261f25658d1df22
Reviewed-on: https://swiftshader-review.googlesource.com/5122
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix error on invalid type/format combination.
Nicolas Capens [Tue, 12 Apr 2016 13:24:52 +0000 (09:24 -0400)]
Fix error on invalid type/format combination.

GL_INVALID_ENUM is for enum values that are never valid for the function.
GL_INVALID_OPERATION is expected for enum combinations that are not valid.

Change-Id: I43a6cd169303420a680e4cab15683605a8684517
Reviewed-on: https://swiftshader-review.googlesource.com/5094
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix validation of texture level.
Nicolas Capens [Tue, 12 Apr 2016 04:54:08 +0000 (00:54 -0400)]
Fix validation of texture level.

Early out checks for zero size were skipping the validation.

Change-Id: I1d8173146117be5a7a3330cf6eae46c2ef8231ff
Reviewed-on: https://swiftshader-review.googlesource.com/5093
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix local variable hides function parameter for GLSL ES 1.0
Nicolas Capens [Thu, 7 Apr 2016 19:12:39 +0000 (15:12 -0400)]
Fix local variable hides function parameter for GLSL ES 1.0

GLSL ES 1.0 specifies that "a function body has a scope nested inside
the function’s definition". For GLSL ES 3.0, they form a single scope.
Both specs use the compound_statement_no_new_scope rule. This change
respects that while supporting both behaviors. It does not impact legacy
content since it makes things more permissive.

Change-Id: Ica40fbf4d24d441ca2288fe5d43c288161e16b89
Reviewed-on: https://swiftshader-review.googlesource.com/5055
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdded floating point formats to glCopyTexImage2D
Alexis Hetu [Wed, 13 Apr 2016 14:30:03 +0000 (10:30 -0400)]
Added floating point formats to glCopyTexImage2D

Added floating point formats to validateColorBufferFormat,
which is used by glCopyTexImage2D, since it was a missing
part of the previously added floating point extensions.

From the extension spec:
https://www.khronos.org/registry/gles/extensions/EXT/EXT_color_buffer_half_float.txt
"9. Should CopyTex[Sub]Image be supported for floating-point formats? [...] Yes."

Change-Id: Ie14d8afd352b004e8a2400cfef16facdeab94e33
Reviewed-on: https://swiftshader-review.googlesource.com/5110
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoTransform feedback primitives written query fix
Alexis Hetu [Thu, 7 Apr 2016 15:05:57 +0000 (11:05 -0400)]
Transform feedback primitives written query fix

pixelProgress[cluster].processedPrimitives could have been cleared
between the moment where it has been written and where it is read,
so I added a local variable to prevent this issue.

Change-Id: I495ed5c9e845c276890d6193b2fe4b8208f993d1
Reviewed-on: https://swiftshader-review.googlesource.com/5061
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRenderer side code to lock/unlock transform feedback data
Alexis Hetu [Thu, 7 Apr 2016 14:48:31 +0000 (10:48 -0400)]
Renderer side code to lock/unlock transform feedback data

Added variables and function calls to lock/unlock transform
feedback data used for reading the selected transform
feedback varying variables out of the vertex shader.

Also fixed uniform buffer unlocking potential race condition.

Change-Id: I98790fc36fdf8674506d924b2f21b3e68892811a
Reviewed-on: https://swiftshader-review.googlesource.com/5060
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed transformFeedbackEnabled in Context
Alexis Hetu [Thu, 7 Apr 2016 15:33:13 +0000 (11:33 -0400)]
Fixed transformFeedbackEnabled in Context

transformFeedbackEnabled represents flags, not a single value,
so it should not have been of type bool.

Change-Id: I723660a84e0ecfd42d361511d8b445d40d6d31a8
Reviewed-on: https://swiftshader-review.googlesource.com/5063
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix min/max constant folding.
Nicolas Capens [Sun, 10 Apr 2016 03:45:12 +0000 (23:45 -0400)]
Fix min/max constant folding.

Change-Id: I9ac2051f5cc8703e804b86c0006bb1b9fe48f521
Reviewed-on: https://swiftshader-review.googlesource.com/5082
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix constant expression vector indexing.
Nicolas Capens [Sun, 10 Apr 2016 05:54:50 +0000 (01:54 -0400)]
Fix constant expression vector indexing.

Change-Id: If3b61ad65f1f1d6687890bd8715b2a534c78a353
Reviewed-on: https://swiftshader-review.googlesource.com/5081
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix unary operator return type.
Nicolas Capens [Sun, 10 Apr 2016 05:53:59 +0000 (01:53 -0400)]
Fix unary operator return type.

Change-Id: I68322e6626953023c3af97325f085bc33ff1b7c6
Reviewed-on: https://swiftshader-review.googlesource.com/5080
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoPropagate constness.
Nicolas Capens [Sun, 10 Apr 2016 03:45:12 +0000 (23:45 -0400)]
Propagate constness.

Change-Id: I38ccac08347592356e0225b6eb90517e20394909
Reviewed-on: https://swiftshader-review.googlesource.com/5079
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix constant folding of vector compares.
Nicolas Capens [Tue, 5 Apr 2016 21:18:24 +0000 (17:18 -0400)]
Fix constant folding of vector compares.

Change-Id: If17c2429d38158663c2436e374691a460e3d588c
Reviewed-on: https://swiftshader-review.googlesource.com/5064
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoHandle constant expressions that have not been constant folded.
Nicolas Capens [Sun, 10 Apr 2016 04:30:02 +0000 (00:30 -0400)]
Handle constant expressions that have not been constant folded.

Change-Id: I7dd1e6db9a4cee64cb10fb27373d77038b2af63e
Reviewed-on: https://swiftshader-review.googlesource.com/5078
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUniform block register allocation
Alexis Hetu [Thu, 7 Apr 2016 14:29:41 +0000 (10:29 -0400)]
Uniform block register allocation

Uniform blocks members, when unnamed blocks are used, are
used in glsl only with the member's name, without any
reference to the block itself. When this happens, we still
need the whole block to be allocated as one contiguous
structure in the registers. To do that, whenever a member
of an unnamed block is first used, the whole block is
allocated. Also, whenever any member of an unnamed block
attempts to allocate a register, it first verifies if the
parent block has already been allocated. So this means that
both allocation and lookup must be done through the parent
block when dealing with unnamed block members.

Change-Id: Ib11eaa1ee052d32252f32997eb5f650a9765533d
Reviewed-on: https://swiftshader-review.googlesource.com/5059
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoHalf float packing and unpacking intrinsic functions
Alexis Hetu [Wed, 6 Apr 2016 22:05:00 +0000 (18:05 -0400)]
Half float packing and unpacking intrinsic functions

Implementation for packHalf2x16, unpackHalf2x16 intrinsic functions.

Change-Id: I55212f8bc2ecd30e0108858d74117c3cf60733ed
Reviewed-on: https://swiftshader-review.googlesource.com/5056
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUniform buffer uniform unpacking utility function
Alexis Hetu [Mon, 4 Apr 2016 19:41:51 +0000 (15:41 -0400)]
Uniform buffer uniform unpacking utility function

When data is packed into uniform blocks, some data isn't formatted in
a way that fits how data is usually represented, which is the case
for booleans and row major matrices. In these 2 cases, the variables
are unpacked into temporaries before being used. Booleans can be any
integer value and any non-zero value represents "true", so the value
in the uniform buffer has to go through an int to bool conversion
before being used. For row major matrices, a given register of that
matrix has to be transposed into a temporary before being used.

Change-Id: I0e001ceff2ce9be9a3570171e184586afc48c02d
Reviewed-on: https://swiftshader-review.googlesource.com/5040
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoBuild fix
Alexis Hetu [Wed, 6 Apr 2016 18:49:07 +0000 (14:49 -0400)]
Build fix

libGL was broken (probably by the recent namespace change, not sure)

Change-Id: I27e461f82a652cb8f9a646ab1d4091195efc454b
Reviewed-on: https://swiftshader-review.googlesource.com/5054
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRenaming UniformBufferBinding to BufferBinding
Alexis Hetu [Mon, 4 Apr 2016 20:30:15 +0000 (16:30 -0400)]
Renaming UniformBufferBinding to BufferBinding

UniformBufferBinding was used for both uniform buffers
and transform feedback buffers, so the uniform buffer
specific name no longer made sense.

Change-Id: I36a5b774e780460fa090c6c611cb8cb475ef2ced
Reviewed-on: https://swiftshader-review.googlesource.com/5042
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix potential division by zero.
Nicolas Capens [Fri, 12 Feb 2016 22:10:58 +0000 (17:10 -0500)]
Fix potential division by zero.

Bug 25351344

Change-Id: Iaf0ce657a3a98c9b70902240340ed5f3f8076281
Reviewed-on: https://swiftshader-review.googlesource.com/4769
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix support for all GL_EXT_read_format_bgra formats.
Nicolas Capens [Fri, 12 Feb 2016 22:06:31 +0000 (17:06 -0500)]
Fix support for all GL_EXT_read_format_bgra formats.

Change-Id: I9b3977959aea8bd2711ebd94e06c0e09376d4d6e
Reviewed-on: https://swiftshader-review.googlesource.com/4768
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoSigned and unsigned integer packing and unpacking intrinsic functions
Alexis Hetu [Wed, 6 Apr 2016 17:03:38 +0000 (13:03 -0400)]
Signed and unsigned integer packing and unpacking intrinsic functions

Implementation for packSnorm2x16, unpackSnorm2x16, packUnorm2x16 and
unpackUnorm2x16 intrinsic functions.

Change-Id: I6b9e2584c1aaad8011f026c217d8ad3f72e9ba45
Reviewed-on: https://swiftshader-review.googlesource.com/5053
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoTransform Feedback buffer locking utility functions
Alexis Hetu [Mon, 4 Apr 2016 20:14:58 +0000 (16:14 -0400)]
Transform Feedback buffer locking utility functions

Similarly to what had been done for uniform buffers,
transform feedback buffers require locking/unlocking
functions so that the Renderer can access these resources.

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