[Bf-blender-cvs] [93936b8643b] blender2.8: GPUTexture: Add for stencil to default depth buffers.
Clément Foucault
noreply at git.blender.org
Tue Nov 14 03:07:11 CET 2017
Commit: 93936b8643b9c4f77fe13d35b41ecaa246843dd8
Author: Clément Foucault
Date: Mon Nov 13 23:25:46 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB93936b8643b9c4f77fe13d35b41ecaa246843dd8
GPUTexture: Add for stencil to default depth buffers.
Theses will be used by eevee SSS.
TODO: only allocate stencil if needed.
===================================================================
M source/blender/gpu/GPU_texture.h
M source/blender/gpu/intern/gpu_framebuffer.c
M source/blender/gpu/intern/gpu_texture.c
M source/blender/gpu/intern/gpu_viewport.c
===================================================================
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index fa8ed992c72..82e215f6fae 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -162,6 +162,7 @@ GPUTexture *GPU_texture_create_cube_custom(
GPUTexture *GPU_texture_create_depth(int w, int h, char err_out[256]);
GPUTexture *GPU_texture_create_depth_with_stencil(int w, int h, char err_out[256]);
GPUTexture *GPU_texture_create_depth_multisample(int w, int h, int samples, char err_out[256]);
+GPUTexture *GPU_texture_create_depth_with_stencil_multisample(int w, int h, int samples, char err_out[256]);
GPUTexture *GPU_texture_from_blender(
struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time, int mipmap);
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 9f0ccffb8eb..884a305bd02 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -670,7 +670,7 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, char err_
}
}
- ofs->depth = GPU_texture_create_depth_multisample(width, height, samples, err_out);
+ ofs->depth = GPU_texture_create_depth_with_stencil_multisample(width, height, samples, err_out);
if (!ofs->depth) {
GPU_offscreen_free(ofs);
return NULL;
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index ac8c8bacac1..252eede8758 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -711,6 +711,11 @@ GPUTexture *GPU_texture_create_depth_multisample(int w, int h, int samples, char
return GPU_texture_create_nD(w, h, 0, 2, NULL, GPU_DEPTH_COMPONENT24, 1, samples, false, err_out);
}
+GPUTexture *GPU_texture_create_depth_with_stencil_multisample(int w, int h, int samples, char err_out[256])
+{
+ return GPU_texture_create_nD(w, h, 0, 2, NULL, GPU_DEPTH24_STENCIL8, 1, samples, false, err_out);
+}
+
void GPU_texture_update(GPUTexture *tex, const float *pixels)
{
BLI_assert(tex->format > -1);
diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c
index bdbf829a1ca..bd563a36f57 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -381,7 +381,8 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect)
}
/* Depth */
- dtxl->multisample_depth = GPU_texture_create_depth_multisample(rect_w, rect_h, U.ogl_multisamples, NULL);
+ dtxl->multisample_depth = GPU_texture_create_depth_with_stencil_multisample(rect_w, rect_h,
+ U.ogl_multisamples, NULL);
if (!dtxl->multisample_depth) {
ok = false;
@@ -430,7 +431,7 @@ cleanup_multisample:
}
/* Depth */
- dtxl->depth = GPU_texture_create_depth(rect_w, rect_h, NULL);
+ dtxl->depth = GPU_texture_create_depth_with_stencil(rect_w, rect_h, NULL);
if (dtxl->depth) {
/* Define texture parameters */
More information about the Bf-blender-cvs
mailing list