Commit Graph

774 Commits

Author SHA1 Message Date
bjorn 450ee72c89 OpenXR: Windows graphics plugin properly uses HDC instead of HWND;
The HWND was getting passed in directly instead of first converting
it to an HDC.  This was causing SteamVR to fail to create its OpenGL
context.
2022-03-15 15:21:31 -07:00
bjorn 17c05b1760 Merge branch 'master' into dev 2022-03-14 14:10:25 -07:00
bjorn a11121d739 OpenXR: fix thumbrest action; 2022-03-14 14:10:12 -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
Patrik Sjöberg 2c55d05be6 Fix a discrepancy between lovrRasterizerMeasure and lovrFontRender wrapping 2022-03-11 12:27:00 -08:00
bjorn 54154a643a Thumbrest support; 2022-03-06 17:43:04 -08:00
Josip Miskovic 2e82dfce92 For Quest, discern left/right XY/AB buttons
The VrApi implementation now checks that X, Y, A, B buttons exist on that
specific controller. X,Y are on left; A,B on the right controller. That
mapping covers Quest Touch and Quest 2 controllers.
2022-03-06 17:41:33 -08: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 9428b36986 Fix OpenVR driver; 2022-02-11 18:37:21 -08:00
bjorn 6f3e46d8cf Fix some pointer formatting; 2022-02-02 12:01:38 -08:00
bjorn 3ff64fa3ef OpenXR: Fix instance extension enumeration; 2022-01-29 15:31:44 -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 8d3d233e91 Include unknwn.h to fix OpenXR on some windows systems; 2021-12-27 15:16:50 +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
bjorn e283245dc6 Remove suspicious friction override; 2021-11-12 12:20:21 -08:00
bjorn 6fb5885e9b Fix glb loading; 2021-11-05 18:47:03 -07:00
bjorn 998b355e30 Make some private functions static; 2021-10-31 12:35:49 -07:00
bjorn ebeee33298 Fix lovrAudioGetSampleRate prototype; 2021-10-31 12:09:33 -07:00
bjorn af6ae0cfbb Fix VrApi casing; 2021-10-28 14:36:31 -07:00
bjorn e1527a949a openxr: fix xrLocateViews call;
- The input parameter is a count, not a size
- The view structs must be initialized with a type
2021-10-24 13:03:05 -07:00
Josip Miskovic 8e64ded60a Check stbtt_GetGlyphBox() return status
Only use results of stbtt_GetGlyphBox() if they are valid. Fixes the
font rendering glitch when printing text with leading space character.
2021-10-24 11:21:16 -07: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 00e6e20595 Details; 2021-10-08 14:12:44 -07:00
bjorn bfa155a103 ModelBuffer tracks more blob info; 2021-10-08 13:46:42 -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 1fdaa797ac Error on enabling an effect on a Source with effects disabled; 2021-08-12 11:25:51 -07:00
bjorn 8ea24c266c vrapi: Fix recentering; 2021-08-07 09:27:58 -07:00
bjorn 703104c4d1 Fix pico build; 2021-08-04 11:05:29 -07:00
mcc 9f96917d91 Fix horizontal rotation bug in Oculus spatializer 2021-07-26 11:24:04 -07:00
mcc db28be591a Fix incomplete LOVR_ENABLE PHONON/OCULUS define change 2021-07-23 09:55:16 -07:00
mcc 52db969622 Remove DEFAULT_SAMPLE_RATE 2021-07-20 11:28:48 -07:00
mcc a0a242a610 Fix types/naming to standard style 2021-07-20 11:28:48 -07:00
mcc 56138492f2 Allow get sample rate in conf.lua, read back with lovr.audio.getSampleRate() 2021-07-20 11:28:48 -07:00
mcc 2a73310198 Fix distance attenuation in Oculus spatializer 2021-07-20 11:23:32 -07:00
bjorn bb78d266b4 DESKTOP_HEADSET -> DESKTOP; 2021-07-18 22:24:00 -07:00
bjorn ecd7769ba0 Convert Tupfile to Lua; 2021-07-18 22:24:00 -07:00
mcc 39dca2f093 Fix lovr.audio.setPose() in oculus spatializer mode 2021-07-18 20:39:46 -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 92a08c326f vrapi: getViewPose returns a pose when position is invalid;
To match getViewAngles.  Also simplify mask check.
2021-06-18 15:51:18 -06:00
brainrom 59d3b25932 Able to get view angles with 3DOF 2021-06-18 15:50:28 -06:00
bjorn 0582746137 Fix OpenXR compilation; 2021-06-12 14:42:30 -06:00