diff options
author | Tapani Pälli <tapani.palli@intel.com> | 2020-12-15 13:15:29 +0200 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2020-12-21 14:08:40 -0800 |
commit | eec213d2adce3c9ce04d3007b6c6fc80584f69f3 (patch) | |
tree | d688bf9538398aa1d67533e7e53aa1384b42e3b3 | |
parent | 27e6dfb06a17148b651d0fe71567a93c3b718465 (diff) | |
download | mesa-eec213d2adce3c9ce04d3007b6c6fc80584f69f3.tar.gz |
mesa: fix layered framebuffer attachment target check
Current code was making the layer target checking for depth and stencil
attachments as well while the check in spec is specified only for color.
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3980
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8102>
(cherry picked from commit 296d8662dc68612c41d0e488d9b8bdf51e674b06)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/mesa/main/fbobject.c | 22 |
2 files changed, 21 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json index 687825c34c9..8d350d9fd78 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -166,7 +166,7 @@ "description": "mesa: fix layered framebuffer attachment target check", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 600c941a24f..103b285e4b0 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1320,15 +1320,33 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, att_layer_count = att->Renderbuffer->Height; else att_layer_count = att->Renderbuffer->Depth; + + /* From OpenGL ES 3.2 spec, chapter 9.4. FRAMEBUFFER COMPLETENESS: + * + * "If any framebuffer attachment is layered, all populated + * attachments must be layered. Additionally, all populated color + * attachments must be from textures of the same target + * (three-dimensional, one- or two-dimensional array, cube map, or + * cube map array textures)." + * + * Same text can be found from OpenGL 4.6 spec. + * + * Setup the checked layer target with first color attachment here + * so that mismatch check below will not trigger between depth, + * stencil, only between color attachments. + */ + if (i == 0) + layer_tex_target = att_tex_target; + } else { att_layer_count = 0; } if (!layer_info_valid) { is_layered = att->Layered; max_layer_count = att_layer_count; - layer_tex_target = att_tex_target; layer_info_valid = true; - } else if (max_layer_count > 0 && layer_tex_target != att_tex_target) { + } else if (max_layer_count > 0 && layer_tex_target && + layer_tex_target != att_tex_target) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS; fbo_incomplete(ctx, "layered framebuffer has mismatched targets", i); return; |