diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-03-18 03:26:08 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-03-18 03:56:34 +0300 |
commit | c4644b484d30d7dee62425a18d6896acf6fcbb0c (patch) | |
tree | 7a8b15f6a1a4739d750c00f24c81fb1261c89042 /source/blender/gpu/intern/gpu_framebuffer.c | |
parent | b7355425cdff8f3f23e386f2817d5702b46f7bd6 (diff) |
GPUTexture: Add support for depth_stencil textures.
Diffstat (limited to 'source/blender/gpu/intern/gpu_framebuffer.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index bd08f9d9195..87d734dd40b 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -133,14 +133,16 @@ bool GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slo } } - if (GPU_texture_depth(tex)) + glBindFramebuffer(GL_FRAMEBUFFER, fb->object); + GG.currentfb = fb->object; + + if (GPU_texture_stencil(tex) && GPU_texture_depth(tex)) + attachment = GL_DEPTH_STENCIL_ATTACHMENT; + else if (GPU_texture_depth(tex)) attachment = GL_DEPTH_ATTACHMENT; else attachment = GL_COLOR_ATTACHMENT0 + slot; - glBindFramebuffer(GL_FRAMEBUFFER, fb->object); - GG.currentfb = fb->object; - glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GPU_texture_target(tex), GPU_texture_opengl_bindcode(tex), 0); @@ -168,7 +170,11 @@ void GPU_framebuffer_texture_detach(GPUTexture *tex) GG.currentfb = fb->object; } - if (GPU_texture_depth(tex)) { + if (GPU_texture_stencil(tex) && GPU_texture_depth(tex)) { + fb->depthtex = NULL; + attachment = GL_DEPTH_STENCIL_ATTACHMENT; + } + else if (GPU_texture_depth(tex)) { fb->depthtex = NULL; attachment = GL_DEPTH_ATTACHMENT; } |