static const __DRIextension *dri_screen_extensions[] = {
&swrastTexBufferExtension.base,
&swrast_query_renderer_extension.base,
+ &dri2ConfigQueryExtension.base,
+ &dri2NoErrorExtension.base,
NULL
};
unsigned back_buffer_factor;
mesa_format format;
- /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
- * support pageflipping at all.
- */
static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML
+ __DRI_ATTRIB_SWAP_NONE, __DRI_ATTRIB_SWAP_UNDEFINED
};
uint8_t depth_bits_array[4];
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor, msaa_samples_array, 1,
- GL_TRUE, GL_FALSE);
+ GL_TRUE, GL_FALSE, GL_FALSE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
GLuint x, GLuint y, GLuint w, GLuint h,
GLbitfield mode,
GLubyte **out_map,
- GLint *out_stride)
+ GLint *out_stride,
+ bool flip_y)
{
struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
GLubyte *map = xrb->Base.Buffer;
int cpp = _mesa_get_format_bytes(rb->Format);
int stride = rb->Width * cpp;
+ /* driver does not support GL_FRAMEBUFFER_FLIP_Y_MESA */
+ assert((rb->Name == 0) == flip_y);
+
if (rb->AllocStorage == swrast_alloc_front_storage) {
__DRIdrawable *dPriv = xrb->dPriv;
__DRIscreen *sPriv = dPriv->driScreenPriv;
xrb->map_mode = mode;
xrb->map_x = x;
- xrb->map_y = y;
+ xrb->map_y = rb->Height - y - h;
xrb->map_w = w;
xrb->map_h = h;
stride = w * cpp;
xrb->Base.Buffer = malloc(h * stride);
- sPriv->swrast_loader->getImage(dPriv, x, rb->Height - y - h, w, h,
+ sPriv->swrast_loader->getImage(dPriv, x, xrb->map_y, w, h,
(char *) xrb->Base.Buffer,
dPriv->loaderPrivate);
/* add front renderbuffer */
frontrb = swrast_new_renderbuffer(visual, dPriv, GL_TRUE);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontrb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &frontrb->Base.Base);
/* add back renderbuffer */
if (visual->doubleBufferMode) {
backrb = swrast_new_renderbuffer(visual, dPriv, GL_FALSE);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backrb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, &backrb->Base.Base);
}
/* add software renderbuffers */
{
GLsizei width, height;
+ if (!fb)
+ return;
+
get_window_size(fb, &width, &height);
if (fb->Width != width || fb->Height != height) {
_mesa_resize_framebuffer(ctx, fb, width, height);
}
static void
-update_state( struct gl_context *ctx, GLuint new_state )
+update_state(struct gl_context *ctx)
{
+ GLuint new_state = ctx->NewState;
+
+ if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
+ _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
+
/* not much to do here - pass it on */
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
}
dri_create_context(gl_api api,
const struct gl_config * visual,
__DRIcontext * cPriv,
- unsigned major_version,
- unsigned minor_version,
- uint32_t flags,
- bool notify_reset,
+ const struct __DriverContextConfig *ctx_config,
unsigned *error,
void *sharedContextPrivate)
{
/* Flag filtering is handled in dri2CreateContextAttribs.
*/
- (void) flags;
+ (void) ctx_config->flags;
+
+ /* The swrast driver doesn't understand any of the attributes */
+ if (ctx_config->attribute_mask != 0) {
+ *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;
+ }
ctx = CALLOC_STRUCT(dri_context);
if (ctx == NULL) {
/* build table of device driver functions */
_mesa_init_driver_functions(&functions);
swrast_init_driver_functions(&functions);
+ _tnl_init_driver_draw_function(&functions);
if (share) {
sharedCtx = &share->Base;
goto context_fail;
}
- driContextSetFlags(mesaCtx, flags);
+ driContextSetFlags(mesaCtx, ctx_config->flags);
/* create module contexts */
_swrast_CreateContext( mesaCtx );
_mesa_meta_init(mesaCtx);
_mesa_enable_sw_extensions(mesaCtx);
+ _mesa_override_extensions(mesaCtx);
_mesa_compute_version(mesaCtx);
_mesa_initialize_dispatch_tables(mesaCtx);
__DRIdrawable * driReadPriv)
{
struct gl_context *mesaCtx;
- struct gl_framebuffer *mesaDraw;
- struct gl_framebuffer *mesaRead;
+ struct gl_framebuffer *mesaDraw = NULL;
+ struct gl_framebuffer *mesaRead = NULL;
TRACE;
if (cPriv) {
- struct dri_context *ctx = dri_context(cPriv);
- struct dri_drawable *draw;
- struct dri_drawable *read;
-
- if (!driDrawPriv || !driReadPriv)
- return GL_FALSE;
-
- draw = dri_drawable(driDrawPriv);
- read = dri_drawable(driReadPriv);
- mesaCtx = &ctx->Base;
- mesaDraw = &draw->Base;
- mesaRead = &read->Base;
-
- /* check for same context and buffer */
- if (mesaCtx == _mesa_get_current_context()
- && mesaCtx->DrawBuffer == mesaDraw
- && mesaCtx->ReadBuffer == mesaRead) {
- return GL_TRUE;
- }
+ mesaCtx = &dri_context(cPriv)->Base;
+
+ if (driDrawPriv && driReadPriv) {
+ struct dri_drawable *draw = dri_drawable(driDrawPriv);
+ struct dri_drawable *read = dri_drawable(driReadPriv);
+ mesaDraw = &draw->Base;
+ mesaRead = &read->Base;
+ }
+
+ /* check for same context and buffer */
+ if (mesaCtx == _mesa_get_current_context()
+ && mesaCtx->DrawBuffer == mesaDraw
+ && mesaCtx->ReadBuffer == mesaRead) {
+ return GL_TRUE;
+ }
_glapi_check_multithread();
&driCoreExtension.base,
&driSWRastExtension.base,
&driCopySubBufferExtension.base,
- &dri2ConfigQueryExtension.base,
&swrast_vtable.base,
NULL
};