mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 20:08:06 +02:00
mesa: Move api_exec_es*.c into mesa/main
This requires renaming a few functions to have unique names so that they can all live within the same driver.
This commit is contained in:
parent
a6ba493d71
commit
3f03f71caf
12 changed files with 114 additions and 32 deletions
|
|
@ -24,6 +24,12 @@ default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
|
|||
libglapi.a driver_subdirs
|
||||
|
||||
|
||||
main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
|
||||
|
||||
main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
|
||||
|
||||
|
||||
######################################################################
|
||||
# Helper libraries used by many drivers:
|
||||
|
|
|
|||
|
|
@ -84,17 +84,9 @@ libes2api.a: $(ES2_API_OBJECTS)
|
|||
@$(MKLIB) -o es2api -static $(ES2_API_OBJECTS)
|
||||
|
||||
GENERATED_SOURCES := \
|
||||
main/api_exec_es1.c \
|
||||
main/api_exec_es2.c \
|
||||
main/get_es1.c \
|
||||
main/get_es2.c
|
||||
|
||||
main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
|
||||
|
||||
main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
|
||||
|
||||
main/get_es1.c: main/get_gen.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ include $(MESA)/sources.mak
|
|||
# LOCAL sources
|
||||
|
||||
LOCAL_ES1_SOURCES := \
|
||||
main/api_exec_es1.c \
|
||||
main/get_es1.c \
|
||||
main/drawtex.c \
|
||||
main/es_cpaltex.c \
|
||||
|
|
@ -28,7 +27,6 @@ LOCAL_ES1_INCLUDES := \
|
|||
-I$(MESA)/state_tracker
|
||||
|
||||
LOCAL_ES2_SOURCES := \
|
||||
main/api_exec_es2.c \
|
||||
main/get_es2.c \
|
||||
main/es_cpaltex.c \
|
||||
main/es_fbo.c \
|
||||
|
|
|
|||
|
|
@ -35,5 +35,11 @@ _mesa_alloc_dispatch_table(int size);
|
|||
extern struct _glapi_table *
|
||||
_mesa_create_exec_table(void);
|
||||
|
||||
extern struct _glapi_table *
|
||||
_mesa_create_exec_table_es1(void);
|
||||
|
||||
extern struct _glapi_table *
|
||||
_mesa_create_exec_table_es2(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -393,7 +393,25 @@ one_time_init( GLcontext *ctx )
|
|||
|
||||
_mesa_get_cpu_features();
|
||||
|
||||
_mesa_init_remap_table();
|
||||
switch (ctx->API) {
|
||||
#if FEATURE_GL
|
||||
case API_OPENGL:
|
||||
_mesa_init_remap_table();
|
||||
break;
|
||||
#endif
|
||||
#if FEATURE_ES1
|
||||
case API_OPENGLES:
|
||||
_mesa_init_remap_table_es1();
|
||||
break;
|
||||
#endif
|
||||
#if FEATURE_ES2
|
||||
case API_OPENGLES2:
|
||||
_mesa_init_remap_table_es2();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_mesa_init_sqrt_table();
|
||||
|
||||
|
|
@ -802,9 +820,6 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
|
|||
assert(driverFunctions->NewTextureObject);
|
||||
assert(driverFunctions->FreeTexImageData);
|
||||
|
||||
/* misc one-time initializations */
|
||||
one_time_init(ctx);
|
||||
|
||||
ctx->API = api;
|
||||
ctx->Visual = *visual;
|
||||
ctx->DrawBuffer = NULL;
|
||||
|
|
@ -812,6 +827,9 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
|
|||
ctx->WinSysDrawBuffer = NULL;
|
||||
ctx->WinSysReadBuffer = NULL;
|
||||
|
||||
/* misc one-time initializations */
|
||||
one_time_init(ctx);
|
||||
|
||||
/* Plug in driver functions and context pointer here.
|
||||
* This is important because when we call alloc_shared_state() below
|
||||
* we'll call ctx->Driver.NewTextureObject() to create the default
|
||||
|
|
@ -843,7 +861,27 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
|
|||
|
||||
#if FEATURE_dispatch
|
||||
/* setup the API dispatch tables */
|
||||
ctx->Exec = _mesa_create_exec_table();
|
||||
switch (ctx->API) {
|
||||
#if FEATURE_GL
|
||||
case API_OPENGL:
|
||||
ctx->Exec = _mesa_create_exec_table();
|
||||
break;
|
||||
#endif
|
||||
#if FEATURE_ES1
|
||||
case API_OPENGLES:
|
||||
ctx->Exec = _mesa_create_exec_table_es1();
|
||||
break;
|
||||
#endif
|
||||
#if FEATURE_ES2
|
||||
case API_OPENGLES2:
|
||||
ctx->Exec = _mesa_create_exec_table_es2();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
_mesa_problem(ctx, "unknown or unsupported API");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ctx->Exec) {
|
||||
_mesa_release_shared_state(ctx, ctx->Shared);
|
||||
return GL_FALSE;
|
||||
|
|
|
|||
|
|
@ -103,11 +103,13 @@ VersionSpecificValues = {
|
|||
'description' : 'GLES1.1 functions',
|
||||
'header' : 'GLES/gl.h',
|
||||
'extheader' : 'GLES/glext.h',
|
||||
'shortname' : 'es1'
|
||||
},
|
||||
'GLES2.0': {
|
||||
'description' : 'GLES2.0 functions',
|
||||
'header' : 'GLES2/gl2.h',
|
||||
'extheader' : 'GLES2/gl2ext.h',
|
||||
'shortname' : 'es2'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +166,7 @@ if not VersionSpecificValues.has_key(version):
|
|||
# Grab the version-specific items we need to use
|
||||
versionHeader = VersionSpecificValues[version]['header']
|
||||
versionExtHeader = VersionSpecificValues[version]['extheader']
|
||||
shortname = VersionSpecificValues[version]['shortname']
|
||||
|
||||
# If we get to here, we're good to go. The "version" parameter
|
||||
# directs GetDispatchedFunctions to only allow functions from
|
||||
|
|
@ -206,22 +209,24 @@ extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
|
|||
|
||||
#include "main/compiler.h"
|
||||
#include "main/api_exec.h"
|
||||
|
||||
#include "main/dispatch.h"
|
||||
|
||||
#if FEATURE_remap_table
|
||||
|
||||
#include "main/remap.h"
|
||||
|
||||
#ifdef IN_DRI_DRIVER
|
||||
#define _GLAPI_USE_REMAP_TABLE
|
||||
#endif
|
||||
|
||||
#include "es/glapi/glapi-%s/glapi/glapitable.h"
|
||||
#include "es/glapi/glapi-%s/glapi/glapioffsets.h"
|
||||
#include "es/glapi/glapi-%s/glapi/glapidispatch.h"
|
||||
|
||||
#if FEATURE_remap_table
|
||||
|
||||
#define need_MESA_remap_table
|
||||
#include "main/remap_helper.h"
|
||||
|
||||
#include "es/glapi/glapi-%s/main/remap_helper.h"
|
||||
|
||||
void
|
||||
_mesa_init_remap_table(void)
|
||||
_mesa_init_remap_table_%s(void)
|
||||
{
|
||||
_mesa_do_init_remap_table(_mesa_function_pool,
|
||||
driDispatchRemapTable_size,
|
||||
|
|
@ -229,14 +234,14 @@ _mesa_init_remap_table(void)
|
|||
}
|
||||
|
||||
void
|
||||
_mesa_map_static_functions(void)
|
||||
_mesa_map_static_functions_%s(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
typedef void (*_glapi_proc)(void); /* generic function pointer */
|
||||
"""
|
||||
""" % (shortname, shortname, shortname, shortname, shortname, shortname);
|
||||
|
||||
# Finally we get to the all-important functions
|
||||
print """/*************************************************************
|
||||
|
|
@ -693,14 +698,16 @@ for funcName in keys:
|
|||
|
||||
# end for each function
|
||||
|
||||
print "struct _glapi_table *"
|
||||
print "_mesa_create_exec_table(void)"
|
||||
print "{"
|
||||
print " struct _glapi_table *exec;"
|
||||
print " exec = _mesa_alloc_dispatch_table(sizeof *exec);"
|
||||
print " if (exec == NULL)"
|
||||
print " return NULL;"
|
||||
print ""
|
||||
print """
|
||||
struct _glapi_table *
|
||||
_mesa_create_exec_table_%s(void)
|
||||
{
|
||||
struct _glapi_table *exec;
|
||||
exec = _mesa_alloc_dispatch_table(sizeof *exec);
|
||||
if (exec == NULL)
|
||||
return NULL;
|
||||
|
||||
""" % shortname
|
||||
|
||||
for func in keys:
|
||||
prefix = "_es_" if func not in allSpecials else "_check_"
|
||||
|
|
@ -57,6 +57,12 @@ _mesa_map_function_array(const struct gl_function_remap *func_array);
|
|||
extern void
|
||||
_mesa_map_static_functions(void);
|
||||
|
||||
extern void
|
||||
_mesa_map_static_functions_es1(void);
|
||||
|
||||
extern void
|
||||
_mesa_map_static_functions_es2(void);
|
||||
|
||||
extern void
|
||||
_mesa_do_init_remap_table(const char *pool,
|
||||
int size,
|
||||
|
|
@ -65,6 +71,12 @@ _mesa_do_init_remap_table(const char *pool,
|
|||
extern void
|
||||
_mesa_init_remap_table(void);
|
||||
|
||||
extern void
|
||||
_mesa_init_remap_table_es1(void);
|
||||
|
||||
extern void
|
||||
_mesa_init_remap_table_es2(void);
|
||||
|
||||
#else /* FEATURE_remap_table */
|
||||
|
||||
static INLINE const char *
|
||||
|
|
@ -89,6 +101,17 @@ _mesa_map_static_functions(void)
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
static INLINE void
|
||||
_mesa_map_static_functions_es1(void)
|
||||
{
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
_mesa_map_static_functions_es2(void)
|
||||
{
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
_mesa_do_init_remap_table(const char *pool,
|
||||
int size,
|
||||
|
|
@ -101,6 +124,16 @@ _mesa_init_remap_table(void)
|
|||
{
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
_mesa_init_remap_table_es1(void)
|
||||
{
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
_mesa_init_remap_table_es2(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* FEATURE_remap_table */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
MAIN_SOURCES = \
|
||||
main/api_arrayelt.c \
|
||||
main/api_exec.c \
|
||||
main/api_exec_es1.c \
|
||||
main/api_exec_es2.c \
|
||||
main/api_loopback.c \
|
||||
main/api_noop.c \
|
||||
main/api_validate.c \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue