diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-02 13:41:28 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-03 06:08:22 +1000 |
commit | c0856eacf1f76f294e2b89eb7250580517018567 (patch) | |
tree | 6805234883cd32fc990a7377fce4a0644bfb0cc6 /src/mesa/main/copyimage.c | |
parent | 80c288603300a06ac1585769cc491711c3d1b4f0 (diff) | |
download | external_mesa3d-c0856eacf1f76f294e2b89eb7250580517018567.zip external_mesa3d-c0856eacf1f76f294e2b89eb7250580517018567.tar.gz external_mesa3d-c0856eacf1f76f294e2b89eb7250580517018567.tar.bz2 |
mesa/copyimage: fix num samples check to handle renderbuffers.
This test was only happening for textures, but there is
nothing in the spec to say this, so test it for all cases.
This fixes:
GL45-CTS.copy_image.invalid_target
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/copyimage.c')
-rw-r--r-- | src/mesa/main/copyimage.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c index 63ce13a..6aa6bcb 100644 --- a/src/mesa/main/copyimage.c +++ b/src/mesa/main/copyimage.c @@ -65,6 +65,7 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum target, GLenum *internalFormat, GLuint *width, GLuint *height, + GLuint *num_samples, const char *dbg_prefix) { if (name == 0) { @@ -131,6 +132,7 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum target, *internalFormat = rb->InternalFormat; *width = rb->Width; *height = rb->Height; + *num_samples = rb->NumSamples; *tex_image = NULL; } else { struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name); @@ -201,6 +203,7 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum target, *internalFormat = (*tex_image)->InternalFormat; *width = (*tex_image)->Width; *height = (*tex_image)->Height; + *num_samples = (*tex_image)->NumSamples; } return true; @@ -456,6 +459,7 @@ _mesa_CopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLenum srcIntFormat, dstIntFormat; GLuint src_w, src_h, dst_w, dst_h; GLuint src_bw, src_bh, dst_bw, dst_bh; + GLuint src_num_samples, dst_num_samples; int dstWidth, dstHeight, dstDepth; int i; @@ -477,12 +481,12 @@ _mesa_CopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, if (!prepare_target(ctx, srcName, srcTarget, srcLevel, srcZ, srcDepth, &srcTexImage, &srcRenderbuffer, &srcFormat, - &srcIntFormat, &src_w, &src_h, "src")) + &srcIntFormat, &src_w, &src_h, &src_num_samples, "src")) return; if (!prepare_target(ctx, dstName, dstTarget, dstLevel, dstZ, srcDepth, &dstTexImage, &dstRenderbuffer, &dstFormat, - &dstIntFormat, &dst_w, &dst_h, "dst")) + &dstIntFormat, &dst_w, &dst_h, &dst_num_samples, "dst")) return; _mesa_get_format_block_size(srcFormat, &src_bw, &src_bh); @@ -565,8 +569,7 @@ _mesa_CopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, return; } - if (srcTexImage && dstTexImage && - srcTexImage->NumSamples != dstTexImage->NumSamples) { + if (src_num_samples != dst_num_samples) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyImageSubData(number of samples mismatch)"); return; |