Addressed feedback from code review.

This commit is contained in:
Anthony J. Thibault 2016-10-07 17:46:46 -07:00
parent a4c7e832b5
commit ec801cb9d8
4 changed files with 11 additions and 5 deletions

View file

@ -127,7 +127,7 @@ const gpu::TexturePointer& TextureCache::getGrayTexture() {
if (!_grayTexture) { if (!_grayTexture) {
_grayTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1)); _grayTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1));
_grayTexture->setSource("TextureCache::_grayTexture"); _grayTexture->setSource("TextureCache::_grayTexture");
_grayTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_WHITE), OPAQUE_GRAY); _grayTexture->assignStoredMip(0, _grayTexture->getTexelFormat(), sizeof(OPAQUE_GRAY), OPAQUE_GRAY);
} }
return _grayTexture; return _grayTexture;
} }
@ -145,7 +145,7 @@ const gpu::TexturePointer& TextureCache::getBlackTexture() {
if (!_blackTexture) { if (!_blackTexture) {
_blackTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1)); _blackTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, 1, 1));
_blackTexture->setSource("TextureCache::_blackTexture"); _blackTexture->setSource("TextureCache::_blackTexture");
_blackTexture->assignStoredMip(0, _whiteTexture->getTexelFormat(), sizeof(OPAQUE_BLACK), OPAQUE_BLACK); _blackTexture->assignStoredMip(0, _blackTexture->getTexelFormat(), sizeof(OPAQUE_BLACK), OPAQUE_BLACK);
} }
return _blackTexture; return _blackTexture;
} }

View file

@ -61,6 +61,11 @@ void OculusBaseDisplayPlugin::customizeContext() {
Parent::customizeContext(); Parent::customizeContext();
} }
void OculusBaseDisplayPlugin::uncustomizeContext() {
Parent::uncustomizeContext();
internalPresent();
}
bool OculusBaseDisplayPlugin::internalActivate() { bool OculusBaseDisplayPlugin::internalActivate() {
_session = acquireOculusSession(); _session = acquireOculusSession();
if (!_session) { if (!_session) {

View file

@ -26,6 +26,7 @@ public:
protected: protected:
void customizeContext() override; void customizeContext() override;
void uncustomizeContext() override;
bool internalActivate() override; bool internalActivate() override;
void internalDeactivate() override; void internalDeactivate() override;
void updatePresentPose() override; void updatePresentPose() override;

View file

@ -104,9 +104,9 @@ void releaseOpenVrSystem() {
qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system"; qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system";
#endif #endif
// HACK: workaround openvr crash, call submit right before VR_Shutdown. // HACK: workaround openvr crash, call submit with an invalid texture, right before VR_Shutdown.
const GLuint NON_ZERO_GL_TEXTURE_HANDLE = 1; const GLuint INVALID_GL_TEXTURE_HANDLE = -1;
vr::Texture_t vrTexture{ (void*)NON_ZERO_GL_TEXTURE_HANDLE, vr::API_OpenGL, vr::ColorSpace_Auto }; vr::Texture_t vrTexture{ (void*)INVALID_GL_TEXTURE_HANDLE, vr::API_OpenGL, vr::ColorSpace_Auto };
static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_LEFT{ 0, 0, 0.5f, 1 }; static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_LEFT{ 0, 0, 0.5f, 1 };
static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_RIGHT{ 0.5f, 0, 1, 1 }; static vr::VRTextureBounds_t OPENVR_TEXTURE_BOUNDS_RIGHT{ 0.5f, 0, 1, 1 };
vr::VRCompositor()->Submit(vr::Eye_Left, &vrTexture, &OPENVR_TEXTURE_BOUNDS_LEFT); vr::VRCompositor()->Submit(vr::Eye_Left, &vrTexture, &OPENVR_TEXTURE_BOUNDS_LEFT);