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