summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-06 20:53:28 +0100
committerBrian <[email protected]>2007-08-06 20:53:28 +0100
commit6da9234fd437f97267e7831f034c78b31156d939 (patch)
treea272c747c910a58cb2a74ca7fbdae059af2437d1
parent8ebf91d15eeb6f19d19580f6319477aaad4df3fd (diff)
New st_init_*_functions() to initialize the driver functions table.
We need to do these initializations before initializing the Mesa context because context init involves creating texture/program/etc objects.
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c18
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.h11
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c10
-rw-r--r--src/mesa/state_tracker/st_cb_clear.h5
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c8
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.h4
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c9
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.h5
-rw-r--r--src/mesa/state_tracker/st_cb_program.c29
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c12
-rw-r--r--src/mesa/state_tracker/st_cb_texture.h6
-rw-r--r--src/mesa/state_tracker/st_context.c18
-rw-r--r--src/mesa/state_tracker/st_context.h7
-rw-r--r--src/mesa/state_tracker/st_program.h5
14 files changed, 60 insertions, 87 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index a667b3e7753..d020eb2007b 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -192,15 +192,13 @@ st_bufferobj_unmap(GLcontext *ctx,
void
-st_init_cb_bufferobjects( struct st_context *st )
+st_init_bufferobject_functions(struct dd_function_table *functions)
{
- GLcontext *ctx = st->ctx;
-
- ctx->Driver.NewBufferObject = st_bufferobj_alloc;
- ctx->Driver.DeleteBuffer = st_bufferobj_free;
- ctx->Driver.BufferData = st_bufferobj_data;
- ctx->Driver.BufferSubData = st_bufferobj_subdata;
- ctx->Driver.GetBufferSubData = st_bufferobj_get_subdata;
- ctx->Driver.MapBuffer = st_bufferobj_map;
- ctx->Driver.UnmapBuffer = st_bufferobj_unmap;
+ functions->NewBufferObject = st_bufferobj_alloc;
+ functions->DeleteBuffer = st_bufferobj_free;
+ functions->BufferData = st_bufferobj_data;
+ functions->BufferSubData = st_bufferobj_subdata;
+ functions->GetBufferSubData = st_bufferobj_get_subdata;
+ functions->MapBuffer = st_bufferobj_map;
+ functions->UnmapBuffer = st_bufferobj_unmap;
}
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.h b/src/mesa/state_tracker/st_cb_bufferobjects.h
index 2787411c5fa..2090a743e0a 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.h
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.h
@@ -1,4 +1,4 @@
- /**************************************************************************
+/**************************************************************************
*
* Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -43,11 +43,6 @@ struct st_buffer_object
};
-/* Hook the bufferobject implementation into mesa:
- */
-void st_init_cb_bufferobjects( struct st_context *st );
-
-
/* Are the obj->Name tests necessary? Unfortunately yes, mesa
* allocates a couple of gl_buffer_object structs statically, and the
* Name == 0 test is the only way to identify them and avoid casting
@@ -63,4 +58,8 @@ st_buffer_object(struct gl_buffer_object *obj)
}
+extern void
+st_init_bufferobject_functions(struct dd_function_table *functions);
+
+
#endif
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index c907b0ed22c..0ec7784d848 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -418,15 +418,7 @@ static void st_clear(GLcontext *ctx, GLbitfield mask)
}
-void st_init_cb_clear( struct st_context *st )
+void st_init_clear_functions(struct dd_function_table *functions)
{
- struct dd_function_table *functions = &st->ctx->Driver;
-
functions->Clear = st_clear;
}
-
-
-void st_destroy_cb_clear( struct st_context *st )
-{
-}
-
diff --git a/src/mesa/state_tracker/st_cb_clear.h b/src/mesa/state_tracker/st_cb_clear.h
index 32086971b58..c715e56bd56 100644
--- a/src/mesa/state_tracker/st_cb_clear.h
+++ b/src/mesa/state_tracker/st_cb_clear.h
@@ -29,9 +29,10 @@
#ifndef ST_CB_CLEAR_H
#define ST_CB_CLEAR_H
-extern void st_init_cb_clear( struct st_context *st );
-extern void st_destroy_cb_clear( struct st_context *st );
+extern void
+st_init_clear_functions(struct dd_function_table *functions);
+
#endif /* ST_CB_CLEAR_H */
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 13f5c5f3c75..92a4e305d14 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -262,14 +262,8 @@ st_drawpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
-void st_init_cb_drawpixels( struct st_context *st )
+void st_init_drawpixels_functions(struct dd_function_table *functions)
{
- struct dd_function_table *functions = &st->ctx->Driver;
-
functions->DrawPixels = st_drawpixels;
}
-
-void st_destroy_cb_drawpixels( struct st_context *st )
-{
-}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.h b/src/mesa/state_tracker/st_cb_drawpixels.h
index 8c36aaa9316..71ba4870200 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.h
+++ b/src/mesa/state_tracker/st_cb_drawpixels.h
@@ -30,9 +30,7 @@
#define ST_CB_DRAWPIXELS_H
-void st_init_cb_drawpixels( struct st_context *st );
-
-void st_destroy_cb_drawpixels( struct st_context *st );
+extern void st_init_drawpixels_functions(struct dd_function_table *functions);
#endif /* ST_CB_DRAWPIXELS_H */
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 6b9ae88dbe2..d0205fd6352 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -322,10 +322,8 @@ st_finish_render_texture(GLcontext *ctx,
-void st_init_cb_fbo( struct st_context *st )
+void st_init_fbo_functions(struct dd_function_table *functions)
{
- struct dd_function_table *functions = &st->ctx->Driver;
-
functions->NewFramebuffer = st_new_framebuffer;
functions->NewRenderbuffer = st_new_renderbuffer;
functions->BindFramebuffer = st_bind_framebuffer;
@@ -336,8 +334,3 @@ void st_init_cb_fbo( struct st_context *st )
functions->ResizeBuffers = st_resize_buffers;
*/
}
-
-
-void st_destroy_cb_fbo( struct st_context *st )
-{
-}
diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h
index f4fa66df59e..6142434ec67 100644
--- a/src/mesa/state_tracker/st_cb_fbo.h
+++ b/src/mesa/state_tracker/st_cb_fbo.h
@@ -30,9 +30,8 @@
#define ST_CB_FBO_H
-extern void st_init_cb_fbo( struct st_context *st );
-
-extern void st_destroy_cb_fbo( struct st_context *st );
+extern void
+st_init_fbo_functions(struct dd_function_table *functions);
#endif /* ST_CB_FBO_H */
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 6da2aeb2f2f..ed47c12066a 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -32,7 +32,6 @@
#include "st_context.h"
#include "st_program.h"
-
#include "glheader.h"
#include "macros.h"
#include "enums.h"
@@ -44,6 +43,11 @@
#include "pipe/tgsi/mesa/tgsi_mesa.h"
+/* Counter to track program string changes:
+ */
+static GLuint program_id = 0;
+
+
static void st_bind_program( GLcontext *ctx,
GLenum target,
struct gl_program *prog )
@@ -70,7 +74,7 @@ static struct gl_program *st_new_program( GLcontext *ctx,
case GL_VERTEX_PROGRAM_ARB: {
struct st_vertex_program *prog = CALLOC_STRUCT(st_vertex_program);
- prog->id = st->program_id++;
+ prog->id = program_id++;
prog->dirty = 1;
return _mesa_init_vertex_program( ctx,
@@ -84,7 +88,7 @@ static struct gl_program *st_new_program( GLcontext *ctx,
{
struct st_fragment_program *prog = CALLOC_STRUCT(st_fragment_program);
- prog->id = st->program_id++;
+ prog->id = program_id++;
prog->dirty = 1;
return _mesa_init_fragment_program( ctx,
@@ -124,7 +128,7 @@ static void st_program_string_notify( GLcontext *ctx,
if (prog == &ctx->FragmentProgram._Current->Base)
st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
- p->id = st->program_id++;
+ p->id = program_id++;
p->param_state = p->Base.Base.Parameters->StateFlags;
}
else if (target == GL_VERTEX_PROGRAM_ARB) {
@@ -133,7 +137,7 @@ static void st_program_string_notify( GLcontext *ctx,
if (prog == &ctx->VertexProgram._Current->Base)
st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
- p->id = st->program_id++;
+ p->id = program_id++;
p->param_state = p->Base.Base.Parameters->StateFlags;
/* Also tell tnl about it:
@@ -144,15 +148,8 @@ static void st_program_string_notify( GLcontext *ctx,
-void st_init_cb_program( struct st_context *st )
+void st_init_program_functions(struct dd_function_table *functions)
{
- struct dd_function_table *functions = &st->ctx->Driver;
-
- /* Need these flags:
- */
- st->ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
- st->ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE;
-
#if 0
assert(functions->ProgramStringNotify == _tnl_program_string);
#endif
@@ -162,9 +159,3 @@ void st_init_cb_program( struct st_context *st )
functions->IsProgramNative = st_is_program_native;
functions->ProgramStringNotify = st_program_string_notify;
}
-
-
-void st_destroy_cb_program( struct st_context *st )
-{
-}
-
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index a0245b553f7..5872ae3e743 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1241,7 +1241,7 @@ do_copy_texsubimage(GLcontext *ctx,
get_teximage_source(ctx, internalFormat);
if (!stImage->mt || !src) {
- DBG("%s fail %p %p\n", __FUNCTION__, stImage->mt, src);
+ DBG("%s fail %p %p\n", __FUNCTION__, (void *) stImage->mt, (void *) src);
return GL_FALSE;
}
@@ -1726,10 +1726,9 @@ st_tex_unmap_images(struct pipe_context *pipe,
-void st_init_cb_texture( struct st_context *st )
+void
+st_init_texture_functions(struct dd_function_table *functions)
{
- struct dd_function_table *functions = &st->ctx->Driver;
-
functions->ChooseTextureFormat = st_ChooseTextureFormat;
functions->TexImage1D = st_TexImage1D;
functions->TexImage2D = st_TexImage2D;
@@ -1756,8 +1755,3 @@ void st_init_cb_texture( struct st_context *st )
functions->TextureMemCpy = do_memcpy;
}
-
-
-void st_destroy_cb_texture( struct st_context *st )
-{
-}
diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h
index c474d164659..c732881c39d 100644
--- a/src/mesa/state_tracker/st_cb_texture.h
+++ b/src/mesa/state_tracker/st_cb_texture.h
@@ -9,11 +9,7 @@ st_finalize_mipmap_tree(GLcontext *ctx,
extern void
-st_init_cb_texture( struct st_context *st );
-
-
-extern void
-st_destroy_cb_texture( struct st_context *st );
+st_init_texture_functions(struct dd_function_table *functions);
#endif /* ST_CB_TEXTURE_H */
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 2b962867704..0ea06c692d0 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -28,6 +28,7 @@
#include "imports.h"
#include "st_public.h"
#include "st_context.h"
+#include "st_cb_bufferobjects.h"
#include "st_cb_clear.h"
#include "st_cb_drawpixels.h"
#include "st_cb_texture.h"
@@ -61,10 +62,17 @@ struct st_context *st_create_context( GLcontext *ctx,
st_init_atoms( st );
st_init_draw( st );
+ /* Need these flags:
+ */
+ st->ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
+ st->ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE;
+
+#if 0
st_init_cb_clear( st );
st_init_cb_program( st );
st_init_cb_drawpixels( st );
st_init_cb_texture( st );
+#endif
return st;
}
@@ -75,11 +83,13 @@ void st_destroy_context( struct st_context *st )
st_destroy_atoms( st );
st_destroy_draw( st );
+#if 0
st_destroy_cb_clear( st );
st_destroy_cb_program( st );
st_destroy_cb_drawpixels( st );
/*st_destroy_cb_teximage( st );*/
st_destroy_cb_texture( st );
+#endif
st->pipe->destroy( st->pipe );
FREE( st );
@@ -87,3 +97,11 @@ void st_destroy_context( struct st_context *st )
+void st_init_driver_functions(struct dd_function_table *functions)
+{
+ st_init_bufferobject_functions(functions);
+ st_init_clear_functions(functions);
+ st_init_drawpixels_functions(functions);
+ st_init_program_functions(functions);
+ st_init_texture_functions(functions);
+}
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index ef3cdb3b091..fe73630c75d 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -97,10 +97,6 @@ struct st_context
struct st_state_flags dirty;
- /* Counter to track program string changes:
- */
- GLuint program_id;
-
GLfloat polygon_offset_scale; /* ?? */
};
@@ -113,4 +109,7 @@ static INLINE struct st_context *st_context(GLcontext *ctx)
}
+extern void st_init_driver_functions(struct dd_function_table *functions);
+
+
#endif
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index f6d5f6d76ce..8dcb2ceb487 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -87,8 +87,9 @@ struct st_vertex_program
GLuint param_state;
};
-void st_init_cb_program( struct st_context *st );
-void st_destroy_cb_program( struct st_context *st );
+
+extern void st_init_program_functions(struct dd_function_table *functions);
+
static inline struct st_fragment_program *
st_fragment_program( struct gl_fragment_program *fp )