1 /**************************************************************************
3 * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 #include "main/imports.h"
30 #include "main/macros.h"
31 #include "main/mtypes.h"
32 #include "main/fbobject.h"
33 #include "main/framebuffer.h"
34 #include "main/renderbuffer.h"
35 #include "main/context.h"
36 #include "main/texformat.h"
37 #include "main/texrender.h"
39 #include "intel_context.h"
40 #include "intel_buffers.h"
41 #include "intel_fbo.h"
42 #include "intel_mipmap_tree.h"
43 #include "intel_regions.h"
46 #define FILE_DEBUG_FLAG DEBUG_FBO
50 * Create a new framebuffer object.
52 static struct gl_framebuffer
*
53 intel_new_framebuffer(GLcontext
* ctx
, GLuint name
)
55 /* Only drawable state in intel_framebuffer at this time, just use Mesa's
58 return _mesa_new_framebuffer(ctx
, name
);
62 /** Called by gl_renderbuffer::Delete() */
64 intel_delete_renderbuffer(struct gl_renderbuffer
*rb
)
66 GET_CURRENT_CONTEXT(ctx
);
67 struct intel_context
*intel
= intel_context(ctx
);
68 struct intel_renderbuffer
*irb
= intel_renderbuffer(rb
);
72 if (irb
->span_cache
!= NULL
)
73 _mesa_free(irb
->span_cache
);
75 if (intel
&& irb
->region
) {
76 intel_region_release(&irb
->region
);
84 * Return a pointer to a specific pixel in a renderbuffer.
87 intel_get_pointer(GLcontext
* ctx
, struct gl_renderbuffer
*rb
,
90 /* By returning NULL we force all software rendering to go through
98 * Called via glRenderbufferStorageEXT() to set the format and allocate
99 * storage for a user-created renderbuffer.
102 intel_alloc_renderbuffer_storage(GLcontext
* ctx
, struct gl_renderbuffer
*rb
,
103 GLenum internalFormat
,
104 GLuint width
, GLuint height
)
106 struct intel_context
*intel
= intel_context(ctx
);
107 struct intel_renderbuffer
*irb
= intel_renderbuffer(rb
);
108 GLboolean softwareBuffer
= GL_FALSE
;
111 ASSERT(rb
->Name
!= 0);
113 switch (internalFormat
) {
117 rb
->_ActualFormat
= GL_RGB5
;
118 rb
->DataType
= GL_UNSIGNED_BYTE
;
122 irb
->texformat
= &_mesa_texformat_rgb565
;
130 rb
->_ActualFormat
= GL_RGB8
;
131 rb
->DataType
= GL_UNSIGNED_BYTE
;
136 irb
->texformat
= &_mesa_texformat_argb8888
; /* XXX: Need xrgb8888 */
147 rb
->_ActualFormat
= GL_RGBA8
;
148 rb
->DataType
= GL_UNSIGNED_BYTE
;
153 irb
->texformat
= &_mesa_texformat_argb8888
;
156 case GL_STENCIL_INDEX
:
157 case GL_STENCIL_INDEX1_EXT
:
158 case GL_STENCIL_INDEX4_EXT
:
159 case GL_STENCIL_INDEX8_EXT
:
160 case GL_STENCIL_INDEX16_EXT
:
161 /* alloc a depth+stencil buffer */
162 rb
->_ActualFormat
= GL_DEPTH24_STENCIL8_EXT
;
163 rb
->DataType
= GL_UNSIGNED_INT_24_8_EXT
;
166 irb
->texformat
= &_mesa_texformat_s8_z24
;
168 case GL_DEPTH_COMPONENT16
:
169 rb
->_ActualFormat
= GL_DEPTH_COMPONENT16
;
170 rb
->DataType
= GL_UNSIGNED_SHORT
;
173 irb
->texformat
= &_mesa_texformat_z16
;
175 case GL_DEPTH_COMPONENT
:
176 case GL_DEPTH_COMPONENT24
:
177 case GL_DEPTH_COMPONENT32
:
178 rb
->_ActualFormat
= GL_DEPTH24_STENCIL8_EXT
;
179 rb
->DataType
= GL_UNSIGNED_INT_24_8_EXT
;
182 irb
->texformat
= &_mesa_texformat_s8_z24
;
184 case GL_DEPTH_STENCIL_EXT
:
185 case GL_DEPTH24_STENCIL8_EXT
:
186 rb
->_ActualFormat
= GL_DEPTH24_STENCIL8_EXT
;
187 rb
->DataType
= GL_UNSIGNED_INT_24_8_EXT
;
191 irb
->texformat
= &_mesa_texformat_s8_z24
;
195 "Unexpected format in intel_alloc_renderbuffer_storage");
201 /* free old region */
203 intel_region_release(&irb
->region
);
206 /* allocate new memory region/renderbuffer */
207 if (softwareBuffer
) {
208 return _mesa_soft_renderbuffer_storage(ctx
, rb
, internalFormat
,
212 /* Choose a pitch to match hardware requirements:
214 GLuint pitch
= ((cpp
* width
+ 63) & ~63) / cpp
;
216 /* alloc hardware renderbuffer */
217 DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width
,
220 irb
->region
= intel_region_alloc(intel
, cpp
, width
, height
, pitch
,
223 return GL_FALSE
; /* out of memory? */
225 ASSERT(irb
->region
->buffer
);
236 * Called for each hardware renderbuffer when a _window_ is resized.
237 * Just update fields.
238 * Not used for user-created renderbuffers!
241 intel_alloc_window_storage(GLcontext
* ctx
, struct gl_renderbuffer
*rb
,
242 GLenum internalFormat
, GLuint width
, GLuint height
)
244 ASSERT(rb
->Name
== 0);
247 rb
->_ActualFormat
= internalFormat
;
254 intel_resize_buffers(GLcontext
*ctx
, struct gl_framebuffer
*fb
,
255 GLuint width
, GLuint height
)
257 struct intel_framebuffer
*intel_fb
= (struct intel_framebuffer
*)fb
;
260 _mesa_resize_framebuffer(ctx
, fb
, width
, height
);
262 fb
->Initialized
= GL_TRUE
; /* XXX remove someday */
268 /* Make sure all window system renderbuffers are up to date */
269 for (i
= 0; i
< 2; i
++) {
270 struct gl_renderbuffer
*rb
= &intel_fb
->color_rb
[i
]->Base
;
272 /* only resize if size is changing */
273 if (rb
&& (rb
->Width
!= width
|| rb
->Height
!= height
)) {
274 rb
->AllocStorage(ctx
, rb
, rb
->InternalFormat
, width
, height
);
280 /** Dummy function for gl_renderbuffer::AllocStorage() */
282 intel_nop_alloc_storage(GLcontext
* ctx
, struct gl_renderbuffer
*rb
,
283 GLenum internalFormat
, GLuint width
, GLuint height
)
285 _mesa_problem(ctx
, "intel_op_alloc_storage should never be called.");
291 intel_renderbuffer_set_region(struct intel_renderbuffer
*rb
,
292 struct intel_region
*region
)
294 struct intel_region
*old
;
298 intel_region_reference(&rb
->region
, region
);
299 intel_region_release(&old
);
304 * Create a new intel_renderbuffer which corresponds to an on-screen window,
305 * not a user-created renderbuffer.
307 struct intel_renderbuffer
*
308 intel_create_renderbuffer(GLenum intFormat
)
310 GET_CURRENT_CONTEXT(ctx
);
312 struct intel_renderbuffer
*irb
;
313 const GLuint name
= 0;
315 irb
= CALLOC_STRUCT(intel_renderbuffer
);
317 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "creating renderbuffer");
321 _mesa_init_renderbuffer(&irb
->Base
, name
);
322 irb
->Base
.ClassID
= INTEL_RB_CLASS
;
326 irb
->Base
._ActualFormat
= GL_RGB5
;
327 irb
->Base
._BaseFormat
= GL_RGBA
;
328 irb
->Base
.RedBits
= 5;
329 irb
->Base
.GreenBits
= 6;
330 irb
->Base
.BlueBits
= 5;
331 irb
->Base
.DataType
= GL_UNSIGNED_BYTE
;
332 irb
->texformat
= &_mesa_texformat_rgb565
;
335 irb
->Base
._ActualFormat
= GL_RGB8
;
336 irb
->Base
._BaseFormat
= GL_RGB
;
337 irb
->Base
.RedBits
= 8;
338 irb
->Base
.GreenBits
= 8;
339 irb
->Base
.BlueBits
= 8;
340 irb
->Base
.AlphaBits
= 0;
341 irb
->Base
.DataType
= GL_UNSIGNED_BYTE
;
342 irb
->texformat
= &_mesa_texformat_argb8888
; /* XXX: Need xrgb8888 */
345 irb
->Base
._ActualFormat
= GL_RGBA8
;
346 irb
->Base
._BaseFormat
= GL_RGBA
;
347 irb
->Base
.RedBits
= 8;
348 irb
->Base
.GreenBits
= 8;
349 irb
->Base
.BlueBits
= 8;
350 irb
->Base
.AlphaBits
= 8;
351 irb
->Base
.DataType
= GL_UNSIGNED_BYTE
;
352 irb
->texformat
= &_mesa_texformat_argb8888
;
354 case GL_STENCIL_INDEX8_EXT
:
355 irb
->Base
._ActualFormat
= GL_STENCIL_INDEX8_EXT
;
356 irb
->Base
._BaseFormat
= GL_STENCIL_INDEX
;
357 irb
->Base
.StencilBits
= 8;
358 irb
->Base
.DataType
= GL_UNSIGNED_BYTE
;
359 irb
->texformat
= &_mesa_texformat_s8_z24
;
361 case GL_DEPTH_COMPONENT16
:
362 irb
->Base
._ActualFormat
= GL_DEPTH_COMPONENT16
;
363 irb
->Base
._BaseFormat
= GL_DEPTH_COMPONENT
;
364 irb
->Base
.DepthBits
= 16;
365 irb
->Base
.DataType
= GL_UNSIGNED_SHORT
;
366 irb
->texformat
= &_mesa_texformat_z16
;
368 case GL_DEPTH_COMPONENT24
:
369 irb
->Base
._ActualFormat
= GL_DEPTH24_STENCIL8_EXT
;
370 irb
->Base
._BaseFormat
= GL_DEPTH_COMPONENT
;
371 irb
->Base
.DepthBits
= 24;
372 irb
->Base
.DataType
= GL_UNSIGNED_INT
;
373 irb
->texformat
= &_mesa_texformat_s8_z24
;
375 case GL_DEPTH24_STENCIL8_EXT
:
376 irb
->Base
._ActualFormat
= GL_DEPTH24_STENCIL8_EXT
;
377 irb
->Base
._BaseFormat
= GL_DEPTH_STENCIL_EXT
;
378 irb
->Base
.DepthBits
= 24;
379 irb
->Base
.StencilBits
= 8;
380 irb
->Base
.DataType
= GL_UNSIGNED_INT_24_8_EXT
;
381 irb
->texformat
= &_mesa_texformat_s8_z24
;
385 "Unexpected intFormat in intel_create_renderbuffer");
389 irb
->Base
.InternalFormat
= intFormat
;
391 /* intel-specific methods */
392 irb
->Base
.Delete
= intel_delete_renderbuffer
;
393 irb
->Base
.AllocStorage
= intel_alloc_window_storage
;
394 irb
->Base
.GetPointer
= intel_get_pointer
;
401 * Create a new renderbuffer object.
402 * Typically called via glBindRenderbufferEXT().
404 static struct gl_renderbuffer
*
405 intel_new_renderbuffer(GLcontext
* ctx
, GLuint name
)
407 /*struct intel_context *intel = intel_context(ctx); */
408 struct intel_renderbuffer
*irb
;
410 irb
= CALLOC_STRUCT(intel_renderbuffer
);
412 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "creating renderbuffer");
416 _mesa_init_renderbuffer(&irb
->Base
, name
);
417 irb
->Base
.ClassID
= INTEL_RB_CLASS
;
419 /* intel-specific methods */
420 irb
->Base
.Delete
= intel_delete_renderbuffer
;
421 irb
->Base
.AllocStorage
= intel_alloc_renderbuffer_storage
;
422 irb
->Base
.GetPointer
= intel_get_pointer
;
423 /* span routines set in alloc_storage function */
430 * Called via glBindFramebufferEXT().
433 intel_bind_framebuffer(GLcontext
* ctx
, GLenum target
,
434 struct gl_framebuffer
*fb
, struct gl_framebuffer
*fbread
)
436 if (target
== GL_FRAMEBUFFER_EXT
|| target
== GL_DRAW_FRAMEBUFFER_EXT
) {
437 intel_draw_buffer(ctx
, fb
);
440 /* don't need to do anything if target == GL_READ_FRAMEBUFFER_EXT */
446 * Called via glFramebufferRenderbufferEXT().
449 intel_framebuffer_renderbuffer(GLcontext
* ctx
,
450 struct gl_framebuffer
*fb
,
451 GLenum attachment
, struct gl_renderbuffer
*rb
)
453 DBG("Intel FramebufferRenderbuffer %u %u\n", fb
->Name
, rb
? rb
->Name
: 0);
457 _mesa_framebuffer_renderbuffer(ctx
, fb
, attachment
, rb
);
458 intel_draw_buffer(ctx
, fb
);
463 intel_update_wrapper(GLcontext
*ctx
, struct intel_renderbuffer
*irb
,
464 struct gl_texture_image
*texImage
)
466 irb
->texformat
= texImage
->TexFormat
;
468 if (texImage
->TexFormat
== &_mesa_texformat_argb8888
) {
469 irb
->Base
._ActualFormat
= GL_RGBA8
;
470 irb
->Base
._BaseFormat
= GL_RGBA
;
471 irb
->Base
.DataType
= GL_UNSIGNED_BYTE
;
472 DBG("Render to RGBA8 texture OK\n");
474 else if (texImage
->TexFormat
== &_mesa_texformat_rgb565
) {
475 irb
->Base
._ActualFormat
= GL_RGB5
;
476 irb
->Base
._BaseFormat
= GL_RGB
;
477 irb
->Base
.DataType
= GL_UNSIGNED_BYTE
;
478 DBG("Render to RGB5 texture OK\n");
480 else if (texImage
->TexFormat
== &_mesa_texformat_argb1555
) {
481 irb
->Base
._ActualFormat
= GL_RGB5_A1
;
482 irb
->Base
._BaseFormat
= GL_RGBA
;
483 irb
->Base
.DataType
= GL_UNSIGNED_BYTE
;
484 DBG("Render to ARGB1555 texture OK\n");
486 else if (texImage
->TexFormat
== &_mesa_texformat_argb4444
) {
487 irb
->Base
._ActualFormat
= GL_RGBA4
;
488 irb
->Base
._BaseFormat
= GL_RGBA
;
489 irb
->Base
.DataType
= GL_UNSIGNED_BYTE
;
490 DBG("Render to ARGB4444 texture OK\n");
492 else if (texImage
->TexFormat
== &_mesa_texformat_z16
) {
493 irb
->Base
._ActualFormat
= GL_DEPTH_COMPONENT16
;
494 irb
->Base
._BaseFormat
= GL_DEPTH_COMPONENT
;
495 irb
->Base
.DataType
= GL_UNSIGNED_SHORT
;
496 DBG("Render to DEPTH16 texture OK\n");
498 else if (texImage
->TexFormat
== &_mesa_texformat_s8_z24
) {
499 irb
->Base
._ActualFormat
= GL_DEPTH24_STENCIL8_EXT
;
500 irb
->Base
._BaseFormat
= GL_DEPTH_STENCIL_EXT
;
501 irb
->Base
.DataType
= GL_UNSIGNED_INT_24_8_EXT
;
502 DBG("Render to DEPTH_STENCIL texture OK\n");
505 DBG("Render to texture BAD FORMAT %d\n",
506 texImage
->TexFormat
->MesaFormat
);
510 irb
->Base
.InternalFormat
= irb
->Base
._ActualFormat
;
511 irb
->Base
.Width
= texImage
->Width
;
512 irb
->Base
.Height
= texImage
->Height
;
513 irb
->Base
.RedBits
= texImage
->TexFormat
->RedBits
;
514 irb
->Base
.GreenBits
= texImage
->TexFormat
->GreenBits
;
515 irb
->Base
.BlueBits
= texImage
->TexFormat
->BlueBits
;
516 irb
->Base
.AlphaBits
= texImage
->TexFormat
->AlphaBits
;
517 irb
->Base
.DepthBits
= texImage
->TexFormat
->DepthBits
;
519 irb
->Base
.Delete
= intel_delete_renderbuffer
;
520 irb
->Base
.AllocStorage
= intel_nop_alloc_storage
;
527 * When glFramebufferTexture[123]D is called this function sets up the
528 * gl_renderbuffer wrapper around the texture image.
529 * This will have the region info needed for hardware rendering.
531 static struct intel_renderbuffer
*
532 intel_wrap_texture(GLcontext
* ctx
, struct gl_texture_image
*texImage
)
534 const GLuint name
= ~0; /* not significant, but distinct for debugging */
535 struct intel_renderbuffer
*irb
;
537 /* make an intel_renderbuffer to wrap the texture image */
538 irb
= CALLOC_STRUCT(intel_renderbuffer
);
540 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glFramebufferTexture");
544 _mesa_init_renderbuffer(&irb
->Base
, name
);
545 irb
->Base
.ClassID
= INTEL_RB_CLASS
;
547 if (!intel_update_wrapper(ctx
, irb
, texImage
)) {
557 * Called by glFramebufferTexture[123]DEXT() (and other places) to
558 * prepare for rendering into texture memory. This might be called
559 * many times to choose different texture levels, cube faces, etc
560 * before intel_finish_render_texture() is ever called.
563 intel_render_texture(GLcontext
* ctx
,
564 struct gl_framebuffer
*fb
,
565 struct gl_renderbuffer_attachment
*att
)
567 struct gl_texture_image
*newImage
568 = att
->Texture
->Image
[att
->CubeMapFace
][att
->TextureLevel
];
569 struct intel_renderbuffer
*irb
= intel_renderbuffer(att
->Renderbuffer
);
570 struct intel_texture_image
*intel_image
;
577 if (newImage
->Border
!= 0) {
578 /* Fallback on drawing to a texture with a border, which won't have a
581 _mesa_reference_renderbuffer(&att
->Renderbuffer
, NULL
);
582 _mesa_render_texture(ctx
, fb
, att
);
586 irb
= intel_wrap_texture(ctx
, newImage
);
588 /* bind the wrapper to the attachment point */
589 _mesa_reference_renderbuffer(&att
->Renderbuffer
, &irb
->Base
);
592 /* fallback to software rendering */
593 _mesa_render_texture(ctx
, fb
, att
);
598 if (!intel_update_wrapper(ctx
, irb
, newImage
)) {
599 _mesa_reference_renderbuffer(&att
->Renderbuffer
, NULL
);
600 _mesa_render_texture(ctx
, fb
, att
);
604 DBG("Begin render texture tid %x tex=%u w=%d h=%d refcount=%d\n",
606 att
->Texture
->Name
, newImage
->Width
, newImage
->Height
,
609 /* point the renderbufer's region to the texture image region */
610 intel_image
= intel_texture_image(newImage
);
611 if (irb
->region
!= intel_image
->mt
->region
) {
613 intel_region_release(&irb
->region
);
614 intel_region_reference(&irb
->region
, intel_image
->mt
->region
);
617 /* compute offset of the particular 2D image within the texture region */
618 imageOffset
= intel_miptree_image_offset(intel_image
->mt
,
622 if (att
->Texture
->Target
== GL_TEXTURE_3D
) {
623 const GLuint
*offsets
= intel_miptree_depth_offsets(intel_image
->mt
,
625 imageOffset
+= offsets
[att
->Zoffset
];
628 /* store that offset in the region */
629 intel_image
->mt
->region
->draw_offset
= imageOffset
;
631 /* update drawing region, etc */
632 intel_draw_buffer(ctx
, fb
);
637 * Called by Mesa when rendering to a texture is done.
640 intel_finish_render_texture(GLcontext
* ctx
,
641 struct gl_renderbuffer_attachment
*att
)
644 * Previously we released the renderbuffer's intel_region but
645 * that's not necessary and actually caused problems when trying
646 * to do a glRead/CopyPixels from the renderbuffer later.
647 * The region will be released later if the texture is replaced
648 * or the renderbuffer deleted.
650 * The intention of this driver hook is more of a "done rendering
651 * to texture, please re-twiddle/etc if necessary".
657 * Do additional "completeness" testing of a framebuffer object.
660 intel_validate_framebuffer(GLcontext
*ctx
, struct gl_framebuffer
*fb
)
662 const struct intel_renderbuffer
*depthRb
=
663 intel_get_renderbuffer(fb
, BUFFER_DEPTH
);
664 const struct intel_renderbuffer
*stencilRb
=
665 intel_get_renderbuffer(fb
, BUFFER_STENCIL
);
668 if (stencilRb
&& stencilRb
!= depthRb
) {
669 /* we only support combined depth/stencil buffers, not separate
672 fb
->_Status
= GL_FRAMEBUFFER_UNSUPPORTED_EXT
;
675 for (i
= 0; i
< ctx
->Const
.MaxDrawBuffers
; i
++) {
676 struct gl_renderbuffer
*rb
= ctx
->DrawBuffer
->_ColorDrawBuffers
[i
];
677 struct intel_renderbuffer
*irb
= intel_renderbuffer(rb
);
682 switch (irb
->texformat
->MesaFormat
) {
683 case MESA_FORMAT_ARGB8888
:
684 case MESA_FORMAT_RGB565
:
685 case MESA_FORMAT_ARGB1555
:
686 case MESA_FORMAT_ARGB4444
:
689 fb
->_Status
= GL_FRAMEBUFFER_UNSUPPORTED_EXT
;
696 * Called from glBlitFramebuffer().
697 * For now, we're doing an approximation with glCopyPixels().
698 * XXX we need to bypass all the per-fragment operations, except scissor.
701 intel_blit_framebuffer(GLcontext
*ctx
,
702 GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
703 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
704 GLbitfield mask
, GLenum filter
)
706 const GLfloat xZoomSave
= ctx
->Pixel
.ZoomX
;
707 const GLfloat yZoomSave
= ctx
->Pixel
.ZoomY
;
708 GLsizei width
, height
;
709 GLfloat xFlip
= 1.0F
, yFlip
= 1.0F
;
725 width
= srcX1
- srcX0
;
726 height
= srcY1
- srcY0
;
728 ctx
->Pixel
.ZoomX
= xFlip
* (dstX1
- dstX0
) / (srcX1
- srcY0
);
729 ctx
->Pixel
.ZoomY
= yFlip
* (dstY1
- dstY0
) / (srcY1
- srcY0
);
731 if (ctx
->Pixel
.ZoomX
< 0.0F
) {
732 dstX0
= MAX2(dstX0
, dstX1
);
735 dstX0
= MIN2(dstX0
, dstX1
);
738 if (ctx
->Pixel
.ZoomY
< 0.0F
) {
739 dstY0
= MAX2(dstY0
, dstY1
);
742 dstY0
= MIN2(dstY0
, dstY1
);
745 if (mask
& GL_COLOR_BUFFER_BIT
) {
746 ctx
->Driver
.CopyPixels(ctx
, srcX0
, srcY0
, width
, height
,
747 dstX0
, dstY0
, GL_COLOR
);
749 if (mask
& GL_DEPTH_BUFFER_BIT
) {
750 ctx
->Driver
.CopyPixels(ctx
, srcX0
, srcY0
, width
, height
,
751 dstX0
, dstY0
, GL_DEPTH
);
753 if (mask
& GL_STENCIL_BUFFER_BIT
) {
754 ctx
->Driver
.CopyPixels(ctx
, srcX0
, srcY0
, width
, height
,
755 dstX0
, dstY0
, GL_STENCIL
);
758 ctx
->Pixel
.ZoomX
= xZoomSave
;
759 ctx
->Pixel
.ZoomY
= yZoomSave
;
764 * Do one-time context initializations related to GL_EXT_framebuffer_object.
765 * Hook in device driver functions.
768 intel_fbo_init(struct intel_context
*intel
)
770 intel
->ctx
.Driver
.NewFramebuffer
= intel_new_framebuffer
;
771 intel
->ctx
.Driver
.NewRenderbuffer
= intel_new_renderbuffer
;
772 intel
->ctx
.Driver
.BindFramebuffer
= intel_bind_framebuffer
;
773 intel
->ctx
.Driver
.FramebufferRenderbuffer
= intel_framebuffer_renderbuffer
;
774 intel
->ctx
.Driver
.RenderTexture
= intel_render_texture
;
775 intel
->ctx
.Driver
.FinishRenderTexture
= intel_finish_render_texture
;
776 intel
->ctx
.Driver
.ResizeBuffers
= intel_resize_buffers
;
777 intel
->ctx
.Driver
.ValidateFramebuffer
= intel_validate_framebuffer
;
778 intel
->ctx
.Driver
.BlitFramebuffer
= intel_blit_framebuffer
;