OSDN Git Service

android-x86/external-swiftshader.git
5 years agoKokoro: Don't use verbose logging for make
Ben Clayton [Sat, 2 Mar 2019 01:22:52 +0000 (01:22 +0000)]
Kokoro: Don't use verbose logging for make

When the build fails, it's very hard to find the compiler error in the spam.

Change-Id: Ic975f0a075e4104db82a58ef03e1ba643e520fe2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26031
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAssert on unimplemented instructions
Chris Forbes [Mon, 4 Mar 2019 18:53:07 +0000 (10:53 -0800)]
Assert on unimplemented instructions

Replace the runtime `warning` with something that will actually crash
us, and add stub implementations of OpLabel and OpReturn to allow
trivial shaders to work.

There's little point in continuing beyond an unimplemented instruction
-- if you get lucky, you hit a crash on use of the instruction's result.
If you get unlucky, you wander off into undefined behavior.

Change-Id: I3b222ea74446754276096c81fc3669c311872316
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26088
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSpirvShader: Add relational ops for integers
Ben Clayton [Mon, 4 Mar 2019 16:32:09 +0000 (16:32 +0000)]
SpirvShader: Add relational ops for integers

Bug: b/127282157
Change-Id: Icaec924ef011b42069d157bec2d76ae5df3eea46
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26048
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd -Wno-implicit-fallthrough
Logan Chien [Tue, 26 Feb 2019 05:49:53 +0000 (13:49 +0800)]
Add -Wno-implicit-fallthrough

This commit adds `-Wno-implicit-fallthrough` to disable implicit
fallthrough warnings.  This commit is required because the latest
LLVM/Clang toolchain emits more warnings.  Since `third_party/llvm-7.0`
is an upstream project, we don't want to locally patch the code.  Thus,
we are disabling implicit fallthrough warnings before it has been fixed
in the upstream.

Bug: b/115344057
Test: Build libGLESv2_swiftshader for Android
Change-Id: Ibde53e030ba66af20ba5281b33a684350ef4b35f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25529
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Logan Chien <loganchien@google.com>
5 years agoFix setup code to deal with inverted area sign
Chris Forbes [Mon, 4 Mar 2019 22:11:49 +0000 (14:11 -0800)]
Fix setup code to deal with inverted area sign

`d` is used to drive some indexing math later.

Bug: b/127343247
Change-Id: Id9da208f5a7b678748f129f97de03f5bf04bcbe1
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26128
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoImplement vkGetSwapchainImagesKHR
Hernan Liatis [Tue, 26 Feb 2019 19:19:27 +0000 (11:19 -0800)]
Implement vkGetSwapchainImagesKHR

dEQP tests passing:
dEQP-VK.wsi.xlib.swapchain.get_images

Bug: b/124265819
Change-Id: I4e2dc8dd48b93bbddba44654c72afb8f43bc3561
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25789
Tested-by: Hernan Liatis <hliatis@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoCreate CI for gcp_windows
Raymond Chiu [Thu, 21 Feb 2019 22:19:57 +0000 (14:19 -0800)]
Create CI for gcp_windows

Change-Id: I30738f487bfc1ac57ae3ef6265c013bb2865417f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25210
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Raymond Chiu <chiur@google.com>
5 years agoRemove some GL/D3D legacy format quirks from vulkan vertex buffers
Chris Forbes [Wed, 27 Feb 2019 21:48:24 +0000 (13:48 -0800)]
Remove some GL/D3D legacy format quirks from vulkan vertex buffers

- Fix mapping of B8G8R8A8 -- this is the same as the old D3DCOLOR.
- Remove all the other stream types that don't match anything in Vulkan.
- Remove unused resource pointer in stream

There is still future cleanup work to do here -- we should be able to
do vertex fetch purely based on the VkFormat rather than mapping it onto
the GL model.

Change-Id: Ia100ec68e8930acd17b6cba35a27403b4ef8e883
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25768
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoVkCreateSwapchainKHR and VkDestroySwapchainKHR
Hernan Liatis [Tue, 26 Feb 2019 03:29:54 +0000 (19:29 -0800)]
VkCreateSwapchainKHR and VkDestroySwapchainKHR

Bare bones implementation of a creatable and
destroyable swapchain

Bug: b/124265819
Change-Id: Ie8277184863ab6b7204b6c8f6fc2b2f86ad787c9
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25509
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Hernan Liatis <hliatis@google.com>
5 years agoAdd support for conversion instructions
Chris Forbes [Sat, 2 Mar 2019 01:13:57 +0000 (17:13 -0800)]
Add support for conversion instructions

- OpSConvert, OpUConvert, OpFConvert have no valid use, as we only have
  one value width (32 bits) and these instructions perform width
  conversions only.
- OpConvertFToU, OpConvertFToS, OpConvertUToF, OpConvertSToF implemented
- OpBitcast implemented. Note that the spec looks scary wrt pointer
  types in OpBitcast, but 2.16.1 Universal Validation Rules disallows
  this use in the Logical addressing model.

Bug: b/126952020
Change-Id: I6c1c95d5ad4e19177e40ead7713bf63ffe16c679
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26010
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd support for OpDot
Chris Forbes [Fri, 1 Mar 2019 21:24:17 +0000 (13:24 -0800)]
Add support for OpDot

Bug: b/126873455
Change-Id: Ibe76dc02ab22903f1ad2d00685cd1855aaeb3338
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25968
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAdd support for OpUMulExtended, OpSMulExtended
Chris Forbes [Fri, 1 Mar 2019 17:08:47 +0000 (09:08 -0800)]
Add support for OpUMulExtended, OpSMulExtended

- Make the existing LLVMReactor lowering support for MulHigh on non-x86
  available on x86 as well, as we don't have good intrinsics-based implementation
  of 4x 32bit mul highs. At some point in the future we can rework this
  to use some shuffles and a pair of pmuludq.
- Plumb through Int4 and UInt4 variants of MulHigh
- Implement SPIRV OpUMulExtended, OpSMulExtended in terms of MulHigh

Bug: b/126873455
Change-Id: I25ba0a69691e7a6f7a5542ec4a90a44ba8f68331
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25929
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoSpirvShader: Add debug checks on Intermediate.
Ben Clayton [Thu, 28 Feb 2019 20:06:42 +0000 (20:06 +0000)]
SpirvShader: Add debug checks on Intermediate.

Memset the scalars to 0, and check their pointers before use. Catches cases where the intermediate was declared but not set.

Also switch from using assert() to ASSERT() as the latter still fires with DCHECK_ALWAYS_ON.

Change-Id: I81abb50aea41568f95c22a340b90b7c56839d3ce
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25869
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoregres: fix wsi test list
Chris Forbes [Mon, 4 Mar 2019 16:47:51 +0000 (08:47 -0800)]
regres: fix wsi test list

Previously we had generated this via deqp-vk --deqp-runmode=stdout-caselist
+ a sed one-liner to strip off the prefix. Unfortunately, that's not quite
good enough -- that output contains a `GROUP: ` line for every non-leaf in
the the test tree. deqp would then produce log spam when failing to find
those nonexistent tests.

New test list generated by also filtering those `GROUP: ` lines.

Change-Id: If3c97724988f94e2e127e9e091960e1f51e3599a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26068
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoFix culling to match Vulkan convention
Chris Forbes [Fri, 1 Mar 2019 23:10:25 +0000 (15:10 -0800)]
Fix culling to match Vulkan convention

Correct the sign of the area calculation. The front facing determination
can then be written to exactly match the spec -- CCW means positive area
is front facing.

Change-Id: Ibed3e26b0cf77030325044c7dc9e818264a8750d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26009
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoAllow all vkBeginCommandBuffer flags
Chris Forbes [Sat, 2 Mar 2019 01:40:25 +0000 (17:40 -0800)]
Allow all vkBeginCommandBuffer flags

Our command buffer playback mechanism is safe for multiple inflight
submissions of the same command buffer, so there is nothing special to
do here.

The problematic case of needing to carry some state from a primary
command buffer into a secondary is already caught by the slightly later
check for pInheritanceInfo.

Bug: b/118619338
Change-Id: I782285fbc9127d59eeac7cbf79fea3f1952e3cde
Reviewed-on: https://swiftshader-review.googlesource.com/c/25950
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Hernan Liatis <hliatis@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoWindows build fix
Alexis Hetu [Fri, 1 Mar 2019 20:31:31 +0000 (15:31 -0500)]
Windows build fix

Bug swiftshader:124

Change-Id: Ied13e859cc8984e59af393de6ca1a93428a0e30e
Reviewed-on: https://swiftshader-review.googlesource.com/c/25949
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoDescriptor sets update mechanism
Alexis Hetu [Fri, 15 Feb 2019 20:28:37 +0000 (15:28 -0500)]
Descriptor sets update mechanism

This cl adds proper storage and update of descriptor sets.
The added functionality includes:
- The descriptor pool now allocates the proper larger required
  storage needed to actually store descriptor set data.
- Descriptor sets, when allocated, also get initialized with some
  basic header data (set layout) and also some Descriptor data
  when available (a.k.a: immutable samplers)
- Descriptors are currently bindless, since it is simpler as a first
  implementation, but can easily be modified, which is intended to
  be done in the near future. For now, each descriptor set is either
  a VkDescriptorImageInfo, a VkDescriptorBufferInfo or a VkBufferView
- Descriptors can be updated from either a VkWriteDescriptorSet or a
  VkCopyDescriptorSet structure. The update supports writing to
  multiple descriptor sets in a single operation and supports array
  sizes mismatch properly according to the spec

Bug b/123244275

Change-Id: I1e0430e0014e26a304632a4b2b10ad0f69b06180
Reviewed-on: https://swiftshader-review.googlesource.com/c/24910
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoRemove src/Vulkan directory from CMake include path
Nicolas Capens [Fri, 1 Mar 2019 18:39:57 +0000 (13:39 -0500)]
Remove src/Vulkan directory from CMake include path

This change requires include directives to include the Vulkan/ path so
it's clearer when we have dependencies across layers/folders.

This was already the case for the other build files, so it avoids
build breakage as well.

Bug b/126557661

Change-Id: I4d8773e8c28e6677fd1e93ca9c9d2d843431343c
Reviewed-on: https://swiftshader-review.googlesource.com/c/25948
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSpirvShader: Begin unary and binary ops.
Ben Clayton [Thu, 28 Feb 2019 19:59:15 +0000 (19:59 +0000)]
SpirvShader: Begin unary and binary ops.

Far from a complete set, but both Chris and I are looking at tests that require these opcodes.

Bug: b/126870789
Bug: b/126873455
Change-Id: Idb2109cfc3352da83aa38d42eed5d15537dfb6b7
Reviewed-on: https://swiftshader-review.googlesource.com/c/25868
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSpirvShader: Fix variable construction of non input/output storage.
Ben Clayton [Thu, 28 Feb 2019 18:42:10 +0000 (18:42 +0000)]
SpirvShader: Fix variable construction of non input/output storage.

I incorrectly (9a16248) added an UNIMPLEMENTED to variables that have a storage type that is neither Input or Output.  However, other storage types do actually work.

Revert that change.

Change-Id: I5ec36e9d6d536dcdd085c93e9f00782310e118d4
Reviewed-on: https://swiftshader-review.googlesource.com/c/25848
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoAdvertise support for VK_KHR_swapchain
Hernan Liatis [Mon, 25 Feb 2019 23:56:36 +0000 (15:56 -0800)]
Advertise support for VK_KHR_swapchain

Bug: b/124265819
Change-Id: I19bbaeefe19ade1afeb6764d4f5576a29334d8bd
Reviewed-on: https://swiftshader-review.googlesource.com/c/25490
Tested-by: Hernan Liatis <hliatis@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd basic VkSurfaceKHR (Xlib only for now)
Hernan Liatis [Fri, 22 Feb 2019 19:12:59 +0000 (11:12 -0800)]
Add basic VkSurfaceKHR (Xlib only for now)

Should pass the following deqp tests:
dEQP-VK.wsi.xlib.surface.create
dEQP-VK.wsi.xlib.surface.query_supportS
dEQP-VK.wsi.xlib.surface.query_capabilities
dEQP-VK.wsi.xlib.surface.query_formatsW
dEQP-VK.wsi.xlib.surface.query_present_modes
dEQP-VK.wsi.xlib.surface.destroy_null_handle
dEQP-VK.wsi.xlib.surface.initial_size
dEQP-VK.wsi.xlib.surface.resizeSW

Bug: b/124265819
Change-Id: I92da1cc8d60923ea97aa26d3d6a098274c6e06b7
Reviewed-on: https://swiftshader-review.googlesource.com/c/25308
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Tested-by: Hernan Liatis <hliatis@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoRemove partial logic op support
Chris Forbes [Thu, 28 Feb 2019 18:29:55 +0000 (10:29 -0800)]
Remove partial logic op support

Pastel 1.0 does not need to implement logic ops. From discussion with
capn@, the existing support was only ever partial, and covered the exact
needs of a special project.

Change-Id: I3003227c4d29ab5d39e0ae6385207c87d22931e2
Reviewed-on: https://swiftshader-review.googlesource.com/c/25828
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoUse sample count from multisample state, not from attachment 0
Chris Forbes [Thu, 28 Feb 2019 18:07:55 +0000 (10:07 -0800)]
Use sample count from multisample state, not from attachment 0

Color attachment 0 (or any color attachments!) may not exist;
rasterizer behavior is supposed to be completely independent of this.

Bug: b/126417154
Change-Id: If16307a7964c267af254e2a62822ac38cf58c48c
Reviewed-on: https://swiftshader-review.googlesource.com/c/25809
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoFix Context::colorWriteActive to consider all rendertargets
Chris Forbes [Thu, 28 Feb 2019 17:03:38 +0000 (09:03 -0800)]
Fix Context::colorWriteActive to consider all rendertargets

Even in the GLES backend, we support RENDERTARGETS=8. This check only
ever considered the first 4.

Bug: b/126719156
Change-Id: I0084aa005f342f06373c53c007bee33268466b92
Reviewed-on: https://swiftshader-review.googlesource.com/c/25808
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoRemove remnants of non-descriptor-backed textures
Chris Forbes [Fri, 22 Feb 2019 21:42:51 +0000 (13:42 -0800)]
Remove remnants of non-descriptor-backed textures

All texture access in Vulkan is through descriptors. We don't need any
of the context-side state for this.

Bug: b/125909515
Change-Id: I7d0846d2fdcc03504e2dd3f44580fb5c09188c1a
Reviewed-on: https://swiftshader-review.googlesource.com/c/25331
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd regres test lists.
Ben Clayton [Sat, 16 Feb 2019 01:05:23 +0000 (01:05 +0000)]
Add regres test lists.

Regres will pick up these lists instead of using its builtin fallback lists.
These lists include additional wsi tests

Change-Id: Iec77d56bb2fc79153c090226e668e613b7969bff
Reviewed-on: https://swiftshader-review.googlesource.com/c/25788
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Hernan Liatis <hliatis@google.com>
5 years agoSpirvShader: Move emit() instructions to their own functions
Ben Clayton [Tue, 26 Feb 2019 12:19:48 +0000 (12:19 +0000)]
SpirvShader: Move emit() instructions to their own functions

These are only going to grow.

Bug: b/126126820
Change-Id: I03a2b214e9968c31dabc4814b505c1f8c22349ae
Reviewed-on: https://swiftshader-review.googlesource.com/c/25552
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoSpirvShader: Debug print human readable opcode names
Ben Clayton [Tue, 26 Feb 2019 11:54:34 +0000 (11:54 +0000)]
SpirvShader: Debug print human readable opcode names

My memory isn't good enough to remember all opcodes by number.

Enum string list stripped in release builds.

Change-Id: Ifa9b9585ee6294a26db5676a34f8ad9c90f527b8
Reviewed-on: https://swiftshader-review.googlesource.com/c/25551
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoSpirvShader: Move type declaration out to its own function
Ben Clayton [Tue, 26 Feb 2019 11:41:07 +0000 (11:41 +0000)]
SpirvShader: Move type declaration out to its own function

Reduces function size, increases readability.

Bug: b/126126820
Change-Id: I073dd40114d3c5e6e7c6088db9fc8f2a0b9d8bac
Reviewed-on: https://swiftshader-review.googlesource.com/c/25550
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSpirvShader: Add support for DescriptorSet and Binding decorations
Ben Clayton [Tue, 26 Feb 2019 11:06:50 +0000 (11:06 +0000)]
SpirvShader: Add support for DescriptorSet and Binding decorations

Bug: b/126330097
Change-Id: Id705dc19bb3a114bf703ddc37b529d6ac89b4d52
Reviewed-on: https://swiftshader-review.googlesource.com/c/25549
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSpirvShader: Add SIMD namespace.
Ben Clayton [Tue, 26 Feb 2019 11:02:42 +0000 (11:02 +0000)]
SpirvShader: Add SIMD namespace.

This namespace declares typedefs that represent per-lane-scalars.

Once we start mixing per-lane storage with linear external memory, this will help readability.

Bug: b/126126820
Change-Id: Ia128c3cc97dd77b3d5c4b7bd9537c19427a9ac3f
Reviewed-on: https://swiftshader-review.googlesource.com/c/25548
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoAdd support for OpVectorShuffle
Chris Forbes [Wed, 27 Feb 2019 06:16:07 +0000 (22:16 -0800)]
Add support for OpVectorShuffle

Bug: b/126472836
Change-Id: I0e7afc53e863540fb5bd76ec8737f4b2aa3a015b
Reviewed-on: https://swiftshader-review.googlesource.com/c/25649
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd support for OpCompositeExtract
Chris Forbes [Fri, 22 Feb 2019 02:53:58 +0000 (18:53 -0800)]
Add support for OpCompositeExtract

Bug: b/126475423
Change-Id: Ia74e5c6b253a5d3ac5de51c3667062405989d641
Reviewed-on: https://swiftshader-review.googlesource.com/c/25191
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd support for OpCompositeInsert
Chris Forbes [Fri, 22 Feb 2019 02:40:33 +0000 (18:40 -0800)]
Add support for OpCompositeInsert

Most of the subtlety here comes from needing to deal with either the old
parts or the new being possibly a constant object.

Uses WalkLiteralAccessChain combined with the size of the "new part"
to determine the range within the object which should be replaced.

Bug: b/126475423
Change-Id: I81f58d0de5dcacc74ffbd155708996c23dbe388e
Reviewed-on: https://swiftshader-review.googlesource.com/c/25214
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd complex type walker for literal indexes
Chris Forbes [Fri, 22 Feb 2019 02:39:31 +0000 (18:39 -0800)]
Add complex type walker for literal indexes

This will be used by OpCompositeInsert and OpCompositeExtract. All
indices are known at compile time, and are specified as literals rather
than ids of constants, (as in Op*AccessChain)

Bug: b/126475423
Change-Id: Ic29e2f988fb6b9bdab4b722b368e51db929c8bd3
Reviewed-on: https://swiftshader-review.googlesource.com/c/25213
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd support for OpCompositeConstruct
Chris Forbes [Fri, 22 Feb 2019 00:51:42 +0000 (16:51 -0800)]
Add support for OpCompositeConstruct

Bug: b/126475423
Change-Id: I69d05db8eaf0825893210424496dc6c9ad793d0d
Reviewed-on: https://swiftshader-review.googlesource.com/c/25190
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd GenericValue wrapper for either an Intermediate or a constant
Chris Forbes [Wed, 27 Feb 2019 05:53:56 +0000 (21:53 -0800)]
Add GenericValue wrapper for either an Intermediate or a constant

This does automatic widening to per-lane so callers don't have to
scatter "is constant?" checks everywhere. This is mostly the right
thing to do -- loads and stores will want to continue specializing
on whether values and offsets are uniform across lanes, but most
other things don't care.

Bug: b/126475489
Change-Id: I1b8693a75e93b00a7972ec06777fbaaa599d2a52
Reviewed-on: https://swiftshader-review.googlesource.com/c/25668
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoFix push & pop of XMM registers.
Stephen White [Wed, 27 Feb 2019 19:39:14 +0000 (14:39 -0500)]
Fix push & pop of XMM registers.

Microsoft's x86-64 calling convention ABI requires registers XMM6-15 to
be preserved by the callee:
https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2017#calling-convention-defaults

Implement a _pop_reg() analog to _push_reg(), so we can specialize
the XMM treatment. Pass the RegNum all the way down to the specialized
class, because we don't know which registers should be 128-bit at the call site.

Bug chromium:931926
Bug swiftshader:22

Change-Id: I57637c852f0f3bb9a374d61a16a7aaa434ac908d
Reviewed-on: https://swiftshader-review.googlesource.com/c/25468
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Stephen White <senorblanco@chromium.org>
5 years agoVkDebug.hpp: Call abort() after assert(false)
Ben Clayton [Tue, 26 Feb 2019 17:59:24 +0000 (17:59 +0000)]
VkDebug.hpp: Call abort() after assert(false)

For debug builds this should be a nop, as the assert should call abort(), however for NDEBUG + DCHECK_ALWAYS_ON builds, assert is a nop and we still want to terminate.

Bug: b/126329018
Change-Id: I45291be05dfa2cce8ea5623c8af8900049d5e855
Reviewed-on: https://swiftshader-review.googlesource.com/c/25558
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoCMake: Add DCHECK_ALWAYS_ON flag
Ben Clayton [Tue, 26 Feb 2019 16:52:12 +0000 (16:52 +0000)]
CMake: Add DCHECK_ALWAYS_ON flag

Enables macros like ASSERT, UNIMPLEMENTED even in release builds.

Bug: b/126329018
Change-Id: I7d810862b16d85b0a4ffc6b39a655cc73d4c669a
Reviewed-on: https://swiftshader-review.googlesource.com/c/25557
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoFix warnings raised during release builds
Ben Clayton [Tue, 26 Feb 2019 17:24:46 +0000 (17:24 +0000)]
Fix warnings raised during release builds

Bug: b/123933266
Change-Id: If4dc4858c8a81dd5e7b3510a08e7dbae74051483
Reviewed-on: https://swiftshader-review.googlesource.com/c/25556
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoSuppress LLVM warnings raised during release builds.
Ben Clayton [Tue, 26 Feb 2019 16:50:31 +0000 (16:50 +0000)]
Suppress LLVM warnings raised during release builds.

Made these suppressions only apply to LLVM as they're scary to be ignored generally.

Bug: b/123933266
Change-Id: I23c01f4cad0bac706f515642ce482703a1161d67
Reviewed-on: https://swiftshader-review.googlesource.com/c/25555
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoReturn newly-created value from SpirvRoutine::createIntermediate
Chris Forbes [Wed, 27 Feb 2019 05:22:32 +0000 (21:22 -0800)]
Return newly-created value from SpirvRoutine::createIntermediate

All the callers needed to fetch this immediately afterward; save some
effort.

Bug: b/126475489
Change-Id: I622d30aa955c27df8e12fdf87762c0db96133666
Reviewed-on: https://swiftshader-review.googlesource.com/c/25648
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoImplement indexed draws
Chris Forbes [Tue, 26 Feb 2019 02:14:42 +0000 (18:14 -0800)]
Implement indexed draws

Adds support for vkBindIndexBuffer and vkDrawIndexed.
There is significant duplication currently between Draw::play and
DrawIndexed::play, but most of it is going to evaporate when we
solve the context stomping problems.

Bug: b/118619338
Change-Id: If8e9f7b1f11a3c763e73663733697fddd3e1fcac
Reviewed-on: https://swiftshader-review.googlesource.com/c/25508
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoDescriptor sets binding
Alexis Hetu [Fri, 15 Feb 2019 19:56:22 +0000 (14:56 -0500)]
Descriptor sets binding

This cl partially implements vkCmdBindDescriptorSets. It allows
binding descriptor sets to the proper pipeline bind point and
descriptor set binding location. Dynamic offsets are not yet
supported.

Bug b/123244275 b/118619338

Change-Id: I91b14b79cb6cf00a4fabb6962938e7f55d5b6c22
Reviewed-on: https://swiftshader-review.googlesource.com/c/24909
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoSimple PipelineBarrier implementation
Alexis Hetu [Tue, 26 Feb 2019 22:03:00 +0000 (17:03 -0500)]
Simple PipelineBarrier implementation

The simplest PipelineBarrier implementation is to call Renderer::synchronize().
This removes the synchronization mechanism from the draw commands, while still
allowing the tests to pass successfully.

Bug b/118619338

Change-Id: If7d9c14170db6f9a74a54c45a978d3ce78a1cdca
Reviewed-on: https://swiftshader-review.googlesource.com/c/25608
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoFix REACTOR_USE_SUBZERO flag
Logan Chien [Tue, 26 Feb 2019 05:39:52 +0000 (13:39 +0800)]
Fix REACTOR_USE_SUBZERO flag

This commit fixes REACTOR_USE_SUBZERO flag.  The commit fde88d96a5 sets
REACTOR_USE_SUBZERO to `false` to disable the SubZero backend.  However,
other Android.mk uses `ifdef` to check whether the SubZero backend is
enabled.  As a result, the SubZero backend is always selected because
both `REACTOR_USE_SUBZERO := true` and `REACTOR_USE_SUBZERO := false`
are considered as defined.

This commit replaces `ifdef REACTOR_USE_SUBZERO` with
`ifeq ($(REACTOR_USE_SUBZERO),true)` to fix the problem.

Bug: b/115344057
Test: Build libEGL_swiftshader and libGLES_swiftshader for Android
Change-Id: I83f2dc5018857c630a71a1b7eae636983283783a
Reviewed-on: https://swiftshader-review.googlesource.com/c/25528
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Cody Schuffelen <schuffelen@google.com>
Tested-by: Logan Chien <loganchien@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAdd Print helpers to reactor
Ben Clayton [Thu, 14 Feb 2019 18:43:22 +0000 (18:43 +0000)]
Add Print helpers to reactor

New tools for debugging JITed code.

rr::Print() is a new function that emits a call to printf() using the provided message and optional values. There is also an overload that accepts additional file, line, and function parameters to help identify the call site.

Format values passed to rr::Print() are implicity cast to a new rr::PrintValues type which does the work of dispatching the value type to the correct printf() format specifier(s) and argument value(s). A single rr::Print() format value can automatically be expanded into multiple printf values - for example an rr::Float4 will expand to "%f %f %f %f" and four scalar float values.

rr::Print() format values can be any of the following types:
  * Reactor LValues, RValues, Pointers.
  * Standard Plain-Old-Value types (int, float, bool, etc)
  * Custom types that specialize the PrintValue::Ty template struct.
  * Static arrays in the form T[N] where T can be any of the above.

The sw::Vector4f and sw::Vector4s types have already had custom formatters written.

These new functions and types described above are typically not called directly. Instead there are two helper macros which simplifies usage:

RR_LOG() is a new macro that wraps rr::Print(), automatically populating the function, file and line parameters and appending a newline to the string.

RR_WATCH() is a new helper macro that prints the name and value of all the supplied arguments. For example, if you had the Int and bool variables 'foo' and 'bar' that you want to print, you can simply write:

    RR_WATCH(foo, bar)

When this JIT compiled code is executed, it will print:
    "foo: 1, bar: true"

All of this code is disabled in non-debug builds, or if the reactor backend is not LLVM 7+.

Change-Id: Ia39b1e507b6afaa3bb1d33e40b1333017f4b4f21
Reviewed-on: https://swiftshader-review.googlesource.com/c/24768
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoVS build fix
Alexis Hetu [Tue, 26 Feb 2019 22:11:23 +0000 (17:11 -0500)]
VS build fix

Change-Id: I7e6589870b539e775371e8941a07a48ca9e0cad7
Reviewed-on: https://swiftshader-review.googlesource.com/c/25628
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoFix point rendering
Chris Forbes [Mon, 25 Feb 2019 21:35:59 +0000 (13:35 -0800)]
Fix point rendering

- Point size limits were left at [0,0], forcing all points to zero coverage.
  Introduce a config value for the maximum, and plumb this through to drive
  physical device limits query.

- Fix all interpolants being replaced with pointcoord

Bug: b/124177079

Change-Id: I281dd3214537f15858afbd3890cf70f8850fa4aa
Reviewed-on: https://swiftshader-review.googlesource.com/c/25489
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoOpAccessChain: Remove pointer walking inside loop
Chris Forbes [Mon, 25 Feb 2019 21:34:59 +0000 (13:34 -0800)]
OpAccessChain: Remove pointer walking inside loop

This cannot occur. The initial stripping of <base>'s pointer type is
already handled outside the loop.

Bug: b/124388146

Change-Id: I55ea64e868308bfbab72aaefca0fd367916f6e69
Reviewed-on: https://swiftshader-review.googlesource.com/c/25488
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoReplace uses of sw::Surface with vk::ImageView in the Renderer
Alexis Hetu [Tue, 26 Feb 2019 19:42:36 +0000 (14:42 -0500)]
Replace uses of sw::Surface with vk::ImageView in the Renderer

sw::Surface contains a locking mechanism which is no longer required
in Vulkan. The app is now responsible for making sure the lifetime of
the objects is long enough for the driver to be able to use them in
any operation where they are required.

A few shortcuts were taken here:
- ImageView::getSampleCount() currently always returns the largest
  available sample count.
- ImageView::subresourceRange.levelCount is not taken into account
- Context::getMultiSampleCount() still uses attachment 0 to get
  the samples count, which may be incorrect.

Bug b/118619338

Change-Id: I8cd49926a1537c0f2bc20e6516f12d7de67d6c65
Reviewed-on: https://swiftshader-review.googlesource.com/c/25588
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoFix various issues in vertex fetch setup
Chris Forbes [Sat, 23 Feb 2019 01:21:23 +0000 (17:21 -0800)]
Fix various issues in vertex fetch setup

There are still some minor sins in here -- we should really unfuse
attributes from buffers completely -- but this is enough to have vertex
fetch work for all per-vertex attribute scenarios.

Bug: b/124177079

Change-Id: I2a7a1a6f049aa80c1a527e9fa9643bb33701d165
Reviewed-on: https://swiftshader-review.googlesource.com/c/25448
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoFix fuzzer build
Nicolas Capens [Tue, 26 Feb 2019 15:47:20 +0000 (10:47 -0500)]
Fix fuzzer build

VertexProcessor multiSampling state was eliminated.

Change-Id: I0507c80faff9e00b36d26ea96e3bc3a8e837d574
Reviewed-on: https://swiftshader-review.googlesource.com/c/25569
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoWork around x86-64 calling convention bug
Nicolas Capens [Fri, 15 Feb 2019 19:41:03 +0000 (14:41 -0500)]
Work around x86-64 calling convention bug

Microsoft's x86-64 calling convention ABI requires registers XMM6-15 to
be preserved by the callee:
https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2017#calling-convention-defaults
Currently only the System V calling convention's behavior is supported,
which does not have any callee-saved XMM registers.

Fixing this properly is non-trivial and this bug is blocking other
projects, so a temporary workaround is to limit Subzero to use only
scratch registers XMM0-XMM5.

Bug chromium:931926
Bug swiftshader:22

Change-Id: If3fde2295fc65fc52042124afe7dfc46873cce3f
Reviewed-on: https://swiftshader-review.googlesource.com/c/25568
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoSpirvShader: Decouple SPIR-V type attributes from object representation
Ben Clayton [Mon, 25 Feb 2019 11:54:43 +0000 (11:54 +0000)]
SpirvShader: Decouple SPIR-V type attributes from object representation

StorageClass, sizeInComponents, isBuiltInBlock are all attributes of the Type, not the Object.

Add 'type' field to Object so type information can easily be looked up regardless of definition opcode.

Add 'element' field to Type, simplifying the likes of WalkAccessChain.

Fixes the weird edge case of OpVariable's sizeInComponents being the size of the pointee, not its type (the pointer).

Bug: b/126126820
Change-Id: I2d1d93e03ee0253a87f831031c3b2806b1d80de0
Reviewed-on: https://swiftshader-review.googlesource.com/c/25408
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoStrongly type object / type identifiers.
Ben Clayton [Wed, 20 Feb 2019 14:36:27 +0000 (14:36 +0000)]
Strongly type object / type identifiers.

Prevents you from mixing them up by mistake, and provides better self-documentation on function signatures.

Bug: b/126126820
Change-Id: I21ce20ded434ca3d5d03ebf3f9027cf6f6b5386f
Reviewed-on: https://swiftshader-review.googlesource.com/c/25068
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoRemove VertexProcessor::multisampling state bit
Chris Forbes [Fri, 22 Feb 2019 21:43:46 +0000 (13:43 -0800)]
Remove VertexProcessor::multisampling state bit

The vertex processor doesn't need to know.

V3: also remove from GL side, which didn't use it either.

Change-Id: Id0624fb2700222be6238a8449b32b334755a45e7
Reviewed-on: https://swiftshader-review.googlesource.com/c/25332
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoWrong macro being #undef'd in VkGetProcAddress
Hernan Liatis [Mon, 25 Feb 2019 23:50:26 +0000 (15:50 -0800)]
Wrong macro being #undef'd in VkGetProcAddress

MAKE_VULKAN_INSTANCE_ENTRY never got undefined

Bug: b/125417927
Change-Id: I0fd5d8054748ff6279a65a5086e9a717441e583f
Reviewed-on: https://swiftshader-review.googlesource.com/c/25469
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Hernan Liatis <hliatis@google.com>
5 years agoFix minor issue in vkCreateInstance extension loop
Hernan Liatis [Sat, 23 Feb 2019 01:46:19 +0000 (17:46 -0800)]
Fix minor issue in vkCreateInstance extension loop

Extension checking in vkCreateInstance would simply
loop through the first extension requested. This
bug did not show up earlier (or at all) because
erroneous situations would cause early exits in
the loader.

Bug: b/125943360
Change-Id: Id664f46d09dce1b3530670ae826314b26797b5be
Reviewed-on: https://swiftshader-review.googlesource.com/c/25368
Tested-by: Hernan Liatis <hliatis@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoPipelineLayout implementation
Alexis Hetu [Fri, 15 Feb 2019 21:41:12 +0000 (16:41 -0500)]
PipelineLayout implementation

Initial basic implementation of PipelineLayout. The information
stored in the PipelineLayout will be used, among other things,
to properly bind descriptor sets affected by a dynamic offset.

Bug b/118386749

Change-Id: I05fa6f9c7740cf79a802a5276e2d88f6e6e4ebe7
Reviewed-on: https://swiftshader-review.googlesource.com/c/24948
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
5 years agoSuppress warnings for more instructions that require no work
Chris Forbes [Sat, 23 Feb 2019 01:39:57 +0000 (17:39 -0800)]
Suppress warnings for more instructions that require no work

Change-Id: Iacb323b4cc0c0b0373791b3aa3a5f0b4dcaffa44
Reviewed-on: https://swiftshader-review.googlesource.com/c/25428
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoAssert there are no unmatched eglBindTexImage/eglReleaseTexImage
Alexis Hetu [Wed, 20 Feb 2019 22:02:14 +0000 (17:02 -0500)]
Assert there are no unmatched eglBindTexImage/eglReleaseTexImage

Two consecutive eglBindTexImage calls on the same buffer (texture)
would eventually result in a crash if the texture is released before
the egl surfaces, so this assert is meant to perform an early
detection of a harder to detect future issue.

Bug chromium:932986 chromium:929088

Change-Id: I10b3892fe06d491c8a0a09dec84678b25f49c6ab
Reviewed-on: https://swiftshader-review.googlesource.com/c/25128
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoFix CMake build documentation
Ben Clayton [Thu, 7 Feb 2019 18:13:16 +0000 (18:13 +0000)]
Fix CMake build documentation

4c9f04bbebc added the build directory, so drop the docs for `mkdir`.

Change-Id: Idc7437c0c72666f2c115bb0ddbd753a3179dba79
Reviewed-on: https://swiftshader-review.googlesource.com/c/24508
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoRemove remnants of non-descriptor UBO support
Chris Forbes [Fri, 22 Feb 2019 21:39:52 +0000 (13:39 -0800)]
Remove remnants of non-descriptor UBO support

All vulkan resource access will be through descriptors. We don't need
any of this context-side state.

Bug: b/125909515
Change-Id: Id6d1da0f8a851e057dd3a16fc844b6a70cf9b935
Reviewed-on: https://swiftshader-review.googlesource.com/c/25330
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoRemove remnants of GL-style user clip planes
Chris Forbes [Fri, 22 Feb 2019 21:35:21 +0000 (13:35 -0800)]
Remove remnants of GL-style user clip planes

Vulkan doesn't have user clip planes in the legacy GL sense -- there is
an optional feature to supply GLSL1.30-style clip distances out of the
vertex shader, but the actual plane handling is the shader's problem.

We also don't support this optional feature.

Bug: b/125909515
Change-Id: I6dfc3eda613982112786a52517d1cd126146c590
Reviewed-on: https://swiftshader-review.googlesource.com/c/25329
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoRemove transform feedback remnants
Chris Forbes [Fri, 22 Feb 2019 21:31:32 +0000 (13:31 -0800)]
Remove transform feedback remnants

Bug: b/125909515
Change-Id: I18f1ed398d85a914863f4b93a2795637e20028b6
Reviewed-on: https://swiftshader-review.googlesource.com/c/25328
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSet render targets correctly when drawing
Chris Forbes [Thu, 21 Feb 2019 22:58:28 +0000 (14:58 -0800)]
Set render targets correctly when drawing

There are some horrible hacks in here -- the draw command should not be
doing anywhere near this much work -- but this gets us to first
triangle.

Passes: dEQP-VK.api.smoke.triangle

Bug: b/124177079
Change-Id: I4240cb8cdce2f4bbb804e88e66d1695ab0b0e41e
Reviewed-on: https://swiftshader-review.googlesource.com/c/25212
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoWire up cull mode handling to Vulkan pipeline
Chris Forbes [Fri, 22 Feb 2019 17:45:06 +0000 (09:45 -0800)]
Wire up cull mode handling to Vulkan pipeline

Bug: b/124177079
Change-Id: I8e55607c8ff7f9c2d2356268bedf170cf27eeb99
Reviewed-on: https://swiftshader-review.googlesource.com/c/25268
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoKokoro: Run unit tests.
Ben Clayton [Thu, 21 Feb 2019 15:55:54 +0000 (15:55 +0000)]
Kokoro: Run unit tests.

Change-Id: I88d914d9aa30291e938b65519ebfecb577c5d33e
Reviewed-on: https://swiftshader-review.googlesource.com/c/25170
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Raymond Chiu <chiur@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoSilence emit-time warnings for many instructions
Chris Forbes [Fri, 22 Feb 2019 00:49:51 +0000 (16:49 -0800)]
Silence emit-time warnings for many instructions

These instructions don't require any work in the emit phase.

Change-Id: I1f82e785afe9a3e3871637349fca3eac3435ab6c
Reviewed-on: https://swiftshader-review.googlesource.com/c/25189
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
5 years agoRemove alpha test plumbing
Chris Forbes [Fri, 22 Feb 2019 17:43:30 +0000 (09:43 -0800)]
Remove alpha test plumbing

Vulkan does not have alpha test. Apps are expected to use discard in the
shader instead.

Change-Id: Idc1d8d2a74f5728cf70c653a5139a0ca1674ca37
Reviewed-on: https://swiftshader-review.googlesource.com/c/25211
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoRestore vertex fetch state update from context -> state
Chris Forbes [Thu, 21 Feb 2019 18:20:26 +0000 (10:20 -0800)]
Restore vertex fetch state update from context -> state

This is required to have the vertex fetch state actually available at
JIT time.

Bug: b/124177079
Change-Id: Ibb548c372ee349d3a5312bb46dddcf13257dc294
Reviewed-on: https://swiftshader-review.googlesource.com/c/25188
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
5 years agoImplement proper handling of constants
Chris Forbes [Wed, 20 Feb 2019 21:00:54 +0000 (13:00 -0800)]
Implement proper handling of constants

Previously we had only supported simple integer constants, as that was
enough to parse array declarations etc. Fully implement constants,
including large null objects, and constant composites constructed out
of other constants.

Bug: b/124934655
Change-Id: Ia1087f62a2bd75a3ca2f784ea24b0b3f01984ad9
Reviewed-on: https://swiftshader-review.googlesource.com/c/25148
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
5 years agoAdd CMake flag to treat warnings as errors
Ben Clayton [Tue, 19 Feb 2019 17:08:56 +0000 (17:08 +0000)]
Add CMake flag to treat warnings as errors

Disabled by default by the request of Nicolas.

Bug: b/123933266
Change-Id: Ie1217dc6c96ec85c9daf8246de785c8729386634
Reviewed-on: https://swiftshader-review.googlesource.com/c/25015
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agovkGetDescriptorSetLayoutSupportKHR listed wrong
Hernan Liatis [Thu, 21 Feb 2019 21:46:36 +0000 (13:46 -0800)]
vkGetDescriptorSetLayoutSupportKHR listed wrong

The above function, while listed with the device
functions, was using MAKE_VULKAN_INSTANCE_ENTRY()
instead of MAKE_VULKAN_DEVICE_ENTRY()

Bug: b/125417927
Change-Id: I66865468f50b2db3f6904fab40f79db3346431a2
Reviewed-on: https://swiftshader-review.googlesource.com/c/25209
Kokoro-Presubmit: Hernan Liatis <hliatis@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Hernan Liatis <hliatis@google.com>
5 years agoUpdate ICD version to 3.0
Hernan Liatis [Thu, 21 Feb 2019 20:57:52 +0000 (12:57 -0800)]
Update ICD version to 3.0

Needed to call VkCreateXXXSurfaceKHR() functions,
where XXX is the platform name.

Bug: b/125405086
Change-Id: Id0de2ee02bd3b7d5b37eda202fb26e4ad3265bf3
Reviewed-on: https://swiftshader-review.googlesource.com/c/25208
Kokoro-Presubmit: Hernan Liatis <hliatis@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Hernan Liatis <hliatis@google.com>
5 years agoGLES: Fix race in Renderer destruction
Ben Clayton [Tue, 12 Feb 2019 11:24:29 +0000 (11:24 +0000)]
GLES: Fix race in Renderer destruction

The clipper and blitter were being destructed before the worker threads were stopped.

Also nullify after deleting other fields - this would have been much harder to detect if the clipper and blitter were not already being nullified after destruction.

Tested with:
./unittests --gtest_repeat=100 --gtest_filter=SwiftShaderTest.TransformFeedback_DrawArraysInstanced

Bug: b/124288179
Change-Id: Iefea829dfb8556c877c0a086253c5924c54aa638
Reviewed-on: https://swiftshader-review.googlesource.com/c/24748
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoSilence warnings: Ignore pedantic warnings with compiler flags
Ben Clayton [Tue, 19 Feb 2019 17:08:14 +0000 (17:08 +0000)]
Silence warnings: Ignore pedantic warnings with compiler flags

Addressing this one toolchain at a time, as not all warning names are the same across toolchains.

Bug: b/123933266
Change-Id: I618ebafb5ff18a885c71a8e2fa1943befc6786b6
Reviewed-on: https://swiftshader-review.googlesource.com/c/25014
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoGLES: Fix OOB access of labelBlock.
Ben Clayton [Thu, 21 Feb 2019 11:05:27 +0000 (11:05 +0000)]
GLES: Fix OOB access of labelBlock.

This was being incorrectly sized by the number of functions, not the highest label in use.

While investigating this, I've realized that the sanity checks to ensure there are no dead functions was never going to fire as the function list was built from the list of called functions. Instead I've changed the function scanning pass to look for labels starting a LABEL-RET pair.

Bug: b/125183107
Change-Id: Ic921097ed42a96b52f1ab7c9590c02fb3552b565
Reviewed-on: https://swiftshader-review.googlesource.com/c/25168
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoGLES: Add tests to exersise sparse labels.
Ben Clayton [Thu, 21 Feb 2019 12:37:53 +0000 (12:37 +0000)]
GLES: Add tests to exersise sparse labels.

Reproduces the issues reported by b/125183107.

Bug: b/125183107
Change-Id: If0f2ab3fcc8c065409fdbbc6df670f78a78fa3f7
Reviewed-on: https://swiftshader-review.googlesource.com/c/25169
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoConnect fragment shader outputs to raster operations stage
Chris Forbes [Wed, 20 Feb 2019 01:19:48 +0000 (17:19 -0800)]
Connect fragment shader outputs to raster operations stage

Bug: b/124177079
Change-Id: I0dbcd154c2a28c43d9895e264cc794fc2ed289f2
Reviewed-on: https://swiftshader-review.googlesource.com/c/25029
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
5 years agoAdd epilog pass to copy outputs out to pipeline
Chris Forbes [Wed, 20 Feb 2019 01:01:28 +0000 (17:01 -0800)]
Add epilog pass to copy outputs out to pipeline

Bug: b/124177079
Change-Id: I1779ed78ccfdb6c77bcf55ba109ae93fc75171ff
Reviewed-on: https://swiftshader-review.googlesource.com/c/24989
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoFix WalkAccessChain to actually walk type tree properly
Chris Forbes [Wed, 20 Feb 2019 01:41:41 +0000 (17:41 -0800)]
Fix WalkAccessChain to actually walk type tree properly

This was completely broken -- we weren't walking down the type tree at
all.

Bug: b/124388146
Change-Id: I359d121403c3413e74427fadf57fd4c3d52f7661
Reviewed-on: https://swiftshader-review.googlesource.com/c/25088
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoRemove needless unique_ptr wrapping from inputs/outputs
Chris Forbes [Wed, 20 Feb 2019 00:40:57 +0000 (16:40 -0800)]
Remove needless unique_ptr wrapping from inputs/outputs

Bug: b/124534397
Change-Id: Icfe0d83b0e8df648c90ba7f250924ad28dd06b55
Reviewed-on: https://swiftshader-review.googlesource.com/c/25108
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSeparate intermediate values from lvalues
Chris Forbes [Sat, 16 Feb 2019 00:00:08 +0000 (16:00 -0800)]
Separate intermediate values from lvalues

The vast majority of values in a SPIRV program are intermediates -- they
are guaranteed written to exactly once, by the instruction which defines
them.

Initially we had treated these the same as mutable (stack) variables, but
that produces wasteful code full of loads and stores.

Instead, represent intermediate values as a bundle of RValue<Float4>,
representing an rvalue float-sized value per SIMD lane. Introduce the
new type Intermediate to hold these bundles to allow incremental
construction of the individual RValue<Float4> objects within the bundle.

Bug: b/124534397
Change-Id: Ibb663773100d017de117111705b530b092f87ea2
Reviewed-on: https://swiftshader-review.googlesource.com/c/24968
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSpirvShader: Split objects from types.
Ben Clayton [Wed, 20 Feb 2019 10:22:09 +0000 (10:22 +0000)]
SpirvShader: Split objects from types.

Change-Id: Ifbcb30da30b912a1a60f5799717869c8d56cd90b
Reviewed-on: https://swiftshader-review.googlesource.com/c/25018
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoSilence warnings: Add override to overriden virtual functions
Ben Clayton [Wed, 20 Feb 2019 08:53:50 +0000 (08:53 +0000)]
Silence warnings: Add override to overriden virtual functions

Bug: b/123933266
Change-Id: I3e5f028ab323f361840a6326a1b7834995e8b8e3
Reviewed-on: https://swiftshader-review.googlesource.com/c/25017
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoSilence warnings: Remove bit-packing of Vulkan state
Ben Clayton [Tue, 19 Feb 2019 17:06:30 +0000 (17:06 +0000)]
Silence warnings: Remove bit-packing of Vulkan state

This produces a non-silenceable warning about enum fields being too small to store all enum values.

Nicolas agreed we can just drop the bitpacking for vulkan state.

Bug: b/123933266
Change-Id: Idf09be3ef122fca70da8d877a211368b7fd8a995
Reviewed-on: https://swiftshader-review.googlesource.com/c/25013
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoswiftshader: Remove semicolons.
Nico Weber [Wed, 20 Feb 2019 14:23:05 +0000 (09:23 -0500)]
swiftshader: Remove semicolons.

Bug: chromium:926235
Change-Id: I9d5a28e1dd2ee6619ee0fefcd9f3798ca22be45b
Reviewed-on: https://swiftshader-review.googlesource.com/c/25048
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nico Weber <thakis@chromium.org>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSilence warnings: Remove all unused local variables
Ben Clayton [Tue, 19 Feb 2019 16:50:48 +0000 (16:50 +0000)]
Silence warnings: Remove all unused local variables

Bug: b/123933266
Change-Id: If8fa478aa65f5c0046ca635a8d133911f8a59977
Reviewed-on: https://swiftshader-review.googlesource.com/c/25010
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoFix mismatch of enum types in equality test
Ben Clayton [Tue, 19 Feb 2019 17:04:37 +0000 (17:04 +0000)]
Fix mismatch of enum types in equality test

Lost in the noise of other warnings

Bug: b/123933266
Change-Id: I4c4eecb55a364c9afacf52b790f43f9d5c9640cb
Reviewed-on: https://swiftshader-review.googlesource.com/c/25012
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoSilence warnings: Add default cases to partial enum switches.
Ben Clayton [Tue, 19 Feb 2019 16:39:36 +0000 (16:39 +0000)]
Silence warnings: Add default cases to partial enum switches.

Fixes warnings about switch statements not handling all enum values.

Bug: b/123933266
Change-Id: I0372ebf2412452622eb99ea7bba7ebc5cedd385c
Reviewed-on: https://swiftshader-review.googlesource.com/c/25009
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

5 years agoGLES: Add unit tests for compile time limits
Ben Clayton [Tue, 12 Feb 2019 09:38:02 +0000 (09:38 +0000)]
GLES: Add unit tests for compile time limits

Compiles and links shaders that perform deep nesting of control blocks and calls.

Bug: b/123587120
Change-Id: I8f19611cbe6d36990ad368a600d2d5be20b1ea07
Reviewed-on: https://swiftshader-review.googlesource.com/c/24728
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
5 years agoRemove sw::BoundedIndex
Ben Clayton [Tue, 19 Feb 2019 18:50:29 +0000 (18:50 +0000)]
Remove sw::BoundedIndex

Not longer needed after https://swiftshader-review.googlesource.com/c/SwiftShader/+/24668

Change-Id: Ib345e5f288123387d44d230438da899120be830a
Reviewed-on: https://swiftshader-review.googlesource.com/c/25016
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoGLES: Remove hardcoded shader limits
Ben Clayton [Mon, 11 Feb 2019 20:59:19 +0000 (20:59 +0000)]
GLES: Remove hardcoded shader limits

Perform whole-shader analysis to determine usage limits.
Use these limits to allocate compile time and runtime arrays.

Removes the constants:
MAX_SHADER_NESTED_LOOPS
MAX_SHADER_NESTED_IFS
MAX_SHADER_CALL_STACK_SIZE

Also switched to using dynamic containers to remove the MAX_SHADER_CALL_SITES limit, which I believe to have been buggy and broken.

Bug: b/123587120
Change-Id: I89be80072183ac2aac28124df236888309e7207c
Reviewed-on: https://swiftshader-review.googlesource.com/c/24668
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
5 years agoAccumulate compile-time constant and runtime offsets separately
Chris Forbes [Sat, 16 Feb 2019 00:39:17 +0000 (16:39 -0800)]
Accumulate compile-time constant and runtime offsets separately

This makes WalkAccessChain slightly easier on the backend -- there is
less constant folding to do.

Bug: b/124388146

Change-Id: I4e76c3e494278e1399b8a86134b652c2a6d96d8c
Reviewed-on: https://swiftshader-review.googlesource.com/c/24988
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
5 years agoGLES: Fix for crashes when sampling certain textures.
Ben Clayton [Thu, 14 Feb 2019 19:31:30 +0000 (19:31 +0000)]
GLES: Fix for crashes when sampling certain textures.

There was an optimization that skipped a [0, 1] clamp for a particular sampling mode as it assumed
the input coordinates were always within these bounds.

However, if the texture sample coordinates were inf or NaN, this assumption broke, causing the
returned address to be outside the bounds of the image data.

Bug: b/123731195
Bug: b/124368982
Change-Id: I0af34ee4c2792b19081d9270fd0b1e0d0559287e
Reviewed-on: https://swiftshader-review.googlesource.com/c/24868
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>