Lines Matching full:ctx
54 fast_read_depth_pixels( struct gl_context *ctx,
60 struct gl_framebuffer *fb = ctx->ReadBuffer;
65 if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0)
78 ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
82 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
101 ctx->Driver.UnmapRenderbuffer(ctx, rb);
110 read_depth_pixels( struct gl_context *ctx,
116 struct gl_framebuffer *fb = ctx->ReadBuffer;
132 if (fast_read_depth_pixels(ctx, x, y, width, height, type, pixels, packing))
139 ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
142 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
152 _mesa_pack_depth_span(ctx, width, dst, type, depthValues, packing);
159 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
164 ctx->Driver.UnmapRenderbuffer(ctx, rb);
172 read_stencil_pixels( struct gl_context *ctx,
178 struct gl_framebuffer *fb = ctx->ReadBuffer;
187 ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
190 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
205 _mesa_pack_stencil_span(ctx, width, type, dest, stencil, packing);
211 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
216 ctx->Driver.UnmapRenderbuffer(ctx, rb);
225 fast_read_rgba_pixels_memcpy( struct gl_context *ctx,
233 struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
242 !ctx->Pack.SwapBytes) {
248 !ctx->Pack.SwapBytes) {
252 ctx->Pack.SwapBytes))
269 ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
272 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
312 ctx->Driver.UnmapRenderbuffer(ctx, rb);
318 slow_read_rgba_pixels( struct gl_context *ctx,
326 struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
338 ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
341 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
355 _mesa_pack_rgba_span_from_uints(ctx, width, (GLuint (*)[4]) rgba, format,
358 _mesa_pack_rgba_span_from_ints(ctx, width, (GLint (*)[4]) rgba, format,
365 _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format,
375 ctx->Driver.UnmapRenderbuffer(ctx, rb);
382 read_rgba_pixels( struct gl_context *ctx,
388 GLbitfield transferOps = ctx->_ImageTransferState;
389 struct gl_framebuffer *fb = ctx->ReadBuffer;
395 if ((ctx->Color._ClampReadColor == GL_TRUE || type != GL_FLOAT) &&
401 if (fast_read_rgba_pixels_memcpy(ctx, x, y, width, height,
407 slow_read_rgba_pixels(ctx, x, y, width, height,
416 fast_read_depth_stencil_pixels(struct gl_context *ctx,
421 struct gl_framebuffer *fb = ctx->ReadBuffer;
434 ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT,
437 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
448 ctx->Driver.UnmapRenderbuffer(ctx, rb);
460 fast_read_depth_stencil_pixels_separate(struct gl_context *ctx,
465 struct gl_framebuffer *fb = ctx->ReadBuffer;
474 ctx->Driver.MapRenderbuffer(ctx, depthRb, x, y, width, height,
477 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
481 ctx->Driver.MapRenderbuffer(ctx, stencilRb, x, y, width, height,
484 ctx->Driver.UnmapRenderbuffer(ctx, depthRb);
485 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
507 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
512 ctx->Driver.UnmapRenderbuffer(ctx, depthRb);
513 ctx->Driver.UnmapRenderbuffer(ctx, stencilRb);
519 slow_read_depth_stencil_pixels_separate(struct gl_context *ctx,
526 struct gl_framebuffer *fb = ctx->ReadBuffer;
538 ctx->Driver.MapRenderbuffer(ctx, depthRb, x, y, width, height,
541 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
546 ctx->Driver.MapRenderbuffer(ctx, stencilRb, x, y, width, height,
550 ctx->Driver.UnmapRenderbuffer(ctx, depthRb);
551 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
569 _mesa_pack_depth_stencil_span(ctx, width, type, (GLuint *)dst,
578 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
584 ctx->Driver.UnmapRenderbuffer(ctx, depthRb);
586 ctx->Driver.UnmapRenderbuffer(ctx, stencilRb);
597 read_depth_stencil_pixels(struct gl_context *ctx,
604 = ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
605 const GLboolean stencilTransfer = ctx->Pixel.IndexShift
606 || ctx->Pixel.IndexOffset || ctx->Pixel.MapStencilFlag;
620 if (fast_read_depth_stencil_pixels(ctx, x, y, width, height,
624 if (fast_read_depth_stencil_pixels_separate(ctx, x, y, width, height,
629 slow_read_depth_stencil_pixels_separate(ctx, x, y, width, height,
637 * Software fallback routine for ctx->Driver.ReadPixels().
641 _mesa_readpixels(struct gl_context *ctx,
649 if (ctx->NewState)
650 _mesa_update_state(ctx);
653 if (_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) {
655 pixels = _mesa_map_pbo_dest(ctx, &clippedPacking, pixels);
660 read_stencil_pixels(ctx, x, y, width, height, type, pixels,
664 read_depth_pixels(ctx, x, y, width, height, type, pixels,
668 read_depth_stencil_pixels(ctx, x, y, width, height, type, pixels,
673 read_rgba_pixels(ctx, x, y, width, height, format, type, pixels,
677 _mesa_unmap_pbo_dest(ctx, &clippedPacking);
690 GET_CURRENT_CONTEXT(ctx);
691 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
693 FLUSH_CURRENT(ctx, 0);
696 _mesa_debug(ctx, "glReadPixels(%d, %d, %s, %s, %p)\n",
703 _mesa_error( ctx, GL_INVALID_VALUE,
716 if (_mesa_is_gles(ctx) && ctx->Version < 30) {
728 _mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)",
735 if (ctx->NewState)
736 _mesa_update_state(ctx);
738 err = _mesa_error_check_format_and_type(ctx, format, type);
740 _mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)",
746 if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
747 _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
752 if (_mesa_is_user_fbo(ctx->ReadBuffer) &&
753 ctx->ReadBuffer->Visual.samples > 0) {
754 _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");
758 if (!_mesa_source_buffer_exists(ctx, format)) {
759 _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)");
766 if (ctx->Extensions.EXT_texture_integer && _mesa_is_color_format(format)) {
767 const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
771 _mesa_error(ctx, GL_INVALID_OPERATION,
780 if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
782 if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
783 _mesa_error(ctx, GL_INVALID_OPERATION,
786 _mesa_error(ctx, GL_INVALID_OPERATION,
793 if (_mesa_is_bufferobj(ctx->Pack.BufferObj) &&
794 _mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
796 _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
800 ctx->Driver.ReadPixels(ctx, x, y, width, height,
801 format, type, &ctx->Pack, pixels);