Merge remote branch 'origin/7.8'
[mesa.git] / src / mesa / drivers / dri / intel / intel_fbo.c
1 /**************************************************************************
2 *
3 * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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.
25 *
26 **************************************************************************/
27
28
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/texrender.h"
37 #include "drivers/common/meta.h"
38
39 #include "intel_context.h"
40 #include "intel_batchbuffer.h"
41 #include "intel_buffers.h"
42 #include "intel_fbo.h"
43 #include "intel_mipmap_tree.h"
44 #include "intel_regions.h"
45
46
47 #define FILE_DEBUG_FLAG DEBUG_FBO
48
49
50 /**
51 * Create a new framebuffer object.
52 */
53 static struct gl_framebuffer *
54 intel_new_framebuffer(GLcontext * ctx, GLuint name)
55 {
56 /* Only drawable state in intel_framebuffer at this time, just use Mesa's
57 * class
58 */
59 return _mesa_new_framebuffer(ctx, name);
60 }
61
62
63 /** Called by gl_renderbuffer::Delete() */
64 static void
65 intel_delete_renderbuffer(struct gl_renderbuffer *rb)
66 {
67 GET_CURRENT_CONTEXT(ctx);
68 struct intel_context *intel = intel_context(ctx);
69 struct intel_renderbuffer *irb = intel_renderbuffer(rb);
70
71 ASSERT(irb);
72
73 if (intel && irb->region) {
74 intel_region_release(&irb->region);
75 }
76
77 free(irb);
78 }
79
80
81 /**
82 * Return a pointer to a specific pixel in a renderbuffer.
83 */
84 static void *
85 intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb,
86 GLint x, GLint y)
87 {
88 /* By returning NULL we force all software rendering to go through
89 * the span routines.
90 */
91 return NULL;
92 }
93
94
95 /**
96 * Called via glRenderbufferStorageEXT() to set the format and allocate
97 * storage for a user-created renderbuffer.
98 */
99 static GLboolean
100 intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
101 GLenum internalFormat,
102 GLuint width, GLuint height)
103 {
104 struct intel_context *intel = intel_context(ctx);
105 struct intel_renderbuffer *irb = intel_renderbuffer(rb);
106 int cpp;
107
108 ASSERT(rb->Name != 0);
109
110 switch (internalFormat) {
111 case GL_R3_G3_B2:
112 case GL_RGB4:
113 case GL_RGB5:
114 rb->Format = MESA_FORMAT_RGB565;
115 rb->DataType = GL_UNSIGNED_BYTE;
116 break;
117 case GL_RGB:
118 case GL_RGB8:
119 case GL_RGB10:
120 case GL_RGB12:
121 case GL_RGB16:
122 rb->Format = MESA_FORMAT_XRGB8888;
123 rb->DataType = GL_UNSIGNED_BYTE;
124 break;
125 case GL_RGBA:
126 case GL_RGBA2:
127 case GL_RGBA4:
128 case GL_RGB5_A1:
129 case GL_RGBA8:
130 case GL_RGB10_A2:
131 case GL_RGBA12:
132 case GL_RGBA16:
133 rb->Format = MESA_FORMAT_ARGB8888;
134 rb->DataType = GL_UNSIGNED_BYTE;
135 break;
136 case GL_STENCIL_INDEX:
137 case GL_STENCIL_INDEX1_EXT:
138 case GL_STENCIL_INDEX4_EXT:
139 case GL_STENCIL_INDEX8_EXT:
140 case GL_STENCIL_INDEX16_EXT:
141 /* alloc a depth+stencil buffer */
142 rb->Format = MESA_FORMAT_S8_Z24;
143 rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
144 break;
145 case GL_DEPTH_COMPONENT16:
146 rb->Format = MESA_FORMAT_Z16;
147 rb->DataType = GL_UNSIGNED_SHORT;
148 break;
149 case GL_DEPTH_COMPONENT:
150 case GL_DEPTH_COMPONENT24:
151 case GL_DEPTH_COMPONENT32:
152 rb->Format = MESA_FORMAT_S8_Z24;
153 rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
154 break;
155 case GL_DEPTH_STENCIL_EXT:
156 case GL_DEPTH24_STENCIL8_EXT:
157 rb->Format = MESA_FORMAT_S8_Z24;
158 rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
159 break;
160 default:
161 _mesa_problem(ctx,
162 "Unexpected format in intel_alloc_renderbuffer_storage");
163 return GL_FALSE;
164 }
165
166 rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
167 cpp = _mesa_get_format_bytes(rb->Format);
168
169 intelFlush(ctx);
170
171 /* free old region */
172 if (irb->region) {
173 intel_region_release(&irb->region);
174 }
175
176 /* allocate new memory region/renderbuffer */
177
178 /* alloc hardware renderbuffer */
179 DBG("Allocating %d x %d Intel RBO\n", width, height);
180
181 irb->region = intel_region_alloc(intel, I915_TILING_NONE, cpp,
182 width, height, GL_TRUE);
183 if (!irb->region)
184 return GL_FALSE; /* out of memory? */
185
186 ASSERT(irb->region->buffer);
187
188 rb->Width = width;
189 rb->Height = height;
190
191 return GL_TRUE;
192 }
193
194
195 #if FEATURE_OES_EGL_image
196 static void
197 intel_image_target_renderbuffer_storage(GLcontext *ctx,
198 struct gl_renderbuffer *rb,
199 void *image_handle)
200 {
201 struct intel_context *intel = intel_context(ctx);
202 struct intel_renderbuffer *irb;
203 __DRIscreen *screen;
204 __DRIimage *image;
205
206 screen = intel->intelScreen->driScrnPriv;
207 image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle,
208 intel->driContext->loaderPrivate);
209 if (image == NULL)
210 return;
211
212 irb = intel_renderbuffer(rb);
213 if (irb->region)
214 intel_region_release(&irb->region);
215 intel_region_reference(&irb->region, image->region);
216
217 rb->InternalFormat = image->internal_format;
218 rb->Width = image->region->width;
219 rb->Height = image->region->height;
220 rb->Format = image->format;
221 rb->DataType = image->data_type;
222 rb->_BaseFormat = _mesa_base_fbo_format(&intel->ctx,
223 image->internal_format);
224 }
225 #endif
226
227 /**
228 * Called for each hardware renderbuffer when a _window_ is resized.
229 * Just update fields.
230 * Not used for user-created renderbuffers!
231 */
232 static GLboolean
233 intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
234 GLenum internalFormat, GLuint width, GLuint height)
235 {
236 ASSERT(rb->Name == 0);
237 rb->Width = width;
238 rb->Height = height;
239 rb->InternalFormat = internalFormat;
240
241 return GL_TRUE;
242 }
243
244
245 static void
246 intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
247 GLuint width, GLuint height)
248 {
249 int i;
250
251 _mesa_resize_framebuffer(ctx, fb, width, height);
252
253 fb->Initialized = GL_TRUE; /* XXX remove someday */
254
255 if (fb->Name != 0) {
256 return;
257 }
258
259
260 /* Make sure all window system renderbuffers are up to date */
261 for (i = BUFFER_FRONT_LEFT; i <= BUFFER_BACK_RIGHT; i++) {
262 struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
263
264 /* only resize if size is changing */
265 if (rb && (rb->Width != width || rb->Height != height)) {
266 rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height);
267 }
268 }
269 }
270
271
272 /** Dummy function for gl_renderbuffer::AllocStorage() */
273 static GLboolean
274 intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
275 GLenum internalFormat, GLuint width, GLuint height)
276 {
277 _mesa_problem(ctx, "intel_op_alloc_storage should never be called.");
278 return GL_FALSE;
279 }
280
281
282 void
283 intel_renderbuffer_set_region(struct intel_renderbuffer *rb,
284 struct intel_region *region)
285 {
286 struct intel_region *old;
287
288 old = rb->region;
289 rb->region = NULL;
290 intel_region_reference(&rb->region, region);
291 intel_region_release(&old);
292 }
293
294
295 /**
296 * Create a new intel_renderbuffer which corresponds to an on-screen window,
297 * not a user-created renderbuffer.
298 */
299 struct intel_renderbuffer *
300 intel_create_renderbuffer(gl_format format)
301 {
302 GET_CURRENT_CONTEXT(ctx);
303
304 struct intel_renderbuffer *irb;
305
306 irb = CALLOC_STRUCT(intel_renderbuffer);
307 if (!irb) {
308 _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
309 return NULL;
310 }
311
312 _mesa_init_renderbuffer(&irb->Base, 0);
313 irb->Base.ClassID = INTEL_RB_CLASS;
314
315 switch (format) {
316 case MESA_FORMAT_RGB565:
317 irb->Base._BaseFormat = GL_RGB;
318 irb->Base.DataType = GL_UNSIGNED_BYTE;
319 break;
320 case MESA_FORMAT_XRGB8888:
321 irb->Base._BaseFormat = GL_RGB;
322 irb->Base.DataType = GL_UNSIGNED_BYTE;
323 break;
324 case MESA_FORMAT_ARGB8888:
325 irb->Base._BaseFormat = GL_RGBA;
326 irb->Base.DataType = GL_UNSIGNED_BYTE;
327 break;
328 case MESA_FORMAT_Z16:
329 irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
330 irb->Base.DataType = GL_UNSIGNED_SHORT;
331 break;
332 case MESA_FORMAT_X8_Z24:
333 irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
334 irb->Base.DataType = GL_UNSIGNED_INT;
335 break;
336 case MESA_FORMAT_S8_Z24:
337 irb->Base._BaseFormat = GL_DEPTH_STENCIL;
338 irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
339 break;
340 default:
341 _mesa_problem(NULL,
342 "Unexpected intFormat in intel_create_renderbuffer");
343 free(irb);
344 return NULL;
345 }
346
347 irb->Base.Format = format;
348 irb->Base.InternalFormat = irb->Base._BaseFormat;
349
350 /* intel-specific methods */
351 irb->Base.Delete = intel_delete_renderbuffer;
352 irb->Base.AllocStorage = intel_alloc_window_storage;
353 irb->Base.GetPointer = intel_get_pointer;
354
355 return irb;
356 }
357
358
359 /**
360 * Create a new renderbuffer object.
361 * Typically called via glBindRenderbufferEXT().
362 */
363 static struct gl_renderbuffer *
364 intel_new_renderbuffer(GLcontext * ctx, GLuint name)
365 {
366 /*struct intel_context *intel = intel_context(ctx); */
367 struct intel_renderbuffer *irb;
368
369 irb = CALLOC_STRUCT(intel_renderbuffer);
370 if (!irb) {
371 _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
372 return NULL;
373 }
374
375 _mesa_init_renderbuffer(&irb->Base, name);
376 irb->Base.ClassID = INTEL_RB_CLASS;
377
378 /* intel-specific methods */
379 irb->Base.Delete = intel_delete_renderbuffer;
380 irb->Base.AllocStorage = intel_alloc_renderbuffer_storage;
381 irb->Base.GetPointer = intel_get_pointer;
382 /* span routines set in alloc_storage function */
383
384 return &irb->Base;
385 }
386
387
388 /**
389 * Called via glBindFramebufferEXT().
390 */
391 static void
392 intel_bind_framebuffer(GLcontext * ctx, GLenum target,
393 struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
394 {
395 if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
396 intel_draw_buffer(ctx, fb);
397 }
398 else {
399 /* don't need to do anything if target == GL_READ_FRAMEBUFFER_EXT */
400 }
401 }
402
403
404 /**
405 * Called via glFramebufferRenderbufferEXT().
406 */
407 static void
408 intel_framebuffer_renderbuffer(GLcontext * ctx,
409 struct gl_framebuffer *fb,
410 GLenum attachment, struct gl_renderbuffer *rb)
411 {
412 DBG("Intel FramebufferRenderbuffer %u %u\n", fb->Name, rb ? rb->Name : 0);
413
414 intelFlush(ctx);
415
416 _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb);
417 intel_draw_buffer(ctx, fb);
418 }
419
420
421 static GLboolean
422 intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
423 struct gl_texture_image *texImage)
424 {
425 if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
426 irb->Base.DataType = GL_UNSIGNED_BYTE;
427 DBG("Render to RGBA8 texture OK\n");
428 }
429 else if (texImage->TexFormat == MESA_FORMAT_XRGB8888) {
430 irb->Base.DataType = GL_UNSIGNED_BYTE;
431 DBG("Render to XGBA8 texture OK\n");
432 }
433 else if (texImage->TexFormat == MESA_FORMAT_RGB565) {
434 irb->Base.DataType = GL_UNSIGNED_BYTE;
435 DBG("Render to RGB5 texture OK\n");
436 }
437 else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) {
438 irb->Base.DataType = GL_UNSIGNED_BYTE;
439 DBG("Render to ARGB1555 texture OK\n");
440 }
441 else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) {
442 irb->Base.DataType = GL_UNSIGNED_BYTE;
443 DBG("Render to ARGB4444 texture OK\n");
444 }
445 else if (texImage->TexFormat == MESA_FORMAT_Z16) {
446 irb->Base.DataType = GL_UNSIGNED_SHORT;
447 DBG("Render to DEPTH16 texture OK\n");
448 }
449 else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) {
450 irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
451 DBG("Render to DEPTH_STENCIL texture OK\n");
452 }
453 else {
454 DBG("Render to texture BAD FORMAT %s\n",
455 _mesa_get_format_name(texImage->TexFormat));
456 return GL_FALSE;
457 }
458
459 irb->Base.Format = texImage->TexFormat;
460
461 irb->Base.InternalFormat = texImage->InternalFormat;
462 irb->Base._BaseFormat = _mesa_base_fbo_format(ctx, irb->Base.InternalFormat);
463 irb->Base.Width = texImage->Width;
464 irb->Base.Height = texImage->Height;
465
466 irb->Base.Delete = intel_delete_renderbuffer;
467 irb->Base.AllocStorage = intel_nop_alloc_storage;
468
469 return GL_TRUE;
470 }
471
472
473 /**
474 * When glFramebufferTexture[123]D is called this function sets up the
475 * gl_renderbuffer wrapper around the texture image.
476 * This will have the region info needed for hardware rendering.
477 */
478 static struct intel_renderbuffer *
479 intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
480 {
481 const GLuint name = ~0; /* not significant, but distinct for debugging */
482 struct intel_renderbuffer *irb;
483
484 /* make an intel_renderbuffer to wrap the texture image */
485 irb = CALLOC_STRUCT(intel_renderbuffer);
486 if (!irb) {
487 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture");
488 return NULL;
489 }
490
491 _mesa_init_renderbuffer(&irb->Base, name);
492 irb->Base.ClassID = INTEL_RB_CLASS;
493
494 if (!intel_update_wrapper(ctx, irb, texImage)) {
495 free(irb);
496 return NULL;
497 }
498
499 return irb;
500 }
501
502
503 /**
504 * Called by glFramebufferTexture[123]DEXT() (and other places) to
505 * prepare for rendering into texture memory. This might be called
506 * many times to choose different texture levels, cube faces, etc
507 * before intel_finish_render_texture() is ever called.
508 */
509 static void
510 intel_render_texture(GLcontext * ctx,
511 struct gl_framebuffer *fb,
512 struct gl_renderbuffer_attachment *att)
513 {
514 struct gl_texture_image *newImage
515 = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
516 struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer);
517 struct intel_texture_image *intel_image;
518 GLuint dst_x, dst_y;
519
520 (void) fb;
521
522 ASSERT(newImage);
523
524 intel_image = intel_texture_image(newImage);
525 if (!intel_image->mt) {
526 /* Fallback on drawing to a texture that doesn't have a miptree
527 * (has a border, width/height 0, etc.)
528 */
529 _mesa_reference_renderbuffer(&att->Renderbuffer, NULL);
530 _mesa_render_texture(ctx, fb, att);
531 return;
532 }
533 else if (!irb) {
534 irb = intel_wrap_texture(ctx, newImage);
535 if (irb) {
536 /* bind the wrapper to the attachment point */
537 _mesa_reference_renderbuffer(&att->Renderbuffer, &irb->Base);
538 }
539 else {
540 /* fallback to software rendering */
541 _mesa_render_texture(ctx, fb, att);
542 return;
543 }
544 }
545
546 if (!intel_update_wrapper(ctx, irb, newImage)) {
547 _mesa_reference_renderbuffer(&att->Renderbuffer, NULL);
548 _mesa_render_texture(ctx, fb, att);
549 return;
550 }
551
552 DBG("Begin render texture tid %lx tex=%u w=%d h=%d refcount=%d\n",
553 _glthread_GetID(),
554 att->Texture->Name, newImage->Width, newImage->Height,
555 irb->Base.RefCount);
556
557 /* point the renderbufer's region to the texture image region */
558 if (irb->region != intel_image->mt->region) {
559 if (irb->region)
560 intel_region_release(&irb->region);
561 intel_region_reference(&irb->region, intel_image->mt->region);
562 }
563
564 /* compute offset of the particular 2D image within the texture region */
565 intel_miptree_get_image_offset(intel_image->mt,
566 att->TextureLevel,
567 att->CubeMapFace,
568 att->Zoffset,
569 &dst_x, &dst_y);
570
571 intel_image->mt->region->draw_offset = (dst_y * intel_image->mt->region->pitch +
572 dst_x) * intel_image->mt->cpp;
573 intel_image->mt->region->draw_x = dst_x;
574 intel_image->mt->region->draw_y = dst_y;
575 intel_image->used_as_render_target = GL_TRUE;
576
577 /* update drawing region, etc */
578 intel_draw_buffer(ctx, fb);
579 }
580
581
582 /**
583 * Called by Mesa when rendering to a texture is done.
584 */
585 static void
586 intel_finish_render_texture(GLcontext * ctx,
587 struct gl_renderbuffer_attachment *att)
588 {
589 struct intel_context *intel = intel_context(ctx);
590 struct gl_texture_object *tex_obj = att->Texture;
591 struct gl_texture_image *image =
592 tex_obj->Image[att->CubeMapFace][att->TextureLevel];
593 struct intel_texture_image *intel_image = intel_texture_image(image);
594
595 /* Flag that this image may now be validated into the object's miptree. */
596 intel_image->used_as_render_target = GL_FALSE;
597
598 /* Since we've (probably) rendered to the texture and will (likely) use
599 * it in the texture domain later on in this batchbuffer, flush the
600 * batch. Once again, we wish for a domain tracker in libdrm to cover
601 * usage inside of a batchbuffer like GEM does in the kernel.
602 */
603 intel_batchbuffer_emit_mi_flush(intel->batch);
604 }
605
606 /**
607 * Do additional "completeness" testing of a framebuffer object.
608 */
609 static void
610 intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
611 {
612 const struct intel_renderbuffer *depthRb =
613 intel_get_renderbuffer(fb, BUFFER_DEPTH);
614 const struct intel_renderbuffer *stencilRb =
615 intel_get_renderbuffer(fb, BUFFER_STENCIL);
616 int i;
617
618 if (depthRb && stencilRb && stencilRb != depthRb) {
619 if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Type == GL_TEXTURE &&
620 ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Type == GL_TEXTURE &&
621 (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Texture->Name ==
622 ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Texture->Name)) {
623 /* OK */
624 } else {
625 /* we only support combined depth/stencil buffers, not separate
626 * stencil buffers.
627 */
628 DBG("Only supports combined depth/stencil (found %s, %s)\n",
629 depthRb ? _mesa_get_format_name(depthRb->Base.Format): "NULL",
630 stencilRb ? _mesa_get_format_name(stencilRb->Base.Format): "NULL");
631 fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
632 }
633 }
634
635 for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
636 struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
637 struct intel_renderbuffer *irb = intel_renderbuffer(rb);
638
639 if (rb == NULL)
640 continue;
641
642 if (irb == NULL) {
643 DBG("software rendering renderbuffer\n");
644 fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
645 continue;
646 }
647
648 switch (irb->Base.Format) {
649 case MESA_FORMAT_ARGB8888:
650 case MESA_FORMAT_XRGB8888:
651 case MESA_FORMAT_RGB565:
652 case MESA_FORMAT_ARGB1555:
653 case MESA_FORMAT_ARGB4444:
654 break;
655 default:
656 fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
657 }
658 }
659 }
660
661
662 /**
663 * Do one-time context initializations related to GL_EXT_framebuffer_object.
664 * Hook in device driver functions.
665 */
666 void
667 intel_fbo_init(struct intel_context *intel)
668 {
669 intel->ctx.Driver.NewFramebuffer = intel_new_framebuffer;
670 intel->ctx.Driver.NewRenderbuffer = intel_new_renderbuffer;
671 intel->ctx.Driver.BindFramebuffer = intel_bind_framebuffer;
672 intel->ctx.Driver.FramebufferRenderbuffer = intel_framebuffer_renderbuffer;
673 intel->ctx.Driver.RenderTexture = intel_render_texture;
674 intel->ctx.Driver.FinishRenderTexture = intel_finish_render_texture;
675 intel->ctx.Driver.ResizeBuffers = intel_resize_buffers;
676 intel->ctx.Driver.ValidateFramebuffer = intel_validate_framebuffer;
677 intel->ctx.Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer;
678
679 #if FEATURE_OES_EGL_image
680 intel->ctx.Driver.EGLImageTargetRenderbufferStorage =
681 intel_image_target_renderbuffer_storage;
682 #endif
683 }