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
path: root/source
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2019-03-22 18:53:50 +0300
committermano-wii <germano.costa@ig.com.br>2019-03-22 19:08:03 +0300
commit40f8f445a3f9b6bc24b58e45be46060cc36c0394 (patch)
treea5f14bf7491802cf03e6f9e517753add589a9b8f /source
parente061cb44378efaf159a30fb1c5834db48ffb2bb3 (diff)
DRW Manager: create and use new DRW_framebuffer_depth_read utility.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/DRW_engine.h1
-rw-r--r--source/blender/draw/intern/draw_manager.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c13
3 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index 68d4ef04f95..94d1bc61b57 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -126,6 +126,7 @@ void DRW_draw_depth_loop(
void DRW_framebuffer_select_id_setup(struct ARegion *ar, const bool clear);
void DRW_framebuffer_select_id_release(struct ARegion *ar);
void DRW_framebuffer_select_id_read(const struct rcti *rect, uint *r_buf);
+void DRW_framebuffer_depth_read(const struct rcti *rect, float *r_buf);
/* grease pencil render */
bool DRW_render_check_grease_pencil(struct Depsgraph *depsgraph);
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index f3e8ba9cbea..bb4e114d4bb 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2513,6 +2513,14 @@ void DRW_framebuffer_select_id_read(const rcti *rect, uint *r_buf)
g_select_buffer.texture_u32, GPU_DATA_UNSIGNED_INT, rect, r_buf);
}
+
+/* Read a block of pixels from the depth frame buffer. */
+void DRW_framebuffer_depth_read(const rcti *rect, float *r_buf)
+{
+ GPU_texture_read_rect(
+ g_select_buffer.texture_depth, GPU_DATA_FLOAT, rect, r_buf);
+}
+
/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 89053b2658b..21e48c24645 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -223,12 +223,6 @@ void view3d_opengl_read_pixels(ARegion *ar, int x, int y, int w, int h, int form
glReadPixels(ar->winrct.xmin + x, ar->winrct.ymin + y, w, h, format, type, data);
}
-/* XXX depth reading exception, for code not using gpu offscreen */
-static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, int format, int type, void *data)
-{
- glReadPixels(ar->winrct.xmin + x, ar->winrct.ymin + y, w, h, format, type, data);
-}
-
void ED_view3d_select_id_validate_with_select_mode(ViewContext *vc, short select_mode)
{
/* TODO: Create a flag in `DRW_manager` because the drawing is no longer
@@ -726,7 +720,6 @@ void ED_view3d_draw_bgpic_test(
/* *********************** */
-/* XXX warning, not using gpu offscreen here */
void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
{
/* clamp rect by region */
@@ -775,14 +768,14 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
}
if (d->damaged) {
- /* XXX using special function here, it doesn't use the gpu offscreen system */
- view3d_opengl_read_Z_pixels(ar, d->x, d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
+ DRW_framebuffer_depth_read(rect, d->depths);
glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
d->damaged = false;
}
}
-/* note, with nouveau drivers the glReadPixels() is very slow. [#24339] */
+/* note, with nouveau drivers the glReadPixels() is very slow. [#24339]
+ * XXX warning, not using gpu offscreen here */
void ED_view3d_depth_update(ARegion *ar)
{
RegionView3D *rv3d = ar->regiondata;