diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-11-14 01:25:46 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-11-14 01:25:46 +0300 |
commit | 93936b8643b9c4f77fe13d35b41ecaa246843dd8 (patch) | |
tree | 3c7738ec519551a344e4b395bb56e806a76f6fa7 | |
parent | ab013224adf5bb07c1467637592cd8c7bb5cb2fe (diff) |
GPUTexture: Add for stencil to default depth buffers.
Theses will be used by eevee SSS.
TODO: only allocate stencil if needed.
-rw-r--r-- | source/blender/gpu/GPU_texture.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_viewport.c | 5 |
4 files changed, 10 insertions, 3 deletions
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 */ |