summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-11-05 15:59:55 -0700
committerBrian <[email protected]>2007-11-05 15:59:55 -0700
commite39f1b4cbea6d41dc09430bd3d811cb7bbdea5f8 (patch)
tree82f76d36cbde01e22b58a257971ec52d414a06d1 /src/mesa/state_tracker
parent9a563d5e696a7c8fc09f7da5a0d33a9675b00e4c (diff)
Update xlib driver to use newer state tracker context/framebuffer functions.
XMesaContext has an st_context * which contains a mesa context.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_context.c7
-rw-r--r--src/mesa/state_tracker/st_context.h3
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c84
-rw-r--r--src/mesa/state_tracker/st_public.h9
4 files changed, 64 insertions, 39 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index a8cc618d770..138f18aa99b 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -174,6 +174,13 @@ void st_make_current(struct st_context *st,
}
+void st_copy_context_state(struct st_context *dst,
+ struct st_context *src,
+ uint mask)
+{
+ _mesa_copy_context(dst->ctx, src->ctx, mask);
+}
+
void st_init_driver_functions(struct dd_function_table *functions)
{
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 9b232827f4a..30407768b95 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -168,12 +168,13 @@ static INLINE struct st_context *st_context(GLcontext *ctx)
/**
- * Wrapper for GLframebuffer, nothing extra for now.
+ * Wrapper for GLframebuffer.
* This is an opaque type to the outside world.
*/
struct st_framebuffer
{
GLframebuffer Base;
+ void *Private;
};
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 2e7687d9c91..ec120ba39ab 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -35,7 +35,9 @@
#include "st_cb_fbo.h"
-struct st_framebuffer *st_create_framebuffer( const __GLcontextModes *visual )
+struct st_framebuffer *st_create_framebuffer( const __GLcontextModes *visual,
+ boolean createRenderbuffers,
+ void *private)
{
struct st_framebuffer *stfb
= CALLOC_STRUCT(st_framebuffer);
@@ -46,46 +48,48 @@ struct st_framebuffer *st_create_framebuffer( const __GLcontextModes *visual )
_mesa_initialize_framebuffer(&stfb->Base, visual);
- {
- /* fake frontbuffer */
- /* XXX allocation should only happen in the unusual case
- it's actually needed */
- struct gl_renderbuffer *rb = st_new_renderbuffer_fb(rgbFormat);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb);
+ if (createRenderbuffers) {
+ {
+ /* fake frontbuffer */
+ /* XXX allocation should only happen in the unusual case
+ it's actually needed */
+ struct gl_renderbuffer *rb = st_new_renderbuffer_fb(rgbFormat);
+ _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb);
+ }
+
+ if (visual->doubleBufferMode) {
+ struct gl_renderbuffer *rb = st_new_renderbuffer_fb(rgbFormat);
+ _mesa_add_renderbuffer(&stfb->Base, BUFFER_BACK_LEFT, rb);
+ }
+
+ if (visual->depthBits == 24 && visual->stencilBits == 8) {
+ /* combined depth/stencil buffer */
+ struct gl_renderbuffer *depthStencilRb
+ = st_new_renderbuffer_fb(GL_DEPTH24_STENCIL8_EXT);
+ /* note: bind RB to two attachment points */
+ _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthStencilRb);
+ _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL,depthStencilRb);
+ }
+ else if (visual->depthBits == 16) {
+ /* just 16-bit depth buffer, no hw stencil */
+ struct gl_renderbuffer *depthRb
+ = st_new_renderbuffer_fb(GL_DEPTH_COMPONENT16);
+ _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb);
+ }
+
+
+ /* now add any/all software-based renderbuffers we may need */
+ _mesa_add_soft_renderbuffers(&stfb->Base,
+ GL_FALSE, /* never sw color */
+ GL_FALSE, /* never sw depth */
+ swStencil, visual->accumRedBits > 0,
+ GL_FALSE, /* never sw alpha */
+ GL_FALSE /* never sw aux */ );
}
- if (visual->doubleBufferMode) {
- struct gl_renderbuffer *rb = st_new_renderbuffer_fb(rgbFormat);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_BACK_LEFT, rb);
- }
-
- if (visual->depthBits == 24 && visual->stencilBits == 8) {
- /* combined depth/stencil buffer */
- struct gl_renderbuffer *depthStencilRb
- = st_new_renderbuffer_fb(GL_DEPTH24_STENCIL8_EXT);
- /* note: bind RB to two attachment points */
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthStencilRb);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL,depthStencilRb);
- }
- else if (visual->depthBits == 16) {
- /* just 16-bit depth buffer, no hw stencil */
- struct gl_renderbuffer *depthRb
- = st_new_renderbuffer_fb(GL_DEPTH_COMPONENT16);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb);
- }
-
-
- /* now add any/all software-based renderbuffers we may need */
- _mesa_add_soft_renderbuffers(&stfb->Base,
- GL_FALSE, /* never sw color */
- GL_FALSE, /* never sw depth */
- swStencil, visual->accumRedBits > 0,
- GL_FALSE, /* never sw alpha */
- GL_FALSE /* never sw aux */ );
-
-
stfb->Base.Initialized = GL_TRUE;
+ stfb->Private = private;
}
return stfb;
}
@@ -149,3 +153,9 @@ st_notify_swapbuffers(struct st_framebuffer *stfb)
}
}
+
+void *st_framebuffer_private( struct st_framebuffer *stfb )
+{
+ return stfb->Private;
+}
+
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index 8162ceeffab..c94e8d32c8a 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -53,7 +53,12 @@ void st_destroy_context( struct st_context *st );
void st_destroy_context2( struct st_context *st );
-struct st_framebuffer *st_create_framebuffer( const __GLcontextModes *visual );
+void st_copy_context_state(struct st_context *dst, struct st_context *src,
+ uint mask);
+
+struct st_framebuffer *st_create_framebuffer( const __GLcontextModes *visual,
+ GLboolean createRenderbuffers,
+ void *privateData);
void st_resize_framebuffer( struct st_framebuffer *stfb,
GLuint width, GLuint height );
@@ -61,6 +66,8 @@ void st_resize_framebuffer( struct st_framebuffer *stfb,
struct pipe_surface *st_get_framebuffer_surface(struct st_framebuffer *stfb,
uint surfIndex);
+void *st_framebuffer_private( struct st_framebuffer *stfb );
+
void st_unreference_framebuffer( struct st_framebuffer **stfb );
void st_make_current(struct st_context *st,