Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kim <pk15950@gmail.com>2021-08-16 05:46:09 +0300
committerPeter Kim <pk15950@gmail.com>2021-08-16 05:46:09 +0300
commiteb278f5e12cf9db9664a89ed10902fb891846afe (patch)
tree3a4db029ab7a69fff2598016440148655043e21e /source/blender/windowmanager
parent899935d5d02463187617d1adc5f0c0f41fe56265 (diff)
XR: Color Depth Adjustments
This addresses reduced visibility of scenes (as displayed in the VR headset) that can result from the 8-bit color depth format currently used for XR swapchain images. By switching to a swapchain format with higher color depth (RGB10_A2, RGBA16, RGBA16F) for supported runtimes, visibility in VR should be noticeably improved. However, current limitations are lack of support for these higher color depth formats by some XR runtimes, especially for OpenGL. Also important to note that GPU_offscreen_create() now explicitly takes in the texture format (eGPUTextureFormat) instead of a "high_bitdepth" boolean. Reviewed By: Julian Eisel, Clément Foucault Differential Revision: http://developer.blender.org/D9842
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c4
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_session.c26
2 files changed, 24 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index f01e28f8822..dcb918747f3 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -455,7 +455,7 @@ static void wm_draw_region_buffer_create(ARegion *region, bool stereo, bool use_
* depth or multisample buffers. 3D view creates own buffers with
* the data it needs. */
GPUOffScreen *offscreen = GPU_offscreen_create(
- region->winx, region->winy, false, false, NULL);
+ region->winx, region->winy, false, GPU_RGBA8, NULL);
if (!offscreen) {
WM_report(RPT_ERROR, "Region could not be drawn!");
return;
@@ -888,7 +888,7 @@ static void wm_draw_window(bContext *C, wmWindow *win)
* stereo methods, but it's less efficient than drawing directly. */
const int width = WM_window_pixels_x(win);
const int height = WM_window_pixels_y(win);
- GPUOffScreen *offscreen = GPU_offscreen_create(width, height, false, false, NULL);
+ GPUOffScreen *offscreen = GPU_offscreen_create(width, height, false, GPU_RGBA8, NULL);
if (offscreen) {
GPUTexture *texture = GPU_offscreen_color_texture(offscreen);
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index dd9cac2bb16..ba30b0dd864 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -657,9 +657,6 @@ bool wm_xr_session_surface_offscreen_ensure(wmXrSurfaceData *surface_data,
GPUViewport *viewport = vp->viewport;
const bool size_changed = offscreen && (GPU_offscreen_width(offscreen) != draw_view->width) &&
(GPU_offscreen_height(offscreen) != draw_view->height);
- char err_out[256] = "unknown";
- bool failure = false;
-
if (offscreen) {
BLI_assert(viewport);
@@ -670,8 +667,29 @@ bool wm_xr_session_surface_offscreen_ensure(wmXrSurfaceData *surface_data,
GPU_offscreen_free(offscreen);
}
+ char err_out[256] = "unknown";
+ bool failure = false;
+ eGPUTextureFormat format =
+ GPU_R8; /* Initialize with some unsupported format to check following switch statement. */
+
+ switch (draw_view->swapchain_format) {
+ case GHOST_kXrSwapchainFormatRGBA8:
+ format = GPU_RGBA8;
+ break;
+ case GHOST_kXrSwapchainFormatRGBA16:
+ format = GPU_RGBA16;
+ break;
+ case GHOST_kXrSwapchainFormatRGBA16F:
+ format = GPU_RGBA16F;
+ break;
+ case GHOST_kXrSwapchainFormatRGB10_A2:
+ format = GPU_RGB10_A2;
+ break;
+ }
+ BLI_assert(format != GPU_R8);
+
offscreen = vp->offscreen = GPU_offscreen_create(
- draw_view->width, draw_view->height, true, false, err_out);
+ draw_view->width, draw_view->height, true, format, err_out);
if (offscreen) {
viewport = vp->viewport = GPU_viewport_create();
if (!viewport) {