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;
}
- /**************************************************************************
+/**************************************************************************
*
* Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
};
-/* 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
}
+extern void
+st_init_bufferobject_functions(struct dd_function_table *functions);
+
+
#endif
}
-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 )
-{
-}
-
#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 */
}
-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 )
-{
-}
#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 */
-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;
functions->ResizeBuffers = st_resize_buffers;
*/
}
-
-
-void st_destroy_cb_fbo( struct st_context *st )
-{
-}
#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 */
#include "st_context.h"
#include "st_program.h"
-
#include "glheader.h"
#include "macros.h"
#include "enums.h"
#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 )
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,
{
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,
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) {
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:
-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
functions->IsProgramNative = st_is_program_native;
functions->ProgramStringNotify = st_program_string_notify;
}
-
-
-void st_destroy_cb_program( struct st_context *st )
-{
-}
-
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;
}
-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;
functions->TextureMemCpy = do_memcpy;
}
-
-
-void st_destroy_cb_texture( struct st_context *st )
-{
-}
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 */
#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"
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;
}
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 );
+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);
+}
struct st_state_flags dirty;
- /* Counter to track program string changes:
- */
- GLuint program_id;
-
GLfloat polygon_offset_scale; /* ?? */
};
}
+extern void st_init_driver_functions(struct dd_function_table *functions);
+
+
#endif
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 )