[Bf-blender-cvs] [47baf42e2cf] vr_scene_inspection: Merge branch 'temp-openxr-ghostxr' into temp-openxr-blenderside
Julian Eisel
noreply at git.blender.org
Mon Feb 17 12:34:53 CET 2020
Commit: 47baf42e2cfcbcb1a342437b02e6c190aa49d88f
Author: Julian Eisel
Date: Mon Feb 17 11:29:08 2020 +0100
Branches: vr_scene_inspection
https://developer.blender.org/rB47baf42e2cfcbcb1a342437b02e6c190aa49d88f
Merge branch 'temp-openxr-ghostxr' into temp-openxr-blenderside
This will currently fail to compile. Fixes upcoming.
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/versioning_280.c
index cd7647fa6b3,8baea5c8c4b..588af978744
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -4419,18 -4436,63 +4438,77 @@@ void blo_do_versions_280(FileData *fd,
}
}
+ /* Pose brush keep anchor point. */
+ for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+ if (br->sculpt_tool == SCULPT_TOOL_POSE) {
+ br->flag2 |= BRUSH_POSE_IK_ANCHORED;
+ }
+ }
+
+ /* Tip Roundness. */
+ if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "tip_roundness")) {
+ for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+ if (br->ob_mode & OB_MODE_SCULPT && br->sculpt_tool == SCULPT_TOOL_CLAY_STRIPS) {
+ br->tip_roundness = 0.18f;
+ }
+ }
+ }
+
+ /* EEVEE: Cascade shadow bias fix */
+ LISTBASE_FOREACH (Light *, light, &bmain->lights) {
+ if (light->type == LA_SUN) {
+ /* Should be 0.0004 but for practical reason we make it bigger.
+ * Correct factor is scene dependent. */
+ light->bias *= 0.002f;
+ }
+ }
+ }
+
+ /**
+ * Versioning code until next subversion bump goes here.
+ *
+ * \note Be sure to check when bumping the version:
+ * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend
+ * - "versioning_userdef.c", #do_versions_theme
+ *
+ * \note Keep this message at the bottom of the function.
+ */
+ {
+ /* Keep this block, even when empty. */
+
+ /* Alembic Transform Cache changed from world to local space. */
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ LISTBASE_FOREACH (bConstraint *, con, &ob->constraints) {
+ if (con->type == CONSTRAINT_TYPE_TRANSFORM_CACHE) {
+ con->ownspace = CONSTRAINT_SPACE_LOCAL;
+ }
+ }
+ }
+
+ /* Add 2D transform to UV Warp modifier. */
+ if (!DNA_struct_elem_find(fd->filesdna, "UVWarpModifierData", "float", "scale[2]")) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+ for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_UVWarp) {
+ UVWarpModifierData *umd = (UVWarpModifierData *)md;
+ copy_v2_fl(umd->scale, 1.0f);
+ }
+ }
+ }
+ }
++
+#ifdef WITH_OPENXR
+ if (!DNA_struct_find(fd->filesdna, "bXrSessionSettings")) {
+ for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
+ const View3D *v3d_default = DNA_struct_default_get(View3D);
+
+ wm->xr.session_settings.shading_type = OB_SOLID;
+ wm->xr.session_settings.draw_flags = (V3D_OFSDRAW_SHOW_GRIDFLOOR |
+ V3D_OFSDRAW_SHOW_ANNOTATION);
+ wm->xr.session_settings.clip_start = v3d_default->clip_start;
+ wm->xr.session_settings.clip_end = v3d_default->clip_end;
+ }
+ }
+#endif
}
}
diff --cc source/blender/gpu/GPU_shader.h
index 23bd6815ce4,d5716cd1b31..1cc38eaae87
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@@ -183,8 -183,7 +183,8 @@@ typedef enum eGPUBuiltinShader
GPU_SHADER_3D_DEPTH_ONLY,
GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR,
/* basic image drawing */
- GPU_SHADER_2D_IMAGE_LINEAR_TO_SRGB,
+ GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE,
+ GPU_SHADER_2D_IMAGE_RECT_LINEAR_TO_SRGB,
GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR,
GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR,
/**
diff --cc source/blender/gpu/GPU_viewport.h
index aff5c6a997d,2d125032f47..d2c7d4c8825
--- a/source/blender/gpu/GPU_viewport.h
+++ b/source/blender/gpu/GPU_viewport.h
@@@ -100,12 -100,17 +100,19 @@@ GPUViewport *GPU_viewport_create(void)
void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect);
void GPU_viewport_unbind(GPUViewport *viewport);
void GPU_viewport_draw_to_screen(GPUViewport *viewport, const rcti *rect);
+void GPU_viewport_draw_to_screen_ex(
+ GPUViewport *viewport, float x1, float x2, float y1, float y2, bool to_srgb);
void GPU_viewport_free(GPUViewport *viewport);
- GPUViewport *GPU_viewport_create_from_offscreen(struct GPUOffScreen *ofs);
- void GPU_viewport_clear_from_offscreen(GPUViewport *viewport);
+ void GPU_viewport_colorspace_set(GPUViewport *viewport,
+ ColorManagedViewSettings *view_settings,
+ ColorManagedDisplaySettings *display_settings,
+ float dither);
+
+ void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs);
+ void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport,
+ struct GPUOffScreen *ofs,
+ bool display_colorspace);
ViewportMemoryPool *GPU_viewport_mempool_get(GPUViewport *viewport);
struct DRWInstanceDataList *GPU_viewport_instance_data_list_get(GPUViewport *viewport);
diff --cc source/blender/gpu/intern/gpu_shader.c
index 2b4d7feae74,c950a1daaa5..274215f2bbc
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@@ -1008,16 -1008,11 +1008,16 @@@ static const GPUShaderStages builtin_sh
.vert = datatoc_gpu_shader_2D_smooth_color_vert_glsl,
.frag = datatoc_gpu_shader_2D_smooth_color_dithered_frag_glsl,
},
- [GPU_SHADER_2D_IMAGE_LINEAR_TO_SRGB] =
+ [GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE] =
{
.vert = datatoc_gpu_shader_2D_image_vert_glsl,
- .frag = datatoc_gpu_shader_image_linear_frag_glsl,
+ .frag = datatoc_gpu_shader_image_overlays_merge_frag_glsl,
},
+ [GPU_SHADER_2D_IMAGE_RECT_LINEAR_TO_SRGB] =
+ {
+ .vert = datatoc_gpu_shader_2D_image_rect_vert_glsl,
+ .frag = datatoc_gpu_shader_image_linear_frag_glsl,
+ },
[GPU_SHADER_2D_IMAGE] =
{
.vert = datatoc_gpu_shader_2D_image_vert_glsl,
diff --cc source/blender/gpu/intern/gpu_viewport.c
index 59696d1fa41,a3ee2d11e56..8dce0fcf927
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@@ -538,18 -534,76 +534,76 @@@ static void gpu_viewport_draw_colormana
void GPU_viewport_draw_to_screen(GPUViewport *viewport, const rcti *rect)
{
- GPUTexture *color = GPU_viewport_color_texture(viewport);
+ DefaultFramebufferList *dfbl = viewport->fbl;
+ DefaultTextureList *dtxl = viewport->txl;
+ GPUTexture *color = dtxl->color;
+
+ if (dfbl->default_fb == NULL) {
+ return;
+ }
+
+ const float w = (float)GPU_texture_width(color);
+ const float h = (float)GPU_texture_height(color);
- if (color) {
- const float w = (float)GPU_texture_width(color);
- const float h = (float)GPU_texture_height(color);
+ BLI_assert(w == BLI_rcti_size_x(rect) + 1);
+ BLI_assert(h == BLI_rcti_size_y(rect) + 1);
- BLI_assert(w == BLI_rcti_size_x(rect) + 1);
- BLI_assert(h == BLI_rcti_size_y(rect) + 1);
+ /* wmOrtho for the screen has this same offset */
- const float halfx = GLA_PIXEL_OFS / w;
- const float halfy = GLA_PIXEL_OFS / h;
++ const float halfx = GLA_PIXEL_OFS / ABS(x2 - x1);
++ const float halfy = GLA_PIXEL_OFS / ABS(y2 - y1);
+
+ rctf pos_rect = {
+ .xmin = rect->xmin,
+ .ymin = rect->ymin,
+ .xmax = rect->xmin + w,
+ .ymax = rect->ymin + h,
+ };
+
+ rctf uv_rect = {
+ .xmin = halfx,
+ .ymin = halfy,
+ .xmax = halfx + 1.0f,
+ .ymax = halfy + 1.0f,
+ };
+
+ gpu_viewport_draw_colormanaged(viewport, &pos_rect, &uv_rect, true);
+ }
- GPU_viewport_draw_to_screen_ex(
- viewport, rect->xmin, rect->xmin + w, rect->ymin, rect->ymin + h, false);
+ /**
+ * Clear vars assigned from offscreen, so we don't free data owned by `GPUOffScreen`.
+ */
+ void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport,
+ struct GPUOffScreen *ofs,
+ bool display_colorspace)
+ {
+ DefaultFramebufferList *dfbl = viewport->fbl;
+ DefaultTextureList *dtxl = viewport->txl;
+
+ if (dfbl->default_fb == NULL) {
+ return;
}
+
+ GPU_depth_test(false);
+ GPU_offscreen_bind(ofs, false);
+
+ rctf pos_rect = {
+ .xmin = -1.0f,
+ .ymin = -1.0f,
+ .xmax = 1.0f,
+ .ymax = 1.0f,
+ };
+
+ rctf uv_rect = {
+ .xmin = 0.0f,
+ .ymin = 0.0f,
+ .xmax = 1.0f,
+ .ymax = 1.0f,
+ };
+
+ gpu_viewport_draw_colormanaged(viewport, &pos_rect, &uv_rect, display_colorspace);
+
+ /* This one is from the offscreen. Don't free it with the viewport. */
+ dtxl->depth = NULL;
}
void GPU_viewport_unbind(GPUViewport *UNUSED(viewport))
diff --cc source/blender/windowmanager/intern/wm_init_exit.c
index 911ea1c1f1e,b775b16c6df..c34c749b0b6
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@@ -534,10 -533,9 +534,10 @@@ void WM_exit_ex(bContext *C, const boo
BKE_addon_pref_type_free();
BKE_keyconfig_pref_type_free();
- BKE_material_gpencil_default_free();
+ BKE_materials_exit();
wm_operatortype_free();
+ wm_surfaces_free();
wm_dropbox_free();
WM_menutype_free();
WM_uilisttype_free();
More information about the Bf-blender-cvs
mailing list