[Mesa-dev] [PATCH 5/5] mesa: add error for glReadPixels(GL_DEPTH_COMPONENT) buffer

Brian Paul brianp at vmware.com
Fri Feb 3 07:32:01 PST 2012


Trying to read depth values from a non-existant depth buffer should
generate GL_INVALID_OPERATION.
---
 src/mesa/main/readpix.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 3882e09..9193def 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -660,7 +660,8 @@ _mesa_error_check_format_type(struct gl_context *ctx, GLenum format,
       }
       break;
    case GL_DEPTH_COMPONENT:
-      if ((drawing && !_mesa_dest_buffer_exists(ctx, format))) {
+      if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
+          (reading && !_mesa_source_buffer_exists(ctx, format))) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "gl%sPixels(no depth buffer)", readDraw);
          return GL_TRUE;
-- 
1.7.3.4



More information about the mesa-dev mailing list