Fix glFramebufferTextureLayer warnings generated by ANGLE

We shouldn't be using glFramebufferTextureLayer on 2D textures.
Also, the "attachment" was wrong (GL_COLOR vs GL_COLOR_ATTACHMENT0).

BUG: dawn:447

Change-Id: I1e47dfc4e8e88d70d9a1e6585b5d138b82ed3cfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38782
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Stephen White 2021-01-26 12:57:58 +00:00 committed by Commit Bot service account
parent 0315c43517
commit d27ed11d0b
1 changed files with 8 additions and 3 deletions

View File

@ -332,9 +332,14 @@ namespace dawn_native { namespace opengl {
GLuint framebuffer = 0;
gl.GenFramebuffers(1, &framebuffer);
gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer);
gl.FramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR, GetHandle(),
static_cast<int>(level),
static_cast<int>(layer));
if (GetArrayLayers() == 1) {
gl.FramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GetGLTarget(), GetHandle(), level);
} else {
gl.FramebufferTextureLayer(GL_DRAW_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0, GetHandle(), level,
layer);
}
gl.Disable(GL_SCISSOR_TEST);
gl.ClearBufferiv(GL_COLOR, 0,
reinterpret_cast<const GLint*>(clearColorData.data()));