Commit Graph

412 Commits

Author SHA1 Message Date
Philip Rideout
da698f2e36 Add high level compression API to prep for cmgen integration. 2018-10-05 10:11:48 -07:00
Mathias Agopian
311d2804bb mContextManager -> mPlatform 2018-10-04 16:10:45 -07:00
Mathias Agopian
2c4ecebf11 Minor importance sampling tweaks and code clean-up (#342)
* cleanup importance sampling code

* Add VNDF importance sampling -- work in progress.

* minor code cleanup
2018-10-04 15:21:34 -07:00
Philip Rideout
eed2f72466 Implement TODO items for ASTC encoding.
These presets are copied over from the ARM standalone tool. I have not
tested them but they seem reasonable.
2018-10-04 14:29:18 -07:00
Philip Rideout
23efe17380 mipgen: fix dark miplevels in normal maps.
When using GAUSSIAN_NORMALS, image::resampleImage automatically unitizes
its output. This means that clients (e.g. mipgen) need to ensure that
the source image is in [-1,+1] rather than [0,+1].
2018-10-04 14:28:44 -07:00
Mathias Agopian
473b173647 fix Vulkan builds 2018-10-04 13:25:49 -07:00
Mathias Agopian
001965cf42 Separate Android specific code from EGL platform
This code manages the virtual machine as well as
external streams. The idea here is that the Vulkan
platform could use this code when it adds support
for external buffers/streams (or at least it will
be easier). None of this needs EGL.
2018-10-04 13:25:49 -07:00
Mathias Agopian
8a0c714108 Rename ExternalContext to Platform
Rename everything related.

Also Platform::create() returns a raw Driver* 
instead of a unique_ptr<Driver>. This is to
remove a dependency on <memory> in public
headers.
2018-10-04 13:25:49 -07:00
Mathias Agopian
af5a168277 Make ExternalContext::createDriver() protected 2018-10-04 13:25:49 -07:00
Mathias Agopian
43070b413e don’t leak the ExternalContext object
FEngine doesn’t take ownership of ExternalContext if
it’s passed as a parameter, however, in the common
case it’s not, and FEngine owns it — and must take
care of destroying it.


Also fix this behavior in “single thread” mode,
the given ExternalContext was ignored.
2018-10-04 13:25:49 -07:00
Philip Rideout
551fe7ef8b Suzanne now uses LINEAR_MIPMAP_LINEAR. 2018-10-04 08:02:53 -07:00
prideout
e74a306df2 Fix utils::Path concat for relative paths.
Concating with an empty path should not prepend a slash since doing so
implies that the user wants to access the system's root folder.

Fixes #332
2018-10-04 07:31:25 -07:00
Mathias Agopian
4302d9dcc3 reduce our dependency to the STL in public headers 2018-10-03 20:13:17 -07:00
Tim Psiaki
18504b1928 Remove unnecessary using. 2018-10-03 13:07:21 -07:00
Tim Psiaki
3defd8a855 Retry eglChooseConfig if no recordable config found. 2018-10-03 13:07:21 -07:00
Tim Psiaki
541db4fea5 Add Cocoa & WebGL stubs for setPresentationTime 2018-10-03 13:07:21 -07:00
Tim Psiaki
5325f57e8f Call eglPresentationTimeANDROID when available. 2018-10-03 13:07:21 -07:00
Philip Rideout
37a42ee854 Enable ETC for Suzanne normal map.
Due to an assertion in etc2comp, this unfortunately uses RGB8 instead of
RG11 but it still helps quite a bit (3.3 MB savings in the unzipped KTX
size).
2018-10-03 12:35:34 -07:00
Philip Rideout
cc61e4649b Add ETC support to mipgen / imageio / suzanne.
This shrinks file size as follows, although it seems to darken the
rendered result.

```
  1398209 Oct  2 16:22 ao.ktx
   699172 Oct  2 16:20 ao_etc.ktx
  1398209 Oct  2 16:22 metallic.ktx
   699172 Oct  2 16:19 metallic_etc.ktx
  1398209 Oct  2 16:22 roughness.ktx
   699172 Oct  2 16:20 roughness_etc.ktx
```
2018-10-02 21:57:22 -07:00
Mathias Agopian
2eeb92fc4c fix typo in variable name. 2018-10-02 15:33:05 -07:00
Mathias Agopian
eaf82961de Don’t use GLES 3.1 features on GLES 3.0 contextes
Fixes #309

- remove some currently unused code that requires
  GLES 3.1 headers. It’s not technically a problem,
  but it makes the code less confusing. We can
  put that back, when we need it.

- Turn off multi-sampling on GLES 3.0

- Add support for EXT_multisampled_render_to_texture
2018-10-02 15:19:38 -07:00
Mathias Agopian
69bdb6d1c9 don’t use stderr, this causes some linking problems on Android. 2018-10-02 14:45:06 -07:00
Philip Rideout
8e9ef497f6 Fix Linux build of etc2comp. 2018-10-02 12:32:23 -07:00
Philip Rideout
70a4c4f887 Add etc2comp to third_party. 2018-10-02 12:32:23 -07:00
Philip Rideout
3ad0574878 Add ASTC support to Suzanne. 2018-10-02 07:46:51 -07:00
Philip Rideout
3185d0f237 Add S3TC support to imageio and Suzanne.
At build time, mipgen now creates several compressed and non-compressed
variants for albedo.

For ASTC we use the ARM encoder, for S3TC we use the STB encoder. The
latter is somewhat limited so we may wish to investigate other libraries
in the future (e.g., AMD Compressenator).

At run time, we detect which of these variants to download, based on
available WebGL extensions. In practice, this means that desktop
browsers will use the S3TC variant and mobile browsers will use the ASTC
variant.

The makes unzipped albedo go from ~4 MB to 682 KB using S3TC.

Mobile support (ASTC and ETC2) is coming in a future PR, stay tuned.
2018-10-01 14:34:21 -07:00
Mathias Agopian
1748724826 Use “cubemap” instead of “faces”. Fixes #320. 2018-10-01 11:55:53 -07:00
Mathias Agopian
741b1a412d experimental: add octahedron output support
Octahedron output support for cmgen. use —type=octahedron.

This is still fairly experimental.
2018-10-01 11:49:29 -07:00
François Guthmann
4177eb14ed Removed typo (#322)
The word 'from' was repeated twice unnecessarily.
2018-10-01 11:19:02 -07:00
Romain Guy
4ddfd52ad8 Fix warnings with recent Android NDK 2018-09-29 15:11:05 -07:00
Philip Rideout
33e0e34aa4 Remove STB dependency from astcenc.
We give the encoder raw RGB data, so there's no reason to use its STB
functionality. This shrinks the lib footprint by a small amount.
2018-09-28 16:33:41 -07:00
Philip Rideout
395b3a398d Fix mipgen windows build. 2018-09-28 16:33:41 -07:00
Philip Rideout
b25e693f6b Add stb to mipgen license list. 2018-09-28 16:33:41 -07:00
Philip Rideout
6ed331d74c Add compression to mipgen and change bitrate to block size.
The compression API now takes block size instead of bit rate. Otherwise
it is quite possible for the encoder to generate a block size that is
not one of the valid block sizes that graphics API's can actually
consume.
2018-09-28 16:33:41 -07:00
Pixelflinger
fae92f2750 Equirectangular export support
this adds a new --type (-t) parameter that is
used to specify cmgen’s output.

faces: outputs cube maps separate faces (default
       and current behavior)
equirect: outputs an equirectangular image
ktx: outputs a ktx file


--format=ktx now implies —type=ktx
2018-09-28 14:37:48 -07:00
Philip Rideout
17cfd55d3c Introduce compression API to imageio.
This wraps ARM's open source encoder with a reasonable interface.
2018-09-28 09:42:09 -07:00
Philip Rideout
ec31a55094 Add astcenc from ARM to third_party.
This was designed as a standalone tool rather than a library, so we are
renaming their "main" function to "standalone_main", which is described
in the tnt README.

We'll also be adding a wrapper to our imageio library.
2018-09-28 09:42:09 -07:00
Mathias Agopian
13e70f7afa fix typos that caused bilinear filtering in corners to be wrong 2018-09-27 21:45:21 -07:00
Mathias Agopian
cb34ab217b fix typo that could cause a crash 2018-09-27 20:11:27 -07:00
Mathias Agopian
4764eefafc improve cubemap bilinear sampling
We now handle all face corners correctly and
follow the OpenGL recommandation of averaging the
corners of all 3 adjacent faces.
2018-09-27 20:11:27 -07:00
Mathias Agopian
86b8a97389 clamp .st when reading shadow map to avoid overflow
because the shadow map can be “focused”, its
texture coordinates can end-up very large, which
in turn can cause overflows in the calculation of
the PCF positions. Unfortunately some GPUs
abort in that situation, which causes artifacts.


Fix Bug 111455153
sceneform-1.6pr2
2018-09-26 18:52:32 -07:00
Philip Rideout
462f55e2b4 Add KTX support to roughness-prefilter. 2018-09-25 15:56:12 -07:00
Mathias Agopian
09a753760c better cross conversion. Fix #283. (#302)
- internal cross storage is now always horizontal
  and seamless.

- source cross images are now always converted to
  internal format, conversion includes rescaling
  and sampling if scaling down.

- vertical cross is supported again

- fixes #283

- replace hardcoded constants
2018-09-25 15:40:19 -07:00
prideout
6f2455e7e3 Simplify KTX metadata. 2018-09-25 15:37:49 -07:00
Philip Rideout
6f09389d2f web / cmgen: use KTX metadata for sh coefficients. 2018-09-25 15:37:49 -07:00
prideout
1ca4fcadce Fix / simplify roughness-prefilter.
This tool was producing bad output for the monkey roughness map because
the monkey map has an (unnecessary) alpha channel, and the tool was
assuming that the source image has 3 channels.

This fixes that particular case and changes the tool so that it
operates on single-channel data instead of 3-channel data.
2018-09-25 14:54:31 -07:00
prideout
c55333b7b5 Add WebGL mention, remove duplicated links. 2018-09-25 13:40:58 -07:00
Ben Doherty
804c974819 Fix, Vulkan samples not compiling on Windows (#306) 2018-09-25 13:28:32 -07:00
prideout
be04ea843c Fix test by add missing code to recent commit. 2018-09-25 12:54:00 -07:00
Philip Rideout
fc7b5872a0 Add metadata support to KtxBundle.
The KTX spec allows for arbitrary key-value pairs, we are interested in
using this to stash spherical harmonics coefficients.
2018-09-25 11:53:48 -07:00