From 5f9133d0dbce6d850fe7024eaf80e622ac4d2eba Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 29 Feb 2016 16:23:00 +1000 Subject: [PATCH] renderer: remove stencil attachments better disconnect using the proper functions, the API in theory works but mesa has bugs so lets avoid it for now. This fixes 1d texture depth tests. --- src/vrend_renderer.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 2072dfb..dd98cc7 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1382,9 +1382,19 @@ void vrend_fb_bind_texture(struct vrend_resource *res, break; } - if (attachment == GL_DEPTH_ATTACHMENT) - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT, - 0, 0, 0); + if (attachment == GL_DEPTH_ATTACHMENT) { + switch (res->target) { + case GL_TEXTURE_1D: + glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT, + GL_TEXTURE_1D, 0, 0); + break; + case GL_TEXTURE_2D: + default: + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT, + GL_TEXTURE_2D, 0, 0); + break; + } + } } static void vrend_hw_set_zsurf_texture(struct vrend_context *ctx)