OSDN Git Service

android-x86/external-swiftshader.git
8 years agoAdd OSX version of OGLES2HelloAPI sample.
Corentin Wallez [Thu, 10 Dec 2015 20:59:28 +0000 (15:59 -0500)]
Add OSX version of OGLES2HelloAPI sample.

Change-Id: I2f8511486ca3b040b257c2a763abb1bd0647d0e6
Reviewed-on: https://swiftshader-review.googlesource.com/4441
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoMake SwiftShader compile on Mac (with unimplemented functions)
Corentin Wallez [Wed, 9 Dec 2015 20:22:08 +0000 (15:22 -0500)]
Make SwiftShader compile on Mac (with unimplemented functions)

Change-Id: Iaef054314fb27632513397412ca9dc22b67a70ce
Reviewed-on: https://swiftshader-review.googlesource.com/4380
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoAdd LLVM config headers for OSX.
Corentin Wallez [Wed, 9 Dec 2015 19:42:19 +0000 (14:42 -0500)]
Add LLVM config headers for OSX.

Change-Id: I08d5d852322a75c8b3a0d6932f229da7022a82f1
Reviewed-on: https://swiftshader-review.googlesource.com/4379
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoAdd a CMakelists.txt to compile on Linux and Mac
Corentin Wallez [Wed, 9 Dec 2015 18:49:40 +0000 (13:49 -0500)]
Add a CMakelists.txt to compile on Linux and Mac

Windows support is still WIP

Change-Id: I5fd5bcda4fad754c0ce73698eddbe73e538f56df
Reviewed-on: https://swiftshader-review.googlesource.com/4370
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoStore the native display as an opaque pointer.
Nicolas Capens [Fri, 11 Dec 2015 22:24:40 +0000 (17:24 -0500)]
Store the native display as an opaque pointer.

Bug 18314459

Change-Id: I63e56d626bd1838803d1de71b417b7e40242c5e9
Reviewed-on: https://swiftshader-review.googlesource.com/4390
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix missing abs() declaration.
Nicolas Capens [Mon, 21 Dec 2015 20:48:31 +0000 (15:48 -0500)]
Fix missing abs() declaration.

Change-Id: I7e4ceea2a45e8767881094de8b69b4d3aadab158
Reviewed-on: https://swiftshader-review.googlesource.com/4354
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoRemove unnecessary header includes.
Nicolas Capens [Mon, 14 Dec 2015 18:18:11 +0000 (13:18 -0500)]
Remove unnecessary header includes.

Change-Id: If1a8a581a63e801ec3855c554f10dabd67e8a4fd
Reviewed-on: https://swiftshader-review.googlesource.com/4400
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoImplemented support for RGB10_A2 in blitter
Alexis Hetu [Thu, 17 Dec 2015 16:09:36 +0000 (11:09 -0500)]
Implemented support for RGB10_A2 in blitter

Added RGB10_A2 implementation in the Blitter and cases in
related Surface utility functions.

Change-Id: I2b1a9cdc1acc605085fb0f853741cc2f75bf1c9b
Reviewed-on: https://swiftshader-review.googlesource.com/4420
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoSending magnification filter info to the sampler
Alexis Hetu [Thu, 10 Dec 2015 13:42:02 +0000 (08:42 -0500)]
Sending magnification filter info to the sampler

Currently, the magnification filter information is ignored
by SwiftShader. In order to fix it, the 1st step is simply
to make the sampler aware of this information. After this,
a subsequent cl using the duvdxy computed in computeLod
will choose which filter to use (if they are different).

Change-Id: Idc8636c3d981c944815094f23e443725bed4cf27
Reviewed-on: https://swiftshader-review.googlesource.com/4382
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed format validations
Alexis Hetu [Thu, 15 Oct 2015 21:22:57 +0000 (17:22 -0400)]
Fixed format validations

Format validations were failing if the exact same format
wasn't used between different texture related calls to the
same texture, even when the formats were equivalent, so I
added a GetSizedInternalFormat function based on a format
map (courtesy of Angle). The validation checks were also
unified in utilities.cpp and used wherever texture formats
were used, to make sure Image objects used in Texture
objects always use the sized format, so that format
comparisons work properly.

Change-Id: I72fc8fb1b0f135ac679c274866e5b8e223541e7f
Reviewed-on: https://swiftshader-review.googlesource.com/4082
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoBlitter int to int copy fix
Alexis Hetu [Wed, 16 Dec 2015 21:54:32 +0000 (16:54 -0500)]
Blitter int to int copy fix

Integer to integer types copy operations were failing due
to a missing assignment when calling the Insert function
and bad offsets on 16 and 32 bit component types.

Change-Id: I2db55e9b6a284f8349e8fef0451255ee33be5837
Reviewed-on: https://swiftshader-review.googlesource.com/4410
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed stencil clear
Alexis Hetu [Thu, 3 Dec 2015 19:23:10 +0000 (14:23 -0500)]
Fixed stencil clear

Fixed a few mistakes in the stencil clearing code to fix both
masking and scissoring. Also added a few variable in both the
depth clearing code and stencil clearing code to make them
more readable.

Bug 25971463

Change-Id: If33e2b0685fd35ef2edd31c56aea088cfbf2b430
Reviewed-on: https://swiftshader-review.googlesource.com/4335
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed blitter operation from alphaless types
Alexis Hetu [Mon, 14 Dec 2015 22:33:04 +0000 (17:33 -0500)]
Fixed blitter operation from alphaless types

Some types without alpha were not correctly setting the
alpha value, so copying to a type with alpha was causing
the image to not appear (due to it being almost completely
transparent).

Change-Id: Ib12c291bd5c51628e0579285731033372656f6a0
Reviewed-on: https://swiftshader-review.googlesource.com/4391
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
8 years agoAdded new extensions
Alexis Hetu [Fri, 4 Dec 2015 16:16:35 +0000 (11:16 -0500)]
Added new extensions

The new extensions are:
- GL_OES_framebuffer_object (with extra exports)
- GL_OES_depth24
- GL_OES_depth32
- GL_EXT_color_buffer_half_float

These were mostly supported already with the GLES3 related changes,
so only a few minor changes were required.

Change-Id: Iab6e94043cfdabb8ad74e526f44f7bd9d57c267f
Reviewed-on: https://swiftshader-review.googlesource.com/4342
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
8 years agoUpdate eglplatform.h to latest Khronos version.
Nicolas Capens [Wed, 9 Dec 2015 21:17:25 +0000 (16:17 -0500)]
Update eglplatform.h to latest Khronos version.

We need this to define the native EGL types for Apple.

Change-Id: Iba492ea863fffd3649c8f7a3b7ca7453e12c3772
Reviewed-on: https://swiftshader-review.googlesource.com/4381
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoEnabled 2D array textures
Alexis Hetu [Tue, 1 Dec 2015 20:13:23 +0000 (15:13 -0500)]
Enabled 2D array textures

- Implemented mipmap generation and completeness checks for
  Texture2DArray.
- Fixed texture parameters setters and getters along with
  mipmap generation functions to use the proper 2D array
  texture instead of the 3D texture for 2D array textures.
- Enabled the same path as 3D texture for 2D array textures
  in the sampler.
- Added an address function for the w component, which
  simply clamps the rounded value for 2D array textures and
  adapted SamplerCore::computeIndices to this new behavior.

Change-Id: Ida0659afac75330bfd9af4052cfd2625c729f9ef
Reviewed-on: https://swiftshader-review.googlesource.com/4310
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUse stlport prior to Marshmallow.
Nicolas Capens [Tue, 8 Dec 2015 01:58:40 +0000 (20:58 -0500)]
Use stlport prior to Marshmallow.

Change-Id: I83294568a5725e95fcf2d7490336bead35517bdf
Reviewed-on: https://swiftshader-review.googlesource.com/4362
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFramebuffer completeness multisample fix
Alexis Hetu [Tue, 8 Dec 2015 16:24:21 +0000 (11:24 -0500)]
Framebuffer completeness multisample fix

Framebuffer completeness, usually verified through
glCheckFramebufferStatus, should return
GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE when the number of
samples is not the same for all attached renderbuffers.

Change-Id: I8d29895c6d4ded26847ce47fbd2581bbf06ed1bf
Reviewed-on: https://swiftshader-review.googlesource.com/4363
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFramebufferTextureLayer fix
Alexis Hetu [Fri, 4 Dec 2015 22:12:35 +0000 (17:12 -0500)]
FramebufferTextureLayer fix

Fixed a few things related to FramebufferTextureLayer:
- Added layer validation to make sure it does not exceed
  the size of the 3D texture's or 2D array's depth.
- Fixed frambuffer target / texture target confusion.
- Removed bad validation.
- Fixed last 2 arguments of set[insert type]Buffer calls
  (layer and level) which were inverted.

Change-Id: Ie1f2cb595d8b9abfee27bcf834c535f7e023e3ee
Reviewed-on: https://swiftshader-review.googlesource.com/4343
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRemove unused header.
Nicolas Capens [Sat, 5 Dec 2015 04:42:19 +0000 (23:42 -0500)]
Remove unused header.

Change-Id: I2bd7c62b0923c855327fdb105eb22ef4655ea8ac
Reviewed-on: https://swiftshader-review.googlesource.com/4344
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFixes for JBMR0 compile (API 16)
Greg Hartman [Wed, 2 Dec 2015 04:07:21 +0000 (20:07 -0800)]
Fixes for JBMR0 compile (API 16)

Change-Id: Ibb2ebd66116f3dfd0008217153006bd6c7a49b9e
Reviewed-on: https://swiftshader-review.googlesource.com/4322
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoRemove legacy build script.
Nicolas Capens [Fri, 4 Dec 2015 05:18:48 +0000 (00:18 -0500)]
Remove legacy build script.

Change-Id: If348bb5dd92c1160e57f1db15929a2e02d1f253d
Reviewed-on: https://swiftshader-review.googlesource.com/4350
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoEnable x86-64 builds for Android.
Nicolas Capens [Fri, 4 Dec 2015 17:09:28 +0000 (12:09 -0500)]
Enable x86-64 builds for Android.

Change-Id: Ief54422c0c0d82c773f96f4491bfebb7ee717ba8
Reviewed-on: https://swiftshader-review.googlesource.com/4351
Reviewed-by: Greg Hartman <ghartman@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/4353
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoOnly build for x86 Android architectures.
Nicolas Capens [Fri, 4 Dec 2015 02:59:36 +0000 (21:59 -0500)]
Only build for x86 Android architectures.

Change-Id: I06da8a8e48f202d6625c6d6eb8569be3867da13c
Reviewed-on: https://swiftshader-review.googlesource.com/4341
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/4352

8 years agoFixed BindRenderbuffer
Alexis Hetu [Thu, 3 Dec 2015 16:29:56 +0000 (11:29 -0500)]
Fixed BindRenderbuffer

BindRenderbuffer doesn't require anything except a non-zero
renderbuffer to create a new Renderbuffer object (it is not
required to use GenRenderbuffers before using BindRenderbuffer).
This had been fixed for GLES 3.0, but the same also applies
to GLES 2.0, which has been fixed here. Note that the Context
already handles the case where renderbuffer is zero properly.

Bug 25983901

Change-Id: I75f706fc56df28871bf60b5645f1c0db039fccb8
Reviewed-on: https://swiftshader-review.googlesource.com/4334
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMinor bug fixes and cleanup
Alexis Hetu [Tue, 24 Nov 2015 20:23:58 +0000 (15:23 -0500)]
Minor bug fixes and cleanup

- Removed unused variables
- Fixed member initialization order in a few classes
- Fixed Surface::setSwapBehavior()
- Removed unused mPixelPackingStateDirty members
- Fixed initialization of "size" member in LinkedVarying class
- Fixed constness of a string
- Removed unused static functions
- Added parenthesis to fix && / || order ambiguity

Change-Id: Ia9ad8eaca335c60871fdc58037e441aa2010a641
Reviewed-on: https://swiftshader-review.googlesource.com/4301
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed fbo related validations
Alexis Hetu [Wed, 2 Dec 2015 20:29:43 +0000 (15:29 -0500)]
Fixed fbo related validations

A few minor fixes:
- In FramebufferRenderbuffer, if renderbuffer isn't 0,
  it must be a valid object.
- In FramebufferTexture2D, I moved the isCompressed check AFTER
  the textarget validation, to avoid using an invalid textarget.
- In GetFramebufferAttachmentParameteriv, not using GL_BACK,
  GL_DEPTH or GL_STENCIL for the default framebuffer should
  produce GL_INVALID_ENUM instead of GL_INVALID_OPERATION.
- In GetFramebufferAttachmentParameteriv, when
  attachmentObjectType is GL_NONE, in ES3, the query for
  GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME should return 0.

Change-Id: I913cadd5961fa473b54ddfe174772bb7270dfdc5
Reviewed-on: https://swiftshader-review.googlesource.com/4333
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoIncreased the number of color attachments enums supported
Alexis Hetu [Wed, 2 Dec 2015 17:53:42 +0000 (12:53 -0500)]
Increased the number of color attachments enums supported

Since the new headers have been committed, a larger amount of
color attachments enums can be supported. Added the new enums
where appropriate.

Change-Id: Idd7210fbeaeb7828ca6c094bed115addd90b497c
Reviewed-on: https://swiftshader-review.googlesource.com/4332
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdded integer type texture support to SamplerCore code
Alexis Hetu [Mon, 26 Oct 2015 20:40:26 +0000 (16:40 -0400)]
Added integer type texture support to SamplerCore code

This cl doesn't entirely enable integer texture sampling, but
it adds the required cases in SamplerCore. To fully enable
these types, only a few small selection functions will be
required so that the proper types use the proper sampling code.

Change-Id: Ie101d782dd9b43c96d8e0198c49fe9ec6855b007
Reviewed-on: https://swiftshader-review.googlesource.com/4150
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed stencil masking
Alexis Hetu [Wed, 25 Nov 2015 18:57:28 +0000 (13:57 -0500)]
Fixed stencil masking

This is odd, but stencil masking was simply disabled, so
clearing the stencil buffer would only work if the mask
was 0xFF, or it would simply skip the clearing entirely.
I removed this condition to fix the issue. Also removed
some dead code and added an early exit if the mask is 0.

Change-Id: I359b10ed3382b75cb9d078470f237e68f1a6e7b9
Reviewed-on: https://swiftshader-review.googlesource.com/4303
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoTexture function refactoring
Alexis Hetu [Thu, 22 Oct 2015 17:58:32 +0000 (13:58 -0400)]
Texture function refactoring

To make it easier to branch on the different texture
fetching options, a new TextureFunction class is
introduced here, which performs the string comparisons
and identifies the different options.

I also had to add a 5th argument for textureGradOffset
and textureProjGradOffset.

I added function stubs (with the UNIMPLEMENTED markers)
for all new texture functions.

Change-Id: I58cde91a2bacb0012bdc34ec85b0befa19a85326
Reviewed-on: https://swiftshader-review.googlesource.com/4116
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRenderbuffer allocation fix for GLES3
Alexis Hetu [Wed, 2 Dec 2015 16:49:37 +0000 (11:49 -0500)]
Renderbuffer allocation fix for GLES3

According to the ES3 spec, there's no requirement for a
renderbuffer to be allocated until it is bound and any
non-zero renderbuffer bound must be allocated.

Change-Id: Id47083c7ec6e3b3698e176d6feff31121983e446
Reviewed-on: https://swiftshader-review.googlesource.com/4331
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix GL and D3D9 compilation.
Nicolas Capens [Tue, 1 Dec 2015 20:15:53 +0000 (15:15 -0500)]
Fix GL and D3D9 compilation.

Change-Id: I12fdf25465176ed9b0c2e95ef398b8b469419b6e
Reviewed-on: https://swiftshader-review.googlesource.com/4311
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoBuild SwiftShader for sdk_google targets.
Nicolas Capens [Wed, 25 Nov 2015 20:33:07 +0000 (15:33 -0500)]
Build SwiftShader for sdk_google targets.

Change-Id: I9cff8a31cac858e14c2364a79f61c028996e91dd
Reviewed-on: https://swiftshader-review.googlesource.com/4304
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Keun Soo Yim <yim@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUse original PowerVR ColourGrading ES 3.0 sample.
Nicolas Capens [Mon, 26 Oct 2015 19:13:22 +0000 (15:13 -0400)]
Use original PowerVR ColourGrading ES 3.0 sample.

Change-Id: Ifff92974ea41be61244ae1c09e2d54e299c10eeb
Reviewed-on: https://swiftshader-review.googlesource.com/4160
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoUpdate OpenGL ES header files.
Nicolas Capens [Mon, 30 Nov 2015 22:02:07 +0000 (17:02 -0500)]
Update OpenGL ES header files.

Change-Id: I401c06e523d945d6e629c3326bb7cbb2054c48f1
Reviewed-on: https://swiftshader-review.googlesource.com/4307
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoImplement trivial glInvalidate[Sub]Framebuffer.
Nicolas Capens [Mon, 30 Nov 2015 21:53:44 +0000 (16:53 -0500)]
Implement trivial glInvalidate[Sub]Framebuffer.

Change-Id: I0790163f89116469f73ad9ff15c71dc7366a6f65
Reviewed-on: https://swiftshader-review.googlesource.com/4306
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 explicit stride for framebuffer blit.
Nicolas Capens [Mon, 30 Nov 2015 18:24:24 +0000 (13:24 -0500)]
Use explicit stride for framebuffer blit.

Change-Id: I68685932934caba4d9fab7b45014d24316ce45a8
Reviewed-on: https://swiftshader-review.googlesource.com/4293
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoAdding RGB support to the blitter
Alexis Hetu [Tue, 24 Nov 2015 19:09:34 +0000 (14:09 -0500)]
Adding RGB support to the blitter

Added both RGB8 and BGR8 formats to the blitter and related
functions so that these formats may be used with glReadPixels.

Change-Id: I22ee13f837b66af5f2135abc77fe81cc2e995fec
Reviewed-on: https://swiftshader-review.googlesource.com/4294
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoBlitter clear implementation
Alexis Hetu [Thu, 19 Nov 2015 22:40:15 +0000 (17:40 -0500)]
Blitter clear implementation

The "clear" operation can now be done through the blitter.
The few changes are:
- The blitter now supports RGBA masking
- The blitter now supports RGB565
- When in "clear" mode, the blitter does a one read/multiple writes

The old clearing code has been deleted from Surface.

Change-Id: I970c3a0323f63ee5c89f02d94a2705e4bcf83866
Reviewed-on: https://swiftshader-review.googlesource.com/4291
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFloating point renderbuffer support
Alexis Hetu [Thu, 12 Nov 2015 21:36:34 +0000 (16:36 -0500)]
Floating point renderbuffer support

It is now possible to use floating point renderbuffers and read
the data back from them. The changes include:
- Modified glReadPixels so that it always uses the blitter to
  copy the data to the external buffer.
- Added new types to both Framebuffer and some utility functions.
- Added the new ValidReadPixelsFormatType function to validate the
  glReadPixels format/type combo, which had a bit more
  possibilities than the RGBA/UNSIGNED BYTE combo previously used.

Change-Id: I1726ea57c4f7aa85bf0ffa7f323dc6a16abc34ff
Reviewed-on: https://swiftshader-review.googlesource.com/4260
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFragment output fix
Alexis Hetu [Fri, 20 Nov 2015 16:46:41 +0000 (11:46 -0500)]
Fragment output fix

Fragment outputs weren't given a proper index, so a
fragment output array has been added to fix this.

Change-Id: Id9be21f60cc23528bf1af078a8b3ca2df28e7ee4
Reviewed-on: https://swiftshader-review.googlesource.com/4295
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdded some truncation constructors in Nucleus
Alexis Hetu [Mon, 23 Nov 2015 18:31:22 +0000 (13:31 -0500)]
Added some truncation constructors in Nucleus

Added some extra constructors that simply truncate from a type
which has a higher number of bits. The new constructors are:
- Byte from UInt
- Byte from UShort
- SByte from Int
- SByte from Short
- UShort from UInt

Also added an implementation of the RoundUInt function using the
UInt from Float constructor, which had to be fixed since it was
using createFPToSI instead of createFPToUI.

Change-Id: Ie7ee21ef20fbb8133b9f7c74afa1fec9e6c51957
Reviewed-on: https://swiftshader-review.googlesource.com/4300
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoBlitter fix
Alexis Hetu [Thu, 19 Nov 2015 16:44:25 +0000 (11:44 -0500)]
Blitter fix

Conversion from a float format to a non float format was
broken in the blitter because the clamp operation, either
to the [0,1] range or the [-1,1] range, was happening
after the scaling operation, so non float types were
becoming either -1, 0 or 1, which was wrong.

Change-Id: I3e1290313043fc49030454916b6e4ea6666f8343
Reviewed-on: https://swiftshader-review.googlesource.com/4290
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMultiple draw buffers implementation
Alexis Hetu [Thu, 5 Nov 2015 16:12:41 +0000 (11:12 -0500)]
Multiple draw buffers implementation

Implemented the missing pieces for multiple draw buffers support:
- Fixed Context::getScissoredImage() to use the drawbuffer
  parameter properly
- Enabled setting multiple render targets
- Added dynamic indexing of gl_FragData using a new dynOut flag
  to figure out which channels are being written to.

Change-Id: Id3d95c46a980a698f71e99f7781cc6287e880e9d
Reviewed-on: https://swiftshader-review.googlesource.com/4220
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix strict ordering of EGL configs.
Nicolas Capens [Fri, 13 Nov 2015 17:39:21 +0000 (12:39 -0500)]
Fix strict ordering of EGL configs.

Change-Id: I51c1774a35706639481c030b4365ee2e5d7ccd4d
Reviewed-on: https://swiftshader-review.googlesource.com/4255
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoDon't mark any EGL configs as slow.
Nicolas Capens [Fri, 13 Nov 2015 03:15:57 +0000 (22:15 -0500)]
Don't mark any EGL configs as slow.

RGB_565 is now as fast if not faster than 32-bit formats.

Change-Id: I6358e35557164541601ac76ae11028afba439084
Reviewed-on: https://swiftshader-review.googlesource.com/4253
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoAdd "Google" to GL_RENDERER to be whitelisted by Chrome.
Nicolas Capens [Fri, 13 Nov 2015 03:47:30 +0000 (22:47 -0500)]
Add "Google" to GL_RENDERER to be whitelisted by Chrome.

crbug/546671

Change-Id: Ie43f8e34fa22bb0d23e4a123e789c429f2024ebb
Reviewed-on: https://swiftshader-review.googlesource.com/4254
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix go/ab builds for jb-mr1
Greg Hartman [Fri, 13 Nov 2015 00:38:42 +0000 (16:38 -0800)]
Fix go/ab builds for jb-mr1

This forces clang to avoid use init_array for all initialization rather than
splitting the initialization between init_array and ctors.

Local builds do this anyway, but for some reason the builds on go/ab do not.
Setting this flag makes the builds consistent (and unbroken on JB-MR1).

I already checked this in on cloud-android-current-release because I wanted
to test it before submitting.

Bug 25597090

Change-Id: I5a7195ba53531835fb8333b698ed39d21ff847a6
(cherry picked from commit 95c7182f118cc686df27c3f49db7d3c7908e0e59)
Reviewed-on: https://swiftshader-review.googlesource.com/4271
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
8 years agoDisplay the watermark on AOSP images
Nicolas Capens [Wed, 11 Nov 2015 15:49:08 +0000 (10:49 -0500)]
Display the watermark on AOSP images

Bug 25638876

Change-Id: If6d84c6e0778e0e45af27b74c92c861001669409
Reviewed-on: https://swiftshader-review.googlesource.com/4252
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdding libglesv3.cpp to code blocks.
Alexis Hetu [Tue, 10 Nov 2015 18:36:34 +0000 (13:36 -0500)]
Adding libglesv3.cpp to code blocks.

Also added the exports to allow enabling ES3 entirely on Linux.

Change-Id: Ia13d229b9ce1104a74a2bbd1f620296686cf18d4
Reviewed-on: https://swiftshader-review.googlesource.com/3064
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoProtect the displays global map
Greg Hartman [Tue, 10 Nov 2015 02:10:30 +0000 (18:10 -0800)]
Protect the displays global map

Bug 25597090

Change-Id: Ie6bc4f55b5105a3e75cdc1b636f3e5716c10cc61
Reviewed-on: https://swiftshader-review.googlesource.com/4240
Tested-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix using YV12 as a format instead of type.
Nicolas Capens [Fri, 6 Nov 2015 21:01:11 +0000 (16:01 -0500)]
Fix using YV12 as a format instead of type.

Bug 25563277

Change-Id: I1721f060e313c135e713915ddd2dbdbca5239380
Reviewed-on: https://swiftshader-review.googlesource.com/4221
Reviewed-by: Keun Soo Yim <yim@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
8 years agoWait on fence sync status query.
Nicolas Capens [Thu, 5 Nov 2015 06:48:31 +0000 (01:48 -0500)]
Wait on fence sync status query.

Bug 24300960

Change-Id: I10a97536bb6559ea7b302b475d0b6936a495b65a
Reviewed-on: https://swiftshader-review.googlesource.com/4210
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoEnsure that make reaches deep enough in the tree.
Greg Hartman [Mon, 2 Nov 2015 21:08:12 +0000 (13:08 -0800)]
Ensure that make reaches deep enough in the tree.

Change-Id: I2940ff65144f001d811b069b3e017b0849f310d1
Reviewed-on: https://swiftshader-review.googlesource.com/4201
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoSwap red and blue channel in the default Android config.
Greg Hartman [Tue, 3 Nov 2015 17:59:28 +0000 (09:59 -0800)]
Swap red and blue channel in the default Android config.

Bug 25432320

Change-Id: I3fd6d123cc1c15f04092a888a8e5c996d1bd4231
Reviewed-on: https://swiftshader-review.googlesource.com/4200
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
8 years agoExplicitly load shared libraries with local visibility.
Nicolas Capens [Mon, 2 Nov 2015 15:11:49 +0000 (10:11 -0500)]
Explicitly load shared libraries with local visibility.

On some platforms the default is undefined if neither RTLD_GLOBAL
nor RTLD_LOCAL is specified.

Bug 25282950

Change-Id: I0aea6a9f604afa0412a8f6d9c614b18987fbf514
Reviewed-on: https://swiftshader-review.googlesource.com/4190
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoSimplify Android window property queries.
Nicolas Capens [Thu, 22 Oct 2015 00:25:15 +0000 (20:25 -0400)]
Simplify Android window property queries.

Change-Id: Ic54eefe422f5d0478b7cdd8dfaa19ccb2e1a8a8e
Reviewed-on: https://swiftshader-review.googlesource.com/4131
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRefactor HAL to GL format conversions.
Nicolas Capens [Fri, 30 Oct 2015 18:06:54 +0000 (14:06 -0400)]
Refactor HAL to GL format conversions.

Bug 25390254

Change-Id: I434e6d319335be00204eff88f09c98b2dd4f2acc
Reviewed-on: https://swiftshader-review.googlesource.com/4188
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoSet the EGL_NATIVE_VISUAL_ID attribute for Android HAL formats.
Nicolas Capens [Fri, 30 Oct 2015 18:05:23 +0000 (14:05 -0400)]
Set the EGL_NATIVE_VISUAL_ID attribute for Android HAL formats.

Bug 25390254

Change-Id: I6ac37912435e2c73f5e905db7c78af7884f0c93c
Reviewed-on: https://swiftshader-review.googlesource.com/4187
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoEnumerate RGB config formats.
Nicolas Capens [Fri, 30 Oct 2015 17:54:24 +0000 (13:54 -0400)]
Enumerate RGB config formats.

Bug 25390254

Change-Id: Ibd8fc3a957f9ecf5480490e9504fa7041c7c9fa2
Reviewed-on: https://swiftshader-review.googlesource.com/4186
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoSet EGL_FRAMEBUFFER_TARGET_ANDROID on configs matching the framebuffer.
Nicolas Capens [Fri, 30 Oct 2015 17:50:31 +0000 (13:50 -0400)]
Set EGL_FRAMEBUFFER_TARGET_ANDROID on configs matching the framebuffer.

Only configs with formats that match the system's framebuffer format should
advertised the EGL_FRAMEBUFFER_TARGET_ANDROID attribute.

Bug 25390254

Change-Id: I81e1a0365e151ed7082e3315399748e93c531ccc
Reviewed-on: https://swiftshader-review.googlesource.com/4185
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoDetermine the framebuffer format from the fb0 device.
Nicolas Capens [Fri, 30 Oct 2015 17:39:52 +0000 (13:39 -0400)]
Determine the framebuffer format from the fb0 device.

Bug 25390254

Change-Id: I21ed5b6d4a918bb6c3ac9ccc31ee5d47e193bd7f
Reviewed-on: https://swiftshader-review.googlesource.com/4184
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 AOSP build configuration.
Nicolas Capens [Thu, 29 Oct 2015 14:25:32 +0000 (10:25 -0400)]
Use the AOSP build configuration.

Change-Id: I8fb7499ac9d7d858a785c81d1e8e0a8511cab73c
Reviewed-on: https://swiftshader-review.googlesource.com/4182
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoLocal variables hide function arguments
Veranika Liaukevich [Wed, 28 Oct 2015 18:25:27 +0000 (14:25 -0400)]
Local variables hide function arguments

Definitions of variables inside functions should be located in a scope
different from function's arguments scope.

Change-Id: I89fe1f527681c68963f4a69c71b78975787a410c
Reviewed-on: https://swiftshader-review.googlesource.com/4180
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Veranika Liaukevich <veranika@google.com>
8 years agoModify glslang.y to support Bison 3.0.2.
Veranika Liaukevich [Thu, 22 Oct 2015 15:29:04 +0000 (11:29 -0400)]
Modify glslang.y to support Bison 3.0.2.

For this patch lexer and parser files were regenerated with newer versions
of Flex(2.5.39) and Bison(3.0.2). Because YYLEX_PARAM was deprecated and removed
from Bison, it was replaced with %param. The change was inspired by Angle source
code.

Change-Id: I7ac60041aabb78567860653a0663ec9adb205e8a
Reviewed-on: https://swiftshader-review.googlesource.com/4115
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Veranika Liaukevich <veranika@google.com>
8 years agoFix missing luminance and alpha floating-point format selection.
Nicolas Capens [Wed, 28 Oct 2015 22:53:23 +0000 (18:53 -0400)]
Fix missing luminance and alpha floating-point format selection.

Bug 25351037

Change-Id: I0c758a218d15116fa5593eb9ddb783141ff93146
Reviewed-on: https://swiftshader-review.googlesource.com/4181
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 missing bitcasts.
Nicolas Capens [Wed, 28 Oct 2015 05:58:18 +0000 (01:58 -0400)]
Add missing bitcasts.

Bug 25322177

Change-Id: I4bf200e534cc1100db1ae777502f794047df81e5
Reviewed-on: https://swiftshader-review.googlesource.com/4170
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 load functionality for integer types
Alexis Hetu [Fri, 23 Oct 2015 18:43:54 +0000 (14:43 -0400)]
Texture load functionality for integer types

- Added cases required to load integer type textures into
  swiftshader's internal formats.
- Cleaned up copy functions that simply perform a memcpy
  for a given number of bytes per row.
- Removed unused functionality for mini floats. Right now,
  all we need is the ability to import these formats, so
  there's currently no need to keep the export code.

Change-Id: I61500c41e668f885d3ec1e687b6f888c117221f2
Reviewed-on: https://swiftshader-review.googlesource.com/4140
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoNew read/write cases for integer types
Alexis Hetu [Thu, 22 Oct 2015 14:57:58 +0000 (10:57 -0400)]
New read/write cases for integer types

Added new read/write functionality for integer types. Also added cases for integer types in some utility functions.

Change-Id: I5efc7c4957d3a1591b47a5df888a9534776033be
Reviewed-on: https://swiftshader-review.googlesource.com/4114
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRevert "Implementation of EGL_KHR_swap_buffers_with_damage."
Nicolas Capens [Thu, 22 Oct 2015 00:09:10 +0000 (20:09 -0400)]
Revert "Implementation of EGL_KHR_swap_buffers_with_damage."

Bug 25161109

This reverts commit 810f99be7600e677c8723fe4f3267a6232b4e8a1.
It was only a workaround, which we no longer need after removing
the libandroid dependency which caused circular symbol resolves.

Change-Id: I0b486b5acfd328c0f64379e2c2dc2db00626738f
Reviewed-on: https://swiftshader-review.googlesource.com/4130
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoInteger types support in Blitter
Alexis Hetu [Wed, 21 Oct 2015 19:32:16 +0000 (15:32 -0400)]
Integer types support in Blitter

The blitter now supports integer types. This means:
- It supports conversions to/from integer types from/to
  other already supported types.
- It supports integer to integer conversions without going
  to an intermediate float format.

Also added a Blitter::GetScale() function to avoid having
2 instances of the same switch statement in the code and
added the read/write utility functions. The final Blitter
code is not longer peppered with switch statements and is,
hopefully, easier to read that way.

Change-Id: I80de519aaaa768f8cedd98f97dc4414dda75bf54
Reviewed-on: https://swiftshader-review.googlesource.com/4113
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoBreak the dependency on the wrapper libEGL.
Greg Hartman [Wed, 21 Oct 2015 23:14:21 +0000 (16:14 -0700)]
Break the dependency on the wrapper libEGL.

This was causing dlsym to return the pointer to the wrapper's function when
SwiftShader didn't support an entry point.

Bug 25152138

Change-Id: I92d1c9258c823acf0dc60dca9dc3d7dd552512b3
Reviewed-on: https://swiftshader-review.googlesource.com/4120
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
8 years agoFix function signature for Windows.
Nicolas Capens [Wed, 21 Oct 2015 19:49:43 +0000 (15:49 -0400)]
Fix function signature for Windows.

Change-Id: I604b2f755ece6a0a411562e9229a39040b3b0153
Reviewed-on: https://swiftshader-review.googlesource.com/4112
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoSwizzle fix
Alexis Hetu [Wed, 21 Oct 2015 19:36:50 +0000 (15:36 -0400)]
Swizzle fix

Added initialization for swizzle related members of Sampler

Change-Id: I81f7aad5274696390e73c32ff1b424687e9f5943
Reviewed-on: https://swiftshader-review.googlesource.com/4111
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
8 years agoNew enums for new texture formats
Alexis Hetu [Wed, 21 Oct 2015 17:36:35 +0000 (13:36 -0400)]
New enums for new texture formats

Added new enums for:
- 8/16/32 bit integers
- R, RG, RGB, RGBA
- Normalized and unnormalized

Also fixed FORMAT_LAST.

Change-Id: Ie3eb5286820c44490630e302907350358a1d85dc
Reviewed-on: https://swiftshader-review.googlesource.com/4110
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoTextureSize implementation
Alexis Hetu [Wed, 22 Jul 2015 21:03:26 +0000 (17:03 -0400)]
TextureSize implementation

Initial TextureSize parsing and implementation

Change-Id: I8b9b1808366b1013a5001e2dfa15a26d8471ab6a
Reviewed-on: https://swiftshader-review.googlesource.com/3753
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoImplementation of EGL_KHR_swap_buffers_with_damage.
Nicolas Capens [Thu, 24 Sep 2015 20:25:06 +0000 (16:25 -0400)]
Implementation of EGL_KHR_swap_buffers_with_damage.

Bug 24111119

This is a trivial implementation which does not actually optimize
compositing using the damage rects. That can be implemented later.

Change-Id: Ibf511ef166a33b1d2f1826bfc5618765062fe2a2
Reviewed-on: https://swiftshader-review.googlesource.com/4014
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoImplementation of EGL_KHR_fence_sync.
Nicolas Capens [Thu, 15 Oct 2015 08:49:54 +0000 (04:49 -0400)]
Implementation of EGL_KHR_fence_sync.

Bug 21662268

Change-Id: Iefdc18303c42967ccc25fd6580851e05520dc2b9
Reviewed-on: https://swiftshader-review.googlesource.com/4071
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 new swizzle parameters to Sampler's state
Alexis Hetu [Tue, 29 Sep 2015 15:50:05 +0000 (11:50 -0400)]
Added new swizzle parameters to Sampler's state

The new parameters are: swizzleR, swizzleG, swizzleB, swizzleA.

Also, parameters sent from the context that can be either
originating from the Texture object or the Sampler object
are now sent from the correct origin.

An implementation for the swizzleR, swizzleG, swizzleB, swizzleA
parameters was done in SamplerCore. All related dEQP tests pass.

Change-Id: I45405a0d241d0e70a91a3c56357c7bc04c7dc75a
Reviewed-on: https://swiftshader-review.googlesource.com/4017
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoAdjusting texture completeness checks
Alexis Hetu [Mon, 5 Oct 2015 17:17:35 +0000 (13:17 -0400)]
Adjusting texture completeness checks

Mipmap levels used in texture sampling must be limited by the
texture's base level (default: 0) and max level (default: 1000).
This has an effect on texture completeness, since only the
required levels are required to be present in the texture to be
considered complete.

Change-Id: I31dd87d5a4306622e469c2546107b59f6e51c7dd
Reviewed-on: https://swiftshader-review.googlesource.com/4039
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoUnpack row length fix
Alexis Hetu [Thu, 15 Oct 2015 21:05:30 +0000 (17:05 -0400)]
Unpack row length fix

The unpack row length was supposed to replace the width, not the
pitch, of the input image, which explains why related tests were
failing.

Change-Id: I7bd46e057bae4113b31d072fd6748d9dd6043feb
Reviewed-on: https://swiftshader-review.googlesource.com/4080
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoNew Short->Int and UShort->Int constructors
Alexis Hetu [Wed, 14 Oct 2015 20:32:39 +0000 (16:32 -0400)]
New Short->Int and UShort->Int constructors

Added 2 new constructors for the Int4 class in Nucleus,
which are for conversion to Int4 from Short4 or UShort4.
Some of the required code was extracted from Float4
constructors, which were cleaned up to remove the
duplicate code.

All 4 constructors (2 new Int4 and 2 modified Float4)
behaved properly in dEQP tests.

Change-Id: Ib400ea27a867d31901f4a9ca08bf6093f186b277
Reviewed-on: https://swiftshader-review.googlesource.com/4060
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFix mixed type call to max
Greg Hartman [Thu, 8 Oct 2015 05:56:08 +0000 (22:56 -0700)]
Fix mixed type call to max

Change-Id: I12c262fbdc2b2b489c02871fb9477bf25a0cfb6b
Reviewed-on: https://swiftshader-review.googlesource.com/4050
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
8 years agoSet default thread count to 1 for debug builds.
Greg Hartman [Fri, 2 Oct 2015 23:29:40 +0000 (16:29 -0700)]
Set default thread count to 1 for debug builds.

Change-Id: I14673f17ef0f299a7ead5bc55bd6729f37759b19
Reviewed-on: https://swiftshader-review.googlesource.com/3870
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
8 years agoNew format conversion classes and routines
Alexis Hetu [Fri, 18 Sep 2015 15:38:31 +0000 (11:38 -0400)]
New format conversion classes and routines

- A new routine has been added to convert from any component of
  8bit sRGB data to 8bit linear RGB, using a precomputed array.
- Two new classes have been added to easily convert to and from
  the RGB9E5 format and the R11G11B10F format.

Change-Id: I85ca58bed30bcd5a9130bca5040d351badabb19e
Reviewed-on: https://swiftshader-review.googlesource.com/3990
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoRemove the dependency on GCE for display size.
Nicolas Capens [Thu, 1 Oct 2015 05:09:27 +0000 (01:09 -0400)]
Remove the dependency on GCE for display size.

Change-Id: I201ffae8193cfcac48a7ad3446f4b79da6c3d217
Reviewed-on: https://swiftshader-review.googlesource.com/4032
Tested-by: Greg Hartman <ghartman@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoETC2 decoder
Alexis Hetu [Wed, 9 Sep 2015 17:56:41 +0000 (13:56 -0400)]
ETC2 decoder

A new ETC2 decoder was added to SwiftShader, based on the
OpenGL ETC2 specification. The decoder is fully standalone
and does not rely on any outside code (there are no files
included in the header and the source file only include the
header file, so it can easily be ported to any other project).

Things to note:
- In Surface.cpp, signed ETC2 images are decoded to full 32FP
  images, because of the lack of support for signed 8 bit R
  and RG internal formats. This should be fixed as soon as
  these formats are made available.
- sRGB conversion is not performed within the decoder, so it has
  been added as a loop inside Surface::decodeETC2 after the ETC2
  decoding is performed. This is to make sure that there is no
  loss of precision, should we choose to do the conversion to a
  higher bit precision format. The loop is fairly straightforward
  and does the conversion in place, so the impact on performance
  compared to doing the sRGB conversion in the decoder should be
  minimal.

Change-Id: I3a1af623353344bf35818ba9c9f4cf349b587e2f
Reviewed-on: https://swiftshader-review.googlesource.com/3960
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMatrix determinant and inverse implementation
Alexis Hetu [Wed, 23 Sep 2015 16:27:32 +0000 (12:27 -0400)]
Matrix determinant and inverse implementation

Implementation for determinant has been done directly in
ShaderCore in order to avoid having to allocate temporaries
manually in OutputASM.

For now, the implementation for the inverse matrix is very
simple, i.e., it doesn't attempt to re-use results from the
cofactor matrix computation to compute the determinant or
do any other kind of optimization, but it works.

Change-Id: I0fc70133809ae2752dc567bf58b60d7af7a88009
Reviewed-on: https://swiftshader-review.googlesource.com/4000
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
8 years agoFixed non square matrix multiplication
Alexis Hetu [Fri, 11 Sep 2015 19:06:48 +0000 (15:06 -0400)]
Fixed non square matrix multiplication

A few cases of matrix multiplication weren't working properly
due to using the wrong matrix dimension. For example, if we
have the following matrix operation (using matColRow):
mat32 = mat22 * mat32
This results in 3 multiplication of 2 element vectors for each
row of the result and the current code (before this cl) would
only perform 2 multiplications and produce the wrong result.

This cl should fix all uses of the * operator and of the
matrixCompMult function when using non square matrices.

Change-Id: Id0dbfd9d65c20102220049c34435c37e3db7f9da
Reviewed-on: https://swiftshader-review.googlesource.com/3966
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoCopy-paste error fixed
Alexis Hetu [Mon, 28 Sep 2015 14:59:11 +0000 (10:59 -0400)]
Copy-paste error fixed

Fixed 2 occurrences of setCompareMode being used instead
of setImmutableFormat and added a missing break statement.

Change-Id: I1013d0983220ba155dcd4f6255c6e089f03e7fc8
Reviewed-on: https://swiftshader-review.googlesource.com/4016
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed Temporary issues
Alexis Hetu [Fri, 25 Sep 2015 17:09:56 +0000 (13:09 -0400)]
Fixed Temporary issues

Some issues, like failures using the do-while command, were caused
by the assembler being unable to assign registers consistently for
a single temporary variable. For example, in the do-while case, the
"iterate" Temporary object was not being assigned to the same
register between it's initial declaration and it's usage inside the
loop condition later on, causing the do-while to behave weirdly.
Other instances where multiple Temporary objects ended up being used
simultaneously of where a single object was references in multiple
parts of the code could have failed because of this.

The fix is simply to assign Temporary objects a unique ID.

Change-Id: Ie48c596b4c6570853702cab71497b3e00a40c2a0
Reviewed-on: https://swiftshader-review.googlesource.com/4015
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoDisable R5G6B5 conversion in gralloc.
Nicolas Capens [Fri, 4 Sep 2015 17:31:30 +0000 (13:31 -0400)]
Disable R5G6B5 conversion in gralloc.

Bug 20891368

Change-Id: Ie293159d2092985c496202eb25733e69f9a3ff6f
Reviewed-on: https://swiftshader-review.googlesource.com/3252
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoEnable R5G6B5 as an internal format.
Nicolas Capens [Fri, 4 Sep 2015 14:45:43 +0000 (10:45 -0400)]
Enable R5G6B5 as an internal format.

Bug 20891368

Change-Id: Iea526eebe65616079578563126a6958d87647eb1
Reviewed-on: https://swiftshader-review.googlesource.com/3255
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
8 years agoFix makefile typo.
Nicolas Capens [Thu, 24 Sep 2015 07:44:03 +0000 (03:44 -0400)]
Fix makefile typo.

Change-Id: I4f610396af2d31792d9b9e452abd8ac597eb1aee
Reviewed-on: https://swiftshader-review.googlesource.com/4011
Reviewed-by: Greg Hartman <ghartman@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoMinor PixelRoutine cleanup
Alexis Hetu [Tue, 11 Aug 2015 14:15:34 +0000 (10:15 -0400)]
Minor PixelRoutine cleanup

- Removed redundant parameters from fogBlend()
- Moved computation registers and color output
  registers from PixelRoutine to PixelProgram.
- Made many PixelRoutine member functions
  private rather than protected when possible.

Change-Id: I748333626d993c0d46b369991d74bc3a22c972c2
Reviewed-on: https://swiftshader-review.googlesource.com/3850
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 agoFloating point parameters should be rounded, not truncated
Alexis Hetu [Thu, 10 Sep 2015 20:57:44 +0000 (16:57 -0400)]
Floating point parameters should be rounded, not truncated

Bug 20724899

Change-Id: I03f858ee3d159cfa2541afa1d8d063ca99701a4c
Reviewed-on: https://swiftshader-review.googlesource.com/3964
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoFixed uint uniforms
Alexis Hetu [Thu, 10 Sep 2015 20:55:03 +0000 (16:55 -0400)]
Fixed uint uniforms

uint uniforms were failing because of a missing condition.
This only affected uint scalars, uint vectors were unaffected.

Change-Id: Ia2338a683f1e6f5f9b6944aae72e2dbec70a8ef2
Reviewed-on: https://swiftshader-review.googlesource.com/3963
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoImplement RGB565 multisample resolve.
Nicolas Capens [Fri, 4 Sep 2015 13:18:15 +0000 (09:18 -0400)]
Implement RGB565 multisample resolve.

Bug 20891368

Change-Id: I29054ccc0a91fdc41d26d26dd4f55dfd4dfca7e4
Reviewed-on: https://swiftshader-review.googlesource.com/3952
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
8 years agoImprove color clear precision.
Nicolas Capens [Tue, 22 Sep 2015 16:26:30 +0000 (12:26 -0400)]
Improve color clear precision.

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