From 0c572c6828b6a338b07a6860280b3a314a81662e Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 24 Apr 2010 01:05:49 +0100 Subject: st_api: Remove st_module The struct st_module isn't needed as it is the same thing as the st_api struct. That is they both represent the API. Instead just use a single function entry point to the the API. --- src/mesa/state_tracker/st_gl_api.h | 9 +++++++++ src/mesa/state_tracker/st_manager.c | 33 +++++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 src/mesa/state_tracker/st_gl_api.h (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_gl_api.h b/src/mesa/state_tracker/st_gl_api.h new file mode 100644 index 0000000000..52c3fa0b41 --- /dev/null +++ b/src/mesa/state_tracker/st_gl_api.h @@ -0,0 +1,9 @@ + +#ifndef ST_GL_API_H +#define ST_GL_API_H + +#include "state_tracker/st_api.h" + +struct st_api * st_gl_api_create(void); + +#endif diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 5cf17fe530..44d59d4476 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -26,7 +26,7 @@ * Chia-I Wu */ -#include "state_tracker/st_api.h" +#include "state_tracker/st_gl_api.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" @@ -692,7 +692,6 @@ st_api_get_proc_address(struct st_api *stapi, const char *procname) static void st_api_destroy(struct st_api *stapi) { - FREE(stapi); } /** @@ -791,24 +790,22 @@ st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb, return TRUE; } +struct st_api st_gl_api = { + st_api_destroy, + st_api_get_proc_address, + st_api_is_visual_supported, + st_api_create_context, + st_api_make_current, + st_api_get_current, +}; + /** - * Create an st_api to manage the state tracker. + * Return the st_api for this state tracker. This might either be GL, GLES1, + * GLES2 that mostly depends on the build and link options. But these + * functions remain the same either way. */ struct st_api * -st_manager_create_api(void) +st_gl_api_create(void) { - struct st_api *stapi; - - stapi = CALLOC_STRUCT(st_api); - if (stapi) { - stapi->destroy = st_api_destroy; - stapi->get_proc_address = st_api_get_proc_address; - stapi->is_visual_supported = st_api_is_visual_supported; - - stapi->create_context = st_api_create_context; - stapi->make_current = st_api_make_current; - stapi->get_current = st_api_get_current; - } - - return stapi; + return &st_gl_api; } -- cgit v1.2.3