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

Clean up unused WebVR Foveated-Rendering code. (fixes #1275) #1304

Merged
merged 1 commit into from
Jun 11, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,7 @@ public void updateEnvironment() {
@Override
public void updateFoveatedLevel() {
final int appLevel = SettingsStore.getInstance(this).getFoveatedLevelApp();
final int webVRLevel = SettingsStore.getInstance(this).getFoveatedLevelWebVR();
queueRunnable(() -> updateFoveatedLevelNative(appLevel, webVRLevel));
queueRunnable(() -> updateFoveatedLevelNative(appLevel));
}

@Override
Expand Down Expand Up @@ -1158,7 +1157,7 @@ public void setCylinderDensity(final float aDensity) {
private native void setCylinderDensityNative(float aDensity);
private native void setCPULevelNative(@CPULevelFlags int aCPULevel);
private native void setIsServo(boolean aIsServo);
private native void updateFoveatedLevelNative(int appLevel, int webVRLevel);
private native void updateFoveatedLevelNative(int appLevel);

@IntDef(value = { CPU_LEVEL_NORMAL, CPU_LEVEL_HIGH})
private @interface CPULevelFlags {}
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/cpp/BrowserWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,9 @@ BrowserWorld::UpdateEnvironment() {
}

void
BrowserWorld::UpdateFoveatedLevel(const int aAppLevel, const int aWebVRLevel) {
BrowserWorld::UpdateFoveatedLevel(const int aAppLevel) {
ASSERT_ON_RENDER_THREAD();
m.device->SetFoveatedLevel(aAppLevel, aWebVRLevel);
m.device->SetFoveatedLevel(aAppLevel);
}

void
Expand Down Expand Up @@ -1365,8 +1365,8 @@ JNI_METHOD(void, updateEnvironmentNative)
}

JNI_METHOD(void, updateFoveatedLevelNative)
(JNIEnv*, jobject, jint aAppLevel, jint aWebVRLevel) {
crow::BrowserWorld::Instance().UpdateFoveatedLevel(aAppLevel, aWebVRLevel);
(JNIEnv*, jobject, jint aAppLevel) {
crow::BrowserWorld::Instance().UpdateFoveatedLevel(aAppLevel);
}

JNI_METHOD(void, updatePointerColorNative)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/BrowserWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BrowserWorld {
void Draw();
void SetTemporaryFilePath(const std::string& aPath);
void UpdateEnvironment();
void UpdateFoveatedLevel(const int aAppLevel, const int aWebVRLevel);
void UpdateFoveatedLevel(const int aAppLevel);
void UpdatePointerColor();
void SetSurfaceTexture(const std::string& aName, jobject& aSurface);
void AddWidget(int32_t aHandle, const WidgetPlacementPtr& placement);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/DeviceDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class DeviceDelegate {
virtual void SetClearColor(const vrb::Color& aColor) = 0;
virtual void SetClipPlanes(const float aNear, const float aFar) = 0;
virtual void SetControllerDelegate(ControllerDelegatePtr& aController) = 0;
virtual void SetFoveatedLevel(const int32_t aAppLevel, const int32_t aWebVRLevel) {};
virtual void SetFoveatedLevel(const int32_t aAppLevel) {};
virtual void ReleaseControllerDelegate() = 0;
virtual int32_t GetControllerModelCount() const = 0;
virtual const std::string GetControllerModelName(const int32_t aModelIndex) const = 0;
Expand Down
10 changes: 2 additions & 8 deletions app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ struct DeviceDelegateOculusVR::State {
uint32_t renderWidth = 0;
uint32_t renderHeight = 0;
int32_t standaloneFoveatedLevel = 0;
int32_t immersiveFoveatedLevel = 0;
vrb::Color clearColor;
float near = 0.1f;
float far = 100.f;
Expand Down Expand Up @@ -714,11 +713,7 @@ struct DeviceDelegateOculusVR::State {
if (!ovr) {
return;
}
if (renderMode == device::RenderMode::StandAlone) {
vrapi_SetPropertyInt(&java, VRAPI_FOVEATION_LEVEL, standaloneFoveatedLevel);
} else {
vrapi_SetPropertyInt(&java, VRAPI_FOVEATION_LEVEL, immersiveFoveatedLevel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should disable foveated here, otherwise both Gecko and FxR foveated can be applied together here (if foveated is enabled for standalone)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I would like to make both of immersive and standalone mode use the same standaloneFoveatedLevel in OVR for now. I guess when we are ready doing it in GV::WebGL, we would disable foveated here and ask WebGL's framebuffer generate a foveated texture to us according to this standaloneFoveatedLevel.

Copy link
Contributor

@MortimerGoro MortimerGoro Jun 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it makes sense

}
vrapi_SetPropertyInt(&java, VRAPI_FOVEATION_LEVEL, standaloneFoveatedLevel);
}

void UpdateClockLevels() {
Expand Down Expand Up @@ -1175,9 +1170,8 @@ DeviceDelegateOculusVR::ReleaseControllerDelegate() {
}

void
DeviceDelegateOculusVR::SetFoveatedLevel(const int32_t aAppLevel, const int32_t aWebVRLevel) {
DeviceDelegateOculusVR::SetFoveatedLevel(const int32_t aAppLevel) {
m.standaloneFoveatedLevel = aAppLevel;
m.immersiveFoveatedLevel = aWebVRLevel;
m.UpdateFoveatedLevel();
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/oculusvr/cpp/DeviceDelegateOculusVR.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DeviceDelegateOculusVR : public DeviceDelegate {
void SetClipPlanes(const float aNear, const float aFar) override;
void SetControllerDelegate(ControllerDelegatePtr& aController) override;
void ReleaseControllerDelegate() override;
void SetFoveatedLevel(const int32_t aAppLevel, const int32_t aWebVRLevel) override;
void SetFoveatedLevel(const int32_t aAppLevel) override;
int32_t GetControllerModelCount() const override;
const std::string GetControllerModelName(const int32_t aModelIndex) const override;
void SetCPULevel(const device::CPULevel aLevel) override;
Expand Down
2 changes: 1 addition & 1 deletion app/src/wavevr/cpp/DeviceDelegateWaveVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ DeviceDelegateWaveVR::SetClipPlanes(const float aNear, const float aFar) {
}

void
DeviceDelegateWaveVR::SetFoveatedLevel(const int32_t aAppLevel, const int32_t aWebVRLevel) {
DeviceDelegateWaveVR::SetFoveatedLevel(const int32_t aAppLevel) {
m.standaloneFoveatedLevel = aAppLevel;
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/wavevr/cpp/DeviceDelegateWaveVR.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DeviceDelegateWaveVR : public DeviceDelegate {
void SetReorientTransform(const vrb::Matrix& aMatrix) override;
void SetClearColor(const vrb::Color& aColor) override;
void SetClipPlanes(const float aNear, const float aFar) override;
void SetFoveatedLevel(const int32_t aAppLevel, const int32_t aWebVRLevel) override;
void SetFoveatedLevel(const int32_t aAppLevel) override;
void SetControllerDelegate(ControllerDelegatePtr& aController) override;
void ReleaseControllerDelegate() override;
int32_t GetControllerModelCount() const override;
Expand Down