GPUViewport: Make Depth texture not depth testable.

This commit is contained in:
Clément Foucault 2017-05-07 14:29:51 +02:00
parent 104e6a7b8a
commit 2a0c91b70c
2 changed files with 11 additions and 3 deletions

View File

@ -1443,7 +1443,6 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
}
tex = *((GPUTexture **)uni->value);
GPU_texture_bind(tex, uni->bindloc);
GPU_texture_compare_mode(tex, false);
bound_tex = MEM_callocN(sizeof(DRWBoundTexture), "DRWBoundTexture");
bound_tex->tex = tex;

View File

@ -267,11 +267,20 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect)
/* Depth */
dtxl->depth = GPU_texture_create_depth(rect_w, rect_h, NULL);
if (!dtxl->depth) {
if (dtxl->depth) {
/* Define texture parameters */
GPU_texture_bind(dtxl->depth, 0);
GPU_texture_compare_mode(dtxl->depth, false);
GPU_texture_filter_mode(dtxl->depth, true);
GPU_texture_unbind(dtxl->depth);
}
else {
ok = false;
goto cleanup;
}
else if (!GPU_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0, 0)) {
if (!GPU_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0, 0)) {
ok = false;
goto cleanup;
}