Commit Graph

2682 Commits

Author SHA1 Message Date
Pixelflinger
b514b2e996 GL backend: Fix an issue with discardEnd flags
In OpenGL with use glInvalidateFramebuffer() for hinting controlling
the load/store of tiles. However, glInvalidateFramebuffer() conceptually
destroys the content of the framebuffer attachment.

This causes a problem when we want for instance to use a buffer for
reading only (e.g. a depth buffer) in multiple passes. In such
scenario, the attachment will be marked as "discard" (which is a
misnomer for storeOp==DONT_CARE in vulkan parlance), without the
intention of making the buffer invalid.

We fix this by ignoring the discardEnd flags entirely if a buffer
has not been written. In this case, we relying on the driver to not
write the tiles out -- but we don't have any other way to express
this in GL.

This issue cannot be encountered currently because the framegraph 
is not aggressive enough setting the discardEnd flags.
2020-05-01 18:19:23 -07:00
Philip Rideout
8c7fbb2e01 Fix stale IBL string in shadowtest sample. 2020-05-01 16:45:59 -07:00
Ben Doherty
3e67f628ee Bump version to 1.6.0 (#2474) v1.6.0 2020-05-01 15:58:56 -07:00
Pixelflinger
3bd1afedbd compute bitangeant in fragment shader
This saves 4 varying components.
Fixes #2092
2020-05-01 14:41:03 -07:00
Pixelflinger
f19533b149 fix a arithmetic error in SSR when a symmetry was present
Make sure that Camera returns a positive field-of-view, even when
the projection matrix has a symmetry (negative scaling).
2020-05-01 10:15:07 -07:00
Pixelflinger
dc5c48de33 fix a couple missing 'highp' qualifiers 2020-05-01 10:14:44 -07:00
Ben Doherty
fc4b88b5e9 Fix incorrect lightspace 2D bounds calculation for stable shadows (#2468) 2020-05-01 08:56:09 -07:00
Philip Rideout
116b475161 Both Vulkan timestamps should use BOTTOM.
As per the spec:

```
vkCmdWriteTimestamp latches the value of the timer when all previous
commands have completed executing as far as the specified pipeline
stage, and writes the timestamp value to memory.
```
2020-04-30 13:37:21 -07:00
Philip Rideout
cab4a660d3 Vulkan: fix race condition with queries. 2020-04-30 13:37:21 -07:00
Philip Rideout
72dafa4887 Vulkan: add support for timer queries. 2020-04-30 13:37:21 -07:00
Pixelflinger
4e873e8007 A new depth of field (DoF) post-process effect 2020-04-30 13:22:28 -07:00
Ben Doherty
64609cc4aa Update RELEASE_NOTES.md 2020-04-30 10:15:46 -07:00
Ben Doherty
8dc526b536 Update RELEASE_NOTES.md 2020-04-30 10:14:24 -07:00
Ben Doherty
0769aabf29 Add intensityCandela API to LightManager (#2465) 2020-04-30 10:12:09 -07:00
Pixelflinger
db53ce62ad fix LightManager::forEachComponent()
the Instance id was off-by-one and didn't match the
given entity.

in gltf_viewer this caused contact shadows to not work
when there was only a single directional light
2020-04-30 00:23:39 -07:00
Ben Doherty
d91eb1180f Respect all of ShadowOptions when building a light (#2463) 2020-04-29 08:46:41 -07:00
Philip Rideout
89d47eb05a Vulkan: fix lots of validation errors. 2020-04-29 08:45:23 -07:00
Ben Doherty
e985546e81 Set a clear color when no IBL is present (#2440) 2020-04-28 17:57:12 -07:00
Romain Guy
8036d65adf Don't trip assert in debug 2020-04-25 17:01:28 -07:00
Romain Guy
6a95807105 Better fix for texture unit spew 2020-04-25 16:55:30 -07:00
Romain Guy
0a387e16d9 More key fixes for ImGui 2020-04-25 16:15:32 -07:00
Romain Guy
1ec45c670b Fix more ImGui key clashes 2020-04-25 16:10:53 -07:00
Romain Guy
5a9ebf8db0 Always bind the structure sampler (#2462) 2020-04-25 14:33:48 -07:00
Romain Guy
abd852a9aa Improve matinfo output 2020-04-25 14:17:38 -07:00
Romain Guy
2c29c67df0 Cleanup on exit 2020-04-25 14:10:13 -07:00
Romain Guy
1d73027df6 Use a different key for spotLightEnabled 2020-04-25 13:59:36 -07:00
Romain Guy
54a4545ac5 Update README 2020-04-25 10:37:13 -07:00
Romain Guy
14ce9e30b9 Make the build more quiet (#2457)
* Make the build more quiet

* Add mising include
2020-04-25 01:13:30 -07:00
Romain Guy
cc6361e4f9 Make CI scripts safer (#2456)
- Added an extra README file detailing what the scripts are for
- The scripts now display a warning and a prompt before requiring user confirmation to continue
- The system install commands are only executed in CI environments (ninja and cmake being installed as root without checking for the environment was a leftover from a previous non-GitHub based CI setup)
2020-04-25 01:03:29 -07:00
Ben Doherty
45ce2d3a17 Fix crash when using free flight and hovering outside of the window (#2454) 2020-04-24 15:38:15 -07:00
Pixelflinger
1b6c25ce68 some old adreno drivers don't support bool in UBOs
Fixes #2418
2020-04-24 15:10:37 -07:00
Philip Rideout
e10530d3bb Vulkan: fix InvalidImageLayout validation errors.
It is illegal for shaders to sample from images that have a blit layout.
2020-04-24 08:47:19 -07:00
Pixelflinger
043cdcfcff simpify froxel GPU data structure
instead of storing two counters for point and spot lights, we now
only have a single counter for both, and the light data structure
has a type, the shader can use to decide what to do -- instead of
using two loops. In practice spot and point light code is very similar 
anyways. 

This simplify a lot the CPU side (as in make it less complex) and frees
up 8-bits in the per-froxel GPU data structure.
2020-04-24 01:42:27 -07:00
Pixelflinger
880bf0f061 remove the froxel remaping (unused) code
this was just an experiment, we'll never use it.
2020-04-24 01:42:27 -07:00
Philip Rideout
7bbea3e503 Vulkan: add support for 2D texture arrays.
In Vulkan, the arrayness of a texture is an aspect of the "image view",
not the image itself.

In my earlier attempt I used VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT on
the image, which MoltenVK does not support. Confusingly, that flag is
actually meant for rendering into a slice of a 3D texture, which we are
not doing.

Vulkan is hard.
2020-04-23 13:03:18 -07:00
Mathias Agopian
f8e0cedcdb Add java doc for LightManager (#2441)
* Add java doc for LightManager

Co-Authored-By: Ben Doherty <bendoherty@google.com>

Co-authored-by: Ben Doherty <bendoherty@google.com>
2020-04-23 11:02:57 -07:00
Pixelflinger
2a2c339cf5 improve code that generates froxel planes
we can calculate each plane direction from its clip-space equation
(which is trivial), instead of back-projecting 2 points and computing
the cross-product
2020-04-23 10:59:13 -07:00
Benjamin Doherty
9dcb1181f3 Fix camera mode optstr 2020-04-22 16:38:22 -07:00
Ben Doherty
09d9bbb035 Add camera flag to gltf_viewer and material_sandbox (#2438) 2020-04-22 15:23:18 -07:00
Philip Rideout
354d3222cb Vulkan: fix bad depth clears.
The Vulkan backend was failing to clear the depth buffer in apps that do
not have a textured skybox, such as hellotriangle.
2020-04-22 15:22:32 -07:00
Philip Rideout
e6be4c312b Fix warnings. 2020-04-22 15:19:37 -07:00
Philip Rideout
0e2cf44ca4 Skybox now binds dummy texture.
This fixes unbound sampler warnings, as seen in our hellotriangle app.
2020-04-22 13:08:20 -07:00
Ben Doherty
2e0e19d9ce Add a new free flight camera manipulator (#2436) 2020-04-22 13:04:19 -07:00
Pixelflinger
63b863d55d fix yet another froxelization bug
This came up when trying to use a very small number of froxels like
1x1x1 (just one!). 

Some froxels where not detected as used when scanning horizontally,
this would happen when a sphere was fully inside a froxel (i.e. not
actually intersecting any planes), and this was the very last
column on the right.

Now we use the same code we use for Z and Y (which where working fine)
for the X loop.
2020-04-22 11:51:51 -07:00
Pixelflinger
39c85dcbbb handle the case where we have only a single z-slice 2020-04-22 11:51:51 -07:00
Pixelflinger
45119fe15b fix a floating-point exception when the viewport is too small
this could lead to w/h froxel count to be 0, later leading to
divide-by-zero. There could also be a case where the viewport itself
had w/h of zero, also leading to divide-by-zero exception.
2020-04-22 11:51:51 -07:00
Pixelflinger
44c6ba2618 more clear fixes
- there was a case where setting a clear color on the Renderer
  would clear a blended view with that color instead of transparent
  pixels.

- move configuring the ui view into ImGuiHelper

- fix gltf_viewer sidebar so its background is not uninitialized
2020-04-22 00:43:37 -07:00
Pixelflinger
af48d7cff1 add a warning log when there is no texture bound to a used texture unit
sometimes this happens because the shader actually doesn't use the
texture (e.g. in a uber shader model), however this is an error in
metal and vulkan.
2020-04-22 00:43:14 -07:00
Philip Rideout
277a999bca Fix swizzle warning in WebGL. 2020-04-21 13:51:00 -07:00
Ben Doherty
f231368031 Update README on supported iOS version 2020-04-21 10:06:03 -07:00