Commit graph

998 commits

Author SHA1 Message Date
Branimir Karadžić
d2204e5cf2 Merge pull request #423 from mendsley/vr_viewportfix
VR: Fix skewed viewports with buffered eye textures
2015-06-05 09:14:19 -07:00
Matthew Endsley
05d70ea99d VR: Fix skewed viewports with buffered eye textures
Bug fix for #419

Viewport calculations need to take VR eye buffer size into
account. Noticable at the older 100px boundary. Skewing still
exists at newer 8px buffer, but is harder to notice.
Eventually causes pretty bad eye strain, though.

Easily reproduced by setting the buffer to something obscenely
large, such as 2048.
2015-06-05 02:12:24 -07:00
Matthew Endsley
9a1b1f892c VR: Properly support MSAA in OVR builds
Fixes #338

Create the swap chain without MSAA, and the eye textures
with MSAA. The core issue was using the surface description
for the backbuffer for the DSV on the eye textures which did
not match.

This meethod follows both the oculus and openvr guidance on MSAA -
MSAA is configured on the eye render targets, but not on the swap
chain.
2015-06-05 00:30:05 -07:00
Branimir Karadžić
ad4b2f134f Merge branch 'master' of github.com:bkaradzic/bgfx 2015-06-04 22:26:09 -07:00
Branimir Karadžić
132b0c9a1b Cleanup. 2015-06-04 22:24:45 -07:00
Branimir Karadžić
66ad074f90 Merge pull request #420 from mendsley/vr_eye_bleeding
VR: Add buffer between left/right eye textures
2015-06-04 19:23:59 -07:00
Matthew Endsley
9020994470 VR: Add buffer between left/right eye textures
This prevents bleeding across the individual viewports
when the oculus SDK applies distortion mapping. The current
reccommended values are 100px for SDK <= 0.5 and 8px for > 0.5

See: http://static.oculus.com/sdk-downloads/documents/0.6.0/Oculus_Developer_Guide.pdf
  in the "Bugs Fixed Since the Last Release" section.

For an example of this artifact, see the correct scene render:
![Imgur](http://i.imgur.com/fZZExg8.jpg)

followed by a scene that bleeds the left eye into the right eye:
![Imgur](http://i.imgur.com/dZalmPS.jpg)
2015-06-04 18:44:31 -07:00
Matthew Endsley
acdaefb161 VR: Fix OVR_VERSION macro.
Was previously supplying (major,minor,build) when it is
actuall (product,major,minor).

For example, the 0.5.0 SDK has the following:
```
 #define OVR_PRODUCT_VERSION 0
 #define OVR_MAJOR_VERSION   5
 #define OVR_MINOR_VERSION   0
 #define OVR_PATCH_VERSION   1
 #define OVR_BUILD_NUMBER    0
```
2015-06-04 18:41:35 -07:00
Matthew Endsley
1e604e8f38 VR: Add device resolution to HMD. Init at startup.
BREAKING: bgfx::getHMD() now returns a valid pointer
if the VR runtime was initialized. This is different
from existing behavior where getHMD returned NULL until
a bgfx::reset(... BGFX_RESET_HMD) was issued. Applications
must now check HMD::flags for the current state of the VR
runtime. The following code has the code change required:

`const bgfx::HMD* hmd = bgfx::getHMD()
if (NULL != hmd)`
becomes:
`const bgfx::HMD* hmd = bgfx::getHMD()
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDRERING))
{
	// rendering logic
}`

See the updated examples for details.

This allows applications to create the appropriately
sized back buffer for the HMD device by using the new device
resolution fields HMD::deviceHeight and HMD::deviceWidth.
These values report the pixel resolution of the attached
HMD hardware.

This also allows applications to query the reported HMD
resolution immediately after bgfx::init. This prevents
the device from being cycled which generates rendring
artifacts on startup - namely flashing back to a black
screen and reseting the Health+Warning disaply.

This involves initialization the ovrHmd device on
initialization, but deferring rendering until
postReset has been called. This adds an addiional
memory overhead of 32k to builds defining BGFX_CONFIG_USE_OVR.
The overhead for current builds is ~1.9MB for calls to
ovr_Initialize, so the additional overhead is pretty
trivial (+1.8%)
2015-06-03 15:39:09 -07:00
Branimir Karadžić
e1a564ca72 Fixed noop renderer. 2015-06-02 23:29:26 -07:00
Branimir Karadžić
886dd485c0 Cleanup. 2015-05-30 15:58:45 -07:00
Branimir Karadžić
5d22798482 Patching GL shaders to avoid compiler warnings. 2015-05-30 10:07:07 -07:00
Branimir Karadžić
ff01992cb7 Refactored uniform types. 2015-05-28 15:27:00 -07:00
Miodrag Milanovic
b925007b9d Fix for MINGW compile (nw) 2015-05-27 12:27:00 +02:00
Mike Popoloski
b32fc0ec27 Fixing display bug when using flip-sequential swap effect. 2015-05-24 13:29:21 -04:00
Branimir Karadžić
d58d62401e Added texture size check. 2015-05-24 10:20:21 -07:00
Branimir Karadžić
0c78fe8073 Cleanup. 2015-05-21 17:58:21 -07:00
Branimir Karadžić
a361918374 Fixed issue #392. 2015-05-21 17:49:02 -07:00
Branimir Karadžić
cd234013ce Fixed mach TLS issue. 2015-05-21 16:50:14 -07:00
Branimir Karadžić
57f61b7e32 Added ability to run in single-thread mode without rebuild. 2015-05-21 16:45:24 -07:00
Branimir Karadžić
ab22eca640 D3D9: Fixed clear quad. 2015-05-20 17:02:19 -07:00
Branimir Karadžić
2e56304280 Fixed leak in single-threaded mode. 2015-05-19 15:52:47 -07:00
Branimir Karadžić
2048aef329 Cleanup. 2015-05-18 20:34:21 -07:00
Branimir Karadžić
11868f704a GLES31: Fixed image format test. 2015-05-18 20:24:37 -07:00
Branimir Karadžić
6b8964acf7 GL: Added image format test. 2015-05-18 14:35:05 -07:00
Branimir Karadžić
c4231c9731 Added framebuffer support test. 2015-05-18 12:39:42 -07:00
Matthew Endsley
b124334343 Map/Unmap constant buffers instead of using UpdateSubResource
(XB1) Drops GPU Busy % on spiral from 65% to 20%

(PC) Drops bgfx::d3d11::RendererContextD3D11::commitShaderConstants
CPU usage by 95% (11.21%->0.66%)

(PC) Overall decreases bgfx::d3d11::RenderContextD3D11::submit CPU
usage by another 34% (27.18%->17.90%)
2015-05-17 13:08:33 -07:00
Mike Popoloski
ad9e9fe111 Adding missing C99 API methods. 2015-05-16 19:07:10 -04:00
Branimir Karadžić
4b18beb082 Rollback #389. 2015-05-15 20:08:38 -07:00
Branimir Karadžić
e348c08ebe D3D11: Disable map constant buffers. 2015-05-15 19:48:36 -07:00
Branimir Karadžić
991a9604cb Merge branch 'master' of github.com:bkaradzic/bgfx 2015-05-15 16:49:59 -07:00
Branimir Karadžić
c957a3dd51 Fixed timer query. 2015-05-15 16:49:53 -07:00
Matthew Endsley
51875f88b0 Map/Unmap constant buffers instead of using UpdateSubResource
(XB1) Drops GPU Busy % on spiral from 65% to 20%

(PC) Drops bgfx::d3d11::RendererContextD3D11::commitShaderConstants
CPU usage by 95% (11.21%->0.66%)

(PC) Overall decreases bgfx::d3d11::RenderContextD3D11::submit CPU
usage by another 34% (27.18%->17.90%)
2015-05-15 13:38:43 -07:00
Branimir Karadžić
2a49e5a143 Added flush after render reset flag. 2015-05-15 13:14:35 -07:00
Branimir Karadžić
a8ef81ae4b D3D11: Force draw indirect UAV format to be uint32x4. 2015-05-14 14:38:53 -07:00
Branimir Karadžić
f5d0a39dd0 Added buffer compute format flags. 2015-05-14 11:37:32 -07:00
Branimir Karadžić
cacb332b42 GL: Enabled texture check for all platforms. 2015-05-12 23:03:17 -07:00
Branimir Karadžić
8da183a2f1 Cleanup. 2015-05-12 17:25:09 -07:00
Branimir Karadžić
5e33eaf65b Merge pull request #384 from bullno1/color-texture-format-detection
Fix color texture format detection for webgl and gles < 3.0
2015-05-12 17:05:15 -07:00
Branimir Karadžić
e05eddce21 Merge branch 'master' of github.com:bkaradzic/bgfx 2015-05-12 17:03:32 -07:00
Branimir Karadžić
7d50012dbe Added GPU timer. 2015-05-12 17:03:25 -07:00
bullno1
0a3795ddfc Fix color texture format detection for webgl and gles < 3.0 2015-05-13 03:05:33 +08:00
Jonathan Young
ee5d73a328 Reset glPixelStorei GL_UNPACK_ROW_LENGTH to 0 after texture upload, if it's been changed. 2015-05-12 13:09:31 +10:00
Branimir Karadžić
146829b057 Commenting out RenderDoc interface release. Issue #380. 2015-05-11 18:23:02 -07:00
Branimir Karadžić
306b7060ca Cleanup. 2015-05-11 18:17:43 -07:00
Branimir Karadžić
1dd602dd83 EGL: Fixed compile error. 2015-05-11 14:27:38 -07:00
Branimir Karadžić
a40281ea23 Reverted MinGW info queue fix. Doesn't work with TDM64-1 4.9.2. Pull request #377. 2015-05-11 10:45:31 -07:00
Branimir Karadžić
e70ee88dc7 EGL: Initialize GLES2 when KHR_create_context is not available. 2015-05-10 11:45:49 -07:00
Branimir Karadžić
3afcd2c7c4 Merge pull request #377 from Leandros/mingw-patch-1
fix building under mingw32-w64
2015-05-09 20:16:23 -07:00
Lars Viklund
b965f730c0 Create backbuffer RTVs honoring multisampling
When adding sRGB support for the backbuffer render target in D3D11,
the now explicitly specified RTV desc specifies a TEXTURE2D dimension.
For multisampled targets, this needs to be TEXTURE2DMS dimension.

This solves it by branching on the presence of MSAA in the reset flags but
could envisionably be obtained by looking at the desc of the backbuffer.
2015-05-10 01:14:43 +02:00