From 4bea4cb9fd55cdb267003a6e6e16f7e903e00940 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 16 Nov 2012 10:30:19 -0800 Subject: [PATCH] drivers: compute version and then initialize exec table This change forces the context version to be computed before initilizing the exec dispatch tables. Signed-off-by: Jordan Justen Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i915/i830_context.c | 8 ++++++++ src/mesa/drivers/dri/i915/i915_context.c | 8 ++++++++ src/mesa/drivers/dri/i965/brw_context.c | 8 ++++++++ src/mesa/drivers/dri/nouveau/nouveau_context.c | 6 ++++++ src/mesa/drivers/dri/r200/r200_context.c | 6 ++++++ src/mesa/drivers/dri/radeon/radeon_context.c | 6 ++++++ src/mesa/drivers/dri/swrast/swrast.c | 8 ++++++++ src/mesa/drivers/osmesa/osmesa.c | 9 +++++++++ src/mesa/drivers/windows/gdi/wmesa.c | 7 +++++++ src/mesa/drivers/x11/xm_api.c | 7 +++++++ src/mesa/state_tracker/st_context.c | 8 ++++++++ src/mesa/state_tracker/st_manager.c | 2 -- 12 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 3da07455776..e822660c635 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -26,7 +26,10 @@ **************************************************************************/ #include "i830_context.h" +#include "main/api_exec.h" #include "main/imports.h" +#include "main/version.h" +#include "main/vtxfmt.h" #include "tnl/tnl.h" #include "tnl/t_vertex.h" #include "tnl/t_context.h" @@ -111,5 +114,10 @@ i830CreateContext(const struct gl_config * mesaVis, _tnl_allow_vertex_fog(ctx, 1); _tnl_allow_pixel_fog(ctx, 0); + _mesa_compute_version(ctx); + + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + return true; } diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index d47e20f8608..a6b8e4627e5 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -26,8 +26,11 @@ **************************************************************************/ #include "i915_context.h" +#include "main/api_exec.h" #include "main/imports.h" #include "main/macros.h" +#include "main/version.h" +#include "main/vtxfmt.h" #include "intel_tris.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" @@ -295,5 +298,10 @@ i915CreateContext(int api, _tnl_allow_vertex_fog(ctx, 0); _tnl_allow_pixel_fog(ctx, 1); + _mesa_compute_version(ctx); + + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + return true; } diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 5665a3a8517..df0f8d60491 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -30,9 +30,12 @@ */ +#include "main/api_exec.h" #include "main/imports.h" #include "main/macros.h" #include "main/simple_list.h" +#include "main/version.h" +#include "main/vtxfmt.h" #include "vbo/vbo_context.h" @@ -386,6 +389,11 @@ brwCreateContext(int api, if (INTEL_DEBUG & DEBUG_SHADER_TIME) brw_init_shader_time(brw); + _mesa_compute_version(ctx); + + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + return true; } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 7e7dcc49944..8811562dfa8 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -31,12 +31,14 @@ #include "nouveau_fbo.h" #include "nv_object.xml.h" +#include "main/api_exec.h" #include "main/dd.h" #include "main/framebuffer.h" #include "main/fbobject.h" #include "main/light.h" #include "main/state.h" #include "main/version.h" +#include "main/vtxfmt.h" #include "drivers/common/meta.h" #include "drivers/common/driverfuncs.h" #include "swrast/swrast.h" @@ -103,6 +105,10 @@ nouveau_context_create(gl_api api, return GL_FALSE; } + /* Exec table initialization requires the version to be computed */ + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + if (nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, 4096, NULL, &nctx->fence)) { nouveau_context_destroy(dri_ctx); diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 54cf33e5c66..cf35079b245 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -35,12 +35,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "main/glheader.h" #include "main/api_arrayelt.h" +#include "main/api_exec.h" #include "main/context.h" #include "main/simple_list.h" #include "main/imports.h" #include "main/extensions.h" #include "main/mfeatures.h" #include "main/version.h" +#include "main/vtxfmt.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -459,6 +461,10 @@ GLboolean r200CreateContext( gl_api api, _mesa_compute_version(ctx); + /* Exec table initialization requires the version to be computed */ + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + *error = __DRI_CTX_ERROR_SUCCESS; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index d29e1461d86..26490ea4e04 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -37,12 +37,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "main/glheader.h" #include "main/api_arrayelt.h" +#include "main/api_exec.h" #include "main/context.h" #include "main/simple_list.h" #include "main/imports.h" #include "main/extensions.h" #include "main/mfeatures.h" #include "main/version.h" +#include "main/vtxfmt.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -412,6 +414,10 @@ r100CreateContext( gl_api api, _mesa_compute_version(ctx); + /* Exec table initialization requires the version to be computed */ + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + *error = __DRI_CTX_ERROR_SUCCESS; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 2474ed88fb0..33420f78d6a 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -31,12 +31,15 @@ * The back-buffer is allocated by the driver and is private. */ +#include "main/api_exec.h" #include "main/context.h" #include "main/extensions.h" #include "main/formats.h" #include "main/framebuffer.h" #include "main/imports.h" #include "main/renderbuffer.h" +#include "main/version.h" +#include "main/vtxfmt.h" #include "swrast/swrast.h" #include "swrast/s_renderbuffer.h" #include "swrast_setup/swrast_setup.h" @@ -786,6 +789,11 @@ dri_create_context(gl_api api, break; } + _mesa_compute_version(mesaCtx); + + _mesa_initialize_exec_table(mesaCtx); + _mesa_initialize_vbo_vtxfmt(mesaCtx); + *error = __DRI_CTX_ERROR_SUCCESS; return GL_TRUE; diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index c206d643509..95756d5d574 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -35,6 +35,7 @@ #include "main/glheader.h" #include "GL/osmesa.h" +#include "main/api_exec.h" #include "main/context.h" #include "main/extensions.h" #include "main/formats.h" @@ -43,6 +44,8 @@ #include "main/macros.h" #include "main/mtypes.h" #include "main/renderbuffer.h" +#include "main/version.h" +#include "main/vtxfmt.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "swrast/s_context.h" @@ -787,6 +790,12 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, swrast->choose_line = osmesa_choose_line; swrast->choose_triangle = osmesa_choose_triangle; } + + _mesa_compute_version(ctx); + + /* Exec table initialization requires the version to be computed */ + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); } return osmesa; } diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 50347cf77b9..af9ae6be65b 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -12,6 +12,7 @@ #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "main/macros.h" +#include "main/vtxfmt.h" #include "drivers/common/driverfuncs.h" #include "drivers/common/meta.h" #include "vbo/vbo.h" @@ -637,6 +638,12 @@ WMesaContext WMesaCreateContext(HDC hDC, _swsetup_Wakeup(ctx); TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; + _mesa_compute_version(ctx); + + /* Exec table initialization requires the version to be computed */ + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + return c; } diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index a466943a860..0a005f893c5 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -71,6 +71,7 @@ #include "main/macros.h" #include "main/renderbuffer.h" #include "main/teximage.h" +#include "main/vtxfmt.h" #include "glapi/glthread.h" #include "swrast/swrast.h" #include "swrast/s_renderbuffer.h" @@ -958,6 +959,12 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_meta_init(mesaCtx); + _mesa_compute_version(ctx); + + /* Exec table initialization requires the version to be computed */ + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + return c; } diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index efac9eea491..368a30b6871 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -27,9 +27,12 @@ #include "main/imports.h" #include "main/accum.h" +#include "main/api_exec.h" #include "main/context.h" #include "main/samplerobj.h" #include "main/shaderobj.h" +#include "main/version.h" +#include "main/vtxfmt.h" #include "program/prog_cache.h" #include "vbo/vbo.h" #include "glapi/glapi.h" @@ -184,6 +187,11 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, st_init_limits(st); st_init_extensions(st); + _mesa_compute_version(ctx); + + _mesa_initialize_exec_table(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + return st; } diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index e80f238753b..30f5ca5ed1e 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -647,8 +647,6 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, /* need to perform version check */ if (attribs->major > 1 || attribs->minor > 0) { - _mesa_compute_version(st->ctx); - /* Is the actual version less than the requested version? */ if (st->ctx->Version < attribs->major * 10 + attribs->minor) { -- 2.30.2