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