From eb5100accc888b9a9cfc24bc3d3452ea62a84c09 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 12 May 2010 13:26:14 +0800 Subject: [PATCH] mesa: Make FEATURE_ATI_fragment_shader more modular. This allows atifragshader.h to be used without knowing if FEATURE_ATI_fragment_shader is enabled. As a result, atifragshader.c is removed from the omit list in ES overlay. --- src/mesa/es/Makefile | 4 ---- src/mesa/main/api_exec.c | 19 +------------------ src/mesa/shader/atifragshader.c | 25 +++++++++++++++++++++++++ src/mesa/shader/atifragshader.h | 28 +++++++++++++++++++++++++++- 4 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/mesa/es/Makefile b/src/mesa/es/Makefile index e581949..cdd770f 100644 --- a/src/mesa/es/Makefile +++ b/src/mesa/es/Makefile @@ -32,10 +32,6 @@ VBO_OMITTED := \ vbo/vbo_save_loopback.c VBO_SOURCES := $(filter-out $(VBO_OMITTED), $(VBO_SOURCES)) -SHADER_OMITTED := \ - shader/atifragshader.c -SHADER_SOURCES := $(filter-out $(SHADER_OMITTED), $(SHADER_SOURCES)) - # adjust source dir ES_SOURCES := $(addprefix $(MESA)/, $(MESA_SOURCES)) ES_GALLIUM_SOURCES := $(addprefix $(MESA)/, $(MESA_GALLIUM_SOURCES)) diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index ad18472..7bd6e32 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -36,9 +36,7 @@ #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program #include "shader/arbprogram.h" #endif -#if FEATURE_ATI_fragment_shader #include "shader/atifragshader.h" -#endif #include "attrib.h" #include "blend.h" #if FEATURE_ARB_vertex_buffer_object @@ -715,22 +713,7 @@ _mesa_create_exec_table(void) #endif /* GL_ATI_fragment_shader */ -#if FEATURE_ATI_fragment_shader - SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI); - SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI); - SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI); - SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI); - SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI); - SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI); - SET_SampleMapATI(exec, _mesa_SampleMapATI); - SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI); - SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI); - SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI); - SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI); - SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI); - SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI); - SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI); -#endif + _mesa_init_ati_fragment_shader_dispatch(exec); /* GL_ATI_envmap_bumpmap */ SET_GetTexBumpParameterivATI(exec, _mesa_GetTexBumpParameterivATI); diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c index 870f77e..21bb958 100644 --- a/src/mesa/shader/atifragshader.c +++ b/src/mesa/shader/atifragshader.c @@ -28,13 +28,36 @@ #include "main/macros.h" #include "main/enums.h" #include "main/mtypes.h" +#include "main/dispatch.h" #include "atifragshader.h" +#if FEATURE_ATI_fragment_shader + #define MESA_DEBUG_ATI_FS 0 static struct ati_fragment_shader DummyShader; +void +_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) +{ + SET_GenFragmentShadersATI(disp, _mesa_GenFragmentShadersATI); + SET_BindFragmentShaderATI(disp, _mesa_BindFragmentShaderATI); + SET_DeleteFragmentShaderATI(disp, _mesa_DeleteFragmentShaderATI); + SET_BeginFragmentShaderATI(disp, _mesa_BeginFragmentShaderATI); + SET_EndFragmentShaderATI(disp, _mesa_EndFragmentShaderATI); + SET_PassTexCoordATI(disp, _mesa_PassTexCoordATI); + SET_SampleMapATI(disp, _mesa_SampleMapATI); + SET_ColorFragmentOp1ATI(disp, _mesa_ColorFragmentOp1ATI); + SET_ColorFragmentOp2ATI(disp, _mesa_ColorFragmentOp2ATI); + SET_ColorFragmentOp3ATI(disp, _mesa_ColorFragmentOp3ATI); + SET_AlphaFragmentOp1ATI(disp, _mesa_AlphaFragmentOp1ATI); + SET_AlphaFragmentOp2ATI(disp, _mesa_AlphaFragmentOp2ATI); + SET_AlphaFragmentOp3ATI(disp, _mesa_AlphaFragmentOp3ATI); + SET_SetFragmentShaderConstantATI(disp, _mesa_SetFragmentShaderConstantATI); +} + + /** * Allocate and initialize a new ATI fragment shader object. */ @@ -767,3 +790,5 @@ _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value); } } + +#endif /* FEATURE_ATI_fragment_shader */ diff --git a/src/mesa/shader/atifragshader.h b/src/mesa/shader/atifragshader.h index e1dc20e..31c335e 100644 --- a/src/mesa/shader/atifragshader.h +++ b/src/mesa/shader/atifragshader.h @@ -60,6 +60,11 @@ struct atifs_setupinst }; +#if FEATURE_ATI_fragment_shader + +extern void +_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp); + extern struct ati_fragment_shader * _mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id); @@ -120,4 +125,25 @@ _mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, extern void GLAPIENTRY _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value); -#endif +#else /* FEATURE_ATI_fragment_shader */ + +static INLINE void +_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) +{ +} + +static INLINE struct ati_fragment_shader * +_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id) +{ + return NULL; +} + +static INLINE void +_mesa_delete_ati_fragment_shader(GLcontext *ctx, + struct ati_fragment_shader *s) +{ +} + +#endif /* FEATURE_ATI_fragment_shader */ + +#endif /* ATIFRAGSHADER_H */ -- 2.7.4