summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/intel_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_context.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_context.c111
1 files changed, 82 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c
index fb95c492eb..0866c5ccc6 100644
--- a/src/mesa/drivers/dri/i965/intel_context.c
+++ b/src/mesa/drivers/dri/i965/intel_context.c
@@ -57,10 +57,13 @@
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_regions.h"
+#include "intel_buffers.h"
#include "intel_buffer_objects.h"
#include "intel_decode.h"
+#include "intel_fbo.h"
#include "intel_bufmgr_ttm.h"
+#include "drirenderbuffer.h"
#include "i915_drm.h"
#include "utils.h"
@@ -83,8 +86,10 @@ int INTEL_DEBUG = (0);
#define need_GL_EXT_blend_minmax
#define need_GL_EXT_cull_vertex
#define need_GL_EXT_fog_coord
+#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_multi_draw_arrays
#define need_GL_EXT_secondary_color
+#define need_GL_ATI_separate_stencil
#define need_GL_EXT_point_parameters
#define need_GL_VERSION_2_0
#define need_GL_VERSION_2_1
@@ -184,7 +189,14 @@ const struct dri_extension card_extensions[] =
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
{ "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions },
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
+ { "GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions },
{ "GL_EXT_stencil_wrap", NULL },
+ /* Do not enable this extension. It conflicts with GL_ATI_separate_stencil
+ * and 2.0's separate stencil, because mesa's computed _TestTwoSide will
+ * only reflect whether it's enabled through this extension, even if the
+ * application is using the other interfaces.
+ */
+/*{ "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },*/
{ "GL_EXT_texture_edge_clamp", NULL },
{ "GL_EXT_texture_env_combine", NULL },
{ "GL_EXT_texture_env_dot3", NULL },
@@ -202,20 +214,38 @@ const struct dri_extension card_extensions[] =
{ "GL_ARB_shader_objects", GL_ARB_shader_objects_functions},
{ "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions},
{ "GL_ARB_fragment_shader", NULL },
- /* XXX not implement yet, to compile builtin glsl lib */
{ "GL_ARB_draw_buffers", NULL },
{ NULL, NULL }
};
+const struct dri_extension ttm_extensions[] = {
+ {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
+ {"GL_ARB_pixel_buffer_object", NULL},
+ {NULL, NULL}
+};
+
const struct dri_extension arb_oc_extension =
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions};
+/**
+ * Initializes potential list of extensions if ctx == NULL, or actually enables
+ * extensions for a context.
+ */
void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging)
-{
- struct intel_context *intel = ctx?intel_context(ctx):NULL;
- driInitExtensions(ctx, card_extensions, enable_imaging);
- if (!ctx || intel->intelScreen->drmMinor >= 8)
- driInitSingleExtension (ctx, &arb_oc_extension);
+{
+ struct intel_context *intel = ctx?intel_context(ctx):NULL;
+
+ /* Disable imaging extension until convolution is working in teximage paths.
+ */
+ enable_imaging = GL_FALSE;
+
+ driInitExtensions(ctx, card_extensions, enable_imaging);
+
+ if (intel == NULL || intel->ttm)
+ driInitExtensions(ctx, ttm_extensions, GL_FALSE);
+
+ if (intel == NULL || intel->intelScreen->drmMinor >= 8)
+ driInitSingleExtension(ctx, &arb_oc_extension);
}
static const struct dri_debug_control debug_control[] =
@@ -244,6 +274,7 @@ static const struct dri_debug_control debug_control[] =
{ "blit", DEBUG_BLIT},
{ "mip", DEBUG_MIPTREE},
{ "reg", DEBUG_REGION},
+ { "fbo", DEBUG_FBO },
{ NULL, 0 }
};
@@ -506,17 +537,10 @@ GLboolean intelInitContext( struct intel_context *intel,
switch(mesaVis->depthBits) {
case 0: /* what to do in this case? */
case 16:
- intel->depth_scale = 1.0/0xffff;
intel->polygon_offset_scale = 1.0/0xffff;
- intel->depth_clear_mask = ~0;
- intel->ClearDepth = 0xffff;
break;
case 24:
- intel->depth_scale = 1.0/0xffffff;
intel->polygon_offset_scale = 2.0/0xffffff; /* req'd to pass glean */
- intel->depth_clear_mask = 0x00ffffff;
- intel->stencil_clear_mask = 0xff000000;
- intel->ClearDepth = 0x00ffffff;
break;
default:
assert(0);
@@ -534,12 +558,14 @@ GLboolean intelInitContext( struct intel_context *intel,
INTEL_DEBUG = driParseDebugString( getenv( "INTEL_DEBUG" ),
debug_control );
- if (!intel->ttm && (INTEL_DEBUG & DEBUG_BUFMGR))
- dri_bufmgr_fake_set_debug(intel->bufmgr, GL_TRUE);
+ if (INTEL_DEBUG & DEBUG_BUFMGR)
+ dri_bufmgr_set_debug(intel->bufmgr, GL_TRUE);
intel_recreate_static_regions(intel);
intel_bufferobj_init( intel );
+ intel_fbo_init( intel );
+
intel->batch = intel_batchbuffer_alloc( intel );
intel->last_swap_fence = NULL;
intel->first_swap_fence = NULL;
@@ -612,16 +638,6 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
*/
}
- /* Free the regions created to describe front/back/depth
- * buffers:
- */
-#if 0
- intel_region_release(intel, &intel->front_region);
- intel_region_release(intel, &intel->back_region);
- intel_region_release(intel, &intel->depth_region);
- intel_region_release(intel, &intel->draw_region);
-#endif
-
/* free the Mesa context */
intel->ctx.VertexProgram.Current = NULL;
intel->ctx.FragmentProgram.Current = NULL;
@@ -642,7 +658,44 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
{
if (driContextPriv) {
- struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
+ struct intel_context *intel =
+ (struct intel_context *) driContextPriv->driverPrivate;
+ struct intel_framebuffer *intel_fb =
+ (struct intel_framebuffer *) driDrawPriv->driverPrivate;
+ GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
+
+ /* XXX FBO temporary fix-ups! */
+ /* if the renderbuffers don't have regions, init them from the context.
+ * They will be unreferenced when the renderbuffer is destroyed.
+ */
+ {
+ struct intel_renderbuffer *irbDepth
+ = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
+ struct intel_renderbuffer *irbStencil
+ = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
+
+ if (intel_fb->color_rb[0] && !intel_fb->color_rb[0]->region) {
+ intel_region_reference(&intel_fb->color_rb[0]->region,
+ intel->front_region);
+ }
+ if (intel_fb->color_rb[1] && !intel_fb->color_rb[1]->region) {
+ intel_region_reference(&intel_fb->color_rb[1]->region,
+ intel->back_region);
+ }
+ if (intel_fb->color_rb[2] && !intel_fb->color_rb[2]->region) {
+ intel_region_reference(&intel_fb->color_rb[2]->region,
+ intel->third_region);
+ }
+ if (irbDepth && !irbDepth->region) {
+ intel_region_reference(&irbDepth->region, intel->depth_region);
+ }
+ if (irbStencil && !irbStencil->region) {
+ intel_region_reference(&irbStencil->region, intel->depth_region);
+ }
+ }
+
+ /* set GLframebuffer size to match window, if needed */
+ driUpdateFramebufferSize(&intel->ctx, driDrawPriv);
if (intel->driReadDrawable != driReadPriv) {
intel->driReadDrawable = driReadPriv;
@@ -662,10 +715,10 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
}
_mesa_make_current(&intel->ctx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
+ &intel_fb->Base,
+ readFb);
- intel->ctx.Driver.DrawBuffer( &intel->ctx, intel->ctx.Color.DrawBuffer[0] );
+ intel_draw_buffer(&intel->ctx, &intel_fb->Base);
} else {
_mesa_make_current(NULL, NULL, NULL);
}