Removed HMD API and OculusVR support.

This commit is contained in:
Branimir Karadžić 2018-07-19 20:22:21 -07:00
Родитель a90f742662
Коммит db0ec1f5db
43 изменённых файлов: 40 добавлений и 1305 удалений

Просмотреть файл

@ -25,10 +25,6 @@ Supported rendering backends:
* WebGL 1.0
* WebGL 2.0
Supported HMD:
* OculusVR (1.3.0)
Supported platforms:
* Android (14+, ARM, x86, MIPS)

Просмотреть файл

@ -261,20 +261,6 @@ public:
float eye[3] = { 0.0f, 0.0f, -35.0f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -583,20 +583,6 @@ public:
float eye[3] = { 0.0f, 0.0f, -50.0f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -107,20 +107,6 @@ public:
float eye[3] = { 0.0f, 1.0f, -2.5f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -176,20 +176,6 @@ public:
float eye[3] = { 0.0f, 0.0f, -35.0f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -215,20 +215,6 @@ public:
float eye[3] = { 0.0f, 0.0f, -7.0f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -267,49 +267,7 @@ public:
const float centering = 0.5f;
// Setup a top-left ortho matrix for screen space drawing.
const bgfx::HMD* hmd = bgfx::getHMD();
const bgfx::Caps* caps = bgfx::getCaps();
if (NULL != hmd
&& 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float proj[16];
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, caps->homogeneousDepth);
static float time = 0.0f;
time += 0.05f;
const float dist = 10.0f;
const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]);
float ortho[2][16];
const float offsetx = m_width/2.0f;
bx::mtxOrtho(
ortho[0]
, centering
, offsetx + centering
, m_height + centering
, centering
, -1.0f
, 1.0f
, offset0
, caps->homogeneousDepth
);
bx::mtxOrtho(
ortho[1]
, centering
, offsetx + centering
, m_height + centering
, centering
, -1.0f
, 1.0f
, offset1
, caps->homogeneousDepth
);
bgfx::setViewTransform(0, view, ortho[0], BGFX_VIEW_STEREO, ortho[1]);
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float ortho[16];
bx::mtxOrtho(

Просмотреть файл

@ -200,30 +200,7 @@ public:
const float centering = 0.5f;
// Setup a top-left ortho matrix for screen space drawing.
const bgfx::HMD* hmd = bgfx::getHMD();
const bgfx::Caps* caps = bgfx::getCaps();
if (NULL != hmd
&& 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float proj[16];
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, caps->homogeneousDepth);
static float time = 0.0f;
time += 0.05f;
const float dist = 10.0f;
const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]);
float ortho[2][16];
const float viewOffset = m_width/4.0f;
const float viewWidth = m_width/2.0f;
bx::mtxOrtho(ortho[0], centering + viewOffset, centering + viewOffset + viewWidth, m_height + centering, centering, -1.0f, 1.0f, offset0, caps->homogeneousDepth);
bx::mtxOrtho(ortho[1], centering + viewOffset, centering + viewOffset + viewWidth, m_height + centering, centering, -1.0f, 1.0f, offset1, caps->homogeneousDepth);
bgfx::setViewTransform(0, view, ortho[0], BGFX_VIEW_STEREO, ortho[1]);
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float ortho[16];
bx::mtxOrtho(ortho, centering, m_width + centering, m_height + centering, centering, -1.0f, 1.0f, 0.0f, caps->homogeneousDepth);

Просмотреть файл

@ -180,20 +180,6 @@ public:
float eye[3] = { 0.0f, 2.0f, -distance };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's m_width/m_height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -2138,19 +2138,6 @@ public:
cameraUpdate(deltaTime, m_mouseState);
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float eye[3];
cameraGetPosition(eye);
bx::mtxQuatTranslationHMD(m_viewState.m_view, hmd->eye[0].rotation, eye);
bx::mtxProj(m_viewState.m_proj, hmd->eye[0].fov, nearPlane, farPlane, s_oglNdc);
m_viewState.m_width = hmd->width;
m_viewState.m_height = hmd->height;
}
else
{
cameraGetViewMtx(m_viewState.m_view);
bx::mtxProj(m_viewState.m_proj, fov, aspect, nearPlane, farPlane, s_oglNdc);

Просмотреть файл

@ -375,30 +375,6 @@ public:
cameraGetViewMtx(view);
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float viewHead[16];
float eye[3] = {};
bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye);
float tmp[16];
bx::mtxMul(tmp, view, viewHead);
bgfx::setViewTransform(
0
, tmp
, hmd->eye[0].projection
, BGFX_VIEW_STEREO
, hmd->eye[1].projection
);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float proj[16];
bx::mtxProj(

Просмотреть файл

@ -209,23 +209,6 @@ public:
cameraGetViewMtx(view);
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float viewHead[16];
float eye[3] = {};
bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye);
float tmp[16];
bx::mtxMul(tmp, view, viewHead);
bgfx::setViewTransform(0, tmp, hmd->eye[0].projection);
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
bgfx::setViewTransform(1, tmp, hmd->eye[1].projection);
bgfx::setViewRect(1, 0, 0, hmd->width, hmd->height);
}
else
{
float proj[16];
bx::mtxProj(proj, 90.0f, float(m_width)/float(m_height), 0.1f, 10000.0f, bgfx::getCaps()->homogeneousDepth);

Просмотреть файл

@ -617,16 +617,6 @@ public:
float proj[16];
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float eye[3];
cameraGetPosition(eye);
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);

Просмотреть файл

@ -345,16 +345,6 @@ public:
float proj[16];
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float eye[3];
cameraGetPosition(eye);
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);

Просмотреть файл

@ -229,20 +229,6 @@ public:
float eye[3] = { 0.0f, 0.0f, 0.0f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -211,20 +211,6 @@ public:
float eye[3] = { 0.0f, 0.0f, -35.0f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -194,20 +194,6 @@ public:
float eye[3] = { 0.0f, 0.0f, -35.0f };
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float view[16];
bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
}
else
{
float view[16];
bx::mtxLookAt(view, eye, at);

Просмотреть файл

@ -987,18 +987,6 @@ public:
void renderMainPass()
{
// Set view and projection matrix for view 0.
const bgfx::HMD* hmd = bgfx::getHMD();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING))
{
bgfx::setViewTransform(RENDER_PASS_MAIN_ID, m_mainView, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
// Set view 0 default viewport.
//
// Use HMD's width/height since HMD's internal frame buffer size
// might be much larger than window size.
bgfx::setViewRect(RENDER_PASS_MAIN_ID, 0, 0, hmd->width, hmd->height);
}
else
{
bgfx::setViewTransform(RENDER_PASS_MAIN_ID, m_mainView, m_mainProj);

Просмотреть файл

@ -284,9 +284,6 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv)
|| setOrToggle(s_reset, "maxaniso", BGFX_RESET_MAXANISOTROPY, 1, _argc, _argv)
|| setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv)
|| setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv)
|| setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv)
|| setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv)
|| setOrToggle(s_reset, "flush", BGFX_RESET_FLUSH_AFTER_RENDER, 1, _argc, _argv)
|| setOrToggle(s_reset, "flip", BGFX_RESET_FLIP_AFTER_RENDER, 1, _argc, _argv)

Просмотреть файл

@ -79,29 +79,7 @@ struct OcornutImguiContext
bgfx::setViewName(m_viewId, "ImGui");
bgfx::setViewMode(m_viewId, bgfx::ViewMode::Sequential);
const bgfx::HMD* hmd = bgfx::getHMD();
const bgfx::Caps* caps = bgfx::getCaps();
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float proj[16];
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
static float time = 0.0f;
time += 0.05f;
const float dist = 10.0f;
const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]);
float ortho[2][16];
const float viewOffset = width/4.0f;
const float viewWidth = width/2.0f;
bx::mtxOrtho(ortho[0], viewOffset, viewOffset + viewWidth, height, 0.0f, 0.0f, 1000.0f, offset0, caps->homogeneousDepth);
bx::mtxOrtho(ortho[1], viewOffset, viewOffset + viewWidth, height, 0.0f, 0.0f, 1000.0f, offset1, caps->homogeneousDepth);
bgfx::setViewTransform(m_viewId, NULL, ortho[0], BGFX_VIEW_STEREO, ortho[1]);
bgfx::setViewRect(m_viewId, 0, 0, hmd->width, hmd->height);
}
else
{
float ortho[16];
bx::mtxOrtho(ortho, 0.0f, width, height, 0.0f, 0.0f, 1000.0f, 0.0f, caps->homogeneousDepth);

Просмотреть файл

@ -842,34 +842,6 @@ namespace bgfx
uint16_t num; //!< Number of matrices.
};
/// HMD info.
///
/// @attention C99 equivalent is `bgfx_hmd_t`.
///
struct HMD
{
/// Eye
///
/// @attention C99 equivalent is `bgfx_hmd_eye_t`.
///
struct Eye
{
float rotation[4]; //!< Eye rotation represented as quaternion.
float translation[3]; //!< Eye translation.
float fov[4]; //!< Field of view (up, down, left, right).
float viewOffset[3]; //!< Eye view matrix translation adjustment.
float projection[16]; //!< Eye projection matrix.
float pixelsPerTanAngle[2]; //!< Number of pixels that fit in tan(angle) = 1.
};
Eye eye[2];
uint16_t width; //!< Frame buffer width.
uint16_t height; //!< Frame buffer height.
uint32_t deviceWidth; //!< Device resolution width.
uint32_t deviceHeight; //!< Device resolution height.
uint8_t flags; //!< Status flags.
};
///
typedef uint16_t ViewId;
@ -1887,9 +1859,6 @@ namespace bgfx
/// - `BGFX_RESET_VSYNC` - Enable V-Sync.
/// - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy.
/// - `BGFX_RESET_CAPTURE` - Begin screen capture.
/// - `BGFX_RESET_HMD` - HMD stereo rendering.
/// - `BGFX_RESET_HMD_DEBUG` - HMD stereo rendering debug mode.
/// - `BGFX_RESET_HMD_RECENTER` - HMD calibration.
/// - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU.
/// - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip
/// occurs. Default behavior is that flip occurs before rendering new
@ -1949,12 +1918,6 @@ namespace bgfx
///
const Caps* getCaps();
/// Returns HMD info.
///
/// @attention C99 equivalent is `bgfx_get_hmd`.
///
const HMD* getHMD();
/// Returns performance counters.
///
/// @attention Pointer returned is valid until `bgfx::frame` is called.

Просмотреть файл

@ -337,30 +337,6 @@ typedef struct bgfx_transform_s
} bgfx_transform_t;
/**/
typedef struct bgfx_hmd_eye_s
{
float rotation[4];
float translation[3];
float fov[4];
float viewOffset[3];
float projection[16];
float pixelsPerTanAngle[2];
} bgfx_hmd_eye_t;
/**/
typedef struct bgfx_hmd_s
{
bgfx_hmd_eye_t eye[2];
uint16_t width;
uint16_t height;
uint32_t deviceWidth;
uint32_t deviceHeight;
uint8_t flags;
} bgfx_hmd_t;
/**/
typedef uint16_t bgfx_view_id_t;
@ -723,9 +699,6 @@ BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(void);
/**/
BGFX_C_API const bgfx_caps_t* bgfx_get_caps(void);
/**/
BGFX_C_API const bgfx_hmd_t* bgfx_get_hmd(void);
/**/
BGFX_C_API const bgfx_stats_t* bgfx_get_stats(void);

Просмотреть файл

@ -92,7 +92,6 @@ typedef struct bgfx_interface_vtbl
uint32_t (*frame)(bool _capture);
bgfx_renderer_type_t (*get_renderer_type)();
const bgfx_caps_t* (*get_caps)();
const bgfx_hmd_t* (*get_hmd)();
const bgfx_stats_t* (*get_stats)();
const bgfx_memory_t* (*alloc)(uint32_t _size);
const bgfx_memory_t* (*copy)(const void* _data, uint32_t _size);

Просмотреть файл

@ -6,7 +6,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_API_VERSION UINT32_C(75)
#define BGFX_API_VERSION UINT32_C(76)
/// Color RGB/alpha/depth write. When it's not specified write will be disabled.
#define BGFX_STATE_WRITE_R UINT64_C(0x0000000000000001) //!< Enable R write.
@ -417,9 +417,6 @@
#define BGFX_RESET_VSYNC UINT32_C(0x00000080) //!< Enable V-Sync.
#define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100) //!< Turn on/off max anisotropy.
#define BGFX_RESET_CAPTURE UINT32_C(0x00000200) //!< Begin screen capture.
#define BGFX_RESET_HMD UINT32_C(0x00000400) //!< HMD stereo rendering.
#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000800) //!< HMD stereo rendering debug mode.
#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00001000) //!< HMD calibration.
#define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000) //!< Flush rendering after submitting to GPU.
#define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000) //!< This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
#define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer.
@ -440,7 +437,6 @@
#define BGFX_CAPS_FRAGMENT_ORDERING UINT64_C(0x0000000000000040) //!< Fragment ordering is available in fragment shader.
#define BGFX_CAPS_GRAPHICS_DEBUGGER UINT64_C(0x0000000000000080) //!< Graphics debugger is present.
#define BGFX_CAPS_HIDPI UINT64_C(0x0000000000000100) //!< HiDPI rendering is supported.
#define BGFX_CAPS_HMD UINT64_C(0x0000000000000200) //!< Head Mounted Display is available.
#define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000000400) //!< 32-bit indices are supported.
#define BGFX_CAPS_INSTANCING UINT64_C(0x0000000000000800) //!< Instancing is supported.
#define BGFX_CAPS_OCCLUSION_QUERY UINT64_C(0x0000000000001000) //!< Occlusion query is supported.
@ -496,11 +492,6 @@
#define BGFX_PCI_ID_INTEL UINT16_C(0x8086) //!< Intel adapter.
#define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de) //!< nVidia adapter.
///
#define BGFX_HMD_NONE UINT8_C(0x00) //!< None.
#define BGFX_HMD_DEVICE_RESOLUTION UINT8_C(0x01) //!< Has HMD native resolution.
#define BGFX_HMD_RENDERING UINT8_C(0x02) //!< Rendering to HMD.
///
#define BGFX_CUBE_MAP_POSITIVE_X UINT8_C(0x00) //!< Cubemap +x.
#define BGFX_CUBE_MAP_NEGATIVE_X UINT8_C(0x01) //!< Cubemap -x.

Просмотреть файл

@ -9,9 +9,6 @@
#include "glcontext_egl.cpp"
#include "glcontext_glx.cpp"
#include "glcontext_wgl.cpp"
#include "hmd.cpp"
#include "hmd_ovr.cpp"
#include "hmd_openvr.cpp"
#include "nvapi.cpp"
#include "renderer_d3d9.cpp"
#include "renderer_d3d11.cpp"

Просмотреть файл

@ -1159,7 +1159,6 @@ namespace bgfx
CAPS_FLAGS(BGFX_CAPS_FRAGMENT_ORDERING),
CAPS_FLAGS(BGFX_CAPS_GRAPHICS_DEBUGGER),
CAPS_FLAGS(BGFX_CAPS_HIDPI),
CAPS_FLAGS(BGFX_CAPS_HMD),
CAPS_FLAGS(BGFX_CAPS_INDEX32),
CAPS_FLAGS(BGFX_CAPS_INSTANCING),
CAPS_FLAGS(BGFX_CAPS_OCCLUSION_QUERY),
@ -1873,7 +1872,7 @@ namespace bgfx
if (m_rendererInitialized
&& !m_flipped)
{
m_renderCtx->flip(m_render->m_hmd);
m_renderCtx->flip();
m_flipped = true;
if (m_renderCtx->isDeviceRemoved() )
@ -3311,11 +3310,6 @@ error:
return &g_caps;
}
const HMD* getHMD()
{
return s_ctx->getHMD();
}
const Stats* getStats()
{
return s_ctx->getPerfStats();
@ -4619,8 +4613,6 @@ BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Transform, bgfx_transform_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::HMD::Eye, bgfx_hmd_eye_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::HMD, bgfx_hmd_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Stats, bgfx_stats_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexDecl, bgfx_vertex_decl_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t);
@ -4872,11 +4864,6 @@ BGFX_C_API const bgfx_caps_t* bgfx_get_caps(void)
return (const bgfx_caps_t*)bgfx::getCaps();
}
BGFX_C_API const bgfx_hmd_t* bgfx_get_hmd(void)
{
return (const bgfx_hmd_t*)bgfx::getHMD();
}
BGFX_C_API const bgfx_stats_t* bgfx_get_stats(void)
{
return (const bgfx_stats_t*)bgfx::getStats();
@ -5823,7 +5810,6 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
BGFX_IMPORT_FUNC(frame) \
BGFX_IMPORT_FUNC(get_renderer_type) \
BGFX_IMPORT_FUNC(get_caps) \
BGFX_IMPORT_FUNC(get_hmd) \
BGFX_IMPORT_FUNC(get_stats) \
BGFX_IMPORT_FUNC(alloc) \
BGFX_IMPORT_FUNC(copy) \

Просмотреть файл

@ -1778,7 +1778,6 @@ namespace bgfx
Frame()
: m_waitSubmit(0)
, m_waitRender(0)
, m_hmdInitialized(false)
, m_capture(false)
{
SortKey term;
@ -2051,7 +2050,6 @@ namespace bgfx
FreeHandle<UniformHandle, BGFX_CONFIG_MAX_UNIFORMS> m_freeUniform;
TextVideoMem* m_textVideoMem;
HMD m_hmd;
Stats m_perfStats;
ViewStats m_viewStats[BGFX_CONFIG_MAX_VIEWS];
@ -2059,7 +2057,6 @@ namespace bgfx
int64_t m_waitSubmit;
int64_t m_waitRender;
bool m_hmdInitialized;
bool m_capture;
};
@ -2629,7 +2626,7 @@ namespace bgfx
virtual RendererType::Enum getRendererType() const = 0;
virtual const char* getRendererName() const = 0;
virtual bool isDeviceRemoved() = 0;
virtual void flip(HMD& _hmd) = 0;
virtual void flip() = 0;
virtual void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) = 0;
virtual void destroyIndexBuffer(IndexBufferHandle _handle) = 0;
virtual void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) = 0;
@ -2799,18 +2796,6 @@ namespace bgfx
m_submit->m_textVideoMem->image(_x, _y, _width, _height, _data, _pitch);
}
BGFX_API_FUNC(const HMD* getHMD() )
{
BGFX_MUTEX_SCOPE(m_resourceApiLock);
if (m_submit->m_hmdInitialized)
{
return &m_submit->m_hmd;
}
return NULL;
}
BGFX_API_FUNC(const Stats* getPerfStats() )
{
BGFX_MUTEX_SCOPE(m_resourceApiLock);

Просмотреть файл

@ -1,218 +0,0 @@
/*
* Copyright 2011-2018 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#include "hmd.h"
namespace bgfx
{
VR::VR()
: m_impl(NULL)
, m_framesUntilReconnect(0)
, m_enabled(false)
{
}
void VR::init(VRImplI* _impl)
{
if (NULL == _impl)
{
return;
}
if (!_impl->init() )
{
return;
}
m_impl = _impl;
m_impl->connect(&m_desc);
if (!m_impl->isConnected() )
{
connectFailed();
return;
}
m_hmdSize.m_w = m_desc.m_eyeSize[0].m_w + m_desc.m_eyeSize[1].m_w;
m_hmdSize.m_h = bx::uint32_max(m_desc.m_eyeSize[0].m_h, m_desc.m_eyeSize[1].m_h);
}
void VR::shutdown()
{
if (NULL == m_impl)
{
return;
}
m_impl->destroySwapChain();
if (m_impl->isConnected() )
{
m_impl->disconnect();
}
m_impl->shutdown();
m_impl = NULL;
m_enabled = false;
}
void VR::getViewport(uint8_t _eye, Rect* _viewport) const
{
_viewport->m_x = uint16_t(_eye * (m_desc.m_eyeSize[_eye].m_w + 1) );
_viewport->m_y = 0;
_viewport->m_width = uint16_t(m_desc.m_eyeSize[_eye].m_w);
_viewport->m_height = uint16_t(m_desc.m_eyeSize[_eye].m_h);
}
void VR::makeRenderTargetActive()
{
BX_CHECK(m_enabled, "VR::renderEyeStart called while not enabled - render usage error");
if (NULL != m_impl)
{
m_impl->makeRenderTargetActive(m_desc);
}
}
void VR::recenter()
{
if (NULL != m_impl)
{
m_impl->recenter();
}
}
void VR::preReset()
{
if (NULL != m_impl)
{
m_impl->destroyMirror();
}
m_enabled = false;
}
void VR::postReset(int _msaaSamples, int _mirrorWidth, int _mirrorHeight)
{
if (NULL != m_impl
&& m_impl->createSwapChain(m_desc, _msaaSamples, _mirrorWidth, _mirrorHeight) )
{
m_enabled = true;
}
}
void VR::flip()
{
if (NULL == m_impl
|| !m_enabled)
{
return;
}
else if (!m_impl->isConnected()
&& !tryReconnect() )
{
return;
}
if (!m_impl->submitSwapChain(m_desc) )
{
m_impl->destroySwapChain();
m_impl->disconnect();
return;
}
}
void VR::swap(HMD& _hmd)
{
_hmd.flags = BGFX_HMD_NONE;
if (NULL == m_impl)
{
return;
}
_hmd.flags = BGFX_HMD_DEVICE_RESOLUTION;
_hmd.deviceWidth = m_desc.m_deviceSize.m_w;
_hmd.deviceHeight = m_desc.m_deviceSize.m_h;
_hmd.width = uint16_t(m_hmdSize.m_w);
_hmd.height = uint16_t(m_hmdSize.m_h);
if (!m_impl->updateTracking(_hmd) )
{
m_impl->destroySwapChain();
m_impl->disconnect();
}
if (!m_impl->isConnected() )
{
return;
}
for (int eye = 0; eye < 2; ++eye)
{
_hmd.eye[eye].fov[0] = m_desc.m_eyeFov[eye].m_up;
_hmd.eye[eye].fov[1] = m_desc.m_eyeFov[eye].m_down;
_hmd.eye[eye].fov[2] = m_desc.m_eyeFov[eye].m_left;
_hmd.eye[eye].fov[3] = m_desc.m_eyeFov[eye].m_right;
}
m_impl->updateInput(_hmd);
if (m_enabled)
{
_hmd.flags |= BGFX_HMD_RENDERING;
}
}
bool VR::tryReconnect()
{
if (!m_impl)
{
return false;
}
BX_CHECK(!m_impl->isConnected(), "VR::tryReconnect called when already connected. Usage error");
--m_framesUntilReconnect;
if (m_framesUntilReconnect > 0)
{
return false;
}
m_framesUntilReconnect = 90;
m_impl->connect(&m_desc);
if (!m_impl->isConnected() )
{
connectFailed();
return false;
}
m_hmdSize.m_w = m_desc.m_eyeSize[0].m_w + m_desc.m_eyeSize[1].m_w;
m_hmdSize.m_h = bx::uint32_max(m_desc.m_eyeSize[0].m_h, m_desc.m_eyeSize[1].m_h);
return true;
}
void VR::connectFailed()
{
// sane defaults
m_desc.m_deviceSize.m_w = 2160;
m_desc.m_deviceSize.m_h = 1200;
m_desc.m_deviceType = 0;
m_desc.m_refreshRate = 90.0f;
m_desc.m_neckOffset[0] = 0.0805f;
m_desc.m_neckOffset[1] = 0.075f;
for (int eye = 0; eye < 2; ++eye)
{
m_desc.m_eyeFov[eye].m_up = 1.32928634f;
m_desc.m_eyeFov[eye].m_down = 1.32928634f;
}
m_desc.m_eyeFov[0].m_left = 1.05865765f;
m_desc.m_eyeFov[0].m_right = 1.09236801f;
m_desc.m_eyeFov[1].m_left = 1.09236801f;
m_desc.m_eyeFov[1].m_right = 1.05865765f;
}
} // namesapce bgfx

102
src/hmd.h
Просмотреть файл

@ -1,102 +0,0 @@
/*
* Copyright 2011-2018 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef BGFX_HMD_H_HEADER_GUARD
#define BGFX_HMD_H_HEADER_GUARD
#include "bgfx_p.h"
namespace bgfx
{
struct VRSize
{
uint32_t m_w;
uint32_t m_h;
};
struct VRFovTan
{
float m_up;
float m_down;
float m_left;
float m_right;
};
struct VRDesc
{
uint32_t m_deviceType;
float m_refreshRate;
VRSize m_deviceSize;
VRSize m_eyeSize[2];
VRFovTan m_eyeFov[2];
float m_neckOffset[2];
};
struct BX_NO_VTABLE VRImplI
{
virtual ~VRImplI() = 0;
virtual bool init() = 0;
virtual void shutdown() = 0;
virtual void connect(VRDesc* _desc) = 0;
virtual void disconnect() = 0;
virtual bool isConnected() const = 0;
virtual bool updateTracking(HMD& _hmd) = 0;
virtual void updateInput(HMD& _hmd) = 0;
virtual void recenter() = 0;
virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) = 0;
virtual void destroySwapChain() = 0;
virtual void destroyMirror() = 0;
virtual void makeRenderTargetActive(const VRDesc& _desc) = 0;
virtual bool submitSwapChain(const VRDesc& _desc) = 0;
};
inline VRImplI::~VRImplI()
{
}
class VR
{
public:
VR();
void init(VRImplI* _impl);
void shutdown();
bool isInitialized() const
{
return NULL != m_impl;
}
bool isEnabled() const
{
return m_enabled;
}
void getViewport(uint8_t _eye, Rect* _viewport) const;
void makeRenderTargetActive();
void recenter();
void preReset();
void postReset(int _msaaSamples, int _mirrorWidth, int _mirrorHeight);
void flip();
void swap(HMD& _hmd);
private:
bool tryReconnect();
void connectFailed();
VRImplI* m_impl;
VRDesc m_desc;
VRSize m_hmdSize;
uint32_t m_framesUntilReconnect;
bool m_enabled;
};
} // namespace bgfx
#endif // BGFX_HMD_H_HEADER_GUARD

Просмотреть файл

@ -1,95 +0,0 @@
/*
* Copyright 2011-2018 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#include "hmd_openvr.h"
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-variable")
#include <openvr/openvr_capi.h>
namespace bgfx
{
#if BX_PLATFORM_WINDOWS
# define VR_CALLTYPE __cdecl
#else
# define VR_CALLTYPE
#endif
typedef uint32_t (VR_CALLTYPE *PFN_VR_INITINTERNAL)(EVRInitError* peError, EVRApplicationType eType);
typedef void (VR_CALLTYPE *PFN_VR_SHUTDOWNINTERNAL)();
typedef bool (VR_CALLTYPE *PFN_VR_ISHMDPRESENT)();
typedef void* (VR_CALLTYPE *PFN_VR_GETGENERICINTERFACE)(const char* pchInterfaceVersion, EVRInitError* peError);
typedef bool (VR_CALLTYPE *PFN_VR_ISRUNTIMEINSTALLED)();
typedef bool (VR_CALLTYPE *PFN_VR_ISINTERFACEVERSIONVALID)(const char *pchInterfaceVersion);
typedef uint32_t (VR_CALLTYPE *PFN_VR_GETINITTOKEN)();
typedef const char* (VR_CALLTYPE *PFN_VR_GETVRINITERRORASSYMBOL)(EVRInitError error);
typedef const char* (VR_CALLTYPE *PFN_VR_GETVRINITERRORASENGLISHDESCRIPTION)(EVRInitError error);
PFN_VR_INITINTERNAL VR_InitInternal;
PFN_VR_SHUTDOWNINTERNAL VR_ShutdownInternal;
PFN_VR_ISHMDPRESENT VR_IsHmdPresent;
PFN_VR_GETGENERICINTERFACE VR_GetGenericInterface;
PFN_VR_ISRUNTIMEINSTALLED VR_IsRuntimeInstalled;
PFN_VR_ISINTERFACEVERSIONVALID VR_IsInterfaceVersionValid;
PFN_VR_GETINITTOKEN VR_GetInitToken;
PFN_VR_GETVRINITERRORASSYMBOL VR_GetVRInitErrorAsSymbol;
PFN_VR_GETVRINITERRORASENGLISHDESCRIPTION VR_GetVRInitErrorAsEnglishDescription;
void* loadOpenVR()
{
void* openvrdll = bx::dlopen(
#if BX_PLATFORM_LINUX
"libopenvr_api.so"
#elif BX_PLATFORM_OSX
"libopenvr_api.dylib"
#else
"openvr_api.dll"
#endif // BX_PLATFORM_*
);
if (NULL != openvrdll)
{
VR_InitInternal = (PFN_VR_INITINTERNAL )bx::dlsym(openvrdll, "VR_InitInternal");
VR_ShutdownInternal = (PFN_VR_SHUTDOWNINTERNAL )bx::dlsym(openvrdll, "VR_ShutdownInternal");
VR_IsHmdPresent = (PFN_VR_ISHMDPRESENT )bx::dlsym(openvrdll, "VR_IsHmdPresent");
VR_GetGenericInterface = (PFN_VR_GETGENERICINTERFACE )bx::dlsym(openvrdll, "VR_GetGenericInterface");
VR_IsRuntimeInstalled = (PFN_VR_ISRUNTIMEINSTALLED )bx::dlsym(openvrdll, "VR_IsRuntimeInstalled");
VR_IsInterfaceVersionValid = (PFN_VR_ISINTERFACEVERSIONVALID)bx::dlsym(openvrdll, "VR_IsInterfaceVersionValid");
VR_GetInitToken = (PFN_VR_GETINITTOKEN )bx::dlsym(openvrdll, "VR_GetInitToken");
VR_GetVRInitErrorAsSymbol = (PFN_VR_GETVRINITERRORASSYMBOL )bx::dlsym(openvrdll, "VR_GetVRInitErrorAsSymbol");
VR_GetVRInitErrorAsEnglishDescription = (PFN_VR_GETVRINITERRORASENGLISHDESCRIPTION)bx::dlsym(openvrdll, "VR_GetVRInitErrorAsEnglishDescription");
if (NULL == VR_InitInternal
|| NULL == VR_ShutdownInternal
|| NULL == VR_IsHmdPresent
|| NULL == VR_GetGenericInterface
|| NULL == VR_IsRuntimeInstalled
|| NULL == VR_IsInterfaceVersionValid
|| NULL == VR_GetInitToken
|| NULL == VR_GetVRInitErrorAsSymbol
|| NULL == VR_GetVRInitErrorAsEnglishDescription)
{
bx::dlclose(openvrdll);
return NULL;
}
EVRInitError err;
uint32_t token = VR_InitInternal(&err, EVRApplicationType_VRApplication_Scene);
BX_UNUSED(token);
BX_TRACE("OpenVR: HMD is %spresent, Runtime is %sinstalled."
, VR_IsHmdPresent() ? "" : "not "
, VR_IsRuntimeInstalled() ? "" : "not "
);
}
return openvrdll;
}
void unloadOpenVR(void* _openvrdll)
{
VR_ShutdownInternal();
bx::dlclose(_openvrdll);
}
} // namespace bgfx

Просмотреть файл

@ -1,18 +0,0 @@
/*
* Copyright 2011-2018 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef BGFX_OPENVR_H_HEADER_GUARD
#define BGFX_OPENVR_H_HEADER_GUARD
#include "bgfx_p.h"
namespace bgfx
{
void* loadOpenVR();
void unloadOpenVR(void*);
} // namespace bgfx
#endif // BGFX_OPENVR_H_HEADER_GUARD

Просмотреть файл

@ -1,210 +0,0 @@
/*
* Copyright 2011-2018 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#include "bgfx_p.h"
#if BGFX_CONFIG_USE_OVR
#include "hmd_ovr.h"
namespace bgfx
{
#define _OVR_CHECK(_call) \
BX_MACRO_BLOCK_BEGIN \
ovrResult __result__ = _call; \
BX_CHECK(OVR_SUCCESS(__result__), #_call " FAILED %d", __result__); \
BX_MACRO_BLOCK_END
#if BGFX_CONFIG_DEBUG
# define OVR_CHECK(_call) _OVR_CHECK(_call)
#else
# define OVR_CHECK(_call) _call
#endif // BGFX_CONFIG_DEBUG
VRImplOVR::VRImplOVR()
: m_session(NULL)
{
}
VRImplOVR::~VRImplOVR()
{
if (NULL != g_platformData.session)
{
return;
}
BX_CHECK(NULL == m_session, "OVR not shutdown properly.");
}
bool VRImplOVR::init()
{
if (NULL != g_platformData.session)
{
return true;
}
ovrResult initialized = ovr_Initialize(NULL);
if (!OVR_SUCCESS(initialized))
{
BX_TRACE("Unable to initialize OVR runtime.");
return false;
}
return true;
}
void VRImplOVR::shutdown()
{
if (NULL != g_platformData.session)
{
return;
}
ovr_Shutdown();
}
void VRImplOVR::connect(VRDesc* _desc)
{
if (NULL == g_platformData.session)
{
ovrGraphicsLuid luid;
ovrResult result = ovr_Create(&m_session, &luid);
if (!OVR_SUCCESS(result))
{
BX_TRACE("Failed to create OVR device.");
return;
}
}
else
{
m_session = (ovrSession)g_platformData.session;
}
ovrHmdDesc hmdDesc = ovr_GetHmdDesc(m_session);
_desc->m_deviceType = hmdDesc.Type;
_desc->m_refreshRate = hmdDesc.DisplayRefreshRate;
_desc->m_deviceSize.m_w = hmdDesc.Resolution.w;
_desc->m_deviceSize.m_h = hmdDesc.Resolution.h;
BX_TRACE("OVR HMD: %s, %s, firmware: %d.%d"
, hmdDesc.ProductName
, hmdDesc.Manufacturer
, hmdDesc.FirmwareMajor
, hmdDesc.FirmwareMinor
);
ovrSizei eyeSize[2] =
{
ovr_GetFovTextureSize(m_session, ovrEye_Left, hmdDesc.DefaultEyeFov[0], 1.0f),
ovr_GetFovTextureSize(m_session, ovrEye_Right, hmdDesc.DefaultEyeFov[0], 1.0f),
};
for (int eye = 0; eye < 2; ++eye)
{
BX_STATIC_ASSERT(sizeof(_desc->m_eyeFov[eye]) == sizeof(hmdDesc.DefaultEyeFov[eye]));
bx::memCopy(&_desc->m_eyeFov[eye], &hmdDesc.DefaultEyeFov[eye], sizeof(_desc->m_eyeFov[eye]));
_desc->m_eyeSize[eye].m_w = eyeSize[eye].w;
_desc->m_eyeSize[eye].m_h = eyeSize[eye].h;
}
float neckOffset[2] = {OVR_DEFAULT_NECK_TO_EYE_HORIZONTAL, OVR_DEFAULT_NECK_TO_EYE_VERTICAL};
ovr_GetFloatArray(m_session, OVR_KEY_NECK_TO_EYE_DISTANCE, neckOffset, 2);
_desc->m_neckOffset[0] = neckOffset[0];
_desc->m_neckOffset[1] = neckOffset[1];
// build constant layer settings
m_renderLayer.Header.Type = ovrLayerType_EyeFov;
m_renderLayer.Header.Flags = 0;
m_renderLayer.Fov[0] = hmdDesc.DefaultEyeFov[0];
m_renderLayer.Fov[1] = hmdDesc.DefaultEyeFov[1];
m_renderLayer.Viewport[0].Pos.x = 0;
m_renderLayer.Viewport[0].Pos.y = 0;
m_renderLayer.Viewport[0].Size.w = _desc->m_eyeSize[0].m_w;
m_renderLayer.Viewport[0].Size.h = _desc->m_eyeSize[0].m_h;
m_renderLayer.Viewport[1].Pos.x = _desc->m_eyeSize[0].m_w+1;
m_renderLayer.Viewport[1].Pos.y = 0;
m_renderLayer.Viewport[1].Size.w = _desc->m_eyeSize[1].m_w;
m_renderLayer.Viewport[1].Size.h = _desc->m_eyeSize[1].m_h;
m_viewScale.HmdSpaceToWorldScaleInMeters = 1.0f;
for (int eye = 0; eye < 2; ++eye)
{
ovrEyeRenderDesc erd = ovr_GetRenderDesc(m_session, static_cast<ovrEyeType>(eye), hmdDesc.DefaultEyeFov[eye]);
m_viewScale.HmdToEyeOffset[eye] = erd.HmdToEyeOffset;
m_eyeFov[eye] = erd.Fov;
m_pixelsPerTanAngleAtCenter[eye] = erd.PixelsPerTanAngleAtCenter;
}
}
void VRImplOVR::disconnect()
{
if (NULL != g_platformData.session)
{
return;
}
if (NULL != m_session)
{
ovr_Destroy(m_session);
m_session = NULL;
}
}
bool VRImplOVR::updateTracking(HMD& _hmd)
{
if (NULL == m_session)
{
return false;
}
ovr_GetEyePoses(m_session, 0, ovrTrue, m_viewScale.HmdToEyeOffset, m_renderLayer.RenderPose, &m_renderLayer.SensorSampleTime);
for (int eye = 0; eye < 2; ++eye)
{
const ovrPosef& pose = m_renderLayer.RenderPose[eye];
HMD::Eye& hmdEye = _hmd.eye[eye];
hmdEye.rotation[0] = pose.Orientation.x;
hmdEye.rotation[1] = pose.Orientation.y;
hmdEye.rotation[2] = pose.Orientation.z;
hmdEye.rotation[3] = pose.Orientation.w;
hmdEye.translation[0] = pose.Position.x;
hmdEye.translation[1] = pose.Position.y;
hmdEye.translation[2] = pose.Position.z;
hmdEye.viewOffset[0] = -m_viewScale.HmdToEyeOffset[eye].x;
hmdEye.viewOffset[1] = -m_viewScale.HmdToEyeOffset[eye].y;
hmdEye.viewOffset[2] = -m_viewScale.HmdToEyeOffset[eye].z;
hmdEye.pixelsPerTanAngle[0] = m_pixelsPerTanAngleAtCenter[eye].x;
hmdEye.pixelsPerTanAngle[1] = m_pixelsPerTanAngleAtCenter[eye].y;
ovrMatrix4f projection = ovrMatrix4f_Projection(m_eyeFov[eye], 0.1f, 1000.0f, ovrProjection_LeftHanded);
for (uint32_t ii = 0; ii < 4; ++ii)
{
for (uint32_t jj = 0; jj < 4; ++jj)
{
hmdEye.projection[4*ii + jj] = projection.M[jj][ii];
}
}
}
return true;
}
void VRImplOVR::updateInput(HMD& /* _hmd */)
{
}
void VRImplOVR::recenter()
{
if (NULL != m_session)
{
ovr_RecenterTrackingOrigin(m_session);
}
}
} // namespace bgfx
#endif // BGFX_CONFIG_USE_OVR

Просмотреть файл

@ -1,70 +0,0 @@
/*
* Copyright 2011-2018 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef BGFX_OVR_H_HEADER_GUARD
#define BGFX_OVR_H_HEADER_GUARD
#include "bgfx_p.h"
#if BGFX_CONFIG_USE_OVR
# include "hmd.h"
# include <OVR_Version.h>
# define OVR_VERSION_(_a, _b, _c) (_a * 10000 + _b * 100 + _c)
# define OVR_VERSION OVR_VERSION_(OVR_PRODUCT_VERSION, OVR_MAJOR_VERSION, OVR_MINOR_VERSION)
# include <OVR_CAPI.h>
# if BGFX_CONFIG_RENDERER_DIRECT3D11
# include <OVR_CAPI_D3D.h>
# endif // BGFX_CONFIG_RENDERER_DIRECT3D11
# if BGFX_CONFIG_RENDERER_OPENGL
# include <OVR_CAPI_GL.h>
# endif // BGFX_CONFIG_RENDERER_OPENGL
namespace bgfx
{
class VRImplOVR : public VRImplI
{
public:
VRImplOVR();
virtual ~VRImplOVR() = 0;
virtual bool init() override;
virtual void shutdown() override;
virtual void connect(VRDesc* _desc) override;
virtual void disconnect() override;
virtual bool isConnected() const override
{
return NULL != m_session;
}
virtual bool updateTracking(HMD& _hmd) override;
virtual void updateInput(HMD& _hmd) override;
virtual void recenter() override;
virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) override = 0;
virtual void destroySwapChain() override = 0;
virtual void destroyMirror() override = 0;
virtual void makeRenderTargetActive(const VRDesc& _desc) override = 0;
virtual bool submitSwapChain(const VRDesc& _desc) override = 0;
protected:
ovrSession m_session;
ovrLayerEyeFov m_renderLayer;
ovrViewScaleDesc m_viewScale;
ovrFovPort m_eyeFov[2];
ovrVector2f m_pixelsPerTanAngleAtCenter[2];
};
} // namespace bgfx
#endif // BGFX_CONFIG_USE_OVR
#endif // BGFX_OVR_H_HEADER_GUARD

Просмотреть файл

@ -47,12 +47,12 @@ namespace bgfx
{
}
ViewState(Frame* _frame, bool _hmdEnabled)
ViewState(Frame* _frame, bool _stereo)
{
reset(_frame, _hmdEnabled);
reset(_frame, _stereo);
}
void reset(Frame* _frame, bool _hmdEnabled)
void reset(Frame* _frame, bool _stereo)
{
m_alphaRef = 0.0f;
m_invViewCached = UINT16_MAX;
@ -62,16 +62,15 @@ namespace bgfx
m_view[0] = m_viewTmp[0];
m_view[1] = m_viewTmp[1];
if (_hmdEnabled)
if (_stereo)
{
HMD& hmd = _frame->m_hmd;
m_view[0] = m_viewTmp[0];
Matrix4 viewAdjust;
bx::mtxIdentity(viewAdjust.un.val);
for (uint32_t eye = 0; eye < 2; ++eye)
{
/*
const HMD::Eye& hmdEye = hmd.eye[eye];
viewAdjust.un.val[12] = hmdEye.viewOffset[0];
viewAdjust.un.val[13] = hmdEye.viewOffset[1];
@ -91,6 +90,7 @@ namespace bgfx
bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].m_view.un.f4x4, sizeof(Matrix4) );
}
}
*/
}
}
else
@ -103,7 +103,7 @@ namespace bgfx
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{
for (uint32_t eye = 0; eye < uint32_t(_hmdEnabled)+1; ++eye)
for (uint32_t eye = 0; eye < uint32_t(_stereo)+1; ++eye)
{
bx::float4x4_mul(&m_viewProj[eye][ii].un.f4x4
, &m_view[eye][ii].un.f4x4

Просмотреть файл

@ -8,10 +8,6 @@
#if BGFX_CONFIG_RENDERER_DIRECT3D11
# include "renderer_d3d11.h"
#if BGFX_CONFIG_USE_OVR
# include "hmd_ovr.h"
#endif // BGFX_CONFIG_USE_OVR
namespace bgfx { namespace d3d11
{
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
@ -717,15 +713,8 @@ namespace bgfx { namespace d3d11
ErrorState::Enum errorState = ErrorState::Default;
// Must be before device creation, and before RenderDoc.
VRImplI* vrImpl = NULL;
#if BGFX_CONFIG_USE_OVR
vrImpl = &m_ovrRender;
#endif // BGFX_CONFIG_USE_OVR
m_ovr.init(vrImpl);
if (!m_ovr.isInitialized()
&& (_init.debug || _init.profile) )
if (_init.debug
|| _init.profile)
{
m_renderdocdll = loadRenderDoc();
}
@ -1141,9 +1130,6 @@ namespace bgfx { namespace d3d11
| BGFX_CAPS_TEXTURE_DIRECT_ACCESS
: 0)
| BGFX_CAPS_SWAP_CHAIN
| (m_ovr.isInitialized()
? BGFX_CAPS_HMD
: 0)
| BGFX_CAPS_DRAW_INDIRECT
| BGFX_CAPS_TEXTURE_BLIT
| BGFX_CAPS_TEXTURE_READ_BACK
@ -1555,7 +1541,6 @@ namespace bgfx { namespace d3d11
m_agsdll = NULL;
unloadRenderDoc(m_renderdocdll);
m_ovr.shutdown();
break;
}
@ -1565,7 +1550,6 @@ namespace bgfx { namespace d3d11
void shutdown()
{
preReset();
m_ovr.shutdown();
if (NULL != m_ags)
{
@ -2129,8 +2113,7 @@ namespace bgfx { namespace d3d11
ovrPostReset();
// If OVR doesn't create separate depth stencil view, create default one.
if (!m_ovr.isEnabled() && NULL == m_backBufferDepthStencil)
if (NULL == m_backBufferDepthStencil)
{
D3D11_TEXTURE2D_DESC dsd;
dsd.Width = m_scd.width;
@ -2150,14 +2133,7 @@ namespace bgfx { namespace d3d11
DX_RELEASE(depthStencil, 0);
}
if (m_ovr.isEnabled() )
{
m_ovr.makeRenderTargetActive();
}
else
{
m_deviceCtx->OMSetRenderTargets(1, &m_backBufferColor, m_backBufferDepthStencil);
}
m_deviceCtx->OMSetRenderTargets(1, &m_backBufferColor, m_backBufferDepthStencil);
m_currentColor = m_backBufferColor;
m_currentDepthStencil = m_backBufferDepthStencil;
@ -2175,7 +2151,7 @@ namespace bgfx { namespace d3d11
return m_lost;
}
void flip(HMD& _hmd) override
void flip() override
{
if (NULL != m_swapChain
&& !m_lost)
@ -2195,13 +2171,7 @@ namespace bgfx { namespace d3d11
{
if (m_needPresent)
{
m_ovr.flip();
m_ovr.swap(_hmd);
if (!m_ovr.isEnabled() )
{
hr = m_swapChain->Present(syncInterval, 0);
}
hr = m_swapChain->Present(syncInterval, 0);
m_needPresent = false;
}
@ -2285,8 +2255,6 @@ namespace bgfx { namespace d3d11
m_resolution.reset &= ~BGFX_RESET_SUSPEND;
}
bool recenter = !!(_resolution.reset & BGFX_RESET_HMD_RECENTER);
uint32_t maxAnisotropy = 1;
if (!!(_resolution.reset & BGFX_RESET_MAXANISOTROPY) )
{
@ -2314,7 +2282,6 @@ namespace bgfx { namespace d3d11
}
const uint32_t maskFlags = ~(0
| BGFX_RESET_HMD_RECENTER
| BGFX_RESET_MAXANISOTROPY
| BGFX_RESET_DEPTH_CLAMP
| BGFX_RESET_SUSPEND
@ -2382,19 +2349,9 @@ namespace bgfx { namespace d3d11
m_scd.bufferCount = m_swapBufferCount;
}
SwapChainDesc* scd = &m_scd;
SwapChainDesc swapChainScd;
if (0 != (m_resolution.reset & BGFX_RESET_HMD)
&& m_ovr.isInitialized() )
{
swapChainScd = m_scd;
swapChainScd.sampleDesc = s_msaa[0];
scd = &swapChainScd;
}
HRESULT hr;
hr = m_dxgi.createSwapChain(m_device
, *scd
, m_scd
, &m_swapChain
);
BGFX_FATAL(SUCCEEDED(hr), bgfx::Fatal::UnableToInitialize, "Failed to create swap chain.");
@ -2404,11 +2361,6 @@ namespace bgfx { namespace d3d11
postReset();
}
if (recenter)
{
m_ovr.recenter();
}
return false;
}
@ -2471,15 +2423,8 @@ namespace bgfx { namespace d3d11
if (!isValid(_fbh) )
{
if (m_ovr.isEnabled() )
{
m_ovr.makeRenderTargetActive();
}
else
{
m_currentColor = m_backBufferColor;
m_currentDepthStencil = m_backBufferDepthStencil;
}
m_currentColor = m_backBufferColor;
m_currentDepthStencil = m_backBufferDepthStencil;
m_deviceCtx->OMSetRenderTargets(1, &m_currentColor, m_currentDepthStencil);
m_needPresent |= _needPresent;
@ -3485,11 +3430,6 @@ namespace bgfx { namespace d3d11
bool m_rtMsaa;
bool m_timerQuerySupport;
bool m_directAccessSupport;
VR m_ovr;
#if BGFX_CONFIG_USE_OVR
VRImplOVRD3D11 m_ovrRender;
#endif // BGFX_CONFIG_USE_OVR
};
static RendererContextD3D11* s_renderD3D11;
@ -5459,9 +5399,7 @@ namespace bgfx { namespace d3d11
RenderBind currentBind;
currentBind.clear();
_render->m_hmdInitialized = m_ovr.isInitialized();
const bool hmdEnabled = m_ovr.isEnabled();
const bool hmdEnabled = false;
static ViewState viewState;
viewState.reset(_render, hmdEnabled);
@ -5590,15 +5528,8 @@ namespace bgfx { namespace d3d11
);
}
if (m_ovr.isEnabled() )
{
m_ovr.getViewport(eye, &viewState.m_rect);
}
else
{
viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2;
viewState.m_rect.m_width /= 2;
}
viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2;
viewState.m_rect.m_width /= 2;
}
else
{
@ -6452,14 +6383,14 @@ namespace bgfx { namespace d3d11
);
char hmd[16];
bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' ');
bx::snprintf(hmd, BX_COUNTOF(hmd), ", [ ] HMD ");
const uint32_t msaa = (m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d%s, [%c] MaxAnisotropy "
, !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' '
, 0 != msaa ? '\xfe' : ' '
, 1<<msaa
, m_ovr.isInitialized() ? hmd : ", no-HMD "
, ", no-HMD "
, !!(m_resolution.reset&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
);

Просмотреть файл

@ -36,8 +36,6 @@ BX_PRAGMA_DIAGNOSTIC_POP()
#include "renderer.h"
#include "renderer_d3d.h"
#include "shader_dxbc.h"
#include "hmd.h"
#include "hmd_openvr.h"
#include "debug_renderdoc.h"
#include "nvapi.h"
#include "dxgi.h"

Просмотреть файл

@ -1404,7 +1404,7 @@ namespace bgfx { namespace d3d12
return m_lost;
}
void flip(HMD& /*_hmd*/) override
void flip() override
{
if (NULL != m_swapChain
&& !m_lost)
@ -2101,7 +2101,6 @@ namespace bgfx { namespace d3d12
}
const uint32_t maskFlags = ~(0
| BGFX_RESET_HMD_RECENTER
| BGFX_RESET_MAXANISOTROPY
| BGFX_RESET_DEPTH_CLAMP
| BGFX_RESET_SUSPEND
@ -5563,8 +5562,6 @@ namespace bgfx { namespace d3d12
RenderBind currentBind;
currentBind.clear();
_render->m_hmdInitialized = false;
const bool hmdEnabled = false;
static ViewState viewState;
viewState.reset(_render, hmdEnabled);

Просмотреть файл

@ -1403,7 +1403,6 @@ namespace bgfx { namespace d3d9
: 1
;
const uint32_t maskFlags = ~(0
| BGFX_RESET_HMD_RECENTER
| BGFX_RESET_MAXANISOTROPY
| BGFX_RESET_DEPTH_CLAMP
| BGFX_RESET_SUSPEND
@ -1523,7 +1522,7 @@ namespace bgfx { namespace d3d9
return false;
}
void flip(HMD& /*_hmd*/) override
void flip() override
{
if (NULL != m_swapChain)
{

Просмотреть файл

@ -9,7 +9,6 @@
# include "renderer_gl.h"
# include <bx/timer.h>
# include <bx/uint32_t.h>
# include "hmd_ovr.h"
namespace bgfx { namespace gl
{
@ -1798,13 +1797,6 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
setRenderContextSize(_init.resolution.width, _init.resolution.height);
// Must be after context is initialized?!
VRImplI* vrImpl = NULL;
#if BGFX_CONFIG_USE_OVR
vrImpl = &m_ovrRender;
#endif
m_ovr.init(vrImpl);
m_vendor = getGLString(GL_VENDOR);
m_renderer = getGLString(GL_RENDERER);
m_version = getGLString(GL_VERSION);
@ -2595,7 +2587,6 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
}
ovrPreReset();
m_ovr.shutdown();
m_glctx.destroy();
@ -2606,7 +2597,6 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
void shutdown()
{
ovrPreReset();
m_ovr.shutdown();
if (m_vaoSupport)
{
@ -2657,7 +2647,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
return false;
}
void flip(HMD& _hmd) override
void flip() override
{
if (m_flip)
{
@ -2673,9 +2663,6 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
if (m_needPresent)
{
m_ovr.flip();
m_ovr.swap(_hmd);
// Ensure the back buffer is bound as the source of the flip
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo));
@ -3122,7 +3109,6 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
void updateResolution(const Resolution& _resolution)
{
bool recenter = !!(_resolution.reset & BGFX_RESET_HMD_RECENTER);
m_maxAnisotropy = !!(_resolution.reset & BGFX_RESET_MAXANISOTROPY)
? m_maxAnisotropyDefault
: 0.0f
@ -3141,7 +3127,6 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
}
const uint32_t maskFlags = ~(0
| BGFX_RESET_HMD_RECENTER
| BGFX_RESET_MAXANISOTROPY
| BGFX_RESET_DEPTH_CLAMP
| BGFX_RESET_SUSPEND
@ -3159,12 +3144,6 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
m_textVideoMem.resize(false, _resolution.width, _resolution.height);
m_textVideoMem.clear();
if ( (flags & BGFX_RESET_HMD)
&& m_ovr.isInitialized() )
{
flags &= ~BGFX_RESET_MSAA_MASK;
}
setRenderContextSize(m_resolution.width
, m_resolution.height
, flags
@ -3179,22 +3158,10 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
ovrPreReset();
ovrPostReset();
if (m_ovr.isEnabled() )
{
m_ovr.makeRenderTargetActive();
}
else
{
m_currentFbo = 0;
}
m_currentFbo = 0;
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_currentFbo) );
}
if (recenter)
{
m_ovr.recenter();
}
}
void setShaderUniform4f(uint8_t /*_flags*/, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
@ -3235,14 +3202,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
{
m_needPresent |= true;
if (m_ovr.isEnabled() )
{
m_ovr.makeRenderTargetActive();
}
else
{
m_currentFbo = m_msaaBackBufferFbo;
}
m_currentFbo = m_msaaBackBufferFbo;
if (m_srgbWriteControlSupport)
{
@ -3972,11 +3932,6 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
Workaround m_workaround;
GLuint m_currentFbo;
VR m_ovr;
#if BGFX_CONFIG_USE_OVR
VRImplOVRGL m_ovrRender;
#endif // BGFX_CONFIG_USE_OVR
};
RendererContextGL* s_renderGL;
@ -6643,9 +6598,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
RenderBind currentBind;
currentBind.clear();
_render->m_hmdInitialized = m_ovr.isInitialized();
const bool hmdEnabled = m_ovr.isEnabled();
const bool hmdEnabled = false;
static ViewState viewState;
viewState.reset(_render, hmdEnabled);
@ -6656,10 +6609,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
BlitState bs(_render);
int32_t resolutionHeight = hmdEnabled
? _render->m_hmd.height
: _render->m_resolution.height
;
int32_t resolutionHeight = _render->m_resolution.height;
uint32_t blendFactor = 0;
uint8_t primIndex;
@ -6749,10 +6699,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
if (_render->m_view[view].m_fbh.idx != fbh.idx)
{
fbh = _render->m_view[view].m_fbh;
resolutionHeight = hmdEnabled
? _render->m_hmd.height
: _render->m_resolution.height
;
resolutionHeight = _render->m_resolution.height;
resolutionHeight = setFrameBuffer(fbh, resolutionHeight, discardFlags);
}
@ -6792,15 +6739,8 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
GL_CHECK(glInsertEventMarker(0, viewName) );
}
if (m_ovr.isEnabled() )
{
m_ovr.getViewport(eye, &viewState.m_rect);
}
else
{
viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2;
viewState.m_rect.m_width /= 2;
}
viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2;
viewState.m_rect.m_width /= 2;
}
else
{
@ -7783,14 +7723,14 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
);
char hmd[16];
bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' ');
bx::snprintf(hmd, BX_COUNTOF(hmd), ", [ ] HMD ");
const uint32_t msaa = (m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d%s, [%c] MaxAnisotropy "
, !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' '
, 0 != msaa ? '\xfe' : ' '
, 1<<msaa
, m_ovr.isInitialized() ? hmd : ", no-HMD "
, ", no-HMD "
, !!(m_resolution.reset&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
);

Просмотреть файл

@ -113,8 +113,6 @@ typedef uint64_t GLuint64;
#endif // BGFX_CONFIG_RENDERER_OPENGL
#include "renderer.h"
#include "hmd.h"
#include "hmd_openvr.h"
#include "debug_renderdoc.h"
#ifndef GL_LUMINANCE

Просмотреть файл

@ -1163,7 +1163,7 @@ namespace bgfx { namespace mtl
return false;
}
void flip(HMD& /*_hmd*/) override
void flip() override
{
if (NULL == m_commandBuffer)
{

Просмотреть файл

@ -22,7 +22,6 @@ namespace bgfx { namespace noop
| BGFX_CAPS_FRAGMENT_ORDERING
| BGFX_CAPS_GRAPHICS_DEBUGGER
| BGFX_CAPS_HIDPI
| BGFX_CAPS_HMD
| BGFX_CAPS_INDEX32
| BGFX_CAPS_INSTANCING
| BGFX_CAPS_OCCLUSION_QUERY
@ -88,7 +87,7 @@ namespace bgfx { namespace noop
return false;
}
void flip(HMD& /*_hmd*/) override
void flip() override
{
}

Просмотреть файл

@ -1959,7 +1959,7 @@ VK_IMPORT_DEVICE
return false;
}
void flip(HMD& /*_hmd*/) override
void flip() override
{
if (VK_NULL_HANDLE != m_swapchain)
{
@ -2192,7 +2192,7 @@ VK_IMPORT_DEVICE
m_pipelineStateCache.invalidate();
}
uint32_t flags = _resolution.reset & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP);
uint32_t flags = _resolution.reset & ~(BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP);
if (m_resolution.width != _resolution.width
|| m_resolution.height != _resolution.height
@ -3663,8 +3663,6 @@ VK_DESTROY
currentState.m_stateFlags = BGFX_STATE_NONE;
currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE);
_render->m_hmdInitialized = false;
const bool hmdEnabled = false;
ViewState viewState(_render, hmdEnabled);
viewState.reset(_render, hmdEnabled);