Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Workaround for Oculus Layers halo artifact #3105

Merged
merged 1 commit into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,11 @@ struct DeviceDelegateOculusVR::State {
initialized = true;
std::string version = vrapi_GetVersionString();
if (version.find("1.1.32.0") != std::string::npos) {
VRB_ERROR("Disable layers due to driver bug. VRAPI Runtime Version: %s", vrapi_GetVersionString());
layersEnabled = false;
VRBrowser::DisableLayers();
} else {
layersEnabled = VRBrowser::AreLayersEnabled();
VRB_ERROR("Force layer clip due to driver bug. VRAPI Runtime Version: %s",vrapi_GetVersionString());
OculusLayer::sForceClip = true;
}

layersEnabled = VRBrowser::AreLayersEnabled();
SetRenderSize(device::RenderMode::StandAlone);

for (int i = 0; i < VRAPI_EYE_COUNT; ++i) {
Expand Down
7 changes: 6 additions & 1 deletion app/src/oculusvr/cpp/OculusVRLayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ static ovrMatrix4f ovrMatrixFrom(const vrb::Matrix &aMatrix) {
return m;
}

bool OculusLayer::sForceClip = false;

// OculusLayerQuad

Expand Down Expand Up @@ -40,7 +41,7 @@ OculusLayerQuad::Update(const ovrTracking2& aTracking, ovrTextureSwapChain* aCle
vrb::Matrix scale = vrb::Matrix::Identity();
scale.ScaleInPlace(vrb::Vector(w * 0.5f, h * 0.5f, 1.0f));

bool clip = false;
bool clip = sForceClip;

for (int i = 0; i < VRAPI_FRAME_LAYER_EYE_MAX; ++i) {
device::Eye eye = i == 0 ? device::Eye::Left : device::Eye::Right;
Expand Down Expand Up @@ -108,6 +109,10 @@ OculusLayerCylinder::Update(const ovrTracking2& aTracking, ovrTextureSwapChain*
ovrLayer.Textures[i].TextureRect.width = 1.0f;
ovrLayer.Textures[i].TextureRect.height = 1.0f;
}

if (sForceClip) {
SetClipEnabled(true);
}
}


Expand Down
1 change: 1 addition & 0 deletions app/src/oculusvr/cpp/OculusVRLayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ typedef std::weak_ptr<SurfaceChangedTarget> SurfaceChangedTargetWeakPtr;

class OculusLayer {
public:
static bool sForceClip;
virtual void Init(JNIEnv *aEnv, vrb::RenderContextPtr &aContext) = 0;
virtual void Update(const ovrTracking2 &aTracking, ovrTextureSwapChain *aClearSwapChain) = 0;
virtual ovrTextureSwapChain *GetSwapChain() const = 0;
Expand Down