OSDN Git Service

android-x86/external-swiftshader.git
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>
8 years agoFix scaling of float color to RGB565.
Nicolas Capens [Tue, 5 Apr 2016 14:51:45 +0000 (10:51 -0400)]
Fix scaling of float color to RGB565.

The scaling factors ensure that the components are rounded correctly even after
alpha blending, which may multiply colors by colors.

Bug 24332884

Change-Id: Ib75602e89996b2fd1a319a132a681295fb2a18a6
Reviewed-on: https://swiftshader-review.googlesource.com/5048
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoPerform texture coordinate projection at shader assembly level.
Nicolas Capens [Mon, 4 Apr 2016 21:04:58 +0000 (17:04 -0400)]
Perform texture coordinate projection at shader assembly level.

Change-Id: Ia94eb950d8d3ec4562f9f2e57d8d7ba27a41d16c
Reviewed-on: https://swiftshader-review.googlesource.com/5044
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRefactor sampler LOD calculation method into an enum.
Nicolas Capens [Mon, 4 Apr 2016 15:13:24 +0000 (11:13 -0400)]
Refactor sampler LOD calculation method into an enum.

Change-Id: I0beed96cd68608ce07aec0b11f14d6f61e67e53d
Reviewed-on: https://swiftshader-review.googlesource.com/5034
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUse a regular STL map instead of unordered_map.
Nicolas Capens [Tue, 5 Apr 2016 00:09:47 +0000 (20:09 -0400)]
Use a regular STL map instead of unordered_map.

Older branches of Android don't support std::unordered_map.

Bug 28006371

Change-Id: I162249db3b7ee9537c7143768c6c1ec216392cba
Reviewed-on: https://swiftshader-review.googlesource.com/5045
Reviewed-by: Bo Hu <bohu@google.com>
Tested-by: Nicolas Capens <capn@google.com>
(cherry picked from commit db4fee2752c3b440933fd89078e35b3781c211ce)
Reviewed-on: https://swiftshader-review.googlesource.com/5047
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoNew uniform block related utility functions
Alexis Hetu [Thu, 4 Feb 2016 16:53:16 +0000 (11:53 -0500)]
New uniform block related utility functions

This cl adds 2 new utility function and adds one use of
these in the argument() function.
- getBlockId() finds a block by name and returns its ID
- getTypedMemberInfo() finds which block member matches
  a certain register index and returns the block member's
  packing information and type. If the register falls
  within a block member (as a sub-register of a matrix or
  an array), the base offset of the block member is
  returned, along with the register index, which will then
  be used within the argument() function to compute the
  final parameter index.

Change-Id: Ic0edcb3e6772cdb854301e3d0b400775e7ee72c0
Reviewed-on: https://swiftshader-review.googlesource.com/4682
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 performing dynamic component writes on vectors only.
Nicolas Capens [Fri, 1 Apr 2016 19:01:36 +0000 (15:01 -0400)]
Fix performing dynamic component writes on vectors only.

Change-Id: Ia204b708239ae51022f163053e4d054e617695b9
Reviewed-on: https://swiftshader-review.googlesource.com/5031
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 scalar times matrix.
Nicolas Capens [Fri, 1 Apr 2016 17:30:37 +0000 (13:30 -0400)]
Fix scalar times matrix.

Change-Id: I9b46031f57b0cf49428e295b06702099ffef7f01
Reviewed-on: https://swiftshader-review.googlesource.com/5030
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 short-circuiting in preprocessor.
Nicolas Capens [Fri, 1 Apr 2016 15:00:13 +0000 (11:00 -0400)]
Fix short-circuiting in preprocessor.

The 2nd operand in a logical and ('&&') operation is evaluated if and only if
the 1st operand evaluates to non-zero. The 2nd operand in a logical or ('||')
operation is evaluated if and only if the 1st operand evaluates to zero.
If an operand is not evaluated, the presence of undefined identifiers in the
operand will not cause an error.

Integer overflow in short-circuited expressions are still and error because
it is part of lexical analysis.

Change-Id: I6ff5e0e9874551d2e40ab4e4ad34dc36cfa703e5
Reviewed-on: https://swiftshader-review.googlesource.com/5020
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 treating undefined preprocessor identifiers as error.
Nicolas Capens [Tue, 29 Mar 2016 21:27:04 +0000 (17:27 -0400)]
Fix treating undefined preprocessor identifiers as error.

Change-Id: Ifa9db4ab541d9421dddfe6b09571d8b5d38a479d
Reviewed-on: https://swiftshader-review.googlesource.com/5011
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUse namespaces for context owned objects.
Nicolas Capens [Tue, 29 Mar 2016 03:21:31 +0000 (23:21 -0400)]
Use namespaces for context owned objects.

Bug 19219444

Change-Id: I9606dfb30693a15a06896d83888022ccbaa8db2e
Reviewed-on: https://swiftshader-review.googlesource.com/5010
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUse a shared namespace for shader and program objects.
Nicolas Capens [Wed, 23 Mar 2016 20:50:41 +0000 (16:50 -0400)]
Use a shared namespace for shader and program objects.

Bug 19219444

Change-Id: I5eb797eed31ab233866e5c23d83298d3c57091a9
Reviewed-on: https://swiftshader-review.googlesource.com/4989
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUse the namespace for storing objects.
Nicolas Capens [Wed, 23 Mar 2016 06:08:57 +0000 (02:08 -0400)]
Use the namespace for storing objects.

Bug 19219444

Change-Id: I277d80be47d2057f31559c5058e2f6ea422dacfd
Reviewed-on: https://swiftshader-review.googlesource.com/4987
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 reserving user picked object names.
Nicolas Capens [Wed, 23 Mar 2016 04:26:46 +0000 (00:26 -0400)]
Fix reserving user picked object names.

Bug 19219444

Change-Id: Ic0e3c5a37174917a541452bab9f92738bc766044
Reviewed-on: https://swiftshader-review.googlesource.com/4986
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAllocate object names into an unordered set.
Nicolas Capens [Wed, 23 Mar 2016 03:58:42 +0000 (23:58 -0400)]
Allocate object names into an unordered set.

Bug 19219444

Change-Id: Ic100f0bfe64b1f92f13c4f6a413e30095b7b5a6c
Reviewed-on: https://swiftshader-review.googlesource.com/4985
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRefactor NameSpace into a template class.
Nicolas Capens [Wed, 23 Mar 2016 03:26:24 +0000 (23:26 -0400)]
Refactor NameSpace into a template class.

Bug 19219444

Change-Id: Id4b209f491b3a3dde716118309cbc8122feb25d0
Reviewed-on: https://swiftshader-review.googlesource.com/4984
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoDon't blit to NULL format buffers.
Nicolas Capens [Thu, 24 Mar 2016 15:51:05 +0000 (11:51 -0400)]
Don't blit to NULL format buffers.

This was causing crashes in Direct3D 9 applications using the "NULL" FOURCC
used as a render target format for rendering to depth only.

Bug 25351344

Change-Id: I69c2e0869f859489321c26dba56b7a80a2ed2f28
Reviewed-on: https://swiftshader-review.googlesource.com/5000
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRemoving superfluous element in semantic array
Alexis Hetu [Wed, 23 Mar 2016 20:22:14 +0000 (16:22 -0400)]
Removing superfluous element in semantic array

The semantic was of size 11, but the 11th member, meant for fog,
was never used, so the array was resized to size 10.

Change-Id: I2afbc2bc52981eb1002252cc3fb89c6954314c23
Reviewed-on: https://swiftshader-review.googlesource.com/4988
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoUse the framebuffer object's stencil attachment.
Nicolas Capens [Tue, 22 Mar 2016 14:44:57 +0000 (10:44 -0400)]
Use the framebuffer object's stencil attachment.

Bug 27460431

Change-Id: Ic030624cc34b31519882e54497457a1b92eaac45
Reviewed-on: https://swiftshader-review.googlesource.com/4981
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRefactor buffer clearing.
Nicolas Capens [Mon, 21 Mar 2016 20:37:44 +0000 (16:37 -0400)]
Refactor buffer clearing.

Bug 27460431

Change-Id: I90de3285c86c0d3187969270dcbd78a8b02feee9
Reviewed-on: https://swiftshader-review.googlesource.com/4978
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoReduce math function duplication.
Nicolas Capens [Mon, 21 Mar 2016 20:59:03 +0000 (16:59 -0400)]
Reduce math function duplication.

Change-Id: If0fe05eff397c8d88753fb2b1a1852722c73602e
Reviewed-on: https://swiftshader-review.googlesource.com/4979
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoBind depth and stencil buffers separately.
Nicolas Capens [Mon, 21 Mar 2016 18:27:31 +0000 (14:27 -0400)]
Bind depth and stencil buffers separately.

Bug 27460431

Change-Id: Ice854b6faec09dc5f2cbdc2a5c3ffba9a73bfb70
Reviewed-on: https://swiftshader-review.googlesource.com/4977
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 separate depth and stencil buffers.
Nicolas Capens [Mon, 21 Mar 2016 18:14:14 +0000 (14:14 -0400)]
Support separate depth and stencil buffers.

Bug 27460431

Change-Id: If11e16597b3fdfbfa6f1f2282e287b302b541f63
Reviewed-on: https://swiftshader-review.googlesource.com/4976
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 support for more depth types
Alexis Hetu [Thu, 11 Feb 2016 20:52:49 +0000 (15:52 -0500)]
Added support for more depth types

Added format arguments to DepthBuffer/DepthStencilBuffer
constructors and added existing types to type conversion
functions so that more than one depth/stencil format may
be supported.

Change-Id: Ifd60b896e93a1ba4d05a30f123a1322cdd5254a5
Reviewed-on: https://swiftshader-review.googlesource.com/4766
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRemove FORMAT_A1R5G5B5 from EGL configs.
Nicolas Capens [Wed, 16 Mar 2016 14:31:51 +0000 (10:31 -0400)]
Remove FORMAT_A1R5G5B5 from EGL configs.

This is not a natively supported pixel format, thus causing a performance
penalty for conversion. It is not supported by Nexus 4 or 5. Android has
deprecated both 4444 and 5551 as HAL formats. Also, UNSIGNED_SHORT_5_5_5_1
has the alpha component in the least significant bit, whereas A1R5G5B5 has
alpha as the most significant bit.

Bug 27690616

Change-Id: I350f0e780cd87b8a626e2c8914a65c61dbf63258
Reviewed-on: https://swiftshader-review.googlesource.com/4960
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years ago32-bit integer vertex attribute
Alexis Hetu [Fri, 18 Mar 2016 19:00:09 +0000 (15:00 -0400)]
32-bit integer vertex attribute

Added 32-bit signed and unsigned vertex attribute

Change-Id: Ibbf9c035294584db71713ae7aeca36b32a8564c0
Reviewed-on: https://swiftshader-review.googlesource.com/4974
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed some unary operators
Alexis Hetu [Fri, 18 Mar 2016 14:56:08 +0000 (10:56 -0400)]
Fixed some unary operators

There were a few issues in unary operators:
- Many were not compiling because the promote function had not
  been adjusted to take the new builtin functions into account
- abs and sign had not been implemented for int
- For the integer abs version, used pabsd. Removed the extra
  argument, which seemed unnecessary (abs should have 1 input,
  1 output, AFAIK).

Change-Id: If02c5040438e8c45c99fc7b3c55107448c85cf58
Reviewed-on: https://swiftshader-review.googlesource.com/4970
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdd the OGLESBasicTnL sample for Linux.
Nicolas Capens [Wed, 9 Mar 2016 15:09:28 +0000 (10:09 -0500)]
Add the OGLESBasicTnL sample for Linux.

Change-Id: I0c0a9bc99e8cf9ea92919c77ef6c05b1439f40da
Reviewed-on: https://swiftshader-review.googlesource.com/4941
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 jb-mr1-gce-dev build.
Nicolas Capens [Wed, 10 Feb 2016 02:17:32 +0000 (21:17 -0500)]
Fix jb-mr1-gce-dev build.

Change-Id: Iec28db332fe328603a68c3073403bfbe6067bf44
Reviewed-on: https://swiftshader-review.googlesource.com/4735
Reviewed-by: Greg Hartman <ghartman@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
(cherry picked from commit 5d0bad6eea31ee25437877c11e91c1b39be07030)
Reviewed-on: https://swiftshader-review.googlesource.com/4734
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix draw race condition regression.
Nicolas Capens [Thu, 10 Mar 2016 05:56:16 +0000 (00:56 -0500)]
Fix draw race condition regression.

Change-Id: Idcf7c19c2467edf941a8a426078b6f7d7779ab12
Reviewed-on: https://swiftshader-review.googlesource.com/4943
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoDisable SIGXCPU signal handling by LLVM.
Nicolas Capens [Wed, 9 Mar 2016 04:14:14 +0000 (23:14 -0500)]
Disable SIGXCPU signal handling by LLVM.

SIGXCPU is used by Mono, the C# framework used by the Unity game engine.
LLVM does not make any setrlimit(RLIMIT_CPU) calls, so when the SIGXCPU
signal is raised it is not up to LLVM to decide how to handle it.

Bug 23017372

Change-Id: I292b0eac527c5efd66022e6f75bbcb68879a30a4
Reviewed-on: https://swiftshader-review.googlesource.com/4940
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoTransform feedback query implementation
Alexis Hetu [Wed, 2 Mar 2016 20:59:51 +0000 (15:59 -0500)]
Transform feedback query implementation

This is a first implementation of the transform feedback
primitives written query.

It passes available related dEQP tests (more tests will be
available when transform feedback is fully implemented).

Change-Id: Iaee97e3e2e853174b7f22836f72dabede1ed04c1
Reviewed-on: https://swiftshader-review.googlesource.com/4912
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRasterizer discard implementation
Alexis Hetu [Mon, 22 Feb 2016 16:42:39 +0000 (11:42 -0500)]
Rasterizer discard implementation

Implemented rasterizer discard by not using the SetupRoutine
and always returning 0 when rasterizer discard is enabled.
Also guarded all clear calls with a check for rasterizer
discard. Passes all rasterizer discard related dEQP tests.

Change-Id: I1e5c107e3dba550f7a5b01eb302ff51bdac303dc
Reviewed-on: https://swiftshader-review.googlesource.com/4876
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdd missing operation.
Daniel Kenji Toyama [Mon, 7 Mar 2016 20:44:24 +0000 (15:44 -0500)]
Add missing operation.

Bug 27227050

Change-Id: Id8b6357f25888801dec9bbedc5855faa58def62d
Reviewed-on: https://swiftshader-review.googlesource.com/4920
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Daniel Toyama <kenjitoyama@google.com>
8 years agoFixed color clear for non multisampled rendertargets
Alexis Hetu [Wed, 2 Mar 2016 22:24:04 +0000 (17:24 -0500)]
Fixed color clear for non multisampled rendertargets

Bug 27454381

Change-Id: Ie59adfa5e5faf08a09427c993775e7d2892d311b
Reviewed-on: https://swiftshader-review.googlesource.com/4913
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 Android emulator library loading on Windows.
Nicolas Capens [Tue, 1 Mar 2016 16:37:10 +0000 (11:37 -0500)]
Fix Android emulator library loading on Windows.

Change-Id: I1eb8764c622ffd99a5937fe539bf78dc01d77f23
Reviewed-on: https://swiftshader-review.googlesource.com/4911
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFixed color clear on multisampled rendertargets
Alexis Hetu [Mon, 29 Feb 2016 22:37:24 +0000 (17:37 -0500)]
Fixed color clear on multisampled rendertargets

Only the 1st sample's buffer of multisampled buffers was getting
cleared instead of clearing all the samples' buffers, which led
to incorrect results. Added a loop to fix the behavior.

Change-Id: If22ebf2df61ae6afbc4c2975a9baee3c18a2492b
Reviewed-on: https://swiftshader-review.googlesource.com/4910
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoCorrect reciprocal approximation for power-of-two values.
Nicolas Capens [Fri, 26 Feb 2016 04:58:33 +0000 (23:58 -0500)]
Correct reciprocal approximation for power-of-two values.

Intel's reciprocal approximation instruction is not exact for power-of-two
values. It provides 12 bits of mantissa precision and keeps a balance between
positive and negative errors, but the reciprocal of 2^x is not 2^-x. This
affects conformance tests which expect varyings not to be affected by the
perspective division. Correct for this by multiplying by the inverse.

Bug 27165393

Change-Id: Ie52ec511a14a4f447adc47ce9c875bbad03cd274
Reviewed-on: https://swiftshader-review.googlesource.com/4903
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoParser cleanup
Alexis Hetu [Wed, 24 Feb 2016 21:46:13 +0000 (16:46 -0500)]
Parser cleanup

Ported some changes from Angle. Added 4 new functions to
ParserHelper to remove some code from glslang.y. Added
some extra checks regarding qualifiers and precision.

Change-Id: I2856a764749bef0df500891eb4c003211e634673
Reviewed-on: https://swiftshader-review.googlesource.com/4900
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix evaluating empty loop condition to true.
Nicolas Capens [Thu, 25 Feb 2016 14:45:24 +0000 (09:45 -0500)]
Fix evaluating empty loop condition to true.

Bug 27351438

Change-Id: If15f0f91931f34af6e78ad773036b91ff5d57d01
Reviewed-on: https://swiftshader-review.googlesource.com/4902
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 FenceSync object ref count
Alexis Hetu [Thu, 25 Feb 2016 14:41:50 +0000 (09:41 -0500)]
Fixed FenceSync object ref count

FenceSync objects are ref counted objects, so the are deleted
using the release() method. This means that they need to be
refed at creation (since we only store the pointer inside the
map), otherwise we'll hit the assert at deletion.

FenceSync objects are currently only ever refed once (at creation)
and unrefed once (at deletion), but are not fully implemented yet.

Change-Id: Ie693ace8895b6140ae96f9325d5c48951c7e9730
Reviewed-on: https://swiftshader-review.googlesource.com/4901
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
8 years agoRemove unneeded libraries
Greg Hartman [Wed, 24 Feb 2016 04:08:48 +0000 (20:08 -0800)]
Remove unneeded libraries

Change-Id: I827b663c9e3018162b192f267fc038ada4b5ac36
Reviewed-on: https://swiftshader-review.googlesource.com/4879
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoImplement support for separate minification/magnification filters.
Nicolas Capens [Mon, 15 Feb 2016 15:31:49 +0000 (10:31 -0500)]
Implement support for separate minification/magnification filters.

Bug 22373253

Change-Id: Iaa30a341e5eaa58c2ef531fce503631828c5ee9d
Reviewed-on: https://swiftshader-review.googlesource.com/4757
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 Android build failure
Alexis Hetu [Tue, 23 Feb 2016 13:06:33 +0000 (08:06 -0500)]
Fixed Android build failure

Added missing .c_str() to convert the string object
into a character string.

Change-Id: I3810f67a2462f7717fdec61679e09a191b043adf
Reviewed-on: https://swiftshader-review.googlesource.com/4878
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed GLES3.0 attribute locations
Alexis Hetu [Mon, 22 Feb 2016 20:58:16 +0000 (15:58 -0500)]
Fixed GLES3.0 attribute locations

Previously, it was allowed for multiple attributes to share a
location or overlap, but in ES3.0, it should cause a linking error.

Passes WebGL conformance tests.

Change-Id: I1c65b0cb31a04680a25ac54d20f6ee0d869251b9
Reviewed-on: https://swiftshader-review.googlesource.com/4877
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoDefault framebuffer type fix
Alexis Hetu [Thu, 11 Feb 2016 20:26:40 +0000 (15:26 -0500)]
Default framebuffer type fix

In OpenGL ES 3.0, the default framebuffer should use
GL_FRAMEBUFFER_DEFAULT instead of GL_RENDERBUFFER for
default buffer. I also added the Framebuffer::IsRenderbuffer()
utility function to make the transition easier.

Change-Id: I041e610738a4a656555ae7fa7ba41ba68b1fe9ea
Reviewed-on: https://swiftshader-review.googlesource.com/4763
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoPacking fix
Alexis Hetu [Mon, 8 Feb 2016 16:08:03 +0000 (11:08 -0500)]
Packing fix

Unified and fixed packing and unpacking computations.

Change-Id: I1ea2bcf28945a9f105152a6836f11bcb2859750c
Reviewed-on: https://swiftshader-review.googlesource.com/4715
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed setting Renderbuffer's layer and level
Alexis Hetu [Thu, 11 Feb 2016 20:41:27 +0000 (15:41 -0500)]
Fixed setting Renderbuffer's layer and level

The original code allowed Renderbuffer objects to select
layer and level at construction time, but after that point
these parameters were not modifiable. This cl adds the code
to modify layer and/or level when requested.

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