From f90b5936d07c4c8f280318ab5cf5894ecb67aef6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 17:39:15 +0800 Subject: [PATCH] mesa: Add core.h. core.h is the public header of core mesa. GLX, WGL, and GLSL are supposed to include this header file. It should be noted that headers included by core.h must not perform feature tests (#if FEATURE_xxx). Otherwise, we cannot, for example, mix a FEATURE_ES2 libmesagallium.a with a FEATURE_GL libglsl.a. --- src/mesa/main/core.h | 66 ++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/dd.h | 30 ++++++------------- src/mesa/main/mtypes.h | 32 ++++---------------- 3 files changed, 81 insertions(+), 47 deletions(-) create mode 100644 src/mesa/main/core.h diff --git a/src/mesa/main/core.h b/src/mesa/main/core.h new file mode 100644 index 00000000000..11b68cc987b --- /dev/null +++ b/src/mesa/main/core.h @@ -0,0 +1,66 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + + +/** + * \file core.h + * The public header of core mesa. + * + * This file is the (only) public header of core mesa. It is supposed to be + * used by GLX, WGL, and GLSL. It is important that headers directly or + * indirectly included here do not perform feature tests (#if FEATURE_xxx). + */ + + +#ifndef CORE_H +#define CORE_H + + +#include "main/glheader.h" +#include "main/compiler.h" +#include "main/imports.h" +#include "main/macros.h" + +#include "main/version.h" /* for MESA_VERSION_STRING */ +#include "main/context.h" /* for _mesa_share_state */ +#include "main/mtypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* for GLSL */ +#include "program/prog_parameter.h" +#include "program/prog_uniform.h" + +#ifdef __cplusplus +}; +#endif + + +#endif /* CORE_H */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 71d0f570e4b..8a20a663632 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -36,7 +36,7 @@ struct gl_pixelstore_attrib; struct gl_display_list; -#if FEATURE_ARB_vertex_buffer_object +/* GL_ARB_vertex_buffer_object */ /* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return * NULL) if buffer is unavailable for immediate mapping. * @@ -49,7 +49,6 @@ struct gl_display_list; * respect the contents of already referenced data. */ #define MESA_MAP_NOWAIT_BIT 0x0040 -#endif /** @@ -730,7 +729,6 @@ struct dd_function_table { /** * \name Vertex/pixel buffer object functions */ -#if FEATURE_ARB_vertex_buffer_object /*@{*/ void (*BindBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); @@ -774,12 +772,10 @@ struct dd_function_table { GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); /*@}*/ -#endif /** * \name Functions for GL_APPLE_object_purgeable */ -#if FEATURE_APPLE_object_purgeable /*@{*/ /* variations on ObjectPurgeable */ GLenum (*BufferObjectPurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option ); @@ -791,12 +787,10 @@ struct dd_function_table { GLenum (*RenderObjectUnpurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option ); GLenum (*TextureObjectUnpurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option ); /*@}*/ -#endif /** - * \name Functions for GL_EXT_framebuffer_object + * \name Functions for GL_EXT_framebuffer_{object,blit}. */ -#if FEATURE_EXT_framebuffer_object /*@{*/ struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name); struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name); @@ -815,13 +809,10 @@ struct dd_function_table { void (*ValidateFramebuffer)(GLcontext *ctx, struct gl_framebuffer *fb); /*@}*/ -#endif -#if FEATURE_EXT_framebuffer_blit void (*BlitFramebuffer)(GLcontext *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif /** * \name Query objects @@ -976,7 +967,6 @@ struct dd_function_table { void (*EndCallList)( GLcontext *ctx ); -#if FEATURE_ARB_sync /** * \name GL_ARB_sync interfaces */ @@ -990,14 +980,12 @@ struct dd_function_table { void (*ServerWaitSync)(GLcontext *, struct gl_sync_object *, GLbitfield, GLuint64); /*@}*/ -#endif /** GL_NV_conditional_render */ void (*BeginConditionalRender)(GLcontext *ctx, struct gl_query_object *q, GLenum mode); void (*EndConditionalRender)(GLcontext *ctx, struct gl_query_object *q); -#if FEATURE_OES_draw_texture /** * \name GL_OES_draw_texture interface */ @@ -1005,9 +993,10 @@ struct dd_function_table { void (*DrawTex)(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); /*@}*/ -#endif -#if FEATURE_OES_EGL_image + /** + * \name GL_OES_EGL_image interface + */ void (*EGLImageTargetTexture2D)(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage, @@ -1015,9 +1004,10 @@ struct dd_function_table { void (*EGLImageTargetRenderbufferStorage)(GLcontext *ctx, struct gl_renderbuffer *rb, void *image_handle); -#endif -#if FEATURE_EXT_transform_feedback + /** + * \name GL_EXT_transform_feedback interface + */ struct gl_transform_feedback_object * (*NewTransformFeedback)(GLcontext *ctx, GLuint name); void (*DeleteTransformFeedback)(GLcontext *ctx, @@ -1032,7 +1022,6 @@ struct dd_function_table { struct gl_transform_feedback_object *obj); void (*DrawTransformFeedback)(GLcontext *ctx, GLenum mode, struct gl_transform_feedback_object *obj); -#endif }; @@ -1115,7 +1104,7 @@ typedef struct { void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); -#if FEATURE_ARB_vertex_program + /* GL_ARB_vertex_program */ void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x ); void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ); @@ -1124,7 +1113,6 @@ typedef struct { void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v ); -#endif /*@}*/ void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b8bcda56bfa..d44eff69cce 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1632,10 +1632,9 @@ struct gl_array_attrib GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */ -#if FEATURE_ARB_vertex_buffer_object + /* GL_ARB_vertex_buffer_object */ struct gl_buffer_object *ArrayBufferObj; struct gl_buffer_object *ElementArrayBufferObj; -#endif }; @@ -2264,39 +2263,26 @@ struct gl_shared_state */ /*@{*/ struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */ -#if FEATURE_ARB_vertex_program struct gl_vertex_program *DefaultVertexProgram; -#endif -#if FEATURE_ARB_fragment_program struct gl_fragment_program *DefaultFragmentProgram; -#endif -#if FEATURE_ARB_geometry_shader4 struct gl_geometry_program *DefaultGeometryProgram; -#endif /*@}*/ -#if FEATURE_ATI_fragment_shader + /* GL_ATI_fragment_shader */ struct _mesa_HashTable *ATIShaders; struct ati_fragment_shader *DefaultFragmentShader; -#endif -#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object struct _mesa_HashTable *BufferObjects; -#endif -#if FEATURE_ARB_shader_objects /** Table of both gl_shader and gl_shader_program objects */ struct _mesa_HashTable *ShaderObjects; -#endif -#if FEATURE_EXT_framebuffer_object + /* GL_EXT_framebuffer_object */ struct _mesa_HashTable *RenderBuffers; struct _mesa_HashTable *FrameBuffers; -#endif -#if FEATURE_ARB_sync + /* GL_ARB_sync */ struct simple_node SyncObjects; -#endif void *DriverData; /**< Device driver shared state */ }; @@ -2531,14 +2517,13 @@ struct gl_program_constants GLuint MaxNativeParameters; /* For shaders */ GLuint MaxUniformComponents; -#if FEATURE_ARB_geometry_shader4 + /* GL_ARB_geometry_shader4 */ GLuint MaxGeometryTextureImageUnits; GLuint MaxGeometryVaryingComponents; GLuint MaxVertexVaryingComponents; GLuint MaxGeometryUniformComponents; GLuint MaxGeometryOutputVertices; GLuint MaxGeometryTotalOutputComponents; -#endif }; @@ -2786,12 +2771,8 @@ struct gl_extensions GLboolean SGIS_texture_lod; GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; -#if FEATURE_OES_EGL_image GLboolean OES_EGL_image; -#endif -#if FEATURE_OES_draw_texture GLboolean OES_draw_texture; -#endif /* FEATURE_OES_draw_texture */ /** The extension string */ const GLubyte *String; /** Number of supported extensions */ @@ -3232,9 +3213,8 @@ struct __GLcontextRec struct gl_meta_state *Meta; /**< for "meta" operations */ -#if FEATURE_EXT_framebuffer_object + /* GL_EXT_framebuffer_object */ struct gl_renderbuffer *CurrentRenderbuffer; -#endif GLenum ErrorValue; /**< Last error code */ -- 2.30.2