Commit Graph

217 Commits

Author SHA1 Message Date
bjorn d1dc2f3199 rm pico;
Notes:

- We can actually use a single Activity.java file for oculus/pico now
- We can unconditionally compile os_android.c on Android
- No need for including extra jars in build system
- Headset rendering is guaranteed synchronous now, no need to ref L
- Add an "android flavor" build setting to differentiate between oculus
  and pico devices, since they both use OpenXR.
- Update the pico manifest to reflect their OpenXR sample
- Remove some OpenGL hacks that aren't necessary anymore
2022-03-22 16:03:21 -07:00
bjorn 2da18d419b mv util src; 2022-03-22 00:13:38 -07:00
bjorn a4faad39f8 Font:getFilter; Font:setFilter; 2022-03-15 16:02:35 -07:00
bjorn 17c05b1760 Merge branch 'master' into dev 2022-03-14 14:10:25 -07:00
bjorn fdfcb5539f Merge branch 'master' into dev 2022-03-14 13:19:59 -07:00
bjorn c9fe026a66 Fix undefined behavior in arr_free;
Currently there is a single allocator function used in arr_t.  Its
behavior depends on the values for the pointer and size arguments:

- If pointer is NULL, it should allocate new memory.
- If pointer is non-NULL and size is positive, it should resize memory.
- If size is zero, it should free memory.

All instances of arr_t use realloc for this right now.  The problem
is that realloc's behavior is undefined when the size argument is zero.
On Windows and Linux, realloc will free the pointer, but on macOS this
isn't the case.  This means that arr_t leaks memory on macOS.

It's best to not rely on undefined behavior like this, so let's instead
use a helper function that behaves the way we want.
2022-03-14 12:27:58 -07:00
murat g ee3ba6ef3e Font filtering now respects the default setting. 2022-03-03 22:41:47 -08:00
Luna ea1bc6c5c4 Use Texture's format when creating an Image from Canvas 2022-03-03 18:25:22 -08:00
bjorn 599bbc5cf4 Fix off by one error in texture limit; 2022-01-10 00:03:01 -08:00
bjorn 8462beef00 Fix/improve alpha cutoff;
The current flag did not work because float shader flags are not
supported.  It was also not very useful because it was per-shader
and did not use the alpha cutoff property of glTF materials.

Instead, let's turn the shader flag into an enable/disable boolean,
and add a scalar material property named "alphacutoff" that gets
read by the glTF importer.

When the alphaCutoff flag is enabled, the material property will be
compared against the pixel's alpha value to decide whether it should
get discarded.
2021-12-28 21:10:52 +02:00
bjorn 20e4567bd6 Merge branch 'master' into dev 2021-12-20 17:12:39 +02:00
bjorn 255ecbb4d8 Fix stencil color mask;
- When calling lovr.graphics.stencil, the color mask is initially
  disabled, and gets restored to its initial state afterwards.
- However, when it's restored, it uses lovrGraphicsSetColorMask, which
  just sets shadow state that doesn't make it all the way to GL until
  another draw is done.
- The consequence of this is that if you call .stencil and then don't do
  a draw, any clears that happen will use the old (disabled) color mask,
  preventing the color buffer from being cleared.
- The solution here is to lower the color mask change down into opengl.c
  where it can directly hit OpenGL.
2021-11-24 12:25:57 -08:00
Josip Miskovic 09cc73a988 Move text measuring to Rasterizer 2021-10-21 10:42:11 -07:00
bjorn 0a2f968850 Fix circle uvs;
After changing circle scale from diameter to radius, the uvs broke,
since they are calculated from the position.
2021-10-09 03:52:11 -07:00
bjorn 6b99862d3d Don't always force AMD mode to true!; 2021-10-03 15:31:29 -07:00
bjorn 48d98a701c Use WebGL buffer path on AMD GPUs;
AHHHHHHHHHHHHH
2021-10-03 15:31:17 -07:00
bjorn 04d6996b94 Font:getWidth also returns width of last line; 2021-09-06 16:14:47 -07:00
bjorn fdb8a2423c Merge branch 'master' into dev 2021-07-10 09:44:03 -07:00
bjorn e2cad4ed81 Fix crash in Material:setTexture; 2021-07-10 09:42:49 -07:00
bjorn 4125796211 Fix shaders with nil stages;
The length was getting kept as zero, need to adjust length when
falling back to default shaders.
2021-06-21 10:22:15 -06:00
bjorn 82b7632cea Require material textures to be 2D; 2021-06-12 14:26:39 -06:00
bjorn 053c318995 Fix depth test;
- Use incoming depth settings to determine whether depth test should be
  enabled or disabled (wtf)
- Always track state.depthTest, even if depth test is disabled
2021-06-01 12:58:02 -06:00
bjorn 25bb12d07c Native textures don't destroy their handles;
If a Texture is created from a handle, that means someone else created
it, so we expect them to destroy it.  We were always destroying handles,
and I guess this was usually okay because glDeleteTextures is idempotent.

However, we're seeing a crash in the Oculus driver when OVR is torn
down.  Presumably it is trying to access its swapchain textures after we
destroyed them.  Not sure why this wasn't an observable issue before,
maybe it's a new regression.  Still, it makes sense to only delete the
GL texture handle if we were the one that created it.

We don't need to check this for the renderbuffer since we always own those.
2021-04-27 22:24:42 -06:00
bjorn f2590078a9 Don't always force AMD mode to true!; 2021-04-14 10:41:14 -06:00
bjorn 90b33572e1 Use WebGL buffer path on AMD GPUs;
AHHHHHHHHHHHHH
2021-04-13 10:52:28 -06:00
bjorn 6413a6eda2 Fix Model:getTriangles; Add Lua API; 2021-03-25 12:29:11 -06:00
bjorn e1195a92a0 lovrModelGetTriangles; 2021-03-25 12:29:11 -06:00
bjorn 3a35f81918 Fix underscores not printing;
Signed arithmetic strikes again.  Before the padding was configurable,
padding was just a #define'd constant, so signedness didn't matter.
2021-03-25 12:18:48 -06:00
bjorn a3b791a7e7 Fix Canvas flushing; 2021-03-07 21:19:24 -07:00
bjorn 4f5adbc64c lovr.system; 2021-02-25 09:00:12 -07:00
bjorn 39a4d2c1d5 rm lovr.graphics.triangle; 2021-02-24 17:45:31 -07:00
bjorn 72a54bce2f Support STL models;
Only binary STL files are supported right now, ASCII is more challenging.
2021-02-23 12:07:16 -07:00
bjorn 1145085446 macOS fixes; 2021-02-22 17:07:28 -07:00
bjorn fb1447503b Fix gcc warnings; 2021-02-19 23:44:23 -07:00
bjorn 880d06a1d1 Only enable compute extensions on desktop GL; 2021-02-19 14:09:40 -07:00
bjorn 1757d30a59 Compute shader feature detection adjustment;
- Compute feature requires compute shaders, image load/store, and SSBOs.
- GLSL 330 is always used, instead of changing depending on compute shader extension.
- Explicitly enable compute shaders, image load/store, and SSBO extensions when needed.

This allows implementations that don't support GLSL 430 to run compute shaders,
and keeps the min supported GL version more consistently at GL3.3.
2021-02-19 14:07:27 -07:00
bjorn a2b7e1619d Fix wasm compilation issues; 2021-02-19 09:05:57 -07:00
bjorn 023067ec27 util.h no longer uses atomics; 2021-02-11 16:37:55 -07:00
bjorn 5ae5acfb18 Make Font texture rgba16f;
Sampling from rg11b10f does not appear to work on mobile.
2021-02-10 15:22:30 -07:00
bjorn 0919da4091 Improve MSDF font shader; Add spread/padding settings to Font; 2021-02-10 07:08:29 -07:00
bjorn 9377406854 Fix font wrap issue with spaces;
If a space starts before the wrap limit, but ends after it, the next
word won't wrap properly even though it should.
2021-02-09 08:06:37 -07:00
bjorn 84f65c26e4 Move utf8 back into util; 2021-02-08 20:55:51 -07:00
bjorn 8164e0b6e8 TextureData is now named Image!;
The existing Image construct was renamed StorageImage.
2021-02-08 20:17:47 -07:00
bjorn 8c714c45b0 Clean up some includes; 2021-02-08 11:16:00 -07:00
bjorn 0e318aa46e Make Rasterizer opaque; 2021-02-08 10:58:39 -07:00
bjorn 6d92d54079 Try having arr_t in util; 2021-02-08 18:25:05 -07:00
bjorn bc4cde1653 Adjust lovrRelease signature; 2021-02-08 17:52:26 -07:00
bjorn 3ded60948f rm core/ref; rm lovrAlloc; util does refcounting; 2021-02-08 17:26:44 -07:00
bjorn ed09bc3cfa rm unnecessary newlines in assert messages; 2021-02-07 16:58:50 -07:00
bjornbytes 80a33c0544 mat4_multiply -> mat4_mul;
quat_mul vs. mat4_multiply is inconsistent.  Going with mul over
multiply is consistent with vec3_sub and Lua's __mul metamethod.
2020-11-21 14:32:59 -07:00