summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2005-06-06 12:28:40 +0000
committerDavid Reveman <davidr@novell.com>2005-06-06 12:28:40 +0000
commit8292d3b001441cc74347ab1464812c27476ae321 (patch)
tree5abf94000313321ed02c55c6508eed2d465c1f89 /src
parentb137c6156c798434fa618bb57cf375e1adfbdb09 (diff)
Remove temporary context functions and fix framebuffer object issues
Diffstat (limited to 'src')
-rw-r--r--src/glitz.c9
-rw-r--r--src/glitz.h20
-rw-r--r--src/glitz_compose.c14
-rw-r--r--src/glitz_context.c126
-rw-r--r--src/glitz_surface.c2
-rw-r--r--src/glitzint.h9
-rw-r--r--src/glx/glitz_glx_context.c54
7 files changed, 56 insertions, 178 deletions
diff --git a/src/glitz.c b/src/glitz.c
index ae78d73..98a47d4 100644
--- a/src/glitz.c
+++ b/src/glitz.c
@@ -413,8 +413,6 @@ glitz_copy_area (glitz_surface_t *src,
glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
- gl->disable (GLITZ_GL_SCISSOR_TEST);
-
x_src += src->x;
y_src += src->y;
@@ -440,6 +438,11 @@ glitz_copy_area (glitz_surface_t *src,
dst->attached->height -
(dst->y + box.y2));
+ gl->scissor (dst->x + box.x1,
+ dst->attached->height - (dst->y + box.y2),
+ box.x2 - box.x1,
+ box.y2 - box.y1);
+
gl->copy_pixels (x_src + (box.x1 - x_dst),
src->attached->height -
(y_src + (box.y2 - y_dst)),
@@ -453,8 +456,6 @@ glitz_copy_area (glitz_surface_t *src,
clip++;
}
-
- gl->enable (GLITZ_GL_SCISSOR_TEST);
}
else
{
diff --git a/src/glitz.h b/src/glitz.h
index 9798706..ada044f 100644
--- a/src/glitz.h
+++ b/src/glitz.h
@@ -409,27 +409,11 @@ glitz_context_get_proc_address (glitz_context_t *context,
void
glitz_context_make_current (glitz_context_t *context);
-/* XXX: The following context functions are part of a temporary solution and
- will be removed soon. It should not be possible to attach a surface to a
- context. Only drawables can be used with contexts. */
void
-glitz_context_set_surface (glitz_context_t *context,
- glitz_surface_t *surface);
+glitz_context_bind_texture (glitz_context_t *context,
+ glitz_surface_t *surface);
-void
-glitz_context_set_viewport (glitz_context_t *context,
- int x,
- int y,
- int width,
- int height);
-void
-glitz_context_set_scissor (glitz_context_t *context,
- int x,
- int y,
- int width,
- int height);
-
/* glitz_rect.c */
void
diff --git a/src/glitz_compose.c b/src/glitz_compose.c
index b822ebd..c2cbe8d 100644
--- a/src/glitz_compose.c
+++ b/src/glitz_compose.c
@@ -479,7 +479,6 @@ glitz_composite_op_init (glitz_composite_op_t *op,
op->type = GLITZ_COMBINE_TYPE_NA;
op->combine = NULL;
op->alpha_mask = _default_alpha_mask;
- op->gl = &dst->drawable->backend->gl;
op->src = src;
op->mask = mask;
op->dst = dst;
@@ -488,8 +487,17 @@ glitz_composite_op_init (glitz_composite_op_t *op,
op->per_component = 0;
op->fp = 0;
- feature_mask = dst->attached->backend->feature_mask;
-
+ if (dst->attached)
+ {
+ op->gl = &dst->attached->backend->gl;
+ feature_mask = dst->attached->backend->feature_mask;
+ }
+ else
+ {
+ op->gl = &dst->drawable->backend->gl;
+ feature_mask = dst->drawable->backend->feature_mask;
+ }
+
src_type = _glitz_get_surface_type (src, feature_mask);
if (src_type < 1)
return;
diff --git a/src/glitz_context.c b/src/glitz_context.c
index 12d5533..0f11cf6 100644
--- a/src/glitz_context.c
+++ b/src/glitz_context.c
@@ -37,7 +37,6 @@ _glitz_context_init (glitz_context_t *context,
context->ref_count = 1;
context->drawable = drawable;
- context->surface = NULL;
context->closure = NULL;
context->lose_current = NULL;
}
@@ -46,8 +45,6 @@ void
_glitz_context_fini (glitz_context_t *context)
{
glitz_drawable_destroy (context->drawable);
- if (context->surface)
- glitz_surface_destroy (context->surface);
}
glitz_context_t *
@@ -112,124 +109,19 @@ slim_hidden_def(glitz_context_get_proc_address);
void
glitz_context_make_current (glitz_context_t *context)
{
- glitz_surface_t *surface = context->surface;
-
- if (surface->attached)
- {
- glitz_box_t *scissor = &context->scissor;
- glitz_box_t *viewport = &context->viewport;
-
- GLITZ_GL_SURFACE (surface);
-
- surface->attached->backend->make_current (context, surface->attached);
-
- glitz_surface_sync_drawable (surface);
-
- REGION_EMPTY (&surface->texture_damage);
- REGION_INIT (&surface->texture_damage, &context->scissor);
-
- gl->enable (GLITZ_GL_SCISSOR_TEST);
-
- gl->scissor (surface->x + scissor->x1,
- surface->attached->height - surface->y - scissor->y2,
- scissor->x2 - scissor->x1,
- scissor->y2 - scissor->y1);
-
- gl->viewport (surface->x + viewport->x1,
- surface->attached->height - surface->y - viewport->y2,
- viewport->x2 - viewport->x1,
- viewport->y2 - viewport->y1);
-
- gl->draw_buffer (surface->buffer);
- }
- else if (surface->drawable->backend->feature_mask &
- GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK)
- {
- surface->drawable->backend->make_current (context, surface->drawable);
-
- if (!glitz_framebuffer_complete (&surface->drawable->backend->gl,
- &surface->framebuffer,
- &surface->texture))
- glitz_surface_status_add (surface,
- GLITZ_STATUS_NOT_SUPPORTED_MASK);
- }
+ context->drawable->backend->make_current (context, context->drawable);
}
slim_hidden_def(glitz_context_make_current);
void
-glitz_context_set_surface (glitz_context_t *context,
- glitz_surface_t *surface)
+glitz_context_bind_texture (glitz_context_t *context,
+ glitz_surface_t *surface)
{
- glitz_surface_reference (surface);
-
- if (context->surface)
- glitz_surface_destroy (context->surface);
-
- context->surface = surface;
- context->scissor = surface->box;
- context->viewport = surface->box;
-}
-slim_hidden_def(glitz_context_set_surface);
-
-void
-glitz_context_set_scissor (glitz_context_t *context,
- int x,
- int y,
- int width,
- int height)
-{
- glitz_surface_t *surface = context->surface;
+ glitz_gl_proc_address_list_t *gl = &context->drawable->backend->gl;
- GLITZ_GL_SURFACE (surface);
-
- if (surface->attached)
- {
- glitz_box_t *scissor = &context->scissor;
-
- *scissor = surface->box;
- if (x > 0)
- scissor->x1 = x;
- if (y > 0)
- scissor->y2 -= y;
- if (x + width < scissor->x2)
- scissor->x2 = x + width;
- if (y + height < scissor->y2)
- scissor->y1 = scissor->y2 - y - height;
-
- gl->scissor (surface->x + scissor->x1,
- surface->attached->height - surface->y - scissor->y2,
- scissor->x2 - scissor->x1,
- scissor->y2 - scissor->y1);
- } else
- gl->scissor (x, y, width, height);
-}
-slim_hidden_def(glitz_context_set_scissor);
-
-void
-glitz_context_set_viewport (glitz_context_t *context,
- int x,
- int y,
- int width,
- int height)
-{
- glitz_surface_t *surface = context->surface;
-
- GLITZ_GL_SURFACE (surface);
-
- if (surface->attached)
- {
- glitz_box_t *viewport = &context->viewport;
-
- viewport->x1 = x;
- viewport->y1 = surface->box.y2 - y - height;
- viewport->x2 = x + width;
- viewport->y2 = surface->box.y2 - y;
-
- gl->viewport (surface->x + viewport->x1,
- surface->attached->height - surface->y - viewport->y2,
- viewport->x2 - viewport->x1,
- viewport->y2 - viewport->y1);
- } else
- gl->viewport (x, y, width, height);
+ if (!surface->texture.name)
+ gl->gen_textures (1, &surface->texture.name);
+
+ gl->bind_texture (surface->texture.target, surface->texture.name);
}
-slim_hidden_def(glitz_context_set_viewport);
+slim_hidden_def(glitz_context_bind_texture);
diff --git a/src/glitz_surface.c b/src/glitz_surface.c
index f0f86d5..99e7cd7 100644
--- a/src/glitz_surface.c
+++ b/src/glitz_surface.c
@@ -573,7 +573,7 @@ glitz_surface_push_current (glitz_surface_t *surface,
if (surface->drawable->backend->feature_mask &
GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK)
{
- if (glitz_framebuffer_complete (&surface->attached->backend->gl,
+ if (glitz_framebuffer_complete (&surface->drawable->backend->gl,
&surface->framebuffer,
&surface->texture))
{
diff --git a/src/glitzint.h b/src/glitzint.h
index fd128cc..0d76afb 100644
--- a/src/glitzint.h
+++ b/src/glitzint.h
@@ -590,13 +590,10 @@ struct _glitz_surface {
glitz_gl_proc_address_list_t *gl = &(surface)->drawable->backend->gl;
struct _glitz_context {
- glitz_drawable_t *drawable;
- glitz_surface_t *surface;
int ref_count;
+ glitz_drawable_t *drawable;
void *closure;
glitz_lose_current_function_t lose_current;
- glitz_box_t scissor;
- glitz_box_t viewport;
};
typedef struct _glitz_composite_op_t glitz_composite_op_t;
@@ -983,8 +980,6 @@ slim_hidden_proto(glitz_context_copy)
slim_hidden_proto(glitz_context_set_user_data)
slim_hidden_proto(glitz_context_get_proc_address)
slim_hidden_proto(glitz_context_make_current)
-slim_hidden_proto(glitz_context_set_surface)
-slim_hidden_proto(glitz_context_set_viewport)
-slim_hidden_proto(glitz_context_set_scissor)
+slim_hidden_proto(glitz_context_bind_texture)
#endif /* GLITZINT_H_INCLUDED */
diff --git a/src/glx/glitz_glx_context.c b/src/glx/glitz_glx_context.c
index e6cf48b..767f0db 100644
--- a/src/glx/glitz_glx_context.c
+++ b/src/glx/glitz_glx_context.c
@@ -354,37 +354,35 @@ static void
_glitz_glx_context_update (glitz_glx_drawable_t *drawable,
glitz_constraint_t constraint)
{
- GLXContext context;
-
- switch (constraint) {
- case GLITZ_NONE:
- break;
- case GLITZ_ANY_CONTEXT_CURRENT: {
glitz_glx_display_info_t *dinfo = drawable->screen_info->display_info;
+ GLXContext context = NULL;
- if (dinfo->thread_info->cctx)
- {
- _glitz_glx_context_make_current (drawable, 0);
- }
- else
- {
- context = glXGetCurrentContext ();
- if (context == (GLXContext) 0)
- _glitz_glx_context_make_current (drawable, 0);
- }
- } break;
+ switch (constraint) {
+ case GLITZ_NONE:
+ break;
+ case GLITZ_ANY_CONTEXT_CURRENT:
+ if (!dinfo->thread_info->cctx)
+ context = glXGetCurrentContext ();
+
+ if (context == (GLXContext) 0)
+ _glitz_glx_context_make_current (drawable, 0);
+ break;
case GLITZ_CONTEXT_CURRENT:
- context = glXGetCurrentContext ();
- if (context != drawable->context->context)
- _glitz_glx_context_make_current (drawable, (context)? 1: 0);
- break;
- case GLITZ_DRAWABLE_CURRENT:
- context = glXGetCurrentContext ();
- if ((context != drawable->context->context) ||
- (glXGetCurrentDrawable () != drawable->drawable))
- _glitz_glx_context_make_current (drawable, (context)? 1: 0);
- break;
- }
+ if (!dinfo->thread_info->cctx)
+ context = glXGetCurrentContext ();
+
+ if (context != drawable->context->context)
+ _glitz_glx_context_make_current (drawable, (context)? 1: 0);
+ break;
+ case GLITZ_DRAWABLE_CURRENT:
+ if (!dinfo->thread_info->cctx)
+ context = glXGetCurrentContext ();
+
+ if ((context != drawable->context->context) ||
+ (glXGetCurrentDrawable () != drawable->drawable))
+ _glitz_glx_context_make_current (drawable, (context)? 1: 0);
+ break;
+ }
}
void