1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-05 13:53:38 +00:00
Commit graph

226 commits

Author SHA1 Message Date
bjorn 1792f066f2 Fix CMakeLists; Fix buffer unmapping; Formatting; 2019-05-18 01:09:06 -07:00
bjorn 3267bad4fa Add ShaderFlags;
newShader and newComputeShader accept an optional options table
that can contain a table of flags.  Flags are turned into #defines
in the shader source and can be used as specialization constants in
the future.

Currently they can only be bools and ints.  This might change to add
float and/or remove bools.
2019-05-14 03:48:01 -07:00
bjorn 15c4b6fcd2 Fix me ifdefs; 2019-05-13 20:52:11 -07:00
bjorn f786c40b4e Rework Buffer updates;
Use unsynchronized mapped buffers on macOS.

Reduce amount of Buffer flushes and stalls by flushing once per
batch instead of once per draw.
2019-05-13 20:35:21 -07:00
bjorn c9775c84ac Remove t.gammacorrect flag;
Gamma correct rendering is core in all supported OpenGL versions,
and it's usually a good idea to enable it.
2019-05-03 17:53:33 -07:00
bjorn c021afedae Fix more warnings; 2019-04-20 18:42:25 -07:00
bjorn 196b4ed010 Rename math to maf;
It's funnier and more compatible with some compiler setups,
since it won't get confused with the system <math.h>.
2019-04-20 11:39:20 -07:00
bjorn ee8fdb773d Add missing Texture release in OpenGL state backdoor; 2019-04-08 05:19:39 -07:00
bjorn 011db5f1e5 Revert "Free objects in their destructors;"
This reverts commit d31dca5520.

We can't unconditionally free because sometimes objects are temporarily
allocated on the stack.
2019-04-05 05:45:05 -07:00
bjorn ee27af1a85 graphics: forward declarations; 2019-04-05 04:59:14 -07:00
bjorn d31dca5520 Free objects in their destructors; 2019-04-05 03:56:10 -07:00
bjorn 6fdeda9e61 Make lovrRelease non-generic;
We know what type we're releasing 99% of the time, we don't need to
play a guessing game in lovrRelease, just have the caller say which
destructor to use.

There is lovrGenericRelease for situations where we need it, which
does the slower lookup of the destructor.
2019-04-05 03:41:03 -07:00
bjorn a28b333899 Split draw data stream into two streams;
Also the max number of draws can be hardcoded to 256 now.
2019-04-05 00:49:50 -07:00
bjorn 9744d95039 Fix snprintf warning;
There's a potential string truncation here if you have a uniform array with a really long name.
2019-03-16 19:43:04 -07:00
bjorn 7441456aab Rename lovr.graphics.getSupported and getSystemLimits;
"Features" and "Limits" will be the standard terminology used now.
2019-03-14 21:24:25 -07:00
bjorn c1705da8b7 Improve shader compilation error; 2019-03-13 09:31:06 -07:00
bjorn ce20447260 Use proper ifdefs for LOVR_WEBGL; 2019-03-12 13:18:14 -07:00
bjorn a14e15f856 Only fence when needed;
There appears to be some sort of problem where syncing on WASM and
Android leads to dropped frames.  The only sync that causes this
problem is the delayed sync that occurs after rolling over a
buffer -- in that case the sync is often placed one frame late
once we realize that the rollover has occurred.  I'm not sure if
this is a driver quirk or an improper use of glFenceSync but for
right now avoiding the fence on the problematic platforms fixes
the immediate issue.
2019-03-12 13:09:21 -07:00
bjorn 581d1d7a74 Fix warnings; 2019-02-16 23:43:20 -08:00
bjorn e80e806b9d Always flush ShaderBlocks; 2019-02-14 10:20:19 -08:00
bjorn 241abb5b2b Explicitly set generic int attribute for WebGL; 2019-02-14 10:11:10 -08:00
bjorn 1d3b05a515 Make bone IDs unsigned for WebGL; 2019-02-14 09:49:31 -08:00
bjorn 912dec3c78 Reduce clientWiatSync timeout for WebGL; 2019-02-14 09:43:49 -08:00
bjorn a02d4eb659 rm VertexData; 2019-02-13 15:10:52 -08:00
bjorn 09936a8ae2 Load animation names; General testing; 2019-02-13 15:10:52 -08:00
bjorn 40b8b8da7c Fix primitive restart overflow for u32 indices; 2019-02-13 15:10:52 -08:00
bjorn 6b323e3476 Start parsing glTF; 2019-02-13 15:10:52 -08:00
bjorn 3c08cfb278 Remove gl_FragCoord from fragment shader header;
This fixes a problem where shader compilers are complaining about
the "extension" declarations coming after the "in" declaration.
2019-02-08 07:15:20 -08:00
bjorn 6f20126020 Fix bug with mesh divisors; 2019-02-05 15:57:22 -08:00
bjorn a2cceb0b56 Fix bad interaction between vaos and ibos; 2019-01-31 17:24:13 -08:00
bjorn 3b000e64a1 Call the proper GLES2Loader in GLES; 2019-01-29 22:04:15 -08:00
bjorn 6291a5ad5a Always check malloc result; Less calloc;
Some more questions:

- Should there be some kind of allocation helper so you don't need
  to always check the result?
- Throwing an error on OOM is convenient and is probably correct 90%
  of the time, it even provides a nice error message instead of a
  nil dereference somewhere.  But it's inflexible.  Is it the right
  thing to do?
2019-01-29 16:53:01 -08:00
bjorn 30acdd1347 Add semantic GL defines; 2019-01-29 16:05:27 -08:00
bjorn 6be9bf4911 Fix primitive restart on GLES; 2019-01-29 16:05:27 -08:00
bjorn cb9f166234 Revert "Replace sprintf with stb version;"
This reverts commit 8f9d24c51f.
2019-01-24 17:39:27 -08:00
bjorn bf19fd5c15 Avoid more implicit float-double conversions; 2019-01-24 17:00:41 -08:00
bjorn c473bf50e8 Buffers individually keep track of their flush range;
Fixes bugs with attached Mesh attributes, where flushing wasn't
happening when it should have.
2019-01-22 12:11:01 -08:00
bjorn 8f9d24c51f Replace sprintf with stb version; 2019-01-18 08:55:29 -08:00
bjorn e6d9b82bba Adjust BlockType; getValue -> read; 2019-01-16 10:02:44 -08:00
bjorn c85fd69079 Optimize uniform parsing;
By only parsing the first uniform in an array.
2019-01-11 12:27:40 -08:00
bjorn e1c656c288 Primitive restart is automatic in WebGL; 2019-01-04 18:01:01 -08:00
bjorn fc08b479dc Fix sign issue; 2019-01-04 18:01:01 -08:00
bjorn dac6b0fdbb Cache geometry; 2019-01-04 18:01:01 -08:00
bjorn ea13e638c2 Fix viewports; 2019-01-04 18:01:01 -08:00
bjorn 379dc74cd5 Mesh fixes; 2019-01-04 18:01:01 -08:00
bjorn 67727b092b Start primitive restart; 2019-01-04 18:01:01 -08:00
bjorn ea3a77a73a Many batching improvements; Refactoring; 2019-01-04 18:01:01 -08:00
bjorn 1c5d73e3da Make more GPU functions static; 2019-01-04 18:01:01 -08:00
bjorn 709a91ac56 rm Shader.dirty; 2019-01-04 18:01:01 -08:00
bjorn 09832dab8f rm Mesh.dirty; 2019-01-04 18:01:01 -08:00