diff options
author | brianp <brianp> | 2000-04-20 16:36:36 +0000 |
---|---|---|
committer | brianp <brianp> | 2000-04-20 16:36:36 +0000 |
commit | 899f86f398ead01bcfb72824830966e1d5c65eb2 (patch) | |
tree | 09c32adb0a14256b72ff98baa00611a6ef175330 | |
parent | 1ed162fe52c6627afbfce2f33c41b6ee05a764f9 (diff) |
Merged glxmisc-1-0-0glxmisc-1-0-0-20000420-merge
141 files changed, 6440 insertions, 2813 deletions
diff --git a/xc/extras/Mesa/include/GL/gl.h b/xc/extras/Mesa/include/GL/gl.h index dd2e9c140..b5323f4b0 100644 --- a/xc/extras/Mesa/include/GL/gl.h +++ b/xc/extras/Mesa/include/GL/gl.h @@ -2094,6 +2094,16 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); #endif /* GL_EXT_compiled_vertex_array */ +/* + * 137. GL_HP_occlusion_test + */ +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 + +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 + +#endif /* GL_HP_occlusion_test */ /* diff --git a/xc/extras/Mesa/include/GL/glext.h b/xc/extras/Mesa/include/GL/glext.h index 9ad3426c7..b2df4e806 100644 --- a/xc/extras/Mesa/include/GL/glext.h +++ b/xc/extras/Mesa/include/GL/glext.h @@ -3,9 +3,10 @@ /* - * XXX Many extensions need to be added yet. * XXX Some token values aren't known (grep for ?) * XXX This file may be automatically generated in the future. + * XXX There are some doubly-defined tokens with different values! Search + * for "DUPLICATE". */ @@ -44,8 +45,15 @@ extern "C" { * Now have all extenions up to number 197 * 5. Brian Paul, 27 Mar 2000 * Added GL_ARB_texture_compression + * 6. Brian Paul, 5 Apr 2000 + * Added GL_ARB_multisample tokens, added GL_ARB_texture_env_add + * 7. Brian Paul, 7 Apr 2000 + * Minor clean-ups, temporary token values for GL_SGIS_pixel_texture + * 8. Brian Paul, 15 Apr 2000 + * Added GL_EXT_texture_cube_map, GL_NV_texgen_emboss, adding some + * missing tokens values. */ -#define GL_GLEXT_VERSION_EXT 5 +#define GL_GLEXT_VERSION_EXT 8 /* @@ -377,22 +385,22 @@ typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum i #ifndef GL_SGI_color_table #define GL_SGI_color_table 1 -#define COLOR_TABLE_SGI 0x80D0 -#define POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 -#define POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 -#define PROXY_COLOR_TABLE_SGI 0x80D3 -#define PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 -#define PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 -#define COLOR_TABLE_SCALE_SGI 0x80D6 -#define COLOR_TABLE_BIAS_SGI 0x80D7 -#define COLOR_TABLE_FORMAT_SGI 0x80D8 -#define COLOR_TABLE_WIDTH_SGI 0x80D9 -#define COLOR_TABLE_RED_SIZE_SGI 0x80DA -#define COLOR_TABLE_GREEN_SIZE_SGI 0x80DB -#define COLOR_TABLE_BLUE_SIZE_SGI 0x80DC -#define COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD -#define COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE -#define COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#define GL_COLOR_TABLE_SGI 0x80D0 /* DUPLICATE! */ +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF GLAPI void APIENTRY glColorTableParameterfvSGI(GLenum target, GLenum pname, const GLfloat *params); GLAPI void APIENTRY glColorTableParameterivSGI(GLenum target, GLenum pname, const GLint *params); @@ -437,10 +445,10 @@ typedef void (APIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); #ifndef GL_SGIS_pixel_texture #define GL_SGIS_pixel_texture 1 -#define GL_PIXEL_TEXTURE_SGIS ? -#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS ? -#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS ? -#define GL_PIXEL_GROUP_COLOR_SGIS ? +#define GL_PIXEL_TEXTURE_SGIS 0x1000 /*?*/ +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x1001 /*?*/ +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x1002 /*?*/ +#define GL_PIXEL_GROUP_COLOR_SGIS 0x1003 /*?*/ GLAPI void APIENTRY glPixelTexGenParameterfSGIS(GLenum target, GLfloat value); GLAPI void APIENTRY glPixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value); @@ -493,7 +501,7 @@ typedef void (APIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level #ifndef GL_SGI_texture_color_table #define GL_SGI_texture_color_table 1 -#define GL_COLOR_TABLE_SGI 0x80BC +#define GL_COLOR_TABLE_SGI_80BC 0x80BC /* DUPLICATE! */ #define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD #endif /* GL_SGI_texture_color_table */ @@ -761,7 +769,7 @@ typedef void (APIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GL #ifndef GL_EXT_misc_attribute #define GL_EXT_misc_attribute 1 -#define MISC_BIT_EXT ? +#define GL_MISC_BIT_EXT ? #endif /* GL_EXT_misc_attribute */ @@ -1025,7 +1033,7 @@ typedef void (APIENTRY * PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); typedef void (APIENTRY * PFNGLSTARTINSTRUMENTSSGIXPROC) (void); typedef void (APIENTRY * PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); -#endif +#endif /* GL_SGIX_instruments */ @@ -1254,7 +1262,7 @@ GLAPI void APIENTRY glCopyColorSubTableEXT(GLenum target, GLsizei start, GLint x typedef void (APIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#endif +#endif /* GL_EXT_color_subtable */ @@ -1317,7 +1325,6 @@ typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei #define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022 #define GL_ALLOW_DRAW_WIN_HINT_PGI 107023 #define GL_ALLOW_DRAW_FRG_HINT_PGI 107024 -#define GL_ALLOW_DRAW_SPN_HINT_PGI 107024 #define GL_ALLOW_DRAW_MEM_HINT_PGI 107025 #define GL_CLIP_NEAR_HINT_PGI 107040 #define GL_CLIP_FAR_HINT_PGI 107041 @@ -1724,11 +1731,8 @@ typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint sta #define GL_FRAGMENT_MATERIAL_EXT 0x8349 #define GL_FRAGMENT_NORMAL_EXT 0x834A -/* XXX this symbol collides with the same in GL_EXT_fog_coord and they -** have different values! We're disabling this one since it's the less -** common of the two extensions. -#define GL_FRAGMENT_DEPTH_EXT 0x834B -**/ + +#define GL_FRAGMENT_DEPTH_EXT_834B 0x834B /* DUPLICATE! */ #define GL_FRAGMENT_COLOR_EXT 0x834C #define GL_ATTENUATION_EXT 0x834D #define GL_SHADOW_ATTENUATION_EXT 0x834E @@ -1817,10 +1821,10 @@ typedef void (APIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode) #ifndef GL_INTEL_texture_scissor #define GL_INTEL_texture_scissor 1 -#define TEXTURE_SCISSOR_INTEL ? -#define TEXTURE_SCISSOR_S_INTEL ? -#define TEXTURE_SCISSOR_T_INTEL ? -#define TEXTURE_SCISSOR_R_INTEL ? +#define GL_TEXTURE_SCISSOR_INTEL ? +#define GL_TEXTURE_SCISSOR_S_INTEL ? +#define GL_TEXTURE_SCISSOR_T_INTEL ? +#define GL_TEXTURE_SCISSOR_R_INTEL ? GLAPI void APIENTRY glTexScissorINTEL(GLenum target, GLclampf tlow, GLclampf thigh); GLAPI void APIENTRY glTexScissorFuncINTEL(GLenum target, GLenum lfunc, GLenum hfunc); @@ -1907,7 +1911,7 @@ GLAPI void APIENTRY glGetPixelTransformParameterfvEXT(GLenum target, GLenum pnam #define GL_PIXEL_TRANSFORM_COLOR_TABLE_EXT ? #define GL_PROXY_PIXEL_TRANSFORM_COLOR_TABLE_EXT ? -#endif +#endif /* GL_EXT_pixel_transform_color_table */ @@ -1956,7 +1960,7 @@ GLAPI void APIENTRY glGetPixelTransformParameterfvEXT(GLenum target, GLenum pnam #ifndef GL_EXT_secondary_color #define GL_EXT_secondary_color 1 -#define GLCOLOR_SUM_EXT 0x8458 +#define GL_COLOR_SUM_EXT 0x8458 #define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 #define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A #define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B @@ -2078,7 +2082,7 @@ typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSEXT) (GLenum mode, GLint *first, GL #define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 #define GL_FOG_COORDINATE_EXT 0x8451 -#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 /* DUPLICATE! */ #define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 #define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 #define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 @@ -2640,8 +2644,8 @@ typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLe #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic 1 -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84fe -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84ff +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #endif /* GL_EXT_texture_filter_anisotropic */ @@ -2655,12 +2659,12 @@ typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLe #define GL_VERTEX_WEIGHTING_EXT 0x8509 #define GL_MODELVIEW0_EXT 0x1700 -#define GL_MODELVIEW1_EXT 0x850a -#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850b -#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850c -#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850d -#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850e -#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850f +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F #define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 #define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 #define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 @@ -2673,7 +2677,7 @@ typedef void (APIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); typedef void (APIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif +#endif /* GL_EXT_vertex_weighting */ @@ -2686,7 +2690,7 @@ typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum ty #define GL_MAX_SHININESS_NV 0x8507 #define GL_MAX_SPOT_EXPONENT_NV 0x8508 -#endif +#endif /* GL_NV_light_max_exponent */ @@ -2696,7 +2700,11 @@ typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum ty #ifndef GL_NV_vertex_array_range #define GL_NV_vertex_array_range 1 -/* TOKENS? */ +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 GLAPI void APIENTRY glFlushVertexArrayRangeNV(void); GLAPI void APIENTRY glVertexArrayRangeNV(GLsizei size, const GLvoid * pointer); @@ -2704,7 +2712,7 @@ GLAPI void APIENTRY glVertexArrayRangeNV(GLsizei size, const GLvoid * pointer); typedef void (APIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); typedef void (APIENTRY * PFNGLVERTEXARRAYRANGENV) (GLsizei size, const GLvoid * pointer); -#endif +#endif /* GL_NV_vertex_array_range */ @@ -2714,7 +2722,57 @@ typedef void (APIENTRY * PFNGLVERTEXARRAYRANGENV) (GLsizei size, const GLvoid * #ifndef GL_NV_register_combiners #define GL_NV_register_combiners 1 -/* TOKENS? */ +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_DISCARD_NV 0x8530 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D #ifdef VMS /*VMS only allows externals of maximal 31 characters! */ @@ -2763,9 +2821,9 @@ typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum va #ifndef GL_NV_fog_distance #define GL_NV_fog_distance 1 -#define GL_FOG_DISTANCE_MODE_NV 0x855a -#define GL_EYE_RADIAL_NV 0x855b -#define GL_EYE_PLANE_ABSOLUTE_NV 0x855c +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C #endif /* GL_NV_fog_distance*/ @@ -2879,7 +2937,7 @@ typedef void (APIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *p); /* - * ARB 0. GL_ARB_multitexture + * ARB 1. GL_ARB_multitexture */ #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 @@ -2995,7 +3053,12 @@ typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLs /* - * ARB 2. GL_ARB_tranpose_matrix + * ARB 2. GLX_ARB_get_proc_address + */ + + +/* + * ARB 3. GL_ARB_tranpose_matrix */ #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix 1 @@ -3020,11 +3083,37 @@ typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) ( const GLfloat m[16] /* - * ARB 4. GL_ARB_multisample + * ARB 4. WGL_ARB_buffer_region + */ + + + +/* + * ARB 5. GL_ARB_multisample */ #ifndef GL_ARB_multisample #define GL_ARB_multisample 1 +#define GL_MULTISAMPLE_ARBfunda 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#define GL_1PASS_ARB 0x80A1 +#define GL_2PASS_0_ARB 0x80A2 +#define GL_2PASS_1_ARB 0x80A3 +#define GL_4PASS_0_ARB 0x80A4 +#define GL_4PASS_1_ARB 0x80A5 +#define GL_4PASS_2_ARB 0x80A6 +#define GL_4PASS_3_ARB 0x80A7 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_MAX_PASSES_ARB 0x84E7 +#define GL_SAMPLE_PASS_ARB 0x84E8 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +/* Note: there are more tokens for GLX and WGL */ + GLAPI void APIENTRY glSamplePassARB(GLenum pass); GLAPI void APIENTRY glSampleCoverageARB(GLclampf value, GLboolean invert); @@ -3036,6 +3125,18 @@ typedef void (APIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean /* + * ARB 6. GL_ARB_texture_env_add + */ +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 + +/* No new tokens or functions */ + +#endif /* GL_ARB_texture_env_add */ + + + +/* * ARB ?. GL_ARB_texture_compression */ #ifndef GL_ARB_texture_compression @@ -3074,6 +3175,44 @@ typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLin /* + * ?. GL_EXT_texture_cube_map + */ +#ifndef GL_EXT_texture_cube_map +#define GL_EXT_texture_cube_map 1 + +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C + +#endif /* GL_EXT_texture_cube_map */ + + + +/* + * ? GL_NV_texgen_emboss + */ + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 + +#define GL_EMBOSS_MAP_NV 0x855F +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E + +#endif /* GL_NV_texgen_emboss */ + + + +/* * ??. GL_WIN_swap_hint */ #ifndef GL_WIN_swap_hint @@ -3093,7 +3232,7 @@ typedef void (APIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei #ifndef GL_IBM_cull_vertex #define GL_IBM_cull_vertex 1 -#define GL_CULL_VERTEX_IBM 103050 +#define GL_CULL_VERTEX_IBM 0x1928A #endif /* GL_IBM_cull_vertex */ @@ -3105,8 +3244,8 @@ typedef void (APIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei #ifndef GL_IBM_static_data #define GL_IBM_static_data 1 -#define GL_ALL_STATIC_DATA_IBM 103060 -#define GL_STATIC_VERTEX_ARRAY_IBM 103061 +#define GL_ALL_STATIC_DATA_IBM 0x19294 +#define GL_STATIC_VERTEX_ARRAY_IBM 0x19295 GLAPI void APIENTRY glFlushStaticDataIBM(GLenum target); diff --git a/xc/extras/Mesa/include/GL/glx.h b/xc/extras/Mesa/include/GL/glx.h index 89c3fe438..b731d36bf 100644 --- a/xc/extras/Mesa/include/GL/glx.h +++ b/xc/extras/Mesa/include/GL/glx.h @@ -29,12 +29,21 @@ #define GLX_H +#ifdef __VMS +# ifdef __cplusplus +/* VMS Xlib.h gives problems with C++. + * this avoids a bunch of trivial warnings */ +#pragma message disable nosimpint +#endif +#endif #include <X11/Xlib.h> #include <X11/Xutil.h> -#include "GL/gl.h" -#ifdef MESA -#include "GL/xmesa.h" +#ifdef __VMS +# ifdef __cplusplus +#pragma message enable nosimpint #endif +#endif +#include "GL/gl.h" #if defined(USE_MGL_NAMESPACE) @@ -49,7 +58,6 @@ extern "C" { #define GLX_VERSION_1_1 1 #define GLX_VERSION_1_2 1 -#define GLX_VERSION_1_3 1 #define GLX_EXTENSION_NAME "GLX" @@ -99,13 +107,11 @@ extern "C" { /* * GLX 1.3 and later: - * XXX don't know the values of some of these enums! - * XXX some 1.3 enums may be missing! */ -#define GLX_CONFIG_CAVEAT ? -#define GLX_DONT_CARE ? -#define GLX_SLOW_CONFIG ? -#define GLX_NON_CONFORMANT_CONFIG ? +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_NON_CONFORMANT_CONFIG 0x800D #define GLX_X_VISUAL_TYPE 0x22 #define GLX_TRANSPARENT_TYPE 0x23 #define GLX_TRANSPARENT_INDEX_VALUE 0x24 @@ -113,29 +119,29 @@ extern "C" { #define GLX_TRANSPARENT_GREEN_VALUE 0x26 #define GLX_TRANSPARENT_BLUE_VALUE 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28 -#define GLX_MAX_PBUFFER_WIDTH ? -#define GLX_MAX_PBUFFER_HEIGHT ? -#define GLX_MAX_PBUFFER_PIXELS ? -#define GLX_PRESERVED_CONTENTS ? -#define GLX_LARGEST_BUFFER ? -#define GLX_DRAWABLE_TYPE ? -#define GLX_FBCONFIG_ID ? -#define GLX_VISUAL_ID ? -#define GLX_WINDOW_BIT ? -#define GLX_PIXMAP_BIT ? -#define GLX_PBUFFER_BIT ? -#define GLX_AUX_BUFFERS_BIT ? -#define GLX_FRONT_LEFT_BUFFER_BIT ? -#define GLX_FRONT_RIGHT_BUFFER_BIT ? -#define GLX_BACK_LEFT_BUFFER_BIT ? -#define GLX_BACK_RIGHT_BUFFER_BIT ? -#define GLX_AUX_BUFFERS_BIT ? -#define GLX_DEPTH_BUFFER_BIT ? -#define GLX_STENCIL_BUFFER_BIT ? -#define GLX_ACCUM_BUFFER_BIT ? -#define GLX_RENDER_TYPE ? -#define GLX_DRAWABLE_TYPE ? -#define GLX_X_RENDERABLE ? +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_BUFFER 0x801C +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_VISUAL_ID 0x800B +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 #define GLX_NONE 0x8000 #define GLX_TRUE_COLOR 0x8002 #define GLX_DIRECT_COLOR 0x8003 @@ -144,18 +150,18 @@ extern "C" { #define GLX_GRAY_SCALE 0x8006 #define GLX_STATIC_GRAY 0x8007 #define GLX_TRANSPARENT_INDEX 0x8009 -#define GLX_COLOR_INDEX_TYPE ? -#define GLX_COLOR_INDEX_BIT ? -#define GLX_SCREEN ? -#define GLX_PBUFFER_CLOBBER_MASK ? -#define GLX_DAMAGED ? -#define GLX_SAVED ? -#define GLX_WINDOW ? -#define GLX_PBUFFER ? +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_SCREEN 0x800C +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8033 /* - * GLX_EXT_visual_info extension + * 28. GLX_EXT_visual_info extension */ #define GLX_X_VISUAL_TYPE_EXT 0x22 #define GLX_TRANSPARENT_TYPE_EXT 0x23 @@ -164,11 +170,6 @@ extern "C" { #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 - - -/* - * GLX_visual_info extension - */ #define GLX_TRUE_COLOR_EXT 0x8002 #define GLX_DIRECT_COLOR_EXT 0x8003 #define GLX_PSEUDO_COLOR_EXT 0x8004 @@ -181,9 +182,28 @@ extern "C" { /* + * 42. GLX_EXT_visual_rating + */ +#define GLX_VISUAL_CAVEAT_EXT 0x20 +/*#define GLX_NONE_EXT 0x8000*/ +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D + + +/* + * 47. GLX_EXT_import_context + */ +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C + + +/* * Compile-time extension tests */ #define GLX_EXT_visual_info 1 +#define GLX_EXT_visual_rating 1 +#define GLX_EXT_import_context 1 #define GLX_MESA_pixmap_colormap 1 #define GLX_MESA_release_buffers 1 #define GLX_MESA_copy_sub_buffer 1 @@ -267,12 +287,15 @@ extern Display *glXGetCurrentDisplay( void ); /* GLX 1.3 and later */ -extern GLXFBConfig glXChooseFBConfig( Display *dpy, int screen, - const int *attribList, int *nitems ); +extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen, + const int *attribList, int *nitems ); extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, int attribute, int *value ); +extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen, + int *nelements ); + extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ); @@ -338,6 +361,21 @@ extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count); + +/* GLX_EXT_import_context */ +extern void glXFreeContextEXT(Display *dpy, GLXContext context); + +extern GLXContextID glXGetContextIDEXT(const GLXContext context); + +extern Display *glXGetCurrentDisplayEXT(void); + +extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); + +extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context, + int attribute,int *value); + + + /* GLX_ARB_get_proc_address */ extern void (*glXGetProcAddressARB(const GLubyte *procName))(); diff --git a/xc/extras/Mesa/include/GL/xmesa.h b/xc/extras/Mesa/include/GL/xmesa.h index 5c6a5c904..3f187dbb2 100644 --- a/xc/extras/Mesa/include/GL/xmesa.h +++ b/xc/extras/Mesa/include/GL/xmesa.h @@ -140,24 +140,35 @@ extern void XMesaResetDriver( __DRIscreenPrivate *driScrnPriv ); * db_flag - GL_TRUE = double-buffered, * GL_FALSE = single buffered * stereo_flag - stereo visual? - * depth_size - requested bits/depth values, or zero - * stencil_size - requested bits/stencil values, or zero - * accum_size - requested bits/component values, or zero * ximage_flag - GL_TRUE = use an XImage for back buffer, * GL_FALSE = use an off-screen pixmap for back buffer + * depth_size - requested bits/depth values, or zero + * stencil_size - requested bits/stencil values, or zero + * accum_red_size - requested bits/red accum values, or zero + * accum_green_size - requested bits/green accum values, or zero + * accum_blue_size - requested bits/blue accum values, or zero + * accum_alpha_size - requested bits/alpha accum values, or zero + * num_samples - number of samples/pixel if multisampling, or zero + * level - visual level, usually 0 + * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT * Return; a new XMesaVisual or 0 if error. */ extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display, - XMesaVisualInfo visinfo, - GLboolean rgb_flag, - GLboolean alpha_flag, - GLboolean db_flag, - GLboolean stereo_flag, - GLboolean ximage_flag, - GLint depth_size, - GLint stencil_size, - GLint accum_size, - GLint level ); + XMesaVisualInfo visinfo, + GLboolean rgb_flag, + GLboolean alpha_flag, + GLboolean db_flag, + GLboolean stereo_flag, + GLboolean ximage_flag, + GLint depth_size, + GLint stencil_size, + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ); /* * Destroy an XMesaVisual, but not the associated XVisualInfo. diff --git a/xc/extras/Mesa/src/FX/fxapi.c b/xc/extras/Mesa/src/FX/fxapi.c index 6aea93fbf..4beff2cfe 100644 --- a/xc/extras/Mesa/src/FX/fxapi.c +++ b/xc/extras/Mesa/src/FX/fxapi.c @@ -855,6 +855,8 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, GLcontext *ctx = 0; /*FX_GrContext_t glideContext = 0;*/ char *errorstr; + GLboolean useBGR; + char *system = NULL; if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxMesaCreateContext() Start\n"); @@ -915,10 +917,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, if(depthSize && alphaBuffer) alphaBuffer=0; - if(verbose) - fprintf(stderr,"Mesa fx Voodoo Device Driver v0.30\nWritten by David Bucciarelli (davibu@tin.it.it)\n"); - - if((type=fxQueryHardware()) < 0) { + if ((type=fxQueryHardware()) < 0) { fprintf(stderr,"fx Driver: ERROR no Voodoo1/2 Graphics or Voodoo Rush !\n"); return NULL; } @@ -962,37 +961,82 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, goto errorhandler; } - /* Pixel tables are use during pixel read-back */ + /* + * Pixel tables are use during pixel read-back + * Either initialize them for RGB or BGR order. + */ #if FXMESA_USE_ARGB - fxInitPixelTables(fxMesa, GL_FALSE); /* Force RGB pixel order */ + useBGR = GL_FALSE; /* Force RGB pixel order */ + system = "FXMESA_USE_ARGB"; #else if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_VOODOO) { - /* jk991130 - GROSS HACK!!! - Voodoo 3s don't use BGR!! - * the only way to tell if it's a Voodoo 3 at this stage of the - * ballgame (no Glide 3.x for linux *yet*) is to query the # of TMUs + /* jk991130 - Voodoo 3s don't use BGR. Query the # of TMUs * as Voodoo3s have 2 TMUs on board, Banshee has only 1 - * Thanks to Joseph Kain for that one + * bk000413 - another suggestion from Joseph Kain is using + * VendorID 0x121a for all 3dfx boards + * DeviceID VG 1/V2 2/VB 3/V3 5 + * For now we cehck for known BGR devices, and presume + * everything else to be a V3/RGB. */ GrVoodooConfig_t *voodoo; voodoo = &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig; - printf("nTexelfx %d\n", voodoo->nTexelfx); - printf("fbRam %d\n", voodoo->fbRam); - printf("fbiRev %d\n", voodoo->fbiRev); - - if (voodoo->nTexelfx == 2 && voodoo->fbiRev != 260) { - /* RGB pixel order (Voodoo3, but some Quantum3D models) */ - fxInitPixelTables(fxMesa, GL_FALSE); + if (voodoo->nTexelfx == 1) { + /* Voodoo1 or Banshee */ + useBGR = GL_TRUE; + system = "Voodoo1"; + } + else if (voodoo->nTexelfx == 2 && + voodoo->fbiRev == 260 && + voodoo->tmuConfig[0].tmuRev == 4 && + voodoo->tmuConfig[0].tmuRam == 2) { + /* Voodoo 2 */ + useBGR = GL_TRUE; + system = "Voodoo2"; } - else { - /* BGR pixel order on Voodoo1/2, or certain Quantum3D models */ - fxInitPixelTables(fxMesa, GL_TRUE); + else if (voodoo->nTexelfx == 2 && + voodoo->fbiRev == 2 && + voodoo->tmuConfig[0].tmuRev == 1 && + voodoo->tmuConfig[0].tmuRam == 4) { + /* Quantum3D Obsidian 50/100 */ + useBGR = GL_TRUE; + system = "Quantum3D Obsidian"; + } + else + /* Brian + * (voodoo->nTexelfx == 2 && + * voodoo->fbiRev == 0 && + * voodoo->tmuConfig[0].tmuRev == 148441048 && + * voodoo->tmuConfig[0].tmuRam == 3) + * Bernd + * (voodoo->nTexelfx == 2 && + * voodoo->fbiRev == 69634 && + * voodoo->tmuConfig[0].tmuRev == 69634 && + * voodoo->tmuConfig[0].tmuRam == 2 ) + */ + { + /* Presumed Voodoo3 */ + useBGR = GL_FALSE; + system = "Voodoo3"; + } + if (getenv("MESA_FX_INFO")) { + printf("Voodoo: Texelfx: %d / FBI Rev.: %d / TMU Rev.: %d / TMU RAM: %d\n", + voodoo->nTexelfx, + voodoo->fbiRev, + voodoo->tmuConfig[0].tmuRev, + voodoo->tmuConfig[0].tmuRam ); } } else { - fxInitPixelTables(fxMesa, GL_FALSE); /* use RGB pixel order otherwise */ + useBGR = GL_FALSE; /* use RGB pixel order otherwise */ + system = "non-voodoo"; } -#endif +#endif /*FXMESA_USE_ARGB*/ + + if (getenv("MESA_FX_INFO")) + printf("Voodoo pixel order: %s (%s)\n", useBGR ? "BGR" : "RGB", system); + + fxInitPixelTables(fxMesa, useBGR); fxMesa->width=FX_grSstScreenWidth(); fxMesa->height=FX_grSstScreenHeight(); @@ -1011,7 +1055,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, fxMesa->needClip = 0; if(verbose) - fprintf(stderr,"Glide screen size: %dx%d\n", + fprintf(stderr,"Voodoo Glide screen size: %dx%d\n", (int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight()); fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */ @@ -1046,7 +1090,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis, GL_FALSE, /* no software depth */ fxMesa->glVis->StencilBits > 0, - fxMesa->glVis->AccumBits > 0, + fxMesa->glVis->AccumRedBits > 0, fxMesa->glVis->AlphaBits > 0 ); if (!fxMesa->glBuffer) { errorstr = "gl_create_framebuffer"; @@ -1221,6 +1265,25 @@ void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext fxMesa) } +#if 0 +static void QueryCounters(void) +{ + static GLuint prevPassed = 0; + static GLuint prevFailed = 0; + GLuint failed, passed; + GrSstPerfStats_t st; + + FX_grSstPerfStats(&st); + failed = st.zFuncFail - st.aFuncFail - st.chromaFail; + passed = st.pixelsIn - failed; + printf("failed: %d passed: %d\n", failed - prevFailed, passed - prevPassed); + + prevPassed = passed; + prevFailed = failed; +} +#endif + + /* * Swap front/back buffers for current context if double buffered. */ @@ -1263,40 +1326,45 @@ int GLAPIENTRY fxQueryHardware(void) fprintf(stderr,"fxmesa: fxQueryHardware() Start\n"); } - if(!glbGlideInitialized) { + if (!glbGlideInitialized) { grGlideInit(); - if(FX_grSstQueryHardware(&glbHWConfig)) { + if (FX_grSstQueryHardware(&glbHWConfig)) { grSstSelect(glbCurrentBoard); - glb3DfxPresent=1; + glb3DfxPresent = 1; - if(getenv("MESA_FX_INFO")) { + if (getenv("MESA_FX_INFO")) { char buf[80]; FX_grGlideGetVersion(buf); - fprintf(stderr,"Using Glide V%s\n",""); - fprintf(stderr,"Number of boards: %d\n",glbHWConfig.num_sst); - - if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) { - fprintf(stderr,"Framebuffer RAM: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect ? - (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam*2) : - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam); - fprintf(stderr,"Number of TMUs: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx); - fprintf(stderr,"SLI detected: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect); - } else if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96) { - fprintf(stderr,"Framebuffer RAM: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.fbRam); - fprintf(stderr,"Number of TMUs: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx); + fprintf(stderr, "Voodoo Using Glide V%s\n", buf); + fprintf(stderr, "Voodoo Number of boards: %d\n", glbHWConfig.num_sst); + + if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_VOODOO) { + GrVoodooConfig_t *voodoo; + voodoo = &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig; + + fprintf(stderr, "Voodoo Framebuffer RAM: %d\n", + voodoo->sliDetect ? (voodoo->fbRam*2) : voodoo->fbRam); + fprintf(stderr, "Voodoo Number of TMUs: %d\n", voodoo->nTexelfx); + fprintf(stderr, "Voodoo fbRam: %d\n", voodoo->fbRam); + fprintf(stderr, "Voodoo fbiRev: %d\n", voodoo->fbiRev); + + fprintf(stderr,"Voodoo SLI detected: %d\n", voodoo->sliDetect); + } + else if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_SST96) { + GrSst96Config_t *sst96; + sst96 = &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config; + fprintf(stderr, "Voodoo Framebuffer RAM: %d\n", sst96->fbRam); + fprintf(stderr, "Voodoo Number of TMUs: %d\n", sst96->nTexelfx); } } - } else - glb3DfxPresent=0; + } + else { + glb3DfxPresent = 0; + } - glbGlideInitialized=1; + glbGlideInitialized = 1; #if defined(__WIN32__) onexit((_onexit_t)cleangraphics); @@ -1308,17 +1376,11 @@ int GLAPIENTRY fxQueryHardware(void) #endif } - if(!glb3DfxPresent) { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxQueryHardware() End (-1)\n"); - } - return(-1); - } - if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxQueryHardware() End (voodooo)\n"); } - return(glbHWConfig.SSTs[glbCurrentBoard].type); + + return glbHWConfig.SSTs[glbCurrentBoard].type; } @@ -1327,8 +1389,8 @@ int GLAPIENTRY fxQueryHardware(void) */ void GLAPIENTRY fxCloseHardware(void) { - if(glbGlideInitialized) { - if(getenv("MESA_FX_INFO")) { + if (glbGlideInitialized) { + if (getenv("MESA_FX_INFO")) { GrSstPerfStats_t st; FX_grSstPerfStats(&st); @@ -1340,9 +1402,9 @@ void GLAPIENTRY fxCloseHardware(void) fprintf(stderr," # pixels drawn (including buffer clears and LFB writes): %u\n",(unsigned)st.pixelsOut); } - if(glbTotNumCtx==0) { + if (glbTotNumCtx == 0) { grGlideShutdown(); - glbGlideInitialized=0; + glbGlideInitialized = 0; } } } @@ -1354,7 +1416,7 @@ void GLAPIENTRY fxCloseHardware(void) /* * Need this to provide at least one external definition. */ - +extern int gl_fx_dummy_function_api(void); int gl_fx_dummy_function_api(void) { return 0; diff --git a/xc/extras/Mesa/src/FX/fxdd.c b/xc/extras/Mesa/src/FX/fxdd.c index b5d700a74..d37943f0c 100644 --- a/xc/extras/Mesa/src/FX/fxdd.c +++ b/xc/extras/Mesa/src/FX/fxdd.c @@ -535,7 +535,7 @@ static GLboolean fxDDReadPixels( GLcontext *ctx, GLint x, GLint y, else { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GrLfbInfo_t info; - GLboolean result; + GLboolean result = GL_FALSE; BEGIN_BOARD_LOCK(); if (grLfbLock(GR_LFB_READ_ONLY, @@ -546,8 +546,12 @@ static GLboolean fxDDReadPixels( GLcontext *ctx, GLint x, GLint y, &info)) { const GLint winX = fxMesa->x_offset; const GLint winY = fxMesa->y_offset + fxMesa->height - 1; +#ifdef XF86DRI const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); + ? (fxMesa->screen_width) : (info.strideInBytes / 2); +#else + const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ +#endif const GLushort *src = (const GLushort *) info.lfbPtr + (winY - y) * srcStride + (winX + x); GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage, @@ -633,7 +637,6 @@ static GLboolean fxDDReadPixels( GLcontext *ctx, GLint x, GLint y, grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); } END_BOARD_LOCK(); - return result; } } @@ -693,7 +696,7 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) } } /* now make the GL_RENDERER string */ - sprintf(buffer, "Mesa DRI %s 20000329", hardware); + sprintf(buffer, "Mesa DRI %s 20000420", hardware); return buffer; } case GL_VENDOR: diff --git a/xc/extras/Mesa/src/FX/fxddspan.c b/xc/extras/Mesa/src/FX/fxddspan.c index 89abdda95..c7479ebb7 100644 --- a/xc/extras/Mesa/src/FX/fxddspan.c +++ b/xc/extras/Mesa/src/FX/fxddspan.c @@ -99,7 +99,7 @@ static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, if (dst_y>=fxMesa->pClipRects[i].y1 && dst_y<fxMesa->pClipRects[i].y2) { if (dst_x<fxMesa->pClipRects[i].x1) { x=fxMesa->pClipRects[i].x1; - data=((char*)src_data)+srcElt*(dst_x-x); + data=((char*)src_data)+srcElt*(x - dst_x); w=src_width-(x-dst_x); } else { x=dst_x; @@ -324,6 +324,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, } +#if 0 static void fxDDReadRGBASpan(const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4]) { @@ -332,6 +333,7 @@ static void fxDDReadRGBASpan(const GLcontext *ctx, GLuint i; GLint bottom=fxMesa->height+fxMesa->y_offset-1; + printf("read span %d, %d, %d\n", x,y,n); if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDReadRGBASpan(...)\n"); } @@ -349,6 +351,66 @@ static void fxDDReadRGBASpan(const GLcontext *ctx, rgba[i][ACOMP] = 255; } } +#endif + + +/* + * Read a span of 16-bit RGB pixels. Note, we don't worry about cliprects + * since OpenGL says obscured pixels have undefined values. + */ +static void read_R5G6B5_span(const GLcontext *ctx, + GLuint n, GLint x, GLint y, GLubyte rgba[][4]) +{ + fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + GrLfbInfo_t info; + BEGIN_BOARD_LOCK(); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; +#ifdef XF86DRI + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 2); +#else + const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ +#endif + const GLushort *data16 = (const GLushort *) info.lfbPtr + + (winY - y) * srcStride + + (winX + x); + const GLuint *data32 = (const GLuint *) data16; + GLuint i, j; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = j = 0; i < n; i += 2, j++) { + GLuint pixel = data32[j]; + GLuint pixel0 = pixel & 0xffff; + GLuint pixel1 = pixel >> 16; + rgba[i][RCOMP] = FX_PixelToR[pixel0]; + rgba[i][GCOMP] = FX_PixelToG[pixel0]; + rgba[i][BCOMP] = FX_PixelToB[pixel0]; + rgba[i][ACOMP] = 255; + rgba[i+1][RCOMP] = FX_PixelToR[pixel1]; + rgba[i+1][GCOMP] = FX_PixelToG[pixel1]; + rgba[i+1][BCOMP] = FX_PixelToB[pixel1]; + rgba[i+1][ACOMP] = 255; + } + if (extraPixel) { + GLushort pixel = data16[n]; + rgba[n][RCOMP] = FX_PixelToR[pixel]; + rgba[n][GCOMP] = FX_PixelToG[pixel]; + rgba[n][BCOMP] = FX_PixelToB[pixel]; + rgba[n][ACOMP] = 255; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); + } + END_BOARD_LOCK(); +} + /************************************************************************/ /***** Pixel functions *****/ @@ -539,7 +601,8 @@ void fxSetupDDSpanPointers(GLcontext *ctx) ctx->Driver.WriteCI32Pixels =NULL; ctx->Driver.WriteMonoCIPixels =NULL; - ctx->Driver.ReadRGBASpan =fxDDReadRGBASpan; + /* ctx->Driver.ReadRGBASpan =fxDDReadRGBASpan;*/ + ctx->Driver.ReadRGBASpan = read_R5G6B5_span; ctx->Driver.ReadRGBAPixels =fxDDReadRGBAPixels; ctx->Driver.ReadCI32Span =NULL; diff --git a/xc/extras/Mesa/src/FX/fxddtex.c b/xc/extras/Mesa/src/FX/fxddtex.c index 0007167cc..55e0be6bf 100644 --- a/xc/extras/Mesa/src/FX/fxddtex.c +++ b/xc/extras/Mesa/src/FX/fxddtex.c @@ -332,7 +332,7 @@ void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj) fprintf(stderr,"fxmesa: fxDDTexDel(%d,%x)\n",tObj->Name,(GLuint)ti); } - if(!ti) + if (!ti) return; fxTMFreeTexture(fxMesa,tObj); @@ -343,77 +343,105 @@ void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj) ctx->NewState|=NEW_TEXTURING; } -void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj) + + +/* + * Convert gl_color_table table to Glide's format. + */ + +static void convertPalette(FxU32 data[256], const struct gl_color_table *table) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - int i; - FxU32 r,g,b,a; - tfxTexInfo *ti; + const GLubyte *tableUB = (const GLubyte *) table->Table; + GLint width = table->Size; + FxU32 r, g, b, a; + GLint i; - if(tObj) { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDTexPalette(%d,%x)\n",tObj->Name,(GLuint)tObj->DriverData); - } + ASSERT(table->TableType == GL_UNSIGNED_BYTE); - if(tObj->Palette.Format!=GL_RGBA) { -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: unsupported palette format in texpalette()\n"); -#endif - return; - } + switch (table->Format) { + case GL_INTENSITY: + for (i = 0; i < width; i++) { + r = tableUB[i]; + g = tableUB[i]; + b = tableUB[i]; + a = tableUB[i]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_LUMINANCE: + for (i = 0; i < width; i++) { + r = tableUB[i]; + g = tableUB[i]; + b = tableUB[i]; + a = 255; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_ALPHA: + for (i = 0; i < width; i++) { + r = g = b = 255; + a = tableUB[i]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_LUMINANCE_ALPHA: + for (i = 0; i < width; i++) { + r = g = b = tableUB[i*2+0]; + a = tableUB[i*2+1]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_RGB: + for (i = 0; i < width; i++) { + r = tableUB[i*3+0]; + g = tableUB[i*3+1]; + b = tableUB[i*3+2]; + a = 255; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_RGBA: + for (i = 0; i < width; i++) { + r = tableUB[i*4+0]; + g = tableUB[i*4+1]; + b = tableUB[i*4+2]; + a = tableUB[i*4+3]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + } +} - if(tObj->Palette.Size>256) { -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: unsupported palette size in texpalette()\n"); -#endif - return; - } +void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj) +{ + fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + + if (tObj) { + /* per-texture palette */ + tfxTexInfo *ti; + if (MESA_VERBOSE&VERBOSE_DRIVER) { + fprintf(stderr,"fxmesa: fxDDTexPalette(%d,%x)\n", + tObj->Name,(GLuint)tObj->DriverData); + } if (!tObj->DriverData) tObj->DriverData=fxAllocTexObjData(fxMesa); - ti=fxTMGetTexInfo(tObj); - - for(i=0;i<tObj->Palette.Size;i++) { - r=tObj->Palette.Table[i*4]; - g=tObj->Palette.Table[i*4+1]; - b=tObj->Palette.Table[i*4+2]; - a=tObj->Palette.Table[i*4+3]; - ti->palette.data[i]=(a<<24)|(r<<16)|(g<<8)|b; - } - + convertPalette(ti->palette.data, &tObj->Palette); fxTexInvalidate(ctx,tObj); - } else { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDTexPalette(global)\n"); - } - if(ctx->Texture.Palette.Format!=GL_RGBA) { -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: unsupported palette format in texpalette()\n"); -#endif - return; - } - - if(ctx->Texture.Palette.Size>256) { -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: unsupported palette size in texpalette()\n"); -#endif - return; - } - - for(i=0;i<ctx->Texture.Palette.Size;i++) { - r=ctx->Texture.Palette.Table[i*4]; - g=ctx->Texture.Palette.Table[i*4+1]; - b=ctx->Texture.Palette.Table[i*4+2]; - a=ctx->Texture.Palette.Table[i*4+3]; - fxMesa->glbPalette.data[i]=(a<<24)|(r<<16)|(g<<8)|b; + } + else { + /* global texture palette */ + if (MESA_VERBOSE&VERBOSE_DRIVER) { + fprintf(stderr,"fxmesa: fxDDTexPalette(global)\n"); } - + convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette); fxMesa->new_state|=FX_NEW_TEXTURING; ctx->Driver.RenderStart = fxSetupFXUnits; } } + void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; diff --git a/xc/extras/Mesa/src/FX/fxdrv.h b/xc/extras/Mesa/src/FX/fxdrv.h index 64ac9ee49..924b4a164 100644 --- a/xc/extras/Mesa/src/FX/fxdrv.h +++ b/xc/extras/Mesa/src/FX/fxdrv.h @@ -187,9 +187,9 @@ typedef struct { } #if FX_USE_PARGB -#define GOURAUD2(v, c) { \ - GLubyte *col = c; \ - v->argb=MESACOLOR2PARGB(col); \ +#define GOURAUD2(v, c) { \ + GLubyte *col = c; \ + v->argb=MESACOLOR2PARGB(col); \ } #else #define GOURAUD2(v, c) { \ @@ -230,13 +230,13 @@ typedef struct { #define FX_UM_E0_MODULATE 0x00000002 #define FX_UM_E0_DECAL 0x00000004 #define FX_UM_E0_BLEND 0x00000008 -#define FX_UM_E0_ADD 0x00000010 +#define FX_UM_E0_ADD 0x00000010 #define FX_UM_E1_REPLACE 0x00000020 #define FX_UM_E1_MODULATE 0x00000040 #define FX_UM_E1_DECAL 0x00000080 #define FX_UM_E1_BLEND 0x00000100 -#define FX_UM_E1_ADD 0x00000200 +#define FX_UM_E1_ADD 0x00000200 #define FX_UM_E_ENVMODE 0x000003ff diff --git a/xc/extras/Mesa/src/FX/fxglidew.c b/xc/extras/Mesa/src/FX/fxglidew.c index 5d24e14ea..0303054bf 100644 --- a/xc/extras/Mesa/src/FX/fxglidew.c +++ b/xc/extras/Mesa/src/FX/fxglidew.c @@ -225,7 +225,7 @@ void FX_grGlideGetVersion(char *buf) void FX_grSstPerfStats(GrSstPerfStats_t *st) { - int n; + FxI32 n; grGet(GR_STATS_PIXELS_IN, 4, &n); st->pixelsIn = n; grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n); st->chromaFail = n; grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n); st->zFuncFail = n; diff --git a/xc/extras/Mesa/src/FX/fxpipeline.c b/xc/extras/Mesa/src/FX/fxpipeline.c index c77e21ffa..cf4c9ebbc 100644 --- a/xc/extras/Mesa/src/FX/fxpipeline.c +++ b/xc/extras/Mesa/src/FX/fxpipeline.c @@ -104,7 +104,7 @@ static void fxDDRenderVB( struct vertex_buffer *VB ) GLcontext *ctx = VB->ctx; fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; - if ((fxMesa->render_index & ~FX_FLAT) || + if ((fxMesa->render_index != 0) || ((ctx->Texture.ReallyEnabled & 0xf) && VB->TexCoordPtr[0]->size>2) || ((ctx->Texture.ReallyEnabled & 0xf0) && VB->TexCoordPtr[1]->size>2)) gl_render_vb( VB ); diff --git a/xc/extras/Mesa/src/FX/fxrender.c b/xc/extras/Mesa/src/FX/fxrender.c index 8ce4b0618..5935998f8 100644 --- a/xc/extras/Mesa/src/FX/fxrender.c +++ b/xc/extras/Mesa/src/FX/fxrender.c @@ -722,8 +722,8 @@ render_func **fxDDChooseRenderVBTables(GLcontext *ctx) return null_tables; switch (fxMesa->render_index) { - case FX_FLAT: - return fxDDRenderVBFlat_tables; +/* case FX_FLAT: */ +/* return fxDDRenderVBFlat_tables; */ case 0: return fxDDRenderVBSmooth_tables; default: diff --git a/xc/extras/Mesa/src/FX/fxsetup.c b/xc/extras/Mesa/src/FX/fxsetup.c index 9e00d152a..e8c75b7c4 100644 --- a/xc/extras/Mesa/src/FX/fxsetup.c +++ b/xc/extras/Mesa/src/FX/fxsetup.c @@ -183,7 +183,7 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx, GLuint envmode=0; GLuint ifmt=0; - if((ctx->Light.ShadeModel==GL_SMOOTH) || + if((ctx->Light.ShadeModel==GL_SMOOTH) || 1 || (ctx->Point.SmoothFlag) || (ctx->Line.SmoothFlag) || (ctx->Polygon.SmoothFlag)) @@ -191,11 +191,13 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx, else unitsmode|=FX_UM_ALPHA_CONSTANT; - if(ctx->Light.ShadeModel==GL_SMOOTH) + if(ctx->Light.ShadeModel==GL_SMOOTH || 1) unitsmode|=FX_UM_COLOR_ITERATED; else unitsmode|=FX_UM_COLOR_CONSTANT; + + /* OpenGL Feeds Texture 0 into Texture 1 Glide Feeds Texture 1 into Texture 0 @@ -356,8 +358,8 @@ static void fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_obje FX_grTexClampMode_NoLock(GR_TMU1,ti->sClamp,ti->tClamp); FX_grTexFilterMode_NoLock(GR_TMU0,ti->minFilt,ti->maxFilt); FX_grTexFilterMode_NoLock(GR_TMU1,ti->minFilt,ti->maxFilt); - FX_grTexMipMapMode_NoLock(GR_TMU0,GR_MIPMAP_NEAREST,FXTRUE); - FX_grTexMipMapMode_NoLock(GR_TMU1,GR_MIPMAP_NEAREST,FXTRUE); + FX_grTexMipMapMode_NoLock(GR_TMU0,ti->mmMode,ti->LODblend); + FX_grTexMipMapMode_NoLock(GR_TMU1,ti->mmMode,ti->LODblend); FX_grTexSource_NoLock(GR_TMU0,ti->tm[FX_TMU0]->startAddr, GR_MIPMAPLEVELMASK_ODD,&(ti->info)); @@ -391,7 +393,7 @@ static void fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_obje } static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, - FxBool LODblend, FxBool negate) + FxBool LODblend) { if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxSelectSingleTMUSrc(%d,%d)\n",tmu,LODblend); @@ -414,45 +416,23 @@ static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, } else { if (tmu!=FX_TMU1) { - if (negate) - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, - GR_COMBINE_FACTOR_ZERO, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - FXFALSE, FXFALSE); - else - FX_grTexCombine_NoLock(GR_TMU0, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - FXFALSE,FXFALSE); + FX_grTexCombine_NoLock(GR_TMU0, + GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, + GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, + FXFALSE,FXFALSE); if (fxMesa->haveTwoTMUs) { FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_ZERO, - GR_COMBINE_FACTOR_NONE, + GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, + GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, FXFALSE,FXFALSE); } fxMesa->tmuSrc=FX_TMU0; } else { - if (negate) - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, - GR_COMBINE_FACTOR_ZERO, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - FXFALSE, FXFALSE); - else - FX_grTexCombine_NoLock(GR_TMU1, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - GR_COMBINE_FUNCTION_LOCAL, - GR_COMBINE_FACTOR_NONE, - FXFALSE,FXFALSE); + FX_grTexCombine_NoLock(GR_TMU1, + GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, + GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, + FXFALSE,FXFALSE); /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */ @@ -490,23 +470,16 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) if (ti->whichTMU==FX_TMU_BOTH) tmu=FX_TMU0; else tmu=ti->whichTMU; - - if (fxMesa->tmuSrc!=tmu || - (unitsmode&FX_UM_E0_BLEND != - fxMesa->lastUnitsMode&FX_UM_E0_BLEND)) { - if (unitsmode&FX_UM_E0_BLEND) - fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend, GL_FALSE); - else - fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend, GL_FALSE); - } + if (fxMesa->tmuSrc!=tmu) + fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend); if(textureset==0 || !fxMesa->haveTwoTMUs) unitsmode=fxGetTexSetConfiguration(ctx,tObj,NULL); else unitsmode=fxGetTexSetConfiguration(ctx,NULL,tObj); - if(fxMesa->lastUnitsMode==unitsmode) - return; +/* if(fxMesa->lastUnitsMode==unitsmode) */ +/* return; */ fxMesa->lastUnitsMode=unitsmode; @@ -564,6 +537,7 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) FXFALSE); break; case GL_BLEND: +#if 0 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL, locala, @@ -581,10 +555,11 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) localc, GR_COMBINE_OTHER_TEXTURE, FXTRUE); -#if 0 - /* We're not enabling blending that requires multipass */ ctx->Driver.MultipassFunc = fxMultipassBlend; -#endif +#else + if (MESA_VERBOSE&VERBOSE_DRIVER) + fprintf(stderr,"fx Driver: GL_BLEND not yet supported\n"); +#endif break; case GL_REPLACE: if((ifmt==GL_RGB) || (ifmt==GL_LUMINANCE)) @@ -614,9 +589,9 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) FXFALSE); break; default: -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: %x Texture.EnvMode not yet supported\n",ctx->Texture.Unit[textureset].EnvMode); -#endif + if (MESA_VERBOSE&VERBOSE_DRIVER) + fprintf(stderr, "fx Driver: %x Texture.EnvMode not yet supported\n", + ctx->Texture.Unit[textureset].EnvMode); break; } @@ -790,8 +765,8 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx) unitsmode=fxGetTexSetConfiguration(ctx,tObj0,tObj1); - if(fxMesa->lastUnitsMode==unitsmode) - return; +/* if(fxMesa->lastUnitsMode==unitsmode) */ +/* return; */ fxMesa->lastUnitsMode=unitsmode; @@ -1056,7 +1031,7 @@ static void fxSetupTextureNone_NoLock(GLcontext *ctx) fprintf(stderr,"fxmesa: fxSetupTextureNone(...)\n"); } - if((ctx->Light.ShadeModel==GL_SMOOTH) || + if((ctx->Light.ShadeModel==GL_SMOOTH) || 1 || (ctx->Point.SmoothFlag) || (ctx->Line.SmoothFlag) || (ctx->Polygon.SmoothFlag)) @@ -1064,7 +1039,7 @@ static void fxSetupTextureNone_NoLock(GLcontext *ctx) else locala=GR_COMBINE_LOCAL_CONSTANT; - if(ctx->Light.ShadeModel==GL_SMOOTH) + if(ctx->Light.ShadeModel==GL_SMOOTH || 1) localc=GR_COMBINE_LOCAL_ITERATED; else localc=GR_COMBINE_LOCAL_CONSTANT; @@ -1542,8 +1517,6 @@ void fxSetScissorValues(GLcontext *ctx) static void fxSetupScissor(GLcontext *ctx) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - /* If we're not going to be setting the clip values in the CLIP_LOOP - then make a call to it here to set it once */ if (!fxMesa->needClip) { BEGIN_BOARD_LOCK(); fxSetScissorValues(ctx); diff --git a/xc/extras/Mesa/src/FX/fxtexman.c b/xc/extras/Mesa/src/FX/fxtexman.c index bc20fa10b..2ffaeadd7 100644 --- a/xc/extras/Mesa/src/FX/fxtexman.c +++ b/xc/extras/Mesa/src/FX/fxtexman.c @@ -146,10 +146,10 @@ static void fxTMUInit(fxMesaContext fxMesa, int tmu) end=FX_grTexMaxAddress(tmu); if(fxMesa->verbose) { - fprintf(stderr,"%s configuration:",(tmu==FX_TMU0) ? "TMU0" : "TMU1"); - fprintf(stderr," Lower texture memory address (%u)\n",(unsigned int)start); - fprintf(stderr," Higher texture memory address (%u)\n",(unsigned int)end); - fprintf(stderr," Splitting Texture memory in 2b blocks:\n"); + fprintf(stderr,"Voodoo %s configuration:",(tmu==FX_TMU0) ? "TMU0" : "TMU1"); + fprintf(stderr,"Voodoo Lower texture memory address (%u)\n",(unsigned int)start); + fprintf(stderr,"Voodoo Higher texture memory address (%u)\n",(unsigned int)end); + fprintf(stderr,"Voodoo Splitting Texture memory in 2b blocks:\n"); } fxMesa->freeTexMem[tmu]=end-start; @@ -162,7 +162,7 @@ static void fxTMUInit(fxMesaContext fxMesa, int tmu) else blockend=blockstart+FX_2MB_SPLIT; if(fxMesa->verbose) - fprintf(stderr," %07u-%07u\n", + fprintf(stderr,"Voodoo %07u-%07u\n", (unsigned int)blockstart,(unsigned int)blockend); tmn=fxTMNewRangeNode(fxMesa, blockstart, blockend); diff --git a/xc/extras/Mesa/src/FX/fxtritmp.h b/xc/extras/Mesa/src/FX/fxtritmp.h index 10bf5ca18..8e5da291f 100644 --- a/xc/extras/Mesa/src/FX/fxtritmp.h +++ b/xc/extras/Mesa/src/FX/fxtritmp.h @@ -66,7 +66,9 @@ static void TAG(fx_tri)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint GLuint facing = (c<0.0) ^ ctx->Polygon.FrontBit; GLubyte (*color)[4] = VB->Color[facing]->data; if (IND & FX_FLAT) { - FX_VB_COLOR(fxMesa, color[pv]); + GOURAUD2(v1,color[pv]); + GOURAUD2(v2,color[pv]); + GOURAUD2(v3,color[pv]); } else { GOURAUD2(v1,color[e1]); GOURAUD2(v2,color[e2]); @@ -103,7 +105,9 @@ static void TAG(fx_tri)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint } else if (IND & FX_FLAT) { GLubyte (*color)[4] = VB->Color[0]->data; - FX_VB_COLOR(fxMesa, color[pv]); + GOURAUD2(v1,color[pv]); + GOURAUD2(v2,color[pv]); + GOURAUD2(v3,color[pv]); } if (IND & FX_FRONT_BACK) { @@ -168,7 +172,10 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint facing = (c<0.0) ^ ctx->Polygon.FrontBit; GLubyte (*color)[4] = VB->Color[facing]->data; if (IND & FX_FLAT) { - FX_VB_COLOR(fxMesa, color[pv]); + GOURAUD2(v1,color[pv]); + GOURAUD2(v2,color[pv]); + GOURAUD2(v3,color[pv]); + GOURAUD2(v4,color[pv]); } else { GOURAUD2(v1,color[e1]); GOURAUD2(v2,color[e2]); @@ -206,7 +213,10 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, } else if (IND & FX_FLAT) { GLubyte (*color)[4] = VB->Color[0]->data; - FX_VB_COLOR(fxMesa, color[pv]); + GOURAUD2(v1,color[pv]); + GOURAUD2(v2,color[pv]); + GOURAUD2(v3,color[pv]); + GOURAUD2(v4,color[pv]); } if (IND & FX_FRONT_BACK) { diff --git a/xc/extras/Mesa/src/FX/fxvs_tmp.h b/xc/extras/Mesa/src/FX/fxvs_tmp.h index e3a30bf5d..d9001db5e 100644 --- a/xc/extras/Mesa/src/FX/fxvs_tmp.h +++ b/xc/extras/Mesa/src/FX/fxvs_tmp.h @@ -142,10 +142,39 @@ static void NAME(struct vertex_buffer *VB, GLuint start, GLuint end) DO_SETUP; } } - } else + } + else { for (;v!=vend;v+=16 INCR) { DO_SETUP; } + } + + if (ctx->FogMode == FOG_FRAGMENT && ctx->ProjectionMatrix.m[15] != 0.0F) { + /* need to compute W values for fogging purposes */ + const GLfloat m10 = ctx->ProjectionMatrix.m[10]; + const GLfloat m14 = ctx->ProjectionMatrix.m[14]; + const GLfloat v10 = ctx->Viewport.WindowMap.m[10]; + const GLfloat v14 = ctx->Viewport.WindowMap.m[14]; + GLfloat *v = gWin[start].f; + GLfloat *win = VB->Win.data[start]; + if (VB->ClipOrMask) { + GLubyte *clipmask = &VB->ClipMask[start]; + for (;v!=vend;v+=16,clipmask++, win+=4) { + if (*clipmask == 0) { + GLfloat zNDC = (win[2] - v14) / v10; + GLfloat zEye = (zNDC - m14) / m10; + v[OOWCOORD] = -1.0F / zEye; + } + } + } + else { + for (;v!=vend;v+=16, win+=4) { + GLfloat zNDC = (win[2] - v14) / v10; + GLfloat zEye = (zNDC - m14) / m10; + v[OOWCOORD] = -1.0F / zEye; + } + } + } /* rare - I hope */ FIXUP; diff --git a/xc/extras/Mesa/src/FX/fxvsetup.c b/xc/extras/Mesa/src/FX/fxvsetup.c index 78a311f25..c7c1218b4 100644 --- a/xc/extras/Mesa/src/FX/fxvsetup.c +++ b/xc/extras/Mesa/src/FX/fxvsetup.c @@ -341,12 +341,14 @@ void fxDDDoRasterSetup( struct vertex_buffer *VB ) GLcontext *ctx = VB->ctx; FX_DRIVER_DATA(VB)->last_vert = FX_DRIVER_DATA(VB)->verts + VB->Count; +#if 0 /* leaving this out fixes the Heretic2 stray polygon bug */ if ((ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE) { fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; fxMesa->setupdone = 0; return; } - +#endif + if (VB->Type == VB_CVA_PRECALC) fxDDPartialRasterSetup( VB ); else diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c index 16fb2f622..deba5af3d 100644 --- a/xc/extras/Mesa/src/X/fakeglx.c +++ b/xc/extras/Mesa/src/X/fakeglx.c @@ -70,6 +70,7 @@ /* Silence compiler warnings */ +extern void Fake_glXDummyFunc( void ); void Fake_glXDummyFunc( void ) { (void) kernel8; @@ -226,7 +227,9 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag, GLboolean stereoFlag, GLint depth_size, GLint stencil_size, - GLint accum_size, GLint level ) + GLint accumRedSize, GLint accumGreenSize, + GLint accumBlueSize, GLint accumAlphaSize, + GLint level ) { GLboolean ximageFlag = GL_TRUE; XMesaVisual xmvis; @@ -269,7 +272,10 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, && (v->gl_visual->AlphaBits > 0) == alphaFlag && (v->gl_visual->DepthBits >= depth_size || depth_size == 0) && (v->gl_visual->StencilBits >= stencil_size || stencil_size == 0) - && (v->gl_visual->AccumBits >= accum_size || accum_size == 0)) { + && (v->gl_visual->AccumRedBits >= accumRedSize || accumRedSize == 0) + && (v->gl_visual->AccumGreenBits >= accumGreenSize || accumGreenSize == 0) + && (v->gl_visual->AccumBlueBits >= accumBlueSize || accumBlueSize == 0) + && (v->gl_visual->AccumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) { /* now either compare XVisualInfo pointers or visual IDs */ if ((!comparePointers && v->visinfo->visualid == vinfo->visualid) || (comparePointers && v->vishandle == vinfo)) { @@ -287,7 +293,10 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, xmvis = XMesaCreateVisual( dpy, vinfo, rgbFlag, alphaFlag, dbFlag, stereoFlag, ximageFlag, - depth_size, stencil_size, accum_size, level ); + depth_size, stencil_size, + accumRedSize, accumBlueSize, + accumBlueSize, accumAlphaSize, 0, level, + GLX_NONE_EXT ); if (xmvis) { VisualTable[NumVisuals] = xmvis; NumVisuals++; @@ -299,6 +308,11 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, /* * Create a GLX visual from a regular XVisualInfo. + * This is called when Fake GLX is given an XVisualInfo which wasn't + * returned by glXChooseVisual. Since this is the first time we're + * considering this visual we'll take a guess at reasonable values + * for depth buffer size, stencil size, accum size, etc. + * This is the best we can do with a client-side emulation of GLX. */ static XMesaVisual create_glx_visual( Display *dpy, XVisualInfo *visinfo ) @@ -315,7 +329,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) GL_FALSE, /* stereo */ 0, /* depth bits */ 0, /* stencil bits */ - 0, /* accum bits */ + 0,0,0,0, /* accum bits */ vislevel /* level */ ); } @@ -328,9 +342,12 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) GL_FALSE, /* alpha */ GL_TRUE, /* double */ GL_FALSE, /* stereo */ - 8*sizeof(GLdepth), - 8*sizeof(GLstencil), - 8*sizeof(GLaccum), + DEFAULT_SOFTWARE_DEPTH_BITS, + 8 * sizeof(GLstencil), + 8 * sizeof(GLaccum), /* r */ + 8 * sizeof(GLaccum), /* g */ + 8 * sizeof(GLaccum), /* b */ + 8 * sizeof(GLaccum), /* a */ 0 /* level */ ); } @@ -860,11 +877,15 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) GLboolean stereo_flag = GL_FALSE; GLint depth_size = 0; GLint stencil_size = 0; - GLint accum_size = 0; + GLint accumRedSize = 0; + GLint accumGreenSize = 0; + GLint accumBlueSize = 0; + GLint accumAlphaSize = 0; int level = 0; int visual_type = DONT_CARE; int trans_type = DONT_CARE; int trans_value = DONT_CARE; + GLint caveat = DONT_CARE; parselist = list; @@ -927,13 +948,31 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) stencil_size = *parselist++; break; case GLX_ACCUM_RED_SIZE: + parselist++; + { + GLint size = *parselist++; + accumRedSize = MAX2( accumRedSize, size ); + } + break; case GLX_ACCUM_GREEN_SIZE: + parselist++; + { + GLint size = *parselist++; + accumGreenSize = MAX2( accumGreenSize, size ); + } + break; case GLX_ACCUM_BLUE_SIZE: + parselist++; + { + GLint size = *parselist++; + accumBlueSize = MAX2( accumBlueSize, size ); + } + break; case GLX_ACCUM_ALPHA_SIZE: parselist++; { GLint size = *parselist++; - accum_size = MAX2( accum_size, size ); + accumAlphaSize = MAX2( accumAlphaSize, size ); } break; @@ -961,6 +1000,14 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) parselist++; break; + /* + * GLX_EXT_visual_info extension + */ + case GLX_VISUAL_CAVEAT_EXT: + parselist++; + caveat = *parselist++; /* ignored for now */ + break; + case None: break; default: @@ -990,7 +1037,7 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) else { /* Get a color index visual */ vis = choose_x_visual( dpy, screen, rgb_flag, min_ci, visual_type ); - accum_size = 0; + accumRedSize = accumGreenSize = accumBlueSize = accumAlphaSize = 0; } } else { @@ -1013,9 +1060,33 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) } if (vis) { + /* Note: we're not exactly obeying the glXChooseVisual rules here. + * When GLX_DEPTH_SIZE = 1 is specified we're supposed to choose the + * largest depth buffer size, which is 32bits/value. However, we + * return 16 to maintain performance with earlier versions of Mesa. + */ + if (depth_size == 1) + depth_size = DEFAULT_SOFTWARE_DEPTH_BITS; + else if (depth_size > 24) + depth_size = 31; + else if (depth_size > 16) + depth_size = 24; + /* we only support one size of stencil and accum buffers. */ + if (stencil_size > 0) + stencil_size = STENCIL_BITS; + if (accumRedSize > 0) + accumRedSize = ACCUM_BITS; + if (accumGreenSize > 0) + accumGreenSize = ACCUM_BITS; + if (accumBlueSize > 0) + accumBlueSize = ACCUM_BITS; + if (accumAlphaSize > 0) + accumAlphaSize = ACCUM_BITS; if (!save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag, - stereo_flag, - depth_size, stencil_size, accum_size, level )) + stereo_flag, depth_size, stencil_size, + accumRedSize, accumGreenSize, + accumBlueSize, accumAlphaSize, + level )) return NULL; } @@ -1227,6 +1298,7 @@ Fake_glXQueryExtension( Display *dpy, int *errorb, int *event ) } +extern void _kw_ungrab_all( Display *dpy ); void _kw_ungrab_all( Display *dpy ) { XUngrabPointer( dpy, CurrentTime ); @@ -1372,15 +1444,16 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, *value = glxvis->gl_visual->StencilBits; return 0; case GLX_ACCUM_RED_SIZE: + *value = glxvis->gl_visual->AccumRedBits; + return 0; case GLX_ACCUM_GREEN_SIZE: + *value = glxvis->gl_visual->AccumGreenBits; + return 0; case GLX_ACCUM_BLUE_SIZE: - *value = glxvis->gl_visual->AccumBits; + *value = glxvis->gl_visual->AccumBlueBits; return 0; case GLX_ACCUM_ALPHA_SIZE: - if (glxvis->gl_visual->AlphaBits > 0) - *value = glxvis->gl_visual->AccumBits; - else - *value = 0; + *value = glxvis->gl_visual->AccumAlphaBits; return 0; /* @@ -1438,6 +1511,17 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, return 0; /* + * GLX_EXT_visual_info extension + */ + case GLX_VISUAL_CAVEAT_EXT: + /* test for zero, just in case */ + if (glxvis->VisualCaveat > 0) + *value = glxvis->VisualCaveat; + else + *value = GLX_NONE_EXT; + return 0; + + /* * Extensions */ default: @@ -1472,10 +1556,10 @@ static const char *get_extensions( void ) #ifdef FX const char *fx = getenv("MESA_GLX_FX"); if (fx && fx[0] != 'd') { - return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address"; + return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address"; } #endif - return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_ARB_get_proc_address"; + return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_ARB_get_proc_address"; } @@ -1544,7 +1628,7 @@ Fake_glXGetClientString( Display *dpy, int name ) * GLX 1.3 and later */ -static GLXFBConfig +static GLXFBConfig * Fake_glXChooseFBConfig( Display *dpy, int screen, const int *attribList, int *nitems ) { @@ -1568,6 +1652,16 @@ Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, } +static GLXFBConfig * +Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements ) +{ + (void) dpy; + (void) screen; + (void) nelements; + return 0; +} + + static XVisualInfo * Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) { @@ -1745,6 +1839,7 @@ Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) extern void Fake_glXUseXFont( Font font, int first, int count, int listbase ); +extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); struct _glxapi_table *_mesa_GetGLXDispatchTable(void) { static struct _glxapi_table glx; diff --git a/xc/extras/Mesa/src/X/glxapi.c b/xc/extras/Mesa/src/X/glxapi.c index 5ee5d7419..85b81c900 100644 --- a/xc/extras/Mesa/src/X/glxapi.c +++ b/xc/extras/Mesa/src/X/glxapi.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -168,8 +168,7 @@ XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *list) } -void glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, - unsigned long mask) +void glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask) { struct _glxapi_table *t = get_dispatch(dpy); if (!t) @@ -359,7 +358,7 @@ Display *glXGetCurrentDisplay(void) #ifdef _GLXAPI_VERSION_1_3 -GLXFBConfig glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) +GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) { struct _glxapi_table *t = get_dispatch(dpy); if (!t) @@ -446,6 +445,14 @@ int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *v } +GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements) +{ + struct _glxapi_table *t = get_dispatch(dpy); + if (!t) + return 0; + return (t->GetFBConfigs)(dpy, screen, nelements); +} + void glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask) { struct _glxapi_table *t = get_dispatch(dpy); diff --git a/xc/extras/Mesa/src/X/glxapi.h b/xc/extras/Mesa/src/X/glxapi.h index ae8433987..7d017dadc 100644 --- a/xc/extras/Mesa/src/X/glxapi.h +++ b/xc/extras/Mesa/src/X/glxapi.h @@ -83,7 +83,7 @@ struct _glxapi_table { #endif #ifdef _GLXAPI_VERSION_1_3 - GLXFBConfig (*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems); + GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems); GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct); GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList); GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList); @@ -93,6 +93,7 @@ struct _glxapi_table { void (*DestroyWindow)(Display *dpy, GLXWindow window); /*GLXDrawable (*GetCurrentReadDrawable)(void);*/ int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value); + GLXFBConfig *(*GetFBConfigs)(Display *dpy, int screen, int *nelements); void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask); XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config); Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); diff --git a/xc/extras/Mesa/src/X/xmesa1.c b/xc/extras/Mesa/src/X/xmesa1.c index 4eb5cc82b..618475d1c 100644 --- a/xc/extras/Mesa/src/X/xmesa1.c +++ b/xc/extras/Mesa/src/X/xmesa1.c @@ -72,6 +72,11 @@ #endif +#ifndef GLX_NONE_EXT +#define GLX_NONE_EXT 0x8000 +#endif + + /* * Current X/Mesa context pointer: */ @@ -418,7 +423,7 @@ static void free_xmesa_buffer(int client, XMesaBuffer buffer) } -/* Copy X color table stuff from on XMesaBuffer to another. */ +/* Copy X color table stuff from one XMesaBuffer to another. */ static void copy_colortable_info(XMesaBuffer dst, const XMesaBuffer src) { MEMCPY(dst->color_table, src->color_table, sizeof(src->color_table)); @@ -1408,21 +1413,29 @@ unsigned long xmesa_color_to_pixel( XMesaContext xmesa, /* * Create a new X/Mesa visual. - * Input: display - the X display - * visinfo - the XVisualInfo - * rgb_flag - TRUE=RGB(A) mode, FALSE=CI mode - * alpha_flag - need alpha planes? - * db_flag - TRUE=double bufferd, FALSE=single - * stereo_flag - true/false - * ximage_flag - TRUE=use XImage for back buffer, FALSE=use Pixmap - * depth_size - requested min bits per depth buffer value - * stencil_size - requested min bits per stencil buffer value - * accum_size - requested min bits per accum buffer value (per channel) - * level - 0=normal, 1=overaly, -1=underlay, etc. - * Return: New XMesaVisual or NULL if something goes wrong + * Input: display - X11 display + * visinfo - an XVisualInfo pointer + * rgb_flag - GL_TRUE = RGB mode, + * GL_FALSE = color index mode + * alpha_flag - alpha buffer requested? + * db_flag - GL_TRUE = double-buffered, + * GL_FALSE = single buffered + * stereo_flag - stereo visual? + * ximage_flag - GL_TRUE = use an XImage for back buffer, + * GL_FALSE = use an off-screen pixmap for back buffer + * depth_size - requested bits/depth values, or zero + * stencil_size - requested bits/stencil values, or zero + * accum_red_size - requested bits/red accum values, or zero + * accum_green_size - requested bits/green accum values, or zero + * accum_blue_size - requested bits/blue accum values, or zero + * accum_alpha_size - requested bits/alpha accum values, or zero + * num_samples - number of samples/pixel if multisampling, or zero + * level - visual level, usually 0 + * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT + * Return; a new XMesaVisual or 0 if error. */ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, - XMesaVisualInfo visinfo, + XMesaVisualInfo visinfo, GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, @@ -1430,8 +1443,13 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, - GLint accum_size, - GLint level ) + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ) { char *gamma; XMesaVisual v; @@ -1506,6 +1524,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, v->ximage_flag = ximage_flag; v->level = level; + v->VisualCaveat = visualCaveat; (void) initialize_visual_and_buffer( 0, v, NULL, rgb_flag, 0, 0 ); @@ -1532,11 +1551,16 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, } } - v->gl_visual = gl_create_visual( rgb_flag, alpha_flag, db_flag, stereo_flag, - depth_size, stencil_size, accum_size, - v->index_bits, - red_bits, green_bits, - blue_bits, alpha_bits ); + v->gl_visual = _mesa_create_visual( rgb_flag, alpha_flag, + db_flag, stereo_flag, + red_bits, green_bits, + blue_bits, alpha_bits, + v->index_bits, + depth_size, + stencil_size, + accum_red_size, accum_green_size, + accum_blue_size, accum_alpha_size, + 0 ); if (!v->gl_visual) { #ifndef XFree86Server FREE(v->visinfo); @@ -1557,7 +1581,7 @@ void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ) void XMesaDestroyVisual( XMesaVisual v ) { - gl_destroy_visual( v->gl_visual ); + _mesa_destroy_visual( v->gl_visual ); #ifndef XFree86Server FREE(v->visinfo); #endif @@ -1594,6 +1618,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list return NULL; } + gl_extensions_enable(c->gl_ctx, "GL_HP_occlusion_test"); + if (CHECK_BYTE_ORDER(v)) { c->swapbytes = GL_FALSE; } @@ -1750,7 +1776,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, b->gl_buffer = gl_create_framebuffer( v->gl_visual, v->gl_visual->DepthBits > 0, v->gl_visual->StencilBits > 0, - v->gl_visual->AccumBits > 0, + v->gl_visual->AccumRedBits > 0, v->gl_visual->AlphaBits > 0 ); if (!b->gl_buffer) { free_xmesa_buffer(client, b); @@ -1778,9 +1804,9 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, if (v->gl_visual->DBflag) { attribs[numAttribs++] = FXMESA_DOUBLEBUFFER; } - if (v->gl_visual->AccumBits > 0) { + if (v->gl_visual->AccumRedBits > 0) { attribs[numAttribs++] = FXMESA_ACCUM_SIZE; - attribs[numAttribs++] = v->gl_visual->AccumBits; + attribs[numAttribs++] = v->gl_visual->AccumRedBits; } if (v->gl_visual->StencilBits > 0) { attribs[numAttribs++] = FXMESA_STENCIL_SIZE; @@ -1897,7 +1923,9 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, b->gl_buffer = gl_create_framebuffer( v->gl_visual, v->gl_visual->DepthBits > 0, v->gl_visual->StencilBits > 0, - v->gl_visual->AccumBits > 0, + v->gl_visual->AccumRedBits + + v->gl_visual->AccumGreenBits + + v->gl_visual->AccumBlueBits > 0, v->gl_visual->AlphaBits > 0 ); if (!b->gl_buffer) { free_xmesa_buffer(client, b); diff --git a/xc/extras/Mesa/src/X/xmesa2.c b/xc/extras/Mesa/src/X/xmesa2.c index 3d56184b8..b02dc66d6 100644 --- a/xc/extras/Mesa/src/X/xmesa2.c +++ b/xc/extras/Mesa/src/X/xmesa2.c @@ -36,8 +36,12 @@ #include "drawpix.h" #include "mem.h" #include "state.h" +#include "depth.h" +#include "macros.h" +#include "vb.h" #include "types.h" #include "xmesaP.h" +#include "extensions.h" @@ -713,7 +717,7 @@ clear_16bit_ximage( GLcontext *ctx, GLboolean all, } -/* Optimized code provided by Nozomi Ytow <nozomi@biol.tsukuba.ac.jp> */ +/* Optimized code provided by Nozomi Ytow <noz@xfree86.org> */ static void clear_24bit_ximage( GLcontext *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height ) @@ -731,14 +735,31 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, } if (all) { - register GLint n = xmesa->xm_buffer->width * xmesa->xm_buffer->height; - register bgr_t *ptr3 = (bgr_t *) xmesa->xm_buffer->backimage->data; if (r==g && g==b) { /* same value for all three components (gray) */ - MEMSET(ptr3, r, 3 * n); + const GLint w3 = xmesa->xm_buffer->width * 3; + const GLint h = xmesa->xm_buffer->height; + GLint i; + for (i = 0; i < h; i++) { + bgr_t *ptr3 = PIXELADDR3(xmesa->xm_buffer, 0, i); + MEMSET(ptr3, r, w3); + } } else { /* the usual case */ + const GLint w = xmesa->xm_buffer->width; + const GLint h = xmesa->xm_buffer->height; + GLint i, j; + for (i = 0; i < h; i++) { + bgr_t *ptr3 = PIXELADDR3(xmesa->xm_buffer, 0, i); + for (j = 0; j < w; j++) { + ptr3->r = r; + ptr3->g = g; + ptr3->b = b; + ptr3++; + } + } +#if 0 /* this code doesn't work for all window widths */ register GLuint *ptr4 = (GLuint *) ptr3; register GLuint px; GLuint pixel4[3]; @@ -805,6 +826,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, case 0: break; } +#endif } } else { @@ -819,6 +841,17 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, } else { /* non-gray clear color */ + GLint i, j; + for (j = 0; j < height; j++) { + bgr_t *ptr3 = PIXELADDR3( xmesa->xm_buffer, x, y+j ); + for (i = 0; i < width; i++) { + ptr3->r = r; + ptr3->g = g; + ptr3->b = b; + ptr3++; + } + } +#if 0 /* this code might not always (seems ptr3 always == ptr4) */ GLint j; GLuint pixel4[3]; pixel4[0] = clearPixel | (clearPixel << 24); @@ -889,6 +922,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, break; } } +#endif } } } @@ -2342,9 +2376,24 @@ static void write_span_5R6G5B_ximage( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - for (i=0;i<n;i++) { - ptr[i] = PACK_5R6G5B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + GLuint p0, p1; + p0 = PACK_5R6G5B(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); + p1 = PACK_5R6G5B(rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP]); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + ptr[n] = PACK_5R6G5B(rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]); + } +#else + for (i = 0; i < n; i++) { + ptr[i] = PACK_5R6G5B(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); } +#endif } } @@ -2366,9 +2415,24 @@ static void write_span_DITHER_5R6G5B_ximage( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - for (i=0;i<n;i++,x++) { - PACK_TRUEDITHER( ptr[i], x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2, x += 2) { + GLuint p0, p1; + PACK_TRUEDITHER( p0, x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); + PACK_TRUEDITHER( p1, x+1, y, rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP] ); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + PACK_TRUEDITHER( ptr[n], x+n, y, rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]); } +#else + for (i = 0; i < n; i++, x++) { + PACK_TRUEDITHER( ptr[i], x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); + } +#endif } } @@ -2390,9 +2454,24 @@ static void write_span_rgb_5R6G5B_ximage( RGB_SPAN_ARGS ) } else { /* draw all pixels */ +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + GLuint p0, p1; + p0 = PACK_5R6G5B(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); + p1 = PACK_5R6G5B(rgb[i+1][RCOMP], rgb[i+1][GCOMP], rgb[i+1][BCOMP]); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + ptr[n] = PACK_5R6G5B(rgb[n][RCOMP], rgb[n][GCOMP], rgb[n][BCOMP]); + } +#else for (i=0;i<n;i++) { ptr[i] = PACK_5R6G5B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); } +#endif } } @@ -2414,9 +2493,24 @@ static void write_span_rgb_DITHER_5R6G5B_ximage( RGB_SPAN_ARGS ) } else { /* draw all pixels */ +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2, x += 2) { + GLuint p0, p1; + PACK_TRUEDITHER( p0, x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); + PACK_TRUEDITHER( p1, x+1, y, rgb[i+1][RCOMP], rgb[i+1][GCOMP], rgb[i+1][BCOMP] ); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + PACK_TRUEDITHER( ptr[n], x+n, y, rgb[n][RCOMP], rgb[n][GCOMP], rgb[n][BCOMP]); + } +#else for (i=0;i<n;i++,x++) { PACK_TRUEDITHER( ptr[i], x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); } +#endif } } @@ -4280,7 +4374,6 @@ static void read_color_span( const GLcontext *ctx, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaBuffer source; - register GLuint i; if (xmesa->use_read_buffer) source = xmesa->xm_read_buffer; @@ -4288,6 +4381,7 @@ static void read_color_span( const GLcontext *ctx, source = xmesa->xm_buffer; if (source->buffer) { + /* Read from Pixmap or Window */ XMesaImage *span = NULL; int error; #ifdef XFree86Server @@ -4307,18 +4401,17 @@ static void read_color_span( const GLcontext *ctx, switch (xmesa->pixelformat) { case PF_TRUECOLOR: case PF_TRUEDITHER: - case PF_5R6G5B: - case PF_DITHER_5R6G5B: { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); - GLubyte *pixelToR = xmesa->xm_visual->PixelToR; - GLubyte *pixelToG = xmesa->xm_visual->PixelToG; - GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; + GLuint i; for (i=0;i<n;i++) { unsigned long p; p = XMesaGetPixel( span, i, 0 ); @@ -4329,9 +4422,31 @@ static void read_color_span( const GLcontext *ctx, } } break; + case PF_5R6G5B: + case PF_DITHER_5R6G5B: + { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; + GLuint i; + for (i=0;i<n;i++) { + unsigned long p = XMesaGetPixel( span, i, 0 ); + /* fast, but not quite accurate + rgba[i][RCOMP] = ((p >> 8) & 0xf8); + rgba[i][GCOMP] = ((p >> 3) & 0xfc); + rgba[i][BCOMP] = ((p << 3) & 0xff); + */ + rgba[i][RCOMP] = pixelToR[p >> 11]; + rgba[i][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p & 0x1f]; + rgba[i][ACOMP] = 255; + } + } + break; case PF_8A8B8G8R: { - GLuint *ptr4 = (GLuint *) span->data; + const GLuint *ptr4 = (GLuint *) span->data; + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ( p4 & 0xff); @@ -4343,7 +4458,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B: { - GLuint *ptr4 = (GLuint *) span->data; + const GLuint *ptr4 = (GLuint *) span->data; + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); @@ -4355,7 +4471,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B24: { - bgr_t *ptr3 = (bgr_t *) span->data; + const bgr_t *ptr3 = (bgr_t *) span->data; + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = ptr3[i].r; rgba[i][GCOMP] = ptr3[i].g; @@ -4367,6 +4484,7 @@ static void read_color_span( const GLcontext *ctx, case PF_HPCR: { GLubyte *ptr1 = (GLubyte *) span->data; + GLuint i; for (i=0;i<n;i++) { GLubyte p = *ptr1++; rgba[i][RCOMP] = p & 0xE0; @@ -4384,7 +4502,8 @@ static void read_color_span( const GLcontext *ctx, GLubyte *gTable = source->pixel_to_g; GLubyte *bTable = source->pixel_to_b; if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { - GLubyte *ptr1 = (GLubyte *) span->data; + const GLubyte *ptr1 = (GLubyte *) span->data; + GLuint i; for (i=0;i<n;i++) { unsigned long p = *ptr1++; rgba[i][RCOMP] = rTable[p]; @@ -4394,9 +4513,9 @@ static void read_color_span( const GLcontext *ctx, } } else { + GLuint i; for (i=0;i<n;i++) { - unsigned long p; - p = XMesaGetPixel( span, i, 0 ); + unsigned long p = XMesaGetPixel( span, i, 0 ); rgba[i][RCOMP] = rTable[p]; rgba[i][GCOMP] = gTable[p]; rgba[i][BCOMP] = bTable[p]; @@ -4408,6 +4527,7 @@ static void read_color_span( const GLcontext *ctx, case PF_1BIT: { int bitFlip = xmesa->xm_visual->bitFlip; + GLuint i; for (i=0;i<n;i++) { unsigned long p; p = XMesaGetPixel( span, i, 0 ) ^ bitFlip; @@ -4425,6 +4545,7 @@ static void read_color_span( const GLcontext *ctx, } else { /* return black pixels */ + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = rgba[i][ACOMP] = 0; } @@ -4434,22 +4555,22 @@ static void read_color_span( const GLcontext *ctx, } } else if (source->backimage) { + /* Read from XImage back buffer */ switch (xmesa->pixelformat) { case PF_TRUECOLOR: case PF_TRUEDITHER: - case PF_5R6G5B: - case PF_DITHER_5R6G5B: { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); - GLubyte *pixelToR = xmesa->xm_visual->PixelToR; - GLubyte *pixelToG = xmesa->xm_visual->PixelToG; - GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; XMesaImage *img = source->backimage; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++) { unsigned long p; @@ -4461,9 +4582,58 @@ static void read_color_span( const GLcontext *ctx, } } break; + case PF_5R6G5B: + case PF_DITHER_5R6G5B: + { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; + const GLushort *ptr2 = PIXELADDR2( source, x, y ); + const GLuint *ptr4 = (const GLuint *) ptr2; + GLuint i; +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + const GLuint p = *ptr4++; + const GLuint p0 = p & 0xffff; + const GLuint p1 = p >> 16; + /* fast, but not quite accurate + rgba[i][RCOMP] = ((p >> 8) & 0xf8); + rgba[i][GCOMP] = ((p >> 3) & 0xfc); + rgba[i][BCOMP] = ((p << 3) & 0xff); + */ + rgba[i][RCOMP] = pixelToR[p0 >> 11]; + rgba[i][GCOMP] = pixelToG[(p0 >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p0 & 0x1f]; + rgba[i][ACOMP] = 255; + rgba[i+1][RCOMP] = pixelToR[p1 >> 11]; + rgba[i+1][GCOMP] = pixelToG[(p1 >> 5) & 0x3f]; + rgba[i+1][BCOMP] = pixelToB[p1 & 0x1f]; + rgba[i+1][ACOMP] = 255; + } + if (extraPixel) { + GLushort p = ptr2[n]; + rgba[n][RCOMP] = pixelToR[p >> 11]; + rgba[n][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[n][BCOMP] = pixelToB[p & 0x1f]; + rgba[n][ACOMP] = 255; + } +#else + for (i = 0; i < n; i++) { + const GLushort p = ptr2[i]; + rgba[i][RCOMP] = pixelToR[p >> 11]; + rgba[i][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p & 0x1f]; + rgba[i][ACOMP] = 255; + } +#endif + } + break; case PF_8A8B8G8R: { - GLuint *ptr4 = PIXELADDR4( source, x, y ); + const GLuint *ptr4 = PIXELADDR4( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ( p4 & 0xff); @@ -4475,7 +4645,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B: { - GLuint *ptr4 = PIXELADDR4( source, x, y ); + const GLuint *ptr4 = PIXELADDR4( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); @@ -4487,7 +4658,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B24: { - bgr_t *ptr3 = PIXELADDR3( source, x, y ); + const bgr_t *ptr3 = PIXELADDR3( source, x, y ); + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = ptr3[i].r; rgba[i][GCOMP] = ptr3[i].g; @@ -4498,7 +4670,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_HPCR: { - GLubyte *ptr1 = PIXELADDR1( source, x, y ); + const GLubyte *ptr1 = PIXELADDR1( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLubyte p = *ptr1++; rgba[i][RCOMP] = p & 0xE0; @@ -4512,11 +4685,12 @@ static void read_color_span( const GLcontext *ctx, case PF_LOOKUP: case PF_GRAYSCALE: { - GLubyte *rTable = source->pixel_to_r; - GLubyte *gTable = source->pixel_to_g; - GLubyte *bTable = source->pixel_to_b; + const GLubyte *rTable = source->pixel_to_r; + const GLubyte *gTable = source->pixel_to_g; + const GLubyte *bTable = source->pixel_to_b; if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { GLubyte *ptr1 = PIXELADDR1( source, x, y ); + GLuint i; for (i=0;i<n;i++) { unsigned long p = *ptr1++; rgba[i][RCOMP] = rTable[p]; @@ -4527,10 +4701,10 @@ static void read_color_span( const GLcontext *ctx, } else { XMesaImage *img = source->backimage; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++,x++) { - unsigned long p; - p = XMesaGetPixel( img, x, y ); + unsigned long p = XMesaGetPixel( img, x, y ); rgba[i][RCOMP] = rTable[p]; rgba[i][GCOMP] = gTable[p]; rgba[i][BCOMP] = bTable[p]; @@ -4543,6 +4717,7 @@ static void read_color_span( const GLcontext *ctx, { XMesaImage *img = source->backimage; int bitFlip = xmesa->xm_visual->bitFlip; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++,x++) { unsigned long p; @@ -4936,7 +5111,6 @@ static const GLubyte *get_string( GLcontext *ctx, GLenum name ) } - static void update_span_funcs( GLcontext *ctx ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; diff --git a/xc/extras/Mesa/src/X/xmesaP.h b/xc/extras/Mesa/src/X/xmesaP.h index 9b79f4314..bba11808e 100644 --- a/xc/extras/Mesa/src/X/xmesaP.h +++ b/xc/extras/Mesa/src/X/xmesaP.h @@ -85,6 +85,7 @@ struct xmesa_visual { GLint BitsPerPixel; /* True bits per pixel for XImages */ GLint level; /* 0=normal, 1=overlay, etc */ + GLint VisualCaveat; /* for GLX_EXT_visual_rating extension */ GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */ diff --git a/xc/extras/Mesa/src/X86/assyntax.h b/xc/extras/Mesa/src/X86/assyntax.h index 43164d907..2a1034870 100644 --- a/xc/extras/Mesa/src/X86/assyntax.h +++ b/xc/extras/Mesa/src/X86/assyntax.h @@ -243,10 +243,7 @@ #endif /* ACK_ASSEMBLER */ -#if (defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) \ - || (defined(linux) || defined(__OS2ELF__)) && defined(__ELF__) \ - || defined(__FreeBSD__) && __FreeBSD__ >= 3) \ - || (defined(__NetBSD__) && defined(__ELF__)) +#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) #define GLNAME(a) a #else #define GLNAME(a) CONCAT(_,a) @@ -851,6 +848,8 @@ #define P_XMM6 xmm6 #define P_XMM7 xmm7 +#define CONCAT(x, y) x ## y + #if defined(NASM_ASSEMBLER) #define ST(n) st ## n diff --git a/xc/extras/Mesa/src/X86/x86.c b/xc/extras/Mesa/src/X86/x86.c index 223cf61c8..d145810c2 100644 --- a/xc/extras/Mesa/src/X86/x86.c +++ b/xc/extras/Mesa/src/X86/x86.c @@ -39,6 +39,7 @@ #include "xform.h" #include "x86.h" +#ifdef USE_X86_ASM extern void _ASMAPI gl_v16_x86_cliptest_points4(GLfloat *first_vert, GLfloat *last_vert, GLubyte *or_mask, @@ -51,7 +52,7 @@ extern void _ASMAPI gl_v16_x86_general_xform(GLfloat *dest, const GLfloat *src, GLuint src_stride, GLuint count); - +#endif #define XFORM_ARGS GLvector4f *to_vec, \ @@ -110,6 +111,7 @@ void gl_init_x86_asm_transforms( void ) ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 3, masked ) ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 4, masked ) + /* XXX this function has been found to cause FP overflow exceptions */ gl_clip_tab[4] = gl_x86_cliptest_points4; #ifdef DEBUG diff --git a/xc/extras/Mesa/src/aatriangle.c b/xc/extras/Mesa/src/aatriangle.c index 28a1952b5..cb6adcd6f 100644 --- a/xc/extras/Mesa/src/aatriangle.c +++ b/xc/extras/Mesa/src/aatriangle.c @@ -44,7 +44,7 @@ * Compute coefficients of a plane using the X,Y coords of the v0, v1, v2 * vertices and the given Z values. */ -static void +static INLINE void compute_plane(const GLfloat v0[], const GLfloat v1[], const GLfloat v2[], GLfloat z0, GLfloat z1, GLfloat z2, GLfloat plane[4]) { @@ -71,7 +71,7 @@ compute_plane(const GLfloat v0[], const GLfloat v1[], const GLfloat v2[], /* * Compute coefficients of a plane with a constant Z value. */ -static void +static INLINE void constant_plane(GLfloat value, GLfloat plane[4]) { plane[0] = 0.0; @@ -93,7 +93,7 @@ do { \ /* * Solve plane equation for Z at (X,Y). */ -static GLfloat +static INLINE GLfloat solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) { GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; @@ -108,7 +108,7 @@ solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) /* * Return 1 / solve_plane(). */ -static GLfloat +static INLINE GLfloat solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) { GLfloat z = -plane[2] / (plane[3] + plane[0] * x + plane[1] * y); @@ -120,7 +120,7 @@ solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) /* * Solve plane and return clamped GLubyte value. */ -static GLubyte +static INLINE GLubyte solve_plane_0_255(GLfloat x, GLfloat y, const GLfloat plane[4]) { GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2] + 0.5F; @@ -323,7 +323,7 @@ index_aa_tri(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv) /* * Compute mipmap level of detail. */ -static GLfloat +static INLINE GLfloat compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], GLfloat invQ, GLfloat width, GLfloat height) { diff --git a/xc/extras/Mesa/src/aatritemp.h b/xc/extras/Mesa/src/aatritemp.h index 94727b1a4..976ee9689 100644 --- a/xc/extras/Mesa/src/aatritemp.h +++ b/xc/extras/Mesa/src/aatritemp.h @@ -124,6 +124,10 @@ return; } +#ifndef DO_OCCLUSION_TEST + ctx->OcclusionResult = GL_TRUE; +#endif + /* plane setup */ #ifdef DO_Z compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane); @@ -480,3 +484,7 @@ #ifdef DO_STUV1 #undef DO_STUV1 #endif + +#ifdef DO_OCCLUSION_TEST +#undef DO_OCCLUSION_TEST +#endif diff --git a/xc/extras/Mesa/src/accum.c b/xc/extras/Mesa/src/accum.c index e4e7cfec8..28f92a2d3 100644 --- a/xc/extras/Mesa/src/accum.c +++ b/xc/extras/Mesa/src/accum.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -144,7 +144,7 @@ _mesa_Accum( GLenum op, GLfloat value ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum"); - if (ctx->Visual->AccumBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) { + if (ctx->Visual->AccumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) { gl_error(ctx, GL_INVALID_OPERATION, "glAccum"); return; } @@ -374,7 +374,7 @@ _mesa_Accum( GLenum op, GLfloat value ) rgba[i][ACOMP] = multTable[acc[i4+3]]; } if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, width, xpos, ypos, rgba ); + _mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba ); } (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, (const GLubyte (*)[4])rgba, NULL ); @@ -401,7 +401,7 @@ _mesa_Accum( GLenum op, GLfloat value ) rgba[i][ACOMP] = CLAMP( a, 0, iChanMax ); } if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, width, xpos, ypos, rgba ); + _mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba ); } (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, (const GLubyte (*)[4])rgba, NULL ); @@ -426,7 +426,7 @@ _mesa_clear_accum_buffer( GLcontext *ctx ) GLuint buffersize; GLfloat acc_scale; - if (ctx->Visual->AccumBits==0) { + if (ctx->Visual->AccumRedBits==0) { /* No accumulation buffer! */ return; } @@ -486,7 +486,7 @@ _mesa_clear_accum_buffer( GLcontext *ctx ) ctx->Accum.ClearColor[2]==0.0 && ctx->Accum.ClearColor[3]==0.0) { /* Black */ - MEMSET( ctx->DrawBuffer->Accum, 0, buffersize * 4 * sizeof(GLaccum) ); + BZERO( ctx->DrawBuffer->Accum, buffersize * 4 * sizeof(GLaccum) ); } else { /* Not black */ diff --git a/xc/extras/Mesa/src/alphabuf.c b/xc/extras/Mesa/src/alphabuf.c index 50bc80d4b..ab65a71dc 100644 --- a/xc/extras/Mesa/src/alphabuf.c +++ b/xc/extras/Mesa/src/alphabuf.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -122,7 +122,8 @@ alloc_alpha_buffers( GLcontext *ctx, GLframebuffer *buf ) /* * Allocate a new front and back alpha buffer. */ -void gl_alloc_alpha_buffers( GLcontext *ctx ) +void +_mesa_alloc_alpha_buffers( GLcontext *ctx ) { alloc_alpha_buffers( ctx, ctx->DrawBuffer ); if (ctx->ReadBuffer != ctx->DrawBuffer) { @@ -134,7 +135,8 @@ void gl_alloc_alpha_buffers( GLcontext *ctx ) /* * Clear all the alpha buffers */ -void gl_clear_alpha_buffers( GLcontext *ctx ) +void +_mesa_clear_alpha_buffers( GLcontext *ctx ) { const GLubyte aclear = (GLint) (ctx->Color.ClearColor[3] * 255.0F); GLuint bufferBit; @@ -183,8 +185,9 @@ void gl_clear_alpha_buffers( GLcontext *ctx ) -void gl_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - CONST GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], const GLubyte mask[] ) { GLubyte *aptr = ALPHA_DRAW_ADDR( x, y ); GLuint i; @@ -205,8 +208,9 @@ void gl_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, } -void gl_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLubyte alpha, const GLubyte mask[] ) +void +_mesa_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + GLubyte alpha, const GLubyte mask[] ) { GLubyte *aptr = ALPHA_DRAW_ADDR( x, y ); GLuint i; @@ -227,9 +231,10 @@ void gl_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, } -void gl_write_alpha_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - CONST GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_write_alpha_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[] ) { GLuint i; @@ -250,9 +255,10 @@ void gl_write_alpha_pixels( GLcontext *ctx, } -void gl_write_mono_alpha_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte alpha, const GLubyte mask[] ) +void +_mesa_write_mono_alpha_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte alpha, const GLubyte mask[] ) { GLuint i; @@ -274,8 +280,9 @@ void gl_write_mono_alpha_pixels( GLcontext *ctx, -void gl_read_alpha_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) +void +_mesa_read_alpha_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { GLubyte *aptr = ALPHA_READ_ADDR( x, y ); GLuint i; @@ -285,9 +292,10 @@ void gl_read_alpha_span( GLcontext *ctx, } -void gl_read_alpha_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_read_alpha_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ) { GLuint i; for (i=0;i<n;i++) { diff --git a/xc/extras/Mesa/src/alphabuf.h b/xc/extras/Mesa/src/alphabuf.h index 260b1c910..22f4b253e 100644 --- a/xc/extras/Mesa/src/alphabuf.h +++ b/xc/extras/Mesa/src/alphabuf.h @@ -31,42 +31,49 @@ #include "types.h" -extern void gl_alloc_alpha_buffers( GLcontext *ctx ); +extern void +_mesa_alloc_alpha_buffers( GLcontext *ctx ); -extern void gl_clear_alpha_buffers( GLcontext *ctx ); +extern void +_mesa_clear_alpha_buffers( GLcontext *ctx ); -extern void gl_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - CONST GLubyte rgba[][4], const GLubyte mask[] ); +extern void +_mesa_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], const GLubyte mask[] ); -extern void gl_write_mono_alpha_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, - GLubyte alpha, const GLubyte mask[] ); +extern void +_mesa_write_mono_alpha_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, + GLubyte alpha, const GLubyte mask[] ); -extern void gl_write_alpha_pixels( GLcontext* ctx, - GLuint n, const GLint x[], const GLint y[], - CONST GLubyte rgba[][4], - const GLubyte mask[] ); +extern void +_mesa_write_alpha_pixels( GLcontext* ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], + const GLubyte mask[] ); -extern void gl_write_mono_alpha_pixels( GLcontext* ctx, - GLuint n, const GLint x[], - const GLint y[], GLubyte alpha, - const GLubyte mask[] ); +extern void +_mesa_write_mono_alpha_pixels( GLcontext* ctx, + GLuint n, const GLint x[], + const GLint y[], GLubyte alpha, + const GLubyte mask[] ); -extern void gl_read_alpha_span( GLcontext* ctx, - GLuint n, GLint x, GLint y, - GLubyte rgba[][4] ); +extern void +_mesa_read_alpha_span( GLcontext* ctx, + GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); -extern void gl_read_alpha_pixels( GLcontext* ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[] ); +extern void +_mesa_read_alpha_pixels( GLcontext* ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ); #endif diff --git a/xc/extras/Mesa/src/attrib.c b/xc/extras/Mesa/src/attrib.c index 8ff30b023..d4f765c3f 100644 --- a/xc/extras/Mesa/src/attrib.c +++ b/xc/extras/Mesa/src/attrib.c @@ -176,6 +176,8 @@ _mesa_PushAttrib(GLbitfield mask) attr->Lighting = ctx->Light.Enabled; attr->LineSmooth = ctx->Line.SmoothFlag; attr->LineStipple = ctx->Line.StippleFlag; + attr->Histogram = ctx->Pixel.HistogramEnabled; + attr->MinMax = ctx->Pixel.MinMaxEnabled; attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled; attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled; attr->Map1Color4 = ctx->Eval.Map1Color4; @@ -197,6 +199,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; attr->Normalize = ctx->Transform.Normalize; + attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; attr->PointSmooth = ctx->Point.SmoothFlag; attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; attr->PolygonOffsetLine = ctx->Polygon.OffsetLine; @@ -530,6 +533,7 @@ _mesa_PopAttrib(void) TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, GL_MAP2_VERTEX_4); TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, GL_RESCALE_NORMAL_EXT); + TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, GL_POLYGON_OFFSET_POINT); TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, GL_POLYGON_OFFSET_LINE); diff --git a/xc/extras/Mesa/src/bitmap.c b/xc/extras/Mesa/src/bitmap.c index d729b5436..642bc7d33 100644 --- a/xc/extras/Mesa/src/bitmap.c +++ b/xc/extras/Mesa/src/bitmap.c @@ -167,6 +167,8 @@ _mesa_Bitmap( GLsizei width, GLsizei height, gl_reduced_prim_change( ctx, GL_BITMAP ); } + ctx->OcclusionResult = GL_TRUE; + if (ctx->Driver.Bitmap) { /* let device driver try to render the bitmap */ completed = (*ctx->Driver.Bitmap)( ctx, x, y, width, height, diff --git a/xc/extras/Mesa/src/blend.c b/xc/extras/Mesa/src/blend.c index ab06b695b..86edbd34a 100644 --- a/xc/extras/Mesa/src/blend.c +++ b/xc/extras/Mesa/src/blend.c @@ -825,7 +825,7 @@ _mesa_blend_pixels( GLcontext *ctx, /* Read pixels from current color buffer */ (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_read_alpha_pixels( ctx, n, x, y, dest, mask ); + _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); } if (!ctx->Color.BlendFunc) diff --git a/xc/extras/Mesa/src/buffers.c b/xc/extras/Mesa/src/buffers.c index 7bfcc7cfa..a99110ab6 100644 --- a/xc/extras/Mesa/src/buffers.c +++ b/xc/extras/Mesa/src/buffers.c @@ -109,7 +109,7 @@ clear_color_buffer_with_masking( GLcontext *ctx ) rgba[j][BCOMP] = b; rgba[j][ACOMP] = a; } - gl_mask_rgba_span( ctx, width, x, y + i, rgba ); + _mesa_mask_rgba_span( ctx, width, x, y + i, rgba ); (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i, (CONST GLubyte (*)[4])rgba, NULL ); } @@ -124,7 +124,7 @@ clear_color_buffer_with_masking( GLcontext *ctx ) for (j=0;j<width;j++) { span[j] = ctx->Color.ClearIndex; } - gl_mask_index_span( ctx, width, x, y + i, span ); + _mesa_mask_index_span( ctx, width, x, y + i, span ); (*ctx->Driver.WriteCI32Span)( ctx, width, x, y + i, span, mask ); } } @@ -290,16 +290,16 @@ _mesa_Clear( GLbitfield mask ) /* do software clearing here */ if (newMask) { - if (newMask & ctx->Color.DrawDestMask) clear_color_buffers( ctx ); - if (newMask & GL_DEPTH_BUFFER_BIT) _mesa_clear_depth_buffer( ctx ); - if (newMask & GL_ACCUM_BUFFER_BIT) _mesa_clear_accum_buffer( ctx ); - if (newMask & GL_STENCIL_BUFFER_BIT) gl_clear_stencil_buffer( ctx ); + if (newMask & ctx->Color.DrawDestMask) clear_color_buffers(ctx); + if (newMask & GL_DEPTH_BUFFER_BIT) _mesa_clear_depth_buffer(ctx); + if (newMask & GL_ACCUM_BUFFER_BIT) _mesa_clear_accum_buffer(ctx); + if (newMask & GL_STENCIL_BUFFER_BIT) _mesa_clear_stencil_buffer(ctx); } /* clear software-based alpha buffer(s) */ if ( (mask & GL_COLOR_BUFFER_BIT) && ctx->Visual->SoftwareAlpha && ctx->Color.ColorMask[RCOMP]) { - gl_clear_alpha_buffers( ctx ); + _mesa_clear_alpha_buffers( ctx ); } #ifdef PROFILE @@ -552,12 +552,12 @@ _mesa_ResizeBuffersMESA( void ) _mesa_alloc_depth_buffer( ctx ); } if (ctx->DrawBuffer->UseSoftwareStencilBuffer) { - gl_alloc_stencil_buffer( ctx ); + _mesa_alloc_stencil_buffer( ctx ); } if (ctx->DrawBuffer->UseSoftwareAccumBuffer) { _mesa_alloc_accum_buffer( ctx ); } if (ctx->Visual->SoftwareAlpha) { - gl_alloc_alpha_buffers( ctx ); + _mesa_alloc_alpha_buffers( ctx ); } } diff --git a/xc/extras/Mesa/src/clip.c b/xc/extras/Mesa/src/clip.c index ed986ad6b..6cfd9e245 100644 --- a/xc/extras/Mesa/src/clip.c +++ b/xc/extras/Mesa/src/clip.c @@ -301,10 +301,12 @@ GLuint gl_userclip_point( GLcontext* ctx, const GLfloat v[] ) -#if defined(__i386__) +#if 0 #define NEGATIVE(x) ((*(int *)&x)<0) +#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) #else #define NEGATIVE(x) (x < 0) +#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) #endif @@ -374,13 +376,10 @@ void gl_update_clipmask( GLcontext *ctx ) if (ctx->Visual->RGBAflag) { - if (ctx->Light.ShadeModel==GL_SMOOTH) - { - mask |= CLIP_RGBA0; + mask |= CLIP_RGBA0; - if (ctx->TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_SEPERATE_SPECULAR)) - mask |= CLIP_RGBA1; - } + if (ctx->TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_SEPERATE_SPECULAR)) + mask |= CLIP_RGBA1; if (ctx->Texture.ReallyEnabled & 0xf0) mask |= CLIP_TEX1|CLIP_TEX0; diff --git a/xc/extras/Mesa/src/clip_funcs.h b/xc/extras/Mesa/src/clip_funcs.h index 8c51fe070..5f0591872 100644 --- a/xc/extras/Mesa/src/clip_funcs.h +++ b/xc/extras/Mesa/src/clip_funcs.h @@ -41,7 +41,6 @@ static GLuint TAG(viewclip_line)( struct vertex_buffer *VB, GLubyte mask ) { GLfloat (*coord)[4] = VB->ClipPtr->data; - GLfloat t, dx, dy, dz, dw, neww; GLuint ii = *i, jj = *j; GLuint vlist[2]; GLuint n; @@ -50,31 +49,29 @@ static GLuint TAG(viewclip_line)( struct vertex_buffer *VB, /* * We use 6 instances of this code to clip agains the 6 planes. - * For each plane, we define the OUTSIDE and COMPUTE_INTERSECTION - * macros apprpriately. */ -#define GENERAL_CLIP \ - if (mask & PLANE) { \ - GLuint flagI = INSIDE( ii ); \ - GLuint flagJ = INSIDE( jj ); \ - \ - if (!(flagI|flagJ)) \ - return 0; \ - \ - if (flagI ^ flagJ) { \ - COMPUTE_INTERSECTION( jj, ii, vb_free ); \ - interp( VB, vb_free, t, jj, ii); \ - \ - if (flagI) { \ - VB->ClipMask[jj] |= PLANE; \ - jj = vb_free; \ - } else { \ - VB->ClipMask[ii] |= PLANE; \ - ii = vb_free; \ - } \ - \ - VB->ClipMask[vb_free++] = 0; \ - } \ +#define GENERAL_CLIP \ + if (mask & PLANE) { \ + GLfloat dpI = CLIP_DOTPROD( ii ); \ + GLfloat dpJ = CLIP_DOTPROD( jj ); \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + GLfloat t = dpI / (dpI - dpJ); \ + INTERP_SZ( t, VB->ClipPtr->data, vb_free, ii, jj, SIZE ); \ + interp( VB, vb_free, t, ii, jj); \ + \ + if (NEGATIVE(dpJ)) { \ + VB->ClipMask[jj] |= PLANE; \ + jj = vb_free; \ + VB->ClipMask[vb_free++] = 0; \ + } else { \ + VB->ClipMask[ii] |= PLANE; \ + ii = vb_free; \ + VB->ClipMask[vb_free++] = 0; \ + } \ + } \ + else if (NEGATIVE(dpI)) \ + return 0; \ } #include "general_clip.h" @@ -142,74 +139,78 @@ static GLuint TAG(viewclip_polygon)( struct vertex_buffer *VB, GLfloat (*coord)[4] = VB->ClipPtr->data; GLuint vlist2[VB_SIZE-VB_MAX]; GLuint *inlist = vlist, *outlist = vlist2; - GLdouble dx, dy, dz, dw, t = 0, neww; GLuint i; GLuint vb_free = VB->FirstFree; + GLubyte *clipmask = VB->ClipMask; clip_interp_func interp = VB->ctx->ClipInterpFunc; if (mask & CLIP_ALL_BITS) { #define GENERAL_CLIP \ if (mask & PLANE) { \ - GLuint prevj = inlist[0]; \ - GLuint prevflag = INSIDE(prevj); \ + GLuint idxPrev = inlist[0]; \ + GLfloat dpPrev = CLIP_DOTPROD(idxPrev); \ GLuint outcount = 0; \ GLuint i; \ - \ + \ inlist[n] = inlist[0]; \ - \ + \ for (i = 1; i < n+1; i++) { \ - GLuint j = inlist[i]; \ - GLuint flag = INSIDE(j); \ - \ - if (prevflag) { \ - outlist[outcount++] = prevj; \ - } else { \ - VB->ClipMask[prevj] |= (PLANE&CLIP_ALL_BITS); \ + GLuint idx = inlist[i]; \ + GLfloat dp = CLIP_DOTPROD(idx); \ + \ + clipmask[idxPrev] |= (PLANE&CLIP_ALL_BITS); \ + \ + if (!NEGATIVE(dpPrev)) { \ + outlist[outcount++] = idxPrev; \ + clipmask[idxPrev] &= ~(PLANE&CLIP_ALL_BITS); \ } \ - \ - if (flag ^ prevflag) { \ - if (flag) { \ - /* Coming back in \ + \ + if (DIFFERENT_SIGNS(dp, dpPrev)) { \ + if (NEGATIVE(dp)) { \ + /* Coming back in. Avoid division by zero as we know \ + * dp != dpPrev from DIFFERENT_SIGNS, above. \ */ \ - COMPUTE_INTERSECTION( j, prevj, vb_free ); \ - interp( VB, vb_free, t, j, prevj ); \ + GLfloat t = dp / (dp - dpPrev); \ + INTERP_SZ( t, VB->ClipPtr->data, vb_free, \ + idx, idxPrev, SIZE ); \ + interp( VB, vb_free, t, idx, idxPrev ); \ \ if (IND&CLIP_TAB_EDGEFLAG) \ VB->EdgeFlagPtr->data[vb_free] = \ - VB->EdgeFlagPtr->data[prevj]; \ - \ - \ + VB->EdgeFlagPtr->data[idxPrev]; \ } else { \ /* Going out of bounds \ */ \ - COMPUTE_INTERSECTION( prevj, j, vb_free ); \ - interp( VB, vb_free, t, prevj, j ); \ + GLfloat t = dpPrev / (dpPrev - dp); \ + INTERP_SZ( t, VB->ClipPtr->data, vb_free, \ + idxPrev, idx, SIZE ); \ + interp( VB, vb_free, t, idxPrev, idx ); \ \ - if (IND&CLIP_TAB_EDGEFLAG) { \ + if (IND&CLIP_TAB_EDGEFLAG) \ VB->EdgeFlagPtr->data[vb_free] = 3; \ - } \ } \ \ - if (IND&CLIP_TAB_EDGEFLAG) { \ + if (IND&CLIP_TAB_EDGEFLAG) { \ /* Demote trailing edge to internal edge. \ */ \ - if (outcount && \ + if (outcount && \ (VB->EdgeFlagPtr->data[outlist[outcount-1]] & 0x2)) \ VB->EdgeFlagPtr->data[outlist[outcount-1]] = 1; \ } \ \ outlist[outcount++] = vb_free; \ - VB->ClipMask[vb_free++] = 0; \ + clipmask[vb_free++] = 0; \ } \ \ - prevj = j; \ - prevflag = flag; \ + idxPrev = idx; \ + dpPrev = dp; \ } \ \ if (outcount < 3) \ return 0; \ - else { \ + \ + { \ GLuint *tmp = inlist; \ inlist = outlist; \ outlist = tmp; \ diff --git a/xc/extras/Mesa/src/colortab.c b/xc/extras/Mesa/src/colortab.c index 95c2a7d84..341ceaa25 100644 --- a/xc/extras/Mesa/src/colortab.c +++ b/xc/extras/Mesa/src/colortab.c @@ -32,175 +32,341 @@ #include "context.h" #include "image.h" #include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "span.h" +#include "teximage.h" #endif -/* - * Return GL_TRUE if k is a power of two, else return GL_FALSE. - */ -static GLboolean -power_of_two( GLint k ) +void +_mesa_init_colortable( struct gl_color_table *p ) { - GLint i, m = 1; - for (i=0; i<32; i++) { - if (k == m) - return GL_TRUE; - m = m << 1; + p->TableType = GL_UNSIGNED_BYTE; + /* allocate a width=1 table by default */ + p->Table = CALLOC(4 * sizeof(GLubyte)); + if (p->Table) { + GLubyte *t = (GLubyte *) p->Table; + t[0] = 255; + t[1] = 255; + t[2] = 255; + t[3] = 255; } - return GL_FALSE; + p->Size = 1; + p->IntFormat = GL_RGBA; + p->Format = GL_RGBA; + p->RedSize = 8; + p->GreenSize = 8; + p->BlueSize = 8; + p->AlphaSize = 8; + p->IntensitySize = 0; + p->LuminanceSize = 0; } -static GLint -decode_internal_format( GLint format ) + +void +_mesa_free_colortable_data( struct gl_color_table *p ) { - switch (format) { + if (p->Table) { + FREE(p->Table); + p->Table = NULL; + } +} + + +/* + * Examine table's format and set the component sizes accordingly. + */ +static void +set_component_sizes( struct gl_color_table *table ) +{ + switch (table->Format) { case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - return GL_ALPHA; - case 1: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - return GL_LUMINANCE; - case 2: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 0; + table->IntensitySize = 0; + table->LuminanceSize = 8; + break; case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - return GL_LUMINANCE_ALPHA; + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 8; + break; case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - return GL_INTENSITY; - case 3: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 0; + table->IntensitySize = 8; + table->LuminanceSize = 0; + break; case GL_RGB: - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return GL_RGB; - case 4: + table->RedSize = 8; + table->GreenSize = 8; + table->BlueSize = 8; + table->AlphaSize = 0; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; case GL_RGBA: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGB5_A1: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return GL_RGBA; + table->RedSize = 8; + table->GreenSize = 8; + table->BlueSize = 8; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; default: - return -1; /* error */ + gl_problem(NULL, "unexpected format in set_component_sizes"); } } + void _mesa_ColorTable( GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, - const GLvoid *table ) + const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_object *texObj; - struct gl_color_table *palette; + struct gl_texture_object *texObj = NULL; + struct gl_color_table *table = NULL; GLboolean proxy = GL_FALSE; + GLint baseFormat; + GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; + GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; + GLboolean floatTable = GL_FALSE; + GLint comps; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorTable"); switch (target) { case GL_TEXTURE_1D: texObj = texUnit->CurrentD[1]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_2D: texObj = texUnit->CurrentD[2]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_3D: texObj = texUnit->CurrentD[3]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_PROXY_TEXTURE_1D: texObj = ctx->Texture.Proxy1D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_2D: texObj = ctx->Texture.Proxy2D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_3D: texObj = ctx->Texture.Proxy3D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - texObj = NULL; - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.ColorTableScale[0]; + gScale = ctx->Pixel.ColorTableScale[1]; + bScale = ctx->Pixel.ColorTableScale[2]; + aScale = ctx->Pixel.ColorTableScale[3]; + rBias = ctx->Pixel.ColorTableBias[0]; + gBias = ctx->Pixel.ColorTableBias[1]; + bBias = ctx->Pixel.ColorTableBias[2]; + aBias = ctx->Pixel.ColorTableBias[3]; + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + proxy = GL_TRUE; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.PCCTscale[0]; + gScale = ctx->Pixel.PCCTscale[1]; + bScale = ctx->Pixel.PCCTscale[2]; + aScale = ctx->Pixel.PCCTscale[3]; + rBias = ctx->Pixel.PCCTbias[0]; + gBias = ctx->Pixel.PCCTbias[1]; + bBias = ctx->Pixel.PCCTbias[2]; + aBias = ctx->Pixel.PCCTbias[3]; + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + proxy = GL_TRUE; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.PCMCTscale[0]; + gScale = ctx->Pixel.PCMCTscale[1]; + bScale = ctx->Pixel.PCMCTscale[2]; + aScale = ctx->Pixel.PCMCTscale[3]; + rBias = ctx->Pixel.PCMCTbias[0]; + gBias = ctx->Pixel.PCMCTbias[1]; + bBias = ctx->Pixel.PCMCTbias[2]; + aBias = ctx->Pixel.PCMCTbias[3]; + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + proxy = GL_TRUE; break; default: gl_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } - assert(palette); + assert(table); if (!_mesa_is_legal_format_and_type(format, type)) { gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)"); return; } - if (decode_internal_format(internalFormat) < 0) { - gl_error( ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)" ); + baseFormat = _mesa_base_tex_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)"); return; } - if (width < 1 || width > MAX_TEXTURE_PALETTE_SIZE || !power_of_two(width)) { - gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)"); + if (width < 1 || width > ctx->Const.MaxColorTableSize + || _mesa_bitcount(width) != 1) { + if (width > ctx->Const.MaxColorTableSize) + gl_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)"); + else + gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)"); if (proxy) { - palette->Size = 0; - palette->IntFormat = (GLenum) 0; - palette->Format = (GLenum) 0; + table->Size = 0; + table->IntFormat = (GLenum) 0; + table->Format = (GLenum) 0; } return; } - palette->Size = width; - palette->IntFormat = internalFormat; - palette->Format = (GLenum) decode_internal_format(internalFormat); + table->Size = width; + table->IntFormat = internalFormat; + table->Format = (GLenum) baseFormat; + set_component_sizes(table); + + comps = _mesa_components_in_format(table->Format); + assert(comps > 0); /* error should have been caught sooner */ + if (!proxy) { - _mesa_unpack_ubyte_color_span(ctx, width, palette->Format, - palette->Table, /* dest */ - format, type, table, - &ctx->Unpack, GL_FALSE); - } - if (texObj) { - /* per-texture object palette */ - if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); + /* free old table, if any */ + if (table->Table) { + FREE(table->Table); } - } - else { - /* shared texture palette */ + if (floatTable) { + GLubyte tableUB[MAX_COLOR_TABLE_SIZE * 4]; + GLfloat *tableF; + GLuint i; + + _mesa_unpack_ubyte_color_span(ctx, width, table->Format, + tableUB, /* dest */ + format, type, data, + &ctx->Unpack, GL_TRUE); + + table->TableType = GL_FLOAT; + table->Table = MALLOC(comps * width * sizeof(GLfloat)); + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); + return; + } + + /* Apply scale and bias and convert GLubyte values to GLfloats + * in [0, 1]. Store results in the tableF[]. + */ + rScale /= 255.0; + gScale /= 255.0; + bScale /= 255.0; + aScale /= 255.0; + tableF = (GLfloat *) table->Table; + + switch (table->Format) { + case GL_INTENSITY: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * rScale + rBias; + } + break; + case GL_LUMINANCE: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * rScale + rBias; + } + break; + case GL_ALPHA: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * aScale + aBias; + } + break; + case GL_LUMINANCE_ALPHA: + for (i = 0; i < width; i++) { + tableF[i*2+0] = tableUB[i*2+0] * rScale + rBias; + tableF[i*2+1] = tableUB[i*2+1] * aScale + aBias; + } + break; + case GL_RGB: + for (i = 0; i < width; i++) { + tableF[i*3+0] = tableUB[i*3+0] * rScale + rBias; + tableF[i*3+1] = tableUB[i*3+1] * gScale + gBias; + tableF[i*3+2] = tableUB[i*3+2] * bScale + bBias; + } + break; + case GL_RGBA: + for (i = 0; i < width; i++) { + tableF[i*4+0] = tableUB[i*4+0] * rScale + rBias; + tableF[i*4+1] = tableUB[i*4+1] * gScale + gBias; + tableF[i*4+2] = tableUB[i*4+2] * bScale + bBias; + tableF[i*4+3] = tableUB[i*4+3] * aScale + aBias; + } + break; + default: + gl_problem(ctx, "Bad format in _mesa_ColorTable"); + return; + } + } + else { + /* store GLubyte table */ + table->TableType = GL_UNSIGNED_BYTE; + table->Table = MALLOC(comps * width * sizeof(GLubyte)); + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); + return; + } + _mesa_unpack_ubyte_color_span(ctx, width, table->Format, + table->Table, /* dest */ + format, type, data, + &ctx->Unpack, GL_TRUE); + } /* floatTable */ + } /* proxy */ + + if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { + /* texture object palette, texObj==NULL means the shared palette */ if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, NULL ); + (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } } @@ -210,40 +376,47 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, void _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, - const GLvoid *table ) + const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_object *texObj; - struct gl_color_table *palette; + struct gl_texture_object *texObj = NULL; + struct gl_color_table *table = NULL; GLint comps; - GLubyte *dest; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorSubTable"); switch (target) { case GL_TEXTURE_1D: texObj = texUnit->CurrentD[1]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_2D: texObj = texUnit->CurrentD[2]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_3D: texObj = texUnit->CurrentD[3]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - texObj = NULL; - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; break; default: gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); return; } - assert(palette); + assert(table); if (!_mesa_is_legal_format_and_type(format, type)) { gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)"); @@ -255,205 +428,618 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, return; } - comps = _mesa_components_in_format(format); - assert(comps > 0); /* error should be caught sooner */ + comps = _mesa_components_in_format(table->Format); + assert(comps > 0); /* error should have been caught sooner */ - if (start + count > palette->Size) { + if (start + count > table->Size) { gl_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); return; } - dest = palette->Table + start * comps * sizeof(GLubyte); - _mesa_unpack_ubyte_color_span(ctx, count, palette->Format, dest, - format, type, table, - &ctx->Unpack, GL_FALSE); - if (texObj) { - /* per-texture object palette */ - if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); - } + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorSubTable"); + return; + } + + if (table->TableType == GL_UNSIGNED_BYTE) { + GLubyte *dest = (GLubyte *) table->Table + start * comps * sizeof(GLubyte); + _mesa_unpack_ubyte_color_span(ctx, count, table->Format, dest, + format, type, data, &ctx->Unpack, GL_TRUE); } else { - /* shared texture palette */ + GLfloat *dest = (GLfloat *) table->Table + start * comps * sizeof(GLfloat); + ASSERT(table->TableType == GL_FLOAT); + _mesa_unpack_float_color_span(ctx, count, table->Format, dest, + format, type, data, &ctx->Unpack, GL_TRUE); + } + + if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { + /* per-texture object palette */ if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, NULL ); + (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } } +/* XXX not tested */ +void +_mesa_CopyColorTable(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width) +{ + GLubyte data[MAX_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorTable"); + + /* Select buffer to read from */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, + ctx->Pixel.DriverReadBuffer ); + + if (width > MAX_WIDTH) + width = MAX_WIDTH; + + /* read the data from framebuffer */ + gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); + + /* Restore reading from draw buffer (the default) */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, + ctx->Color.DriverDrawBuffer ); + + _mesa_ColorTable(target, internalformat, width, + GL_RGBA, GL_UNSIGNED_BYTE, data); +} + + + +/* XXX not tested */ +void +_mesa_CopyColorSubTable(GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width) +{ + GLubyte data[MAX_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorSubTable"); + + /* Select buffer to read from */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, + ctx->Pixel.DriverReadBuffer ); + + if (width > MAX_WIDTH) + width = MAX_WIDTH; + + /* read the data from framebuffer */ + gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); + + /* Restore reading from draw buffer (the default) */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, + ctx->Color.DriverDrawBuffer ); + + _mesa_ColorSubTable(target, start, width, GL_RGBA, GL_UNSIGNED_BYTE, data); +} + + + void _mesa_GetColorTable( GLenum target, GLenum format, - GLenum type, GLvoid *table ) + GLenum type, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_color_table *palette; - GLubyte rgba[MAX_TEXTURE_PALETTE_SIZE][4]; + struct gl_color_table *table = NULL; + GLubyte rgba[MAX_COLOR_TABLE_SIZE][4]; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTable"); switch (target) { case GL_TEXTURE_1D: - palette = &texUnit->CurrentD[1]->Palette; + table = &texUnit->CurrentD[1]->Palette; break; case GL_TEXTURE_2D: - palette = &texUnit->CurrentD[2]->Palette; + table = &texUnit->CurrentD[2]->Palette; break; case GL_TEXTURE_3D: - palette = &texUnit->CurrentD[3]->Palette; + table = &texUnit->CurrentD[3]->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; break; default: gl_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); return; } - assert(palette); + assert(table); - switch (palette->Format) { + switch (table->Format) { case GL_ALPHA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = 0; - rgba[i][GCOMP] = 0; - rgba[i][BCOMP] = 0; - rgba[i][ACOMP] = palette->Table[i]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = tableUB[i]; + } } break; case GL_LUMINANCE: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i]; - rgba[i][GCOMP] = palette->Table[i]; - rgba[i][BCOMP] = palette->Table[i]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][ACOMP] = 255; + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i]; + rgba[i][GCOMP] = tableUB[i]; + rgba[i][BCOMP] = tableUB[i]; + rgba[i][ACOMP] = 255; + } } break; case GL_LUMINANCE_ALPHA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*2+0]; - rgba[i][GCOMP] = palette->Table[i*2+0]; - rgba[i][BCOMP] = palette->Table[i*2+0]; - rgba[i][ACOMP] = palette->Table[i*2+1]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i*2+1] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*2+0]; + rgba[i][GCOMP] = tableUB[i*2+0]; + rgba[i][BCOMP] = tableUB[i*2+0]; + rgba[i][ACOMP] = tableUB[i*2+1]; + } } break; case GL_INTENSITY: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i]; - rgba[i][GCOMP] = palette->Table[i]; - rgba[i][BCOMP] = palette->Table[i]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i]; + rgba[i][GCOMP] = tableUB[i]; + rgba[i][BCOMP] = tableUB[i]; + rgba[i][ACOMP] = tableUB[i]; + } } break; case GL_RGB: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*3+0]; - rgba[i][GCOMP] = palette->Table[i*3+1]; - rgba[i][BCOMP] = palette->Table[i*3+2]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*3+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*3+1] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*3+2] * 255.0F); + rgba[i][ACOMP] = 255; + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*3+0]; + rgba[i][GCOMP] = tableUB[i*3+1]; + rgba[i][BCOMP] = tableUB[i*3+2]; + rgba[i][ACOMP] = 255; + } } break; case GL_RGBA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*4+0]; - rgba[i][GCOMP] = palette->Table[i*4+1]; - rgba[i][BCOMP] = palette->Table[i*4+2]; - rgba[i][ACOMP] = palette->Table[i*4+3]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*4+0]; + rgba[i][GCOMP] = tableUB[i*4+1]; + rgba[i][BCOMP] = tableUB[i*4+2]; + rgba[i][ACOMP] = tableUB[i*4+3]; + } } break; default: - gl_problem(ctx, "bad palette format in glGetColorTable"); + gl_problem(ctx, "bad table format in glGetColorTable"); return; } - _mesa_pack_rgba_span(ctx, palette->Size, (const GLubyte (*)[]) rgba, - format, type, table, &ctx->Pack, GL_FALSE); + _mesa_pack_rgba_span(ctx, table->Size, (const GLubyte (*)[]) rgba, + format, type, data, &ctx->Pack, GL_FALSE); +} + - (void) format; - (void) type; - (void) table; + +void +_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); + + switch (target) { + case GL_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.ColorTableScale[0] = params[0]; + ctx->Pixel.ColorTableScale[1] = params[1]; + ctx->Pixel.ColorTableScale[2] = params[2]; + ctx->Pixel.ColorTableScale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.ColorTableBias[0] = params[0]; + ctx->Pixel.ColorTableBias[1] = params[1]; + ctx->Pixel.ColorTableBias[2] = params[2]; + ctx->Pixel.ColorTableBias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.PCCTscale[0] = params[0]; + ctx->Pixel.PCCTscale[1] = params[1]; + ctx->Pixel.PCCTscale[2] = params[2]; + ctx->Pixel.PCCTscale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.PCCTbias[0] = params[0]; + ctx->Pixel.PCCTbias[1] = params[1]; + ctx->Pixel.PCCTbias[2] = params[2]; + ctx->Pixel.PCCTbias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.PCMCTscale[0] = params[0]; + ctx->Pixel.PCMCTscale[1] = params[1]; + ctx->Pixel.PCMCTscale[2] = params[2]; + ctx->Pixel.PCMCTscale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.PCMCTbias[0] = params[0]; + ctx->Pixel.PCMCTbias[1] = params[1]; + ctx->Pixel.PCMCTbias[2] = params[2]; + ctx->Pixel.PCMCTbias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); + return; + } } void -_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) +_mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { - GLint iparams[10]; - _mesa_GetColorTableParameteriv( target, pname, iparams ); - *params = (GLfloat) iparams[0]; + GLfloat fparams[4]; + if (pname == GL_COLOR_TABLE_SGI || + pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || + pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + /* four values */ + fparams[0] = (GLfloat) params[0]; + fparams[1] = (GLfloat) params[1]; + fparams[2] = (GLfloat) params[2]; + fparams[3] = (GLfloat) params[3]; + } + else { + /* one values */ + fparams[0] = (GLfloat) params[0]; + } + _mesa_ColorTableParameterfv(target, pname, fparams); } void -_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) +_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_color_table *palette; + struct gl_color_table *table = NULL; - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameter"); + ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameterfv"); switch (target) { case GL_TEXTURE_1D: - palette = &texUnit->CurrentD[1]->Palette; + table = &texUnit->CurrentD[1]->Palette; break; case GL_TEXTURE_2D: - palette = &texUnit->CurrentD[2]->Palette; + table = &texUnit->CurrentD[2]->Palette; break; case GL_TEXTURE_3D: - palette = &texUnit->CurrentD[3]->Palette; + table = &texUnit->CurrentD[3]->Palette; break; case GL_PROXY_TEXTURE_1D: - palette = &ctx->Texture.Proxy1D->Palette; + table = &ctx->Texture.Proxy1D->Palette; break; case GL_PROXY_TEXTURE_2D: - palette = &ctx->Texture.Proxy2D->Palette; + table = &ctx->Texture.Proxy2D->Palette; break; case GL_PROXY_TEXTURE_3D: - palette = &ctx->Texture.Proxy3D->Palette; + table = &ctx->Texture.Proxy3D->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.ColorTableScale[0]; + params[1] = ctx->Pixel.ColorTableScale[1]; + params[2] = ctx->Pixel.ColorTableScale[2]; + params[3] = ctx->Pixel.ColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.ColorTableBias[0]; + params[1] = ctx->Pixel.ColorTableBias[1]; + params[2] = ctx->Pixel.ColorTableBias[2]; + params[3] = ctx->Pixel.ColorTableBias[3]; + return; + } + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.PCCTscale[0]; + params[1] = ctx->Pixel.PCCTscale[1]; + params[2] = ctx->Pixel.PCCTscale[2]; + params[3] = ctx->Pixel.PCCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.PCCTbias[0]; + params[1] = ctx->Pixel.PCCTbias[1]; + params[2] = ctx->Pixel.PCCTbias[2]; + params[3] = ctx->Pixel.PCCTbias[3]; + return; + } + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.PCMCTscale[0]; + params[1] = ctx->Pixel.PCMCTscale[1]; + params[2] = ctx->Pixel.PCMCTscale[2]; + params[3] = ctx->Pixel.PCMCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.PCMCTbias[0]; + params[1] = ctx->Pixel.PCMCTbias[1]; + params[2] = ctx->Pixel.PCMCTbias[2]; + params[3] = ctx->Pixel.PCMCTbias[3]; + return; + } + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; break; default: - gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); return; } + assert(table); + switch (pname) { case GL_COLOR_TABLE_FORMAT: - *params = palette->IntFormat; + *params = table->IntFormat; break; case GL_COLOR_TABLE_WIDTH: - *params = palette->Size; + *params = table->Size; break; case GL_COLOR_TABLE_RED_SIZE: - *params = 8; + *params = table->RedSize; break; case GL_COLOR_TABLE_GREEN_SIZE: - *params = 8; + *params = table->GreenSize; break; case GL_COLOR_TABLE_BLUE_SIZE: - *params = 8; + *params = table->BlueSize; break; case GL_COLOR_TABLE_ALPHA_SIZE: - *params = 8; + *params = table->AlphaSize; break; case GL_COLOR_TABLE_LUMINANCE_SIZE: - *params = 8; + *params = table->LuminanceSize; break; case GL_COLOR_TABLE_INTENSITY_SIZE: - *params = 8; + *params = table->IntensitySize; break; default: - gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter" ); + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" ); return; } } + +void +_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_color_table *table = NULL; + + ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameteriv"); + + switch (target) { + case GL_TEXTURE_1D: + table = &texUnit->CurrentD[1]->Palette; + break; + case GL_TEXTURE_2D: + table = &texUnit->CurrentD[2]->Palette; + break; + case GL_TEXTURE_3D: + table = &texUnit->CurrentD[3]->Palette; + break; + case GL_PROXY_TEXTURE_1D: + table = &ctx->Texture.Proxy1D->Palette; + break; + case GL_PROXY_TEXTURE_2D: + table = &ctx->Texture.Proxy2D->Palette; + break; + case GL_PROXY_TEXTURE_3D: + table = &ctx->Texture.Proxy3D->Palette; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.ColorTableScale[0]; + params[1] = (GLint) ctx->Pixel.ColorTableScale[1]; + params[2] = (GLint) ctx->Pixel.ColorTableScale[2]; + params[3] = (GLint) ctx->Pixel.ColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.ColorTableBias[0]; + params[1] = (GLint) ctx->Pixel.ColorTableBias[1]; + params[2] = (GLint) ctx->Pixel.ColorTableBias[2]; + params[3] = (GLint) ctx->Pixel.ColorTableBias[3]; + return; + } + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.PCCTscale[0]; + params[1] = (GLint) ctx->Pixel.PCCTscale[1]; + params[2] = (GLint) ctx->Pixel.PCCTscale[2]; + params[3] = (GLint) ctx->Pixel.PCCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.PCCTbias[0]; + params[1] = (GLint) ctx->Pixel.PCCTbias[1]; + params[2] = (GLint) ctx->Pixel.PCCTbias[2]; + params[3] = (GLint) ctx->Pixel.PCCTbias[3]; + return; + } + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.PCMCTscale[0]; + params[1] = (GLint) ctx->Pixel.PCMCTscale[1]; + params[2] = (GLint) ctx->Pixel.PCMCTscale[2]; + params[3] = (GLint) ctx->Pixel.PCMCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.PCMCTbias[0]; + params[1] = (GLint) ctx->Pixel.PCMCTbias[1]; + params[2] = (GLint) ctx->Pixel.PCMCTbias[2]; + params[3] = (GLint) ctx->Pixel.PCMCTbias[3]; + return; + } + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); + return; + } + + assert(table); + + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + *params = table->IntFormat; + break; + case GL_COLOR_TABLE_WIDTH: + *params = table->Size; + break; + case GL_COLOR_TABLE_RED_SIZE: + *params = table->RedSize; + break; + case GL_COLOR_TABLE_GREEN_SIZE: + *params = table->GreenSize; + break; + case GL_COLOR_TABLE_BLUE_SIZE: + *params = table->BlueSize; + break; + case GL_COLOR_TABLE_ALPHA_SIZE: + *params = table->AlphaSize; + break; + case GL_COLOR_TABLE_LUMINANCE_SIZE: + *params = table->LuminanceSize; + break; + case GL_COLOR_TABLE_INTENSITY_SIZE: + *params = table->IntensitySize; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(pname)" ); + return; + } +} diff --git a/xc/extras/Mesa/src/colortab.h b/xc/extras/Mesa/src/colortab.h index bdcf5fa71..6a3f0cabe 100644 --- a/xc/extras/Mesa/src/colortab.h +++ b/xc/extras/Mesa/src/colortab.h @@ -32,22 +32,53 @@ extern void +_mesa_init_colortable( struct gl_color_table *p ); + +extern void +_mesa_free_colortable_data( struct gl_color_table *p ); + + +extern void _mesa_ColorTable( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ); + extern void _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table ); + +extern void +_mesa_CopyColorSubTable(GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width); + + +extern void +_mesa_CopyColorTable(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width); + + extern void _mesa_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *table ); + +extern void +_mesa_ColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + + +extern void +_mesa_ColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + + extern void _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); + extern void _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); diff --git a/xc/extras/Mesa/src/config.h b/xc/extras/Mesa/src/config.h index 22ad65ca2..76b6a9d18 100644 --- a/xc/extras/Mesa/src/config.h +++ b/xc/extras/Mesa/src/config.h @@ -51,6 +51,9 @@ /* Maximum texture matrix stack depth: */ #define MAX_TEXTURE_STACK_DEPTH 10 +/* Maximum color matrix stack depth: */ +#define MAX_COLOR_STACK_DEPTH 4 + /* Maximum attribute stack depth: */ #define MAX_ATTRIB_STACK_DEPTH 16 @@ -92,8 +95,8 @@ #define MAX_LINE_WIDTH 10.0 #define LINE_WIDTH_GRANULARITY 0.1 -/* Max texture palette size */ -#define MAX_TEXTURE_PALETTE_SIZE 256 +/* Max texture palette / color table size */ +#define MAX_COLOR_TABLE_SIZE 256 /* Number of texture levels */ #define MAX_TEXTURE_LEVELS 12 @@ -111,6 +114,9 @@ /* Subpixel precision for antialiasing, window coordinate snapping */ #define SUB_PIXEL_BITS 4 +/* Size of histogram tables */ +#define HISTOGRAM_TABLE_SIZE 256 + /* diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c index 7f76b6bf8..f72b0caa0 100644 --- a/xc/extras/Mesa/src/context.c +++ b/xc/extras/Mesa/src/context.c @@ -31,6 +31,7 @@ #include "accum.h" #include "alphabuf.h" #include "clip.h" +#include "colortab.h" #include "context.h" #include "cva.h" #include "depth.h" @@ -266,18 +267,23 @@ static void print_timings( GLcontext *ctx ) * Return: pointer to new GLvisual or NULL if requested parameters can't * be met. */ -GLvisual *gl_create_visual( GLboolean rgbFlag, - GLboolean alphaFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint depthBits, - GLint stencilBits, - GLint accumBits, - GLint indexBits, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits ) +GLvisual * +_mesa_create_visual( GLboolean rgbFlag, + GLboolean alphaFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ) { GLvisual *vis; @@ -293,7 +299,16 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) { return NULL; } - if (accumBits < 0 || accumBits > (GLint) (8 * sizeof(GLaccum))) { + if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) { + return NULL; + } + if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) { + return NULL; + } + if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) { + return NULL; + } + if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) { return NULL; } @@ -310,10 +325,13 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, vis->BlueBits = blueBits; vis->AlphaBits = alphaFlag ? (8 * sizeof(GLubyte)) : alphaBits; - vis->IndexBits = indexBits; - vis->DepthBits = depthBits; - vis->AccumBits = (accumBits > 0) ? (8 * sizeof(GLaccum)) : 0; - vis->StencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0; + vis->IndexBits = indexBits; + vis->DepthBits = depthBits; + vis->AccumRedBits = (accumRedBits > 0) ? (8 * sizeof(GLaccum)) : 0; + vis->AccumGreenBits = (accumGreenBits > 0) ? (8 * sizeof(GLaccum)) : 0; + vis->AccumBlueBits = (accumBlueBits > 0) ? (8 * sizeof(GLaccum)) : 0; + vis->AccumAlphaBits = (accumAlphaBits > 0) ? (8 * sizeof(GLaccum)) : 0; + vis->StencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0; vis->SoftwareAlpha = alphaFlag; @@ -333,10 +351,38 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, } +/* This function should no longer be used. Use _mesa_create_visual() instead */ +GLvisual *gl_create_visual( GLboolean rgbFlag, + GLboolean alphaFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint depthBits, + GLint stencilBits, + GLint accumBits, + GLint indexBits, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits ) +{ + return _mesa_create_visual(rgbFlag, alphaFlag, dbFlag, stereoFlag, + redBits, greenBits, blueBits, alphaBits, + indexBits, depthBits, stencilBits, + accumBits, accumBits, accumBits, accumBits, 0); +} + +void +_mesa_destroy_visual( GLvisual *vis ) +{ + FREE(vis); +} + + +/* obsolete */ void gl_destroy_visual( GLvisual *vis ) { - FREE( vis ); + _mesa_destroy_visual(vis); } @@ -380,7 +426,9 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual, } if (softwareAccum) { assert(visual->RGBAflag); - assert(visual->AccumBits > 0); + assert(visual->AccumRedBits > 0); + assert(visual->AccumGreenBits > 0); + assert(visual->AccumBlueBits > 0); } if (softwareAlpha) { assert(visual->RGBAflag); @@ -730,18 +778,6 @@ static void init_2d_map( struct gl_2d_map *map, int n, const float *initial ) } -static void init_color_table( struct gl_color_table *p ) -{ - p->Table[0] = 255; - p->Table[1] = 255; - p->Table[2] = 255; - p->Table[3] = 255; - p->Size = 1; - p->IntFormat = GL_RGBA; - p->Format = GL_RGBA; -} - - /* * Initialize the attribute groups in a GLcontext. */ @@ -768,6 +804,7 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; ctx->Const.LineWidthGranularity = LINE_WIDTH_GRANULARITY; ctx->Const.NumAuxBuffers = NUM_AUX_BUFFERS; + ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; /* Modelview matrix */ gl_matrix_ctr( &ctx->ModelView ); @@ -805,6 +842,13 @@ static void init_attrib_groups( GLcontext *ctx ) } } + /* Color matrix */ + gl_matrix_ctr(&ctx->ColorMatrix); + ctx->ColorStackDepth = 0; + for (j = 0; j < MAX_COLOR_STACK_DEPTH - 1; j++) { + gl_matrix_ctr(&ctx->ColorStack[j]); + } + /* Accumulate buffer group */ ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); @@ -941,10 +985,36 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Hint.Fog = GL_DONT_CARE; ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; ctx->Hint.StrictLighting = GL_TRUE; + /* Histogram group */ + ctx->Histogram.Width = 0; + ctx->Histogram.Format = GL_RGBA; + ctx->Histogram.Sink = GL_FALSE; + ctx->Histogram.RedSize = 0xffffffff; + ctx->Histogram.GreenSize = 0xffffffff; + ctx->Histogram.BlueSize = 0xffffffff; + ctx->Histogram.AlphaSize = 0xffffffff; + ctx->Histogram.LuminanceSize = 0xffffffff; + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + + /* Min/Max group */ + ctx->MinMax.Format = GL_RGBA; + ctx->MinMax.Sink = GL_FALSE; + ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; + ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; + ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; + ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; + + + /* Pipeline */ gl_pipeline_init( ctx ); gl_cva_init( ctx ); @@ -1041,6 +1111,30 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Pixel.MapGtoG[0] = 0.0; ctx->Pixel.MapBtoB[0] = 0.0; ctx->Pixel.MapAtoA[0] = 0.0; + ctx->Pixel.HistogramEnabled = GL_FALSE; + ctx->Pixel.MinMaxEnabled = GL_FALSE; + ctx->Pixel.PixelTextureEnabled = GL_FALSE; + ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + ctx->Pixel.PostColorMatrixRedBias = 0.0; + ctx->Pixel.PostColorMatrixRedScale = 1.0; + ctx->Pixel.PostColorMatrixGreenBias = 0.0; + ctx->Pixel.PostColorMatrixGreenScale = 1.0; + ctx->Pixel.PostColorMatrixBlueBias = 0.0; + ctx->Pixel.PostColorMatrixBlueScale = 1.0; + ctx->Pixel.PostColorMatrixAlphaBias = 0.0; + ctx->Pixel.PostColorMatrixAlphaScale = 1.0; + ctx->Pixel.ColorTableScale[0] = 1.0F; + ctx->Pixel.ColorTableScale[1] = 1.0F; + ctx->Pixel.ColorTableScale[2] = 1.0F; + ctx->Pixel.ColorTableScale[3] = 1.0F; + ctx->Pixel.ColorTableBias[0] = 0.0F; + ctx->Pixel.ColorTableBias[1] = 0.0F; + ctx->Pixel.ColorTableBias[2] = 0.0F; + ctx->Pixel.ColorTableBias[3] = 0.0F; + ctx->Pixel.ColorTableEnabled = GL_FALSE; + ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE; + ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE; /* Point group */ ctx->Point.SmoothFlag = GL_FALSE; @@ -1096,7 +1190,7 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Texture.Enabled = 0; for (i=0; i<MAX_TEXTURE_UNITS; i++) init_texture_unit( ctx, i ); - init_color_table(&ctx->Texture.Palette); + _mesa_init_colortable(&ctx->Texture.Palette); /* Transformation group */ ctx->Transform.MatrixMode = GL_MODELVIEW; @@ -1204,6 +1298,23 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->AttribStackDepth = 0; ctx->ClientAttribStackDepth = 0; + /* Display list */ + ctx->CallDepth = 0; + ctx->ExecuteFlag = GL_TRUE; + ctx->CompileFlag = GL_FALSE; + ctx->CurrentListPtr = NULL; + ctx->CurrentBlock = NULL; + ctx->CurrentListNum = 0; + ctx->CurrentPos = 0; + + /* Color tables */ + _mesa_init_colortable(&ctx->ColorTable); + _mesa_init_colortable(&ctx->ProxyColorTable); + _mesa_init_colortable(&ctx->PostConvolutionColorTable); + _mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable); + _mesa_init_colortable(&ctx->PostColorMatrixColorTable); + _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); + /* Miscellaneous */ ctx->NewState = NEW_ALL; ctx->RenderMode = GL_RENDER; @@ -1215,19 +1326,11 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->NeedEyeNormals = GL_FALSE; ctx->vb_proj_matrix = &ctx->ModelProjectMatrix; - /* Display list */ - ctx->CallDepth = 0; - ctx->ExecuteFlag = GL_TRUE; - ctx->CompileFlag = GL_FALSE; - ctx->CurrentListPtr = NULL; - ctx->CurrentBlock = NULL; - ctx->CurrentListNum = 0; - ctx->CurrentPos = 0; - ctx->ErrorValue = (GLenum) GL_NO_ERROR; ctx->CatchSignals = GL_TRUE; ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; /* For debug/development only */ ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE; @@ -1478,7 +1581,7 @@ void gl_free_context_data( GLcontext *ctx ) FREE( ctx->PB ); - if(ctx->input != ctx->VB->IM) + if (ctx->input != ctx->VB->IM) gl_immediate_free( ctx->input ); gl_vb_free( ctx->VB ); @@ -1541,6 +1644,11 @@ void gl_free_context_data( GLcontext *ctx ) if (ctx->EvalMap.Map2Texture4.Points) FREE( ctx->EvalMap.Map2Texture4.Points ); + _mesa_free_colortable_data( &ctx->ColorTable ); + _mesa_free_colortable_data( &ctx->PostConvolutionColorTable ); + _mesa_free_colortable_data( &ctx->PostColorMatrixColorTable ); + _mesa_free_colortable_data( &ctx->Texture.Palette ); + /* Free cache of immediate buffers. */ while (ctx->nr_im_queued-- > 0) { struct immediate * next = ctx->freed_im_queue->next; diff --git a/xc/extras/Mesa/src/context.h b/xc/extras/Mesa/src/context.h index 1f0b0d063..da5ad0d72 100644 --- a/xc/extras/Mesa/src/context.h +++ b/xc/extras/Mesa/src/context.h @@ -56,6 +56,25 @@ * the colorbuffer, depth buffer, stencil buffer and accum buffer which will * be used by the GL context and framebuffer. */ +extern GLvisual * +_mesa_create_visual( GLboolean rgbFlag, + GLboolean alphaFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ); + +/* this function is obsolete */ extern GLvisual *gl_create_visual( GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag, @@ -69,7 +88,11 @@ extern GLvisual *gl_create_visual( GLboolean rgbFlag, GLint blueBits, GLint alphaBits ); -extern void gl_destroy_visual( GLvisual *vis ); + +extern void +_mesa_destroy_visual( GLvisual *vis ); + +/*obsolete */ extern void gl_destroy_visual( GLvisual *vis ); /* diff --git a/xc/extras/Mesa/src/copypix.c b/xc/extras/Mesa/src/copypix.c index 0ca25b9f7..17175644b 100644 --- a/xc/extras/Mesa/src/copypix.c +++ b/xc/extras/Mesa/src/copypix.c @@ -36,9 +36,11 @@ #include "mem.h" #include "mmath.h" #include "pixel.h" +#include "pixeltex.h" #include "span.h" #include "state.h" #include "stencil.h" +#include "texture.h" #include "types.h" #include "zoom.h" #endif @@ -83,6 +85,7 @@ static void copy_rgba_pixels( GLcontext *ctx, GLubyte *saveReadAlpha; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; + GLboolean applyTransferOps; /* Determine if copy should be done bottom-to-top or top-to-bottom */ if (srcy < desty) { @@ -156,6 +159,14 @@ static void copy_rgba_pixels( GLcontext *ctx, p = NULL; } + applyTransferOps = ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled; + for (j = 0; j < height; j++, sy += stepy, dy += stepy) { if (overlapping) { MEMCPY(rgba, p, width * sizeof(GLubyte) * 4); @@ -188,12 +199,62 @@ static void copy_rgba_pixels( GLcontext *ctx, ctx->ReadBuffer->Alpha = saveReadAlpha; } - if (ctx->Pixel.ScaleOrBiasRGBA) { - gl_scale_and_bias_rgba( ctx, width, rgba ); + if (applyTransferOps) { + const GLfloat scale = (1.0F / 255.0F); + GLfloat rgbaFloat[MAX_WIDTH][4]; + GLuint k; + /* convert ubyte to float */ + for (k = 0; k < width; k++) { + rgbaFloat[k][RCOMP] = (GLfloat) rgba[k][RCOMP] * scale; + rgbaFloat[k][GCOMP] = (GLfloat) rgba[k][GCOMP] * scale; + rgbaFloat[k][BCOMP] = (GLfloat) rgba[k][BCOMP] * scale; + rgbaFloat[k][ACOMP] = (GLfloat) rgba[k][ACOMP] * scale; + } + /* scale & bias */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, width, rgbaFloat); + } + /* color map lookup */ + if (ctx->Pixel.MapColorFlag) { + _mesa_map_rgba(ctx, width, rgbaFloat); + } + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, width, rgbaFloat); + } + /* color matrix */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, width, rgbaFloat); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, width, rgbaFloat); + } + /* clamp to [0,1] and convert float back to ubyte */ + for (k = 0; k < width; k++) { + GLint r = (GLint) (rgbaFloat[k][RCOMP] * 255.0F); + GLint g = (GLint) (rgbaFloat[k][GCOMP] * 255.0F); + GLint b = (GLint) (rgbaFloat[k][BCOMP] * 255.0F); + GLint a = (GLint) (rgbaFloat[k][ACOMP] * 255.0F); + rgba[k][RCOMP] = (GLubyte) CLAMP(r, 0, 255); + rgba[k][GCOMP] = (GLubyte) CLAMP(g, 0, 255); + rgba[k][BCOMP] = (GLubyte) CLAMP(b, 0, 255); + rgba[k][ACOMP] = (GLubyte) CLAMP(a, 0, 255); + } } - if (ctx->Pixel.MapColorFlag) { - gl_map_rgba( ctx, width, rgba ); + + if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { + GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; + GLuint unit; + /* XXX not sure how multitexture is supposed to work here */ + for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba, + s, t, r, q); + gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba); + } } + if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) { (*ctx->Driver.WriteRGBASpan)( ctx, width, destx, dy, (const GLubyte (*)[4])rgba, NULL ); @@ -298,10 +359,10 @@ static void copy_ci_pixels( GLcontext *ctx, } if (shift_or_offset) { - gl_shift_and_offset_ci( ctx, width, indexes ); + _mesa_shift_and_offset_ci( ctx, width, indexes ); } if (ctx->Pixel.MapColorFlag) { - gl_map_ci( ctx, width, indexes ); + _mesa_map_ci( ctx, width, indexes ); } if (zoom) { @@ -473,7 +534,7 @@ static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } p = psten; for (j = 0; j < height; j++, ssy += stepy) { - gl_read_stencil_span( ctx, width, srcx, ssy, p ); + _mesa_read_stencil_span( ctx, width, srcx, ssy, p ); p += width; } p = psten; @@ -491,21 +552,21 @@ static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, p += width; } else { - gl_read_stencil_span( ctx, width, srcx, sy, stencil ); + _mesa_read_stencil_span( ctx, width, srcx, sy, stencil ); } if (shift_or_offset) { - gl_shift_and_offset_stencil( ctx, width, stencil ); + _mesa_shift_and_offset_stencil( ctx, width, stencil ); } if (ctx->Pixel.MapStencilFlag) { - gl_map_stencil( ctx, width, stencil ); + _mesa_map_stencil( ctx, width, stencil ); } if (zoom) { gl_write_zoomed_stencil_span( ctx, width, destx, dy, stencil, desty ); } else { - gl_write_stencil_span( ctx, width, destx, dy, stencil ); + _mesa_write_stencil_span( ctx, width, destx, dy, stencil ); } } @@ -542,6 +603,8 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, destx = (GLint) (ctx->Current.RasterPos[0] + 0.5F); desty = (GLint) (ctx->Current.RasterPos[1] + 0.5F); + ctx->OcclusionResult = GL_TRUE; + if (ctx->Driver.CopyPixels && (*ctx->Driver.CopyPixels)( ctx, srcx, srcy, width, height, destx, desty, type )) { diff --git a/xc/extras/Mesa/src/depth.c b/xc/extras/Mesa/src/depth.c index 73fd68fb8..ae119018e 100644 --- a/xc/extras/Mesa/src/depth.c +++ b/xc/extras/Mesa/src/depth.c @@ -381,7 +381,7 @@ depth_test_span16( GLcontext *ctx, GLuint n, GLint x, GLint y, } break; case GL_NEVER: - MEMSET(mask, 0, n * sizeof(GLubyte)); + BZERO(mask, n * sizeof(GLubyte)); break; default: gl_problem(ctx, "Bad depth func in depth_test_span16"); @@ -610,7 +610,7 @@ depth_test_span32( GLcontext *ctx, GLuint n, GLint x, GLint y, } break; case GL_NEVER: - MEMSET(mask, 0, n * sizeof(GLubyte)); + BZERO(mask, n * sizeof(GLubyte)); break; default: gl_problem(ctx, "Bad depth func in depth_test_span32"); @@ -893,7 +893,7 @@ software_depth_test_pixels16( GLcontext *ctx, GLuint n, break; case GL_NEVER: /* depth test never passes */ - MEMSET(mask, 0, n * sizeof(GLubyte)); + BZERO(mask, n * sizeof(GLubyte)); break; default: gl_problem(ctx, "Bad depth func in software_depth_test_pixels"); @@ -1139,7 +1139,7 @@ software_depth_test_pixels32( GLcontext *ctx, GLuint n, break; case GL_NEVER: /* depth test never passes */ - MEMSET(mask, 0, n * sizeof(GLubyte)); + BZERO(mask, n * sizeof(GLubyte)); break; default: gl_problem(ctx, "Bad depth func in software_depth_test_pixels"); @@ -1373,7 +1373,7 @@ hardware_depth_test_pixels( GLcontext *ctx, GLuint n, GLdepth zbuffer[], break; case GL_NEVER: /* depth test never passes */ - MEMSET(mask, 0, n * sizeof(GLubyte)); + BZERO(mask, n * sizeof(GLubyte)); break; default: gl_problem(ctx, "Bad depth func in hardware_depth_test_pixels"); @@ -1417,6 +1417,74 @@ _mesa_depth_test_pixels( GLcontext *ctx, /* + * Read a span of depth values from the depth buffer. + * This function does clipping before calling the device driver function. + */ +void +_mesa_read_depth_span( GLcontext *ctx, + GLint n, GLint x, GLint y, GLdepth depth[] ) +{ + if (y < 0 || y >= ctx->DrawBuffer->Height || + x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) { + /* span is completely outside framebuffer */ + GLint i; + for (i = 0; i < n; i++) + depth[i] = 0; + return; + } + + if (x < 0) { + GLint dx = -x; + GLint i; + for (i = 0; i < dx; i++) + depth[i] = 0; + x = 0; + n -= dx; + depth += dx; + } + if (x + n > ctx->DrawBuffer->Width) { + GLint dx = x + n - ctx->DrawBuffer->Width; + GLint i; + for (i = 0; i < dx; i++) + depth[n - i - 1] = 0; + n -= dx; + } + if (n <= 0) { + return; + } + + if (ctx->DrawBuffer->DepthBuffer) { + /* read from software depth buffer */ + if (ctx->Visual->DepthBits <= 16) { + const GLushort *zptr = Z_ADDRESS16( ctx, x, y ); + GLuint i; + for (i = 0; i < n; i++) { + depth[i] = zptr[i]; + } + } + else { + const GLuint *zptr = Z_ADDRESS32( ctx, x, y ); + GLuint i; + for (i = 0; i < n; i++) { + depth[i] = zptr[i]; + } + } + } + else if (ctx->Driver.ReadDepthSpan) { + /* read from hardware depth buffer */ + (*ctx->Driver.ReadDepthSpan)( ctx, n, x, y, depth ); + } + else { + /* no depth buffer */ + BZERO(depth, n * sizeof(GLfloat)); + } + +} + + + + +/* * Return a span of depth values from the depth buffer as floats in [0,1]. * This is used for both hardware and software depth buffers. * Input: n - how many pixels @@ -1424,11 +1492,39 @@ _mesa_depth_test_pixels( GLcontext *ctx, * Output: depth - the array of depth values */ void -_mesa_read_depth_span_float( GLcontext* ctx, - GLuint n, GLint x, GLint y, GLfloat depth[] ) +_mesa_read_depth_span_float( GLcontext *ctx, + GLint n, GLint x, GLint y, GLfloat depth[] ) { const GLfloat scale = 1.0F / ctx->Visual->DepthMaxF; + if (y < 0 || y >= ctx->DrawBuffer->Height || + x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) { + /* span is completely outside framebuffer */ + GLint i; + for (i = 0; i < n; i++) + depth[i] = 0.0F; + return; + } + + if (x < 0) { + GLint dx = -x; + GLint i; + for (i = 0; i < dx; i++) + depth[i] = 0.0F; + n -= dx; + x = 0; + } + if (x + n > ctx->DrawBuffer->Width) { + GLint dx = x + n - ctx->DrawBuffer->Width; + GLint i; + for (i = 0; i < dx; i++) + depth[n - i - 1] = 0.0F; + n -= dx; + } + if (n <= 0) { + return; + } + if (ctx->DrawBuffer->DepthBuffer) { /* read from software depth buffer */ if (ctx->Visual->DepthBits <= 16) { @@ -1458,7 +1554,7 @@ _mesa_read_depth_span_float( GLcontext* ctx, } else { /* no depth buffer */ - MEMSET(depth, 0, n * sizeof(GLfloat)); + BZERO(depth, n * sizeof(GLfloat)); } } @@ -1564,9 +1660,15 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) if (ctx->Visual->DepthBits <= 16) { const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax); if ((clearValue & 0xff) == (clearValue >> 8)) { - /* lower and upper bytes of clear_value are same, use MEMSET */ - MEMSET( ctx->DrawBuffer->DepthBuffer, clearValue & 0xff, - 2 * ctx->DrawBuffer->Width * ctx->DrawBuffer->Height); + if (clearValue == 0) { + BZERO(ctx->DrawBuffer->DepthBuffer, + 2*ctx->DrawBuffer->Width*ctx->DrawBuffer->Height); + } + else { + /* lower and upper bytes of clear_value are same, use MEMSET */ + MEMSET( ctx->DrawBuffer->DepthBuffer, clearValue & 0xff, + 2 * ctx->DrawBuffer->Width * ctx->DrawBuffer->Height); + } } else { GLushort *d = (GLushort *) ctx->DrawBuffer->DepthBuffer; @@ -1591,24 +1693,30 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) } else { /* >16 bit depth buffer */ - GLuint *d = (GLuint *) ctx->DrawBuffer->DepthBuffer; const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax); - GLint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; - while (n >= 16) { - d[0] = clearValue; d[1] = clearValue; - d[2] = clearValue; d[3] = clearValue; - d[4] = clearValue; d[5] = clearValue; - d[6] = clearValue; d[7] = clearValue; - d[8] = clearValue; d[9] = clearValue; - d[10] = clearValue; d[11] = clearValue; - d[12] = clearValue; d[13] = clearValue; - d[14] = clearValue; d[15] = clearValue; - d += 16; - n -= 16; + if (clearValue == 0) { + BZERO(ctx->DrawBuffer->DepthBuffer, + ctx->DrawBuffer->Width*ctx->DrawBuffer->Height*sizeof(GLuint)); } - while (n > 0) { - *d++ = clearValue; - n--; + else { + GLint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; + GLuint *d = (GLuint *) ctx->DrawBuffer->DepthBuffer; + while (n >= 16) { + d[0] = clearValue; d[1] = clearValue; + d[2] = clearValue; d[3] = clearValue; + d[4] = clearValue; d[5] = clearValue; + d[6] = clearValue; d[7] = clearValue; + d[8] = clearValue; d[9] = clearValue; + d[10] = clearValue; d[11] = clearValue; + d[12] = clearValue; d[13] = clearValue; + d[14] = clearValue; d[15] = clearValue; + d += 16; + n -= 16; + } + while (n > 0) { + *d++ = clearValue; + n--; + } } } } diff --git a/xc/extras/Mesa/src/depth.h b/xc/extras/Mesa/src/depth.h index 041318235..9bf009997 100644 --- a/xc/extras/Mesa/src/depth.h +++ b/xc/extras/Mesa/src/depth.h @@ -67,7 +67,12 @@ _mesa_depth_test_pixels( GLcontext *ctx, extern void -_mesa_read_depth_span_float( GLcontext *ctx, GLuint n, GLint x, GLint y, +_mesa_read_depth_span( GLcontext *ctx, + GLint n, GLint x, GLint y, GLdepth depth[] ); + + +extern void +_mesa_read_depth_span_float( GLcontext *ctx, GLint n, GLint x, GLint y, GLfloat depth[] ); diff --git a/xc/extras/Mesa/src/dlist.c b/xc/extras/Mesa/src/dlist.c index b2cc13787..929a050db 100644 --- a/xc/extras/Mesa/src/dlist.c +++ b/xc/extras/Mesa/src/dlist.c @@ -58,6 +58,7 @@ #include "mem.h" #include "pipeline.h" #include "pixel.h" +#include "pixeltex.h" #include "points.h" #include "polygon.h" #include "readpix.h" @@ -226,6 +227,9 @@ typedef enum { /* GL_ARB_multitexture */ OPCODE_ACTIVE_TEXTURE, OPCODE_CLIENT_ACTIVE_TEXTURE, + /* GL_SGIX/SGIS_pixel_texture */ + OPCODE_PIXEL_TEXGEN_SGIX, + OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_VERTEX_CASSETTE, /* render prebuilt vertex buffer */ @@ -585,6 +589,9 @@ void gl_init_lists( void ) InstSize[OPCODE_ERROR] = 3; InstSize[OPCODE_VERTEX_CASSETTE] = 9; InstSize[OPCODE_END_OF_LIST] = 1; + /* GL_SGIX/SGIS_pixel_texture */ + InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2; + InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3, /* GL_ARB_multitexture */ InstSize[OPCODE_ACTIVE_TEXTURE] = 2; InstSize[OPCODE_CLIENT_ACTIVE_TEXTURE] = 2; @@ -3223,6 +3230,53 @@ static void save_MultTransposeMatrixfARB( const GLfloat m[16] ) } +static void save_PixelTexGenSGIX(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 ); + if (n) { + n[1].e = mode; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->PixelTexGenSGIX)( mode ); + } +} + + +static void save_PixelTexGenParameteriSGIS(GLenum target, GLint value) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 ); + if (n) { + n[1].e = target; + n[2].i = value; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->PixelTexGenParameteriSGIS)( target, value ); + } +} + + +static void save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) +{ + save_PixelTexGenParameteriSGIS(target, (GLint) value); +} + + +static void save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) +{ + save_PixelTexGenParameteriSGIS(target, *value); +} + + +static void save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) +{ + save_PixelTexGenParameteriSGIS(target, (GLint) *value); +} void gl_compile_cassette( GLcontext *ctx ) { @@ -3870,6 +3924,12 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_CLIENT_ACTIVE_TEXTURE: /* GL_ARB_multitexture */ (*ctx->Exec->ClientActiveTextureARB)( n[1].e ); break; + case OPCODE_PIXEL_TEXGEN_SGIX: /* GL_SGIX_pixel_texture */ + (*ctx->Exec->PixelTexGenSGIX)( n[1].e ); + break; + case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS: /* GL_SGIS_pixel_texture */ + (*ctx->Exec->PixelTexGenParameteriSGIS)( n[1].e, n[2].i ); + break; case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -4567,6 +4627,17 @@ _mesa_init_dlist_table( struct _glapi_table *table ) table->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; table->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; + /* 15. GL_SGIX_pixel_texture */ + table->PixelTexGenSGIX = save_PixelTexGenSGIX; + + /* 15. GL_SGIS_pixel_texture */ + table->PixelTexGenParameteriSGIS = save_PixelTexGenParameteriSGIS; + table->PixelTexGenParameterfSGIS = save_PixelTexGenParameterfSGIS; + table->PixelTexGenParameterivSGIS = save_PixelTexGenParameterivSGIS; + table->PixelTexGenParameterfvSGIS = save_PixelTexGenParameterfvSGIS; + table->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; + table->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; + /* GL_EXT_compiled_vertex_array */ table->LockArraysEXT = _mesa_LockArraysEXT; table->UnlockArraysEXT = _mesa_UnlockArraysEXT; @@ -4808,7 +4879,6 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) case OPCODE_END_OF_LIST: fprintf(f,"END-LIST %u\n", list); done = GL_TRUE; - gl_print_cassette( (struct immediate *) n[1].data ); break; default: if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { diff --git a/xc/extras/Mesa/src/dlist.h b/xc/extras/Mesa/src/dlist.h index a5233e50c..3305392d9 100644 --- a/xc/extras/Mesa/src/dlist.h +++ b/xc/extras/Mesa/src/dlist.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,15 +24,13 @@ */ - - - #ifndef DLIST_H #define DLIST_H #include "types.h" + struct display_list { union node *nodes; GLuint OrFlag; @@ -68,7 +66,6 @@ extern void _mesa_NewList( GLuint list, GLenum mode ); extern void _mesa_init_dlist_table( struct _glapi_table *table ); - extern void gl_compile_cassette( GLcontext *ctx ); extern void gl_save_error( GLcontext *ctx, GLenum error, const char *s ); diff --git a/xc/extras/Mesa/src/drawpix.c b/xc/extras/Mesa/src/drawpix.c index 283ca63e5..362e30b9c 100644 --- a/xc/extras/Mesa/src/drawpix.c +++ b/xc/extras/Mesa/src/drawpix.c @@ -36,9 +36,11 @@ #include "mem.h" #include "mmath.h" #include "pixel.h" +#include "pixeltex.h" #include "span.h" #include "state.h" #include "stencil.h" +#include "texture.h" #include "types.h" #include "zoom.h" #endif @@ -113,17 +115,16 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, return GL_TRUE; } - if (ctx->NewState) { - gl_update_state(ctx); - } - if ((ctx->RasterMask&(~(SCISSOR_BIT|WINCLIP_BIT)))==0 - && ctx->Pixel.RedBias==0.0 && ctx->Pixel.RedScale==1.0 - && ctx->Pixel.GreenBias==0.0 && ctx->Pixel.GreenScale==1.0 - && ctx->Pixel.BlueBias==0.0 && ctx->Pixel.BlueScale==1.0 - && ctx->Pixel.AlphaBias==0.0 && ctx->Pixel.AlphaScale==1.0 + && !ctx->Pixel.ScaleOrBiasRGBA + && !ctx->Pixel.ScaleOrBiasRGBApcm + && ctx->ColorMatrix.type == MATRIX_IDENTITY + && !ctx->Pixel.ColorTableEnabled + && !ctx->Pixel.PostColorMatrixColorTableEnabled + && !ctx->Pixel.MinMaxEnabled && ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0 && ctx->Pixel.MapColorFlag==0 + && ctx->Texture.ReallyEnabled == 0 && unpack->Alignment==1 && !unpack->SwapBytes && !unpack->LsbFirst) { @@ -341,7 +342,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { assert(drawWidth < MAX_WIDTH); - gl_map_ci8_to_rgba(ctx, drawWidth, src, rgba); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, (const GLubyte (*)[4])rgba, NULL); @@ -355,7 +356,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { assert(drawWidth < MAX_WIDTH); - gl_map_ci8_to_rgba(ctx, drawWidth, src, rgba); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, zSpan, (void *) rgba, zoomY0); src += rowLength; @@ -449,6 +450,7 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, GLenum type, const GLvoid *pixels ) { const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; + const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; const GLint desty = y; GLint row, drawWidth; @@ -473,14 +475,20 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); _mesa_unpack_index_span(ctx, drawWidth, destType, values, - type, source, &ctx->Unpack, GL_TRUE); + type, source, &ctx->Unpack, GL_FALSE); + if (shift_or_offset) { + _mesa_shift_and_offset_stencil( ctx, drawWidth, values ); + } + if (ctx->Pixel.MapStencilFlag) { + _mesa_map_stencil( ctx, drawWidth, values ); + } if (zoom) { gl_write_zoomed_stencil_span( ctx, (GLuint) drawWidth, x, y, values, desty ); } else { - gl_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values ); + _mesa_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values ); } } } @@ -643,6 +651,19 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, pixels, width, height, format, type, 0, row, 0); _mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba, format, type, source, unpack, GL_TRUE); + if (ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) + continue; + + if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { + GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; + GLuint unit; + /* XXX not sure how multitexture is supposed to work here */ + for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba, + s, t, r, q); + gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba); + } + } if (quickDraw) { (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y, @@ -677,9 +698,15 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, return; } + if (ctx->NewState) { + gl_update_state(ctx); + } + x = (GLint) (ctx->Current.RasterPos[0] + 0.5F); y = (GLint) (ctx->Current.RasterPos[1] + 0.5F); + ctx->OcclusionResult = GL_TRUE; + /* see if device driver can do the drawpix */ if (ctx->Driver.DrawPixels && (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type, diff --git a/xc/extras/Mesa/src/enable.c b/xc/extras/Mesa/src/enable.c index cc81c8557..38a2f396d 100644 --- a/xc/extras/Mesa/src/enable.c +++ b/xc/extras/Mesa/src/enable.c @@ -454,6 +454,10 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_OCCLUSION_TEST_HP: if (ctx->Extensions.HaveHpOcclusionTest) { ctx->Depth.OcclusionTest = state; + if (state) + ctx->OcclusionResult = ctx->OcclusionResultSaved; + else + ctx->OcclusionResultSaved = ctx->OcclusionResult; ctx->NewState |= NEW_RASTER_OPS; } else { @@ -462,6 +466,27 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + ctx->Pixel.PixelTextureEnabled = state; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + ctx->Pixel.PixelTextureEnabled = state; + break; + + /* GL_SGI_color_table */ + case GL_COLOR_TABLE_SGI: + ctx->Pixel.ColorTableEnabled = state; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + ctx->Pixel.PostConvolutionColorTableEnabled = state; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + ctx->Pixel.PostColorMatrixColorTableEnabled = state; + break; + default: if (state) { gl_error( ctx, GL_INVALID_ENUM, "glEnable" ); @@ -666,6 +691,22 @@ _mesa_IsEnabled( GLenum cap ) return GL_FALSE; } + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + return ctx->Pixel.PixelTextureEnabled; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + return ctx->Pixel.PixelTextureEnabled; + + /* GL_SGI_color_table */ + case GL_COLOR_TABLE_SGI: + return ctx->Pixel.ColorTableEnabled; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + return ctx->Pixel.PostConvolutionColorTableEnabled; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + return ctx->Pixel.PostColorMatrixColorTableEnabled; + default: gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); return GL_FALSE; diff --git a/xc/extras/Mesa/src/extensions.c b/xc/extras/Mesa/src/extensions.c index 5c952217e..89e3ab420 100644 --- a/xc/extras/Mesa/src/extensions.c +++ b/xc/extras/Mesa/src/extensions.c @@ -48,36 +48,40 @@ struct extension { static struct { int enabled; const char *name; } default_extensions[] = { + { DEFAULT_OFF, "GL_ARB_imaging" }, + { DEFAULT_ON, "GL_ARB_multitexture" }, + { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, + { ALWAYS_ENABLED, "GL_EXT_abgr" }, { DEFAULT_ON, "GL_EXT_blend_color" }, - { DEFAULT_OFF, "ARB_imaging" }, - { DEFAULT_ON, "GL_EXT_blend_minmax" }, { DEFAULT_ON, "GL_EXT_blend_logic_op" }, + { DEFAULT_ON, "GL_EXT_blend_minmax" }, { DEFAULT_ON, "GL_EXT_blend_subtract" }, + { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, + { DEFAULT_ON, "GL_EXT_compiled_vertex_array" }, { DEFAULT_ON, "GL_EXT_paletted_texture" }, { DEFAULT_ON, "GL_EXT_point_parameters" }, { ALWAYS_ENABLED, "GL_EXT_polygon_offset" }, - { ALWAYS_ENABLED, "GL_EXT_vertex_array" }, - { ALWAYS_ENABLED, "GL_EXT_texture_object" }, - { DEFAULT_ON, "GL_EXT_texture3D" }, - { ALWAYS_ENABLED, "GL_MESA_window_pos" }, - { ALWAYS_ENABLED, "GL_MESA_resize_buffers" }, - { DEFAULT_ON, "GL_EXT_shared_texture_palette" }, { ALWAYS_ENABLED, "GL_EXT_rescale_normal" }, - { ALWAYS_ENABLED, "GL_EXT_abgr" }, - { ALWAYS_ENABLED, "GL_SGIS_texture_edge_clamp" }, + { DEFAULT_ON, "GL_EXT_shared_texture_palette" }, { ALWAYS_ENABLED, "GL_EXT_stencil_wrap" }, + { DEFAULT_ON, "GL_EXT_texture3D" }, + { DEFAULT_OFF, "GL_EXT_texture_env" }, + { DEFAULT_ON, "GL_EXT_texture_env_add" }, + { ALWAYS_ENABLED, "GL_EXT_texture_object" }, + { DEFAULT_ON, "GL_EXT_texture_lod_bias" }, + { ALWAYS_ENABLED, "GL_EXT_vertex_array" }, + { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, + { DEFAULT_OFF, "GL_HP_occlusion_test" }, { DEFAULT_ON, "GL_INGR_blend_func_separate" }, - { DEFAULT_ON, "GL_ARB_multitexture" }, + { ALWAYS_ENABLED, "GL_MESA_window_pos" }, + { ALWAYS_ENABLED, "GL_MESA_resize_buffers" }, { ALWAYS_ENABLED, "GL_NV_texgen_reflection" }, { DEFAULT_ON, "GL_PGI_misc_hints" }, - { DEFAULT_ON, "GL_EXT_compiled_vertex_array" }, - { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, - { DEFAULT_ON, "GL_EXT_texture_env_add" }, - { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, - { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, - { DEFAULT_OFF, "GL_EXT_texture_env" }, - { DEFAULT_ON, "GL_EXT_texture_lod_bias" }, - { DEFAULT_OFF, "GL_HP_occlusion_test" } + { DEFAULT_ON, "GL_SGI_color_matrix" }, + { DEFAULT_ON, "GL_SGI_color_table" }, + { DEFAULT_ON, "GL_SGIS_pixel_texture" }, + { DEFAULT_ON, "GL_SGIS_texture_edge_clamp" }, + { DEFAULT_ON, "GL_SGIX_pixel_texture" } }; diff --git a/xc/extras/Mesa/src/fog.c b/xc/extras/Mesa/src/fog.c index e35906c8f..bac41cb1d 100644 --- a/xc/extras/Mesa/src/fog.c +++ b/xc/extras/Mesa/src/fog.c @@ -35,7 +35,6 @@ #include "types.h" #include "xform.h" #endif -#include "xform.h" diff --git a/xc/extras/Mesa/src/fog.h b/xc/extras/Mesa/src/fog.h index 59d84517b..28355dd44 100644 --- a/xc/extras/Mesa/src/fog.h +++ b/xc/extras/Mesa/src/fog.h @@ -31,6 +31,9 @@ #include "types.h" +extern struct gl_pipeline_stage gl_fog_coord_stage; + + extern void _mesa_Fogf(GLenum pname, GLfloat param); @@ -65,6 +68,4 @@ extern void _mesa_init_fog( void ); -extern struct gl_pipeline_stage gl_fog_coord_stage; - #endif diff --git a/xc/extras/Mesa/src/fog_tmp.h b/xc/extras/Mesa/src/fog_tmp.h index a0fa87229..5096b0a99 100644 --- a/xc/extras/Mesa/src/fog_tmp.h +++ b/xc/extras/Mesa/src/fog_tmp.h @@ -84,12 +84,11 @@ static void TAG(make_fog_coord)( struct vertex_buffer *VB, } else { - GLubyte r = 0; + GLubyte r = 255; if (ctx->Fog.Mode == GL_LINEAR) { - GLfloat f = ctx->Fog.End * (ctx->Fog.End - ctx->Fog.Start); + GLfloat f = 1.0 - ctx->Fog.End / (ctx->Fog.End - ctx->Fog.Start); CLAMP_FLOAT_COLOR( f ); - f = 1.0 - f; FLOAT_COLOR_TO_UBYTE_COLOR(r, f); } diff --git a/xc/extras/Mesa/src/general_clip.h b/xc/extras/Mesa/src/general_clip.h index 29a8eb760..c8bc8890a 100644 --- a/xc/extras/Mesa/src/general_clip.h +++ b/xc/extras/Mesa/src/general_clip.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -28,144 +28,56 @@ */ - -/* - * Clip against +X - * - * The if conditions are known at compile time. - */ -#define PLANE (CLIP_RIGHT_BIT) -#define INSIDE(K) (X(K) <= W(K)) -#define COMPUTE_INTERSECTION( in, out, new ) \ - dx = X(out)-X(in); \ - dw = W(out)-W(in); \ - t = (X(in)-W(in)) / (dw-dx); \ - neww = W(in) + t * dw; \ - X(new) = neww; \ - Y(new) = Y(in) + t * (Y(out) - Y(in)); \ - if (SIZE>=3) coord[new][2] = Z(in) + t * (Z(out) - Z(in)); \ - if (SIZE==4) coord[new][3] = neww; +#define PLANE CLIP_RIGHT_BIT +#define CLIP_DOTPROD(K) (- X(K) + W(K)) GENERAL_CLIP -#undef INSIDE +#undef CLIP_DOTPROD #undef PLANE -#undef COMPUTE_INTERSECTION -/* - * Clip against -X - */ -#define PLANE (CLIP_LEFT_BIT) -#define INSIDE(K) (X(K) >= -W(K)) -#define COMPUTE_INTERSECTION( in, out, new ) \ - dx = X(out)-X(in); \ - dw = W(out)-W(in); \ - t = -(X(in)+W(in)) / (dw+dx); \ - neww = W(in) + t * dw; \ - X(new) = -neww; \ - Y(new) = Y(in) + t * (Y(out) - Y(in)); \ - if (SIZE>=3) coord[new][2] = Z(in) + t * (Z(out) - Z(in)); \ - if (SIZE==4) coord[new][3] = neww; +#define PLANE CLIP_LEFT_BIT +#define CLIP_DOTPROD(K) (X(K) + W(K)) GENERAL_CLIP -#undef INSIDE +#undef CLIP_DOTPROD #undef PLANE -#undef COMPUTE_INTERSECTION - -/* - * Clip against +Y - */ -#define PLANE (CLIP_TOP_BIT) -#define INSIDE(K) (Y(K) <= W(K)) -#define COMPUTE_INTERSECTION( in, out, new ) \ - dy = Y(out)-Y(in); \ - dw = W(out)-W(in); \ - t = (Y(in)-W(in)) / (dw-dy); \ - neww = W(in) + t * dw; \ - X(new) = X(in) + t * (X(out) - X(in)); \ - Y(new) = neww; \ - if (SIZE>=3) coord[new][2] = Z(in) + t * (Z(out) - Z(in)); \ - if (SIZE==4) coord[new][3] = neww; +#define PLANE CLIP_TOP_BIT +#define CLIP_DOTPROD(K) (- Y(K) + W(K)) GENERAL_CLIP -#undef INSIDE +#undef CLIP_DOTPROD #undef PLANE -#undef COMPUTE_INTERSECTION - -/* - * Clip against -Y - */ -#define PLANE (CLIP_BOTTOM_BIT) -#define INSIDE(K) (Y(K) >= -W(K)) -#define COMPUTE_INTERSECTION( in, out, new ) \ - dy = Y(out)-Y(in); \ - dw = W(out)-W(in); \ - t = -(Y(in)+W(in)) / (dw+dy); \ - neww = W(in) + t * dw; \ - X(new) = X(in) + t * (X(out) - X(in)); \ - Y(new) = -neww; \ - if (SIZE>=3) coord[new][2] = Z(in) + t * (Z(out) - Z(in)); \ - if (SIZE==4) coord[new][3] = neww; +#define PLANE CLIP_BOTTOM_BIT +#define CLIP_DOTPROD(K) (Y(K) + W(K)) GENERAL_CLIP -#undef INSIDE +#undef CLIP_DOTPROD #undef PLANE -#undef COMPUTE_INTERSECTION - +#define PLANE CLIP_FAR_BIT +#define CLIP_DOTPROD(K) (- Z(K) + W(K)) -/* - * Clip against +Z - */ -#define PLANE (CLIP_FAR_BIT) -#define INSIDE(K) (Z(K) <= W(K)) -#define COMPUTE_INTERSECTION( in, out, new ) \ - dz = Z(out)-Z(in); \ - dw = W(out)-W(in); \ - t = (Z(in)-W(in)) / (dw-dz); \ - neww = W(in) + t * dw; \ - X(new) = X(in) + t * (X(out) - X(in)); \ - Y(new) = Y(in) + t * (Y(out) - Y(in)); \ - coord[new][2] = neww; \ - if (SIZE==4) coord[new][3] = neww; - - if (SIZE>=3) { - GENERAL_CLIP - } + if (SIZE >= 3) { + GENERAL_CLIP + } -#undef INSIDE +#undef CLIP_DOTPROD #undef PLANE -#undef COMPUTE_INTERSECTION +#define PLANE CLIP_NEAR_BIT +#define CLIP_DOTPROD(K) (Z(K) + W(K)) -/* - * Clip against -Z - */ -#define PLANE (CLIP_NEAR_BIT) -#define INSIDE(K) (Z(K) >= -W(K)) -#define COMPUTE_INTERSECTION( in, out, new ) \ - dz = Z(out)-Z(in); \ - dw = W(out)-W(in); \ - t = -(Z(in)+W(in)) / (dw+dz); \ - neww = W(in) + t * dw; \ - X(new) = X(in) + t * (X(out) - X(in)); \ - Y(new) = Y(in) + t * (Y(out) - Y(in)); \ - coord[new][2] = -neww; \ - if (SIZE==4) coord[new][3] = neww; - - if (SIZE>=3) { - GENERAL_CLIP - } + if (SIZE >=3 ) { + GENERAL_CLIP + } -#undef INSIDE +#undef CLIP_DOTPROD #undef PLANE -#undef COMPUTE_INTERSECTION #undef GENERAL_CLIP - - diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c index f43e305e5..005f88e91 100644 --- a/xc/extras/Mesa/src/get.c +++ b/xc/extras/Mesa/src/get.c @@ -57,6 +57,28 @@ #endif +static GLenum +pixel_texgen_mode(const GLcontext *ctx) +{ + if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_RGBA; + } + else { + return GL_RGB; + } + } + else { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_ALPHA; + } + else { + return GL_NONE; + } + } +} + + void _mesa_GetBooleanv( GLenum pname, GLboolean *params ) @@ -74,10 +96,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumRedBits); + break; case GL_ACCUM_GREEN_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumGreenBits); + break; case GL_ACCUM_BLUE_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumBlueBits); + break; case GL_ACCUM_ALPHA_BITS: - *params = INT_TO_BOOL(ctx->Visual->AccumBits); + *params = INT_TO_BOOL(ctx->Visual->AccumAlphaBits); break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]); @@ -934,12 +962,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLboolean) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLboolean) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -948,8 +976,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLboolean) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLboolean) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLboolean) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLboolean) ctx->Hint.AllowDrawMem; @@ -1022,14 +1050,80 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) return; case GL_OCCLUSION_TEST_RESULT_HP: if (ctx->Extensions.HaveHpOcclusionTest) { - *params = ctx->OcclusionResult; - ctx->OcclusionResult = GL_FALSE; /* reset now */ + if (ctx->Depth.OcclusionTest) + *params = ctx->OcclusionResult; + else + *params = ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; } else { gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); } return; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLboolean) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = FLOAT_TO_BOOL(ctx->ColorMatrix.m[i]); + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = INT_TO_BOOL(ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = FLOAT_TO_BOOL(MAX_COLOR_STACK_DEPTH); + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixRedScale); + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixGreenScale); + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBlueScale); + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixAlphaScale); + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixRedBias); + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixGreenBias); + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBlueBias); + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixAlphaBias); + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); } @@ -1054,10 +1148,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLdouble) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLdouble) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLdouble) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLdouble) ctx->Visual->AccumBits; + *params = (GLdouble) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = (GLdouble) ctx->Accum.ClearColor[0]; @@ -1915,12 +2015,12 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLdouble) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLdouble) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -1929,8 +2029,8 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLdouble) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLdouble) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLdouble) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLdouble) ctx->Hint.AllowDrawMem; @@ -2003,14 +2103,80 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) return; case GL_OCCLUSION_TEST_RESULT_HP: if (ctx->Extensions.HaveHpOcclusionTest) { - *params = (GLdouble) ctx->OcclusionResult; - ctx->OcclusionResult = GL_FALSE; /* reset now */ + if (ctx->Depth.OcclusionTest) + *params = (GLdouble) ctx->OcclusionResult; + else + *params = (GLdouble) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; } else { gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); } return; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLdouble) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLdouble) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLdouble) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = (GLdouble) ctx->ColorMatrix.m[i]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLdouble) (ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLdouble) MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixRedScale; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixGreenScale; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBlueScale; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixAlphaScale; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixRedBias; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixGreenBias; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBlueBias; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixAlphaBias; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); } @@ -2035,10 +2201,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLfloat) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLfloat) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLfloat) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLfloat) ctx->Visual->AccumBits; + *params = (GLfloat) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = ctx->Accum.ClearColor[0]; @@ -2894,12 +3066,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLfloat) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLfloat) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -2908,8 +3080,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLfloat) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLfloat) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLfloat) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLfloat) ctx->Hint.AllowDrawMem; @@ -2961,14 +3133,80 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) return; case GL_OCCLUSION_TEST_RESULT_HP: if (ctx->Extensions.HaveHpOcclusionTest) { - *params = (GLfloat) ctx->OcclusionResult; - ctx->OcclusionResult = GL_FALSE; /* reset now */ + if (ctx->Depth.OcclusionTest) + *params = (GLfloat) ctx->OcclusionResult; + else + *params = (GLfloat) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; } else { gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); } return; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLfloat) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLfloat) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLfloat) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = ctx->ColorMatrix.m[i]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLfloat) (ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLfloat) MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixRedScale; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixGreenScale; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixBlueScale; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixAlphaScale; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixRedBias; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixGreenBias; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBlueBias; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixAlphaBias; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); } @@ -2993,10 +3231,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLint) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLint) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLint) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLint) ctx->Visual->AccumBits; + *params = (GLint) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] ); @@ -3854,12 +4098,12 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -3868,8 +4112,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = ctx->Hint.AllowDrawMem; @@ -3942,14 +4186,80 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) return; case GL_OCCLUSION_TEST_RESULT_HP: if (ctx->Extensions.HaveHpOcclusionTest) { - *params = (GLint) ctx->OcclusionResult; - ctx->OcclusionResult = GL_FALSE; /* reset now */ + if (ctx->Depth.OcclusionTest) + *params = (GLint) ctx->OcclusionResult; + else + *params = (GLint) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; } else { gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); } return; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLint) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLint) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLint) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = (GLint) ctx->ColorMatrix.m[i]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = ctx->ColorStackDepth + 1; + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixRedScale; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixGreenScale; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBlueScale; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixAlphaScale; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixRedBias; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixGreenBias; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBlueBias; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixAlphaBias; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); } diff --git a/xc/extras/Mesa/src/glapitemp.h b/xc/extras/Mesa/src/glapitemp.h index 7b940def6..a04c2a327 100644 --- a/xc/extras/Mesa/src/glapitemp.h +++ b/xc/extras/Mesa/src/glapitemp.h @@ -2933,6 +2933,117 @@ KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) } +/* 112. GL_EXT_draw_range_elements */ + +#if 00 +KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +{ + DISPATCH(DrawRangeElementsEXT, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %u %u %d 0x%x %p);", mode, start, end, count, type, indices)); +} +#endif + + +/* 117. GL_EXT_light_texture */ + +#if 00 +KEYWORD1 void KEYWORD2 NAME(ApplyTextureEXT)(GLenum mode) +{ + DISPATCH(ApplyTextureEXT, (mode), (F, "glApplyTextureEXT(0x%x);", mode)); +} + + +KEYWORD1 void KEYWORD2 NAME(TextureLightEXT)(GLenum pname) +{ + DISPATCH(TextureLightEXT, (pname), (F, "glTextureLightEXT(0x%x);", pname)); +} + +KEYWORD1 void KEYWORD2 NAME(TextureMaterialEXT)(GLenum face, GLenum mode) +{ + DISPATCH(TextureMaterialEXT, (face, mode), (F, "glTextureMaterialEXT(0x%x, 0x%x);", face, mode)); +} +#endif + + + +/* 135. GL_INTEL_texture_scissor */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(TexScissorINTEL)(GLenum target, GLclampf tlow, GLclampf thigh) +{ + DISPATCH(TexScissorINTEL, (target, tlow, thigh), (F, "glTexScissorINTEL(0x%x %g %g);", target, tlow, thigh)); +} + +KEYWORD1 void KEYWORD2 NAME(TexScissorFuncINTEL)(GLenum target, GLenum lfunc, GLenum hfunc) +{ + DISPATCH(TexScissorFuncINTEL, (target, lfunc, hfunc), (F, "glTexScissorFuncINTEL(0x%x 0x%x 0x%x);", target, tlow, thigh)); +} +#endif + + + +/* 136. GL_INTEL_parallel_arrays */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(VertexPointervINTEL)(GLint size, GLenum type, const void ** pointer) +{ + DISPATCH(VertexPointervINTEL, (size, type, pointer), (F, "glVertexPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(NormalPointervINTEL)(GLenum type, const void** pointer) +{ + DISPATCH(NormalPointervINTEL, (size, pointer), (F, "glNormalPointervINTEL(%d, %p);", size, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorPointervINTEL)(GLint size, GLenum type, const void** pointer) +{ + DISPATCH(ColorPointervINTEL, (size, type, pointer), (F, "glColorPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoordPointervINTEL)(GLint size, GLenum type, const void** pointer) +{ + DISPATCH(TexCoordPointervINTEL, (size, type, pointer), (F, "glTexCoordPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} +#endif + + +/* 138. GL_EXT_pixel_transform */ +#if 0 +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameteriEXT)(GLenum target, GLenum pname, const GLint param) +{ + DISPATCH(PixelTransformParameteriEXT, (target, pname, param), (F, "glPixelTransformParameteriEXT(0x%x, 0x%x, %d);", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfEXT)(GLenum target, GLenum pname, const GLfloat param) +{ + DISPATCH(PixelTransformParameterfEXT, (target, pname, param), (F, "glPixelTransformParameterfEXT(0x%x, 0x%x, %f);", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + DISPATCH(PixelTransformParameterivEXT, (target, pname, params), (F, "glPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +{ + DISPATCH(PixelTransformParameterfvEXT, (target, pname, params), (F, "glPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + DISPATCH(GetPixelTransformParameterivEXT, (target, pname, params), (F, "glGetPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +{ + DISPATCH(GetPixelTransformParameterfvEXT, (target, pname, params), (F, "glGetPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); +} +#endif + + + +/* 145. GL_EXT_secondary_color */ +/* XXX todo */ + + + /* 149. GL_EXT_fog_coord */ KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) { diff --git a/xc/extras/Mesa/src/hint.c b/xc/extras/Mesa/src/hint.c index 2d7427f01..7f8d88b76 100644 --- a/xc/extras/Mesa/src/hint.c +++ b/xc/extras/Mesa/src/hint.c @@ -89,17 +89,17 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) case GL_ALWAYS_FAST_HINT_PGI: if (mode) { ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_FALSE; + ctx->Hint.AllowDrawFrg = GL_FALSE; ctx->Hint.AllowDrawMem = GL_FALSE; } else { ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; } break; case GL_ALWAYS_SOFT_HINT_PGI: ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -107,8 +107,8 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) case GL_ALLOW_DRAW_WIN_HINT_PGI: ctx->Hint.AllowDrawWin = mode; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - ctx->Hint.AllowDrawSpn = mode; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + ctx->Hint.AllowDrawFrg = mode; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: ctx->Hint.AllowDrawMem = mode; @@ -168,7 +168,7 @@ _mesa_HintPGI( GLenum target, GLint mode ) case GL_ALWAYS_SOFT_HINT_PGI: case GL_ALLOW_DRAW_OBJ_HINT_PGI: case GL_ALLOW_DRAW_WIN_HINT_PGI: - case GL_ALLOW_DRAW_SPN_HINT_PGI: + case GL_ALLOW_DRAW_FRG_HINT_PGI: case GL_ALLOW_DRAW_MEM_HINT_PGI: case GL_CLIP_NEAR_HINT_PGI: case GL_CLIP_FAR_HINT_PGI: diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c index 724a7995e..3f0720ea0 100644 --- a/xc/extras/Mesa/src/image.c +++ b/xc/extras/Mesa/src/image.c @@ -30,6 +30,7 @@ #include "glheader.h" #include "context.h" #include "image.h" +#include "imaging.h" #include "macros.h" #include "mem.h" #include "mmath.h" @@ -601,34 +602,39 @@ _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, * applyTransferOps - apply scale/bias/lookup-table ops? */ void -_mesa_pack_rgba_span( const GLcontext *ctx, - GLuint n, CONST GLubyte rgba[][4], +_mesa_pack_rgba_span( GLcontext *ctx, + GLuint n, CONST GLubyte srcRgba[][4], GLenum format, GLenum type, GLvoid *destination, const struct gl_pixelstore_attrib *packing, GLboolean applyTransferOps ) { - applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag); + applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled); /* Test for optimized case first */ if (!applyTransferOps && format == GL_RGBA && type == GL_UNSIGNED_BYTE) { /* common simple case */ - MEMCPY( destination, rgba, n * 4 * sizeof(GLubyte) ); + MEMCPY( destination, srcRgba, n * 4 * sizeof(GLubyte) ); } else if (!applyTransferOps && format == GL_RGB && type == GL_UNSIGNED_BYTE) { /* common simple case */ GLint i; GLubyte *dest = (GLubyte *) destination; for (i = 0; i < n; i++) { - dest[0] = rgba[i][RCOMP]; - dest[1] = rgba[i][GCOMP]; - dest[2] = rgba[i][BCOMP]; + dest[0] = srcRgba[i][RCOMP]; + dest[1] = srcRgba[i][GCOMP]; + dest[2] = srcRgba[i][BCOMP]; dest += 3; } } else { /* general solution */ - GLfloat red[MAX_WIDTH], green[MAX_WIDTH], blue[MAX_WIDTH]; - GLfloat alpha[MAX_WIDTH], luminance[MAX_WIDTH]; + GLfloat rgba[MAX_WIDTH][4], luminance[MAX_WIDTH]; const GLfloat rscale = 1.0F / 255.0F; const GLfloat gscale = 1.0F / 255.0F; const GLfloat bscale = 1.0F / 255.0F; @@ -640,27 +646,51 @@ _mesa_pack_rgba_span( const GLcontext *ctx, /* convert color components to floating point */ for (i=0;i<n;i++) { - red[i] = rgba[i][RCOMP] * rscale; - green[i] = rgba[i][GCOMP] * gscale; - blue[i] = rgba[i][BCOMP] * bscale; - alpha[i] = rgba[i][ACOMP] * ascale; + rgba[i][RCOMP] = srcRgba[i][RCOMP] * rscale; + rgba[i][GCOMP] = srcRgba[i][GCOMP] * gscale; + rgba[i][BCOMP] = srcRgba[i][BCOMP] * bscale; + rgba[i][ACOMP] = srcRgba[i][ACOMP] * ascale; } /* * Apply scale, bias and lookup-tables if enabled. */ if (applyTransferOps) { + /* scale & bias */ if (ctx->Pixel.ScaleOrBiasRGBA) { - gl_scale_and_bias_color( ctx, n, red, green, blue, alpha ); + _mesa_scale_and_bias_rgba( ctx, n, rgba ); } + /* color map lookup */ if (ctx->Pixel.MapColorFlag) { - gl_map_color( ctx, n, red, green, blue, alpha ); + _mesa_map_rgba( ctx, n, rgba ); + } + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* XXX histogram here */ + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (const GLfloat (*)[4]) rgba); + if (ctx->MinMax.Sink) + return; } } if (format==GL_LUMINANCE || format==GL_LUMINANCE_ALPHA) { for (i=0;i<n;i++) { - GLfloat sum = red[i] + green[i] + blue[i]; + GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; luminance[i] = CLAMP( sum, 0.0F, 1.0F ); } } @@ -675,19 +705,19 @@ _mesa_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(red[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(green[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(blue[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(alpha[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -696,45 +726,45 @@ _mesa_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_UBYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UBYTE(red[i]); - dst[i*3+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*3+2] = FLOAT_TO_UBYTE(blue[i]); + dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(red[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UBYTE(blue[i]); - dst[i*3+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*3+2] = FLOAT_TO_UBYTE(red[i]); + dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(red[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(alpha[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(red[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); } break; default: @@ -748,19 +778,19 @@ _mesa_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(red[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(green[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(blue[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(alpha[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -769,44 +799,44 @@ _mesa_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_BYTE(alpha[i]); + dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(red[i]); - dst[i*3+1] = FLOAT_TO_BYTE(green[i]); - dst[i*3+2] = FLOAT_TO_BYTE(blue[i]); + dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(red[i]); - dst[i*4+1] = FLOAT_TO_BYTE(green[i]); - dst[i*4+2] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+3] = FLOAT_TO_BYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(blue[i]); - dst[i*3+1] = FLOAT_TO_BYTE(green[i]); - dst[i*3+2] = FLOAT_TO_BYTE(red[i]); + dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+1] = FLOAT_TO_BYTE(green[i]); - dst[i*4+2] = FLOAT_TO_BYTE(red[i]); - dst[i*4+3] = FLOAT_TO_BYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(alpha[i]); - dst[i*4+1] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+2] = FLOAT_TO_BYTE(green[i]); - dst[i*4+3] = FLOAT_TO_BYTE(red[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]); } break; default: @@ -820,19 +850,19 @@ _mesa_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(red[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(green[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(blue[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(alpha[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -841,45 +871,45 @@ _mesa_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_USHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_USHORT(alpha[i]); + dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_USHORT(red[i]); - dst[i*3+1] = FLOAT_TO_USHORT(green[i]); - dst[i*3+2] = FLOAT_TO_USHORT(blue[i]); + dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(red[i]); - dst[i*4+1] = FLOAT_TO_USHORT(green[i]); - dst[i*4+2] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+3] = FLOAT_TO_USHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_USHORT(blue[i]); - dst[i*3+1] = FLOAT_TO_USHORT(green[i]); - dst[i*3+2] = FLOAT_TO_USHORT(red[i]); + dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+1] = FLOAT_TO_USHORT(green[i]); - dst[i*4+2] = FLOAT_TO_USHORT(red[i]); - dst[i*4+3] = FLOAT_TO_USHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(alpha[i]); - dst[i*4+1] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+2] = FLOAT_TO_USHORT(green[i]); - dst[i*4+3] = FLOAT_TO_USHORT(red[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][RCOMP]); } break; default: @@ -896,19 +926,19 @@ _mesa_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(red[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(green[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(blue[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(alpha[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -917,44 +947,44 @@ _mesa_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_SHORT(alpha[i]); + dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(red[i]); - dst[i*3+1] = FLOAT_TO_SHORT(green[i]); - dst[i*3+2] = FLOAT_TO_SHORT(blue[i]); + dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(red[i]); - dst[i*4+1] = FLOAT_TO_SHORT(green[i]); - dst[i*4+2] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+3] = FLOAT_TO_SHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(blue[i]); - dst[i*3+1] = FLOAT_TO_SHORT(green[i]); - dst[i*3+2] = FLOAT_TO_SHORT(red[i]); + dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+1] = FLOAT_TO_SHORT(green[i]); - dst[i*4+2] = FLOAT_TO_SHORT(red[i]); - dst[i*4+3] = FLOAT_TO_SHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(alpha[i]); - dst[i*4+1] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+2] = FLOAT_TO_SHORT(green[i]); - dst[i*4+3] = FLOAT_TO_SHORT(red[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]); } break; default: @@ -971,19 +1001,19 @@ _mesa_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(red[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(green[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(blue[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(alpha[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -992,45 +1022,45 @@ _mesa_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_UINT(luminance[i]); - dst[i*2+1] = FLOAT_TO_UINT(alpha[i]); + dst[i*2+1] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UINT(red[i]); - dst[i*3+1] = FLOAT_TO_UINT(green[i]); - dst[i*3+2] = FLOAT_TO_UINT(blue[i]); + dst[i*3+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(red[i]); - dst[i*4+1] = FLOAT_TO_UINT(green[i]); - dst[i*4+2] = FLOAT_TO_UINT(blue[i]); - dst[i*4+3] = FLOAT_TO_UINT(alpha[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UINT(blue[i]); - dst[i*3+1] = FLOAT_TO_UINT(green[i]); - dst[i*3+2] = FLOAT_TO_UINT(red[i]); + dst[i*3+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(blue[i]); - dst[i*4+1] = FLOAT_TO_UINT(green[i]); - dst[i*4+2] = FLOAT_TO_UINT(red[i]); - dst[i*4+3] = FLOAT_TO_UINT(alpha[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(alpha[i]); - dst[i*4+1] = FLOAT_TO_UINT(blue[i]); - dst[i*4+2] = FLOAT_TO_UINT(green[i]); - dst[i*4+3] = FLOAT_TO_UINT(red[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][RCOMP]); } break; default: @@ -1047,19 +1077,19 @@ _mesa_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(red[i]); + dst[i] = FLOAT_TO_INT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(green[i]); + dst[i] = FLOAT_TO_INT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(blue[i]); + dst[i] = FLOAT_TO_INT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(alpha[i]); + dst[i] = FLOAT_TO_INT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -1068,45 +1098,45 @@ _mesa_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_INT(luminance[i]); - dst[i*2+1] = FLOAT_TO_INT(alpha[i]); + dst[i*2+1] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_INT(red[i]); - dst[i*3+1] = FLOAT_TO_INT(green[i]); - dst[i*3+2] = FLOAT_TO_INT(blue[i]); + dst[i*3+0] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_INT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(red[i]); - dst[i*4+1] = FLOAT_TO_INT(green[i]); - dst[i*4+2] = FLOAT_TO_INT(blue[i]); - dst[i*4+3] = FLOAT_TO_INT(alpha[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_INT(blue[i]); - dst[i*3+1] = FLOAT_TO_INT(green[i]); - dst[i*3+2] = FLOAT_TO_INT(red[i]); + dst[i*3+0] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_INT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(blue[i]); - dst[i*4+1] = FLOAT_TO_INT(green[i]); - dst[i*4+2] = FLOAT_TO_INT(red[i]); - dst[i*4+3] = FLOAT_TO_INT(alpha[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(alpha[i]); - dst[i*4+1] = FLOAT_TO_INT(blue[i]); - dst[i*4+2] = FLOAT_TO_INT(green[i]); - dst[i*4+3] = FLOAT_TO_INT(red[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]); } break; default: @@ -1123,19 +1153,19 @@ _mesa_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = red[i]; + dst[i] = rgba[i][RCOMP]; break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = green[i]; + dst[i] = rgba[i][GCOMP]; break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = blue[i]; + dst[i] = rgba[i][BCOMP]; break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = alpha[i]; + dst[i] = rgba[i][ACOMP]; break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -1144,45 +1174,45 @@ _mesa_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = luminance[i]; - dst[i*2+1] = alpha[i]; + dst[i*2+1] = rgba[i][ACOMP]; } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = red[i]; - dst[i*3+1] = green[i]; - dst[i*3+2] = blue[i]; + dst[i*3+0] = rgba[i][RCOMP]; + dst[i*3+1] = rgba[i][GCOMP]; + dst[i*3+2] = rgba[i][BCOMP]; } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = red[i]; - dst[i*4+1] = green[i]; - dst[i*4+2] = blue[i]; - dst[i*4+3] = alpha[i]; + dst[i*4+0] = rgba[i][RCOMP]; + dst[i*4+1] = rgba[i][GCOMP]; + dst[i*4+2] = rgba[i][BCOMP]; + dst[i*4+3] = rgba[i][ACOMP]; } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = blue[i]; - dst[i*3+1] = green[i]; - dst[i*3+2] = red[i]; + dst[i*3+0] = rgba[i][BCOMP]; + dst[i*3+1] = rgba[i][GCOMP]; + dst[i*3+2] = rgba[i][RCOMP]; } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = blue[i]; - dst[i*4+1] = green[i]; - dst[i*4+2] = red[i]; - dst[i*4+3] = alpha[i]; + dst[i*4+0] = rgba[i][BCOMP]; + dst[i*4+1] = rgba[i][GCOMP]; + dst[i*4+2] = rgba[i][RCOMP]; + dst[i*4+3] = rgba[i][ACOMP]; } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = alpha[i]; - dst[i*4+1] = blue[i]; - dst[i*4+2] = green[i]; - dst[i*4+3] = red[i]; + dst[i*4+0] = rgba[i][ACOMP]; + dst[i*4+1] = rgba[i][BCOMP]; + dst[i*4+2] = rgba[i][GCOMP]; + dst[i*4+3] = rgba[i][RCOMP]; } break; default: @@ -1197,9 +1227,9 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLubyte *dst = (GLubyte *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 7.0F)) << 5) - | (((GLint) (green[i] * 7.0F)) << 2) - | (((GLint) (blue[i] * 3.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) << 5) + | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 2) + | (((GLint) (rgba[i][BCOMP] * 3.0F)) ); } } break; @@ -1207,9 +1237,9 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLubyte *dst = (GLubyte *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 7.0F)) ) - | (((GLint) (green[i] * 7.0F)) << 3) - | (((GLint) (blue[i] * 3.0F)) << 5); + dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 3) + | (((GLint) (rgba[i][BCOMP] * 3.0F)) << 5); } } break; @@ -1217,9 +1247,9 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) << 11) - | (((GLint) (green[i] * 63.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) ); } } break; @@ -1227,9 +1257,9 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) ) - | (((GLint) (green[i] * 63.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) << 11); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11); } } break; @@ -1237,10 +1267,10 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 15.0F)) << 12) - | (((GLint) (green[i] * 15.0F)) << 8) - | (((GLint) (blue[i] * 15.0F)) << 4) - | (((GLint) (alpha[i] * 15.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) ); } } break; @@ -1248,10 +1278,10 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 15.0F)) ) - | (((GLint) (green[i] * 15.0F)) << 4) - | (((GLint) (blue[i] * 15.0F)) << 8) - | (((GLint) (alpha[i] * 15.0F)) << 12); + dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); } } break; @@ -1259,10 +1289,10 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) << 11) - | (((GLint) (green[i] * 31.0F)) << 6) - | (((GLint) (blue[i] * 31.0F)) << 1) - | (((GLint) (alpha[i] * 1.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 1) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) ); } } break; @@ -1270,10 +1300,10 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) ) - | (((GLint) (green[i] * 31.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) << 10) - | (((GLint) (alpha[i] * 1.0F)) << 15); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 10) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); } } break; @@ -1281,28 +1311,28 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 255.0F)) << 24) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (blue[i] * 255.0F)) << 8) - | (((GLuint) (alpha[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 255.0F)) << 24) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (red[i] * 255.0F)) << 8) - | (((GLuint) (alpha[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 255.0F)) << 24) - | (((GLuint) (blue[i] * 255.0F)) << 16) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (red[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) ); } } break; @@ -1310,28 +1340,28 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 255.0F)) ) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (blue[i] * 255.0F)) << 16) - | (((GLuint) (alpha[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 255.0F)) ) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (red[i] * 255.0F)) << 16) - | (((GLuint) (alpha[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 255.0F)) ) - | (((GLuint) (blue[i] * 255.0F)) << 8) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (red[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24); } } break; @@ -1339,28 +1369,28 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 1023.0F)) << 22) - | (((GLuint) (green[i] * 1023.0F)) << 12) - | (((GLuint) (blue[i] * 1023.0F)) << 2) - | (((GLuint) (alpha[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 1023.0F)) << 22) - | (((GLuint) (green[i] * 1023.0F)) << 12) - | (((GLuint) (red[i] * 1023.0F)) << 2) - | (((GLuint) (alpha[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 1023.0F)) << 22) - | (((GLuint) (blue[i] * 1023.0F)) << 12) - | (((GLuint) (green[i] * 1023.0F)) << 2) - | (((GLuint) (red[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][RCOMP] * 3.0F)) ); } } break; @@ -1368,28 +1398,28 @@ _mesa_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 1023.0F)) ) - | (((GLuint) (green[i] * 1023.0F)) << 10) - | (((GLuint) (blue[i] * 1023.0F)) << 20) - | (((GLuint) (alpha[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 1023.0F)) ) - | (((GLuint) (green[i] * 1023.0F)) << 10) - | (((GLuint) (red[i] * 1023.0F)) << 20) - | (((GLuint) (alpha[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 1023.0F)) ) - | (((GLuint) (blue[i] * 1023.0F)) << 10) - | (((GLuint) (green[i] * 1023.0F)) << 20) - | (((GLuint) (red[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][RCOMP] * 3.0F)) << 30); } } break; @@ -1400,6 +1430,7 @@ _mesa_pack_rgba_span( const GLcontext *ctx, } + #define SWAP2BYTE(VALUE) \ { \ GLubyte *bytes = (GLubyte *) &(VALUE); \ @@ -2103,7 +2134,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], * XXX perhaps expand this to process whole images someday. */ void -_mesa_unpack_ubyte_color_span( const GLcontext *ctx, +_mesa_unpack_ubyte_color_span( GLcontext *ctx, GLuint n, GLenum dstFormat, GLubyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -2153,12 +2184,16 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, srcType == GL_UNSIGNED_INT_10_10_10_2 || srcType == GL_UNSIGNED_INT_2_10_10_10_REV); - /* this is intended for RGBA mode */ + /* this is intended for RGBA mode only */ assert(ctx->Visual->RGBAflag); applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag || - ctx->Pixel.MapColorFlag); + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled); /* Try simple cases first */ if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE) { @@ -2210,8 +2245,8 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } + /* general solution begins here */ { - /* general solution */ GLfloat rgba[MAX_WIDTH][4]; GLint dstComponents; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; @@ -2230,32 +2265,26 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, extract_uint_indexes(n, indexes, srcFormat, srcType, source, unpacking); - /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); - - if (dstFormat == GL_COLOR_INDEX) { - if (applyTransferOps) { - if (ctx->Pixel.MapColorFlag) { - /* Apply lookup table */ - gl_map_ci(ctx, n, indexes); - } - - if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { - - } + if (applyTransferOps) { + if (ctx->Pixel.MapColorFlag) { + _mesa_map_ci(ctx, n, indexes); } + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { + _mesa_shift_and_offset_ci(ctx, n, indexes); + } + } + if (dstFormat == GL_COLOR_INDEX) { /* convert to GLubyte and return */ - { - GLuint i; - for (i = 0; i < n; i++) { - dest[i] = (GLubyte) (indexes[i] & 0xff); - } + GLuint i; + for (i = 0; i < n; i++) { + dest[i] = (GLubyte) (indexes[i] & 0xff); } + return; } else { /* Convert indexes to RGBA */ - gl_map_ci_to_rgba_float(ctx, n, indexes, rgba); + _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); } } else { @@ -2264,23 +2293,38 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, if (applyTransferOps) { /* scale and bias colors */ - gl_scale_and_bias_rgba_float(ctx, n, rgba); - - /* color table lookup */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, n, rgba); + } + /* color map lookup */ if (ctx->Pixel.MapColorFlag) { - gl_map_rgba_float(ctx, n, rgba); + _mesa_map_rgba(ctx, n, rgba); } } } - - /* - * XXX This is where more color table lookups, convolution, - * histograms, minmax, color matrix, etc would take place if - * implemented. - * See figure 3.7 in the OpenGL 1.2 specification for more info. - */ - + if (applyTransferOps) { + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix transform */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* XXX histogram here */ + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (const GLfloat (*)[4]) rgba); + } + } /* clamp to [0,1] */ { @@ -2400,6 +2444,266 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } +void +_mesa_unpack_float_color_span( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLfloat dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *unpacking, + GLboolean applyTransferOps ) +{ + ASSERT(dstFormat == GL_ALPHA || + dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE_ALPHA || + dstFormat == GL_INTENSITY || + dstFormat == GL_RGB || + dstFormat == GL_RGBA || + dstFormat == GL_COLOR_INDEX); + + ASSERT(srcFormat == GL_RED || + srcFormat == GL_GREEN || + srcFormat == GL_BLUE || + srcFormat == GL_ALPHA || + srcFormat == GL_LUMINANCE || + srcFormat == GL_LUMINANCE_ALPHA || + srcFormat == GL_INTENSITY || + srcFormat == GL_RGB || + srcFormat == GL_BGR || + srcFormat == GL_RGBA || + srcFormat == GL_BGRA || + srcFormat == GL_ABGR_EXT || + srcFormat == GL_COLOR_INDEX); + + ASSERT(srcType == GL_BITMAP || + srcType == GL_UNSIGNED_BYTE || + srcType == GL_BYTE || + srcType == GL_UNSIGNED_SHORT || + srcType == GL_SHORT || + srcType == GL_UNSIGNED_INT || + srcType == GL_INT || + srcType == GL_FLOAT || + srcType == GL_UNSIGNED_BYTE_3_3_2 || + srcType == GL_UNSIGNED_BYTE_2_3_3_REV || + srcType == GL_UNSIGNED_SHORT_5_6_5 || + srcType == GL_UNSIGNED_SHORT_5_6_5_REV || + srcType == GL_UNSIGNED_SHORT_4_4_4_4 || + srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || + srcType == GL_UNSIGNED_SHORT_5_5_5_1 || + srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || + srcType == GL_UNSIGNED_INT_8_8_8_8 || + srcType == GL_UNSIGNED_INT_8_8_8_8_REV || + srcType == GL_UNSIGNED_INT_10_10_10_2 || + srcType == GL_UNSIGNED_INT_2_10_10_10_REV); + + /* this is intended for RGBA mode only */ + assert(ctx->Visual->RGBAflag); + + applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled); + + /* general solution, no special cases, yet */ + { + GLfloat rgba[MAX_WIDTH][4]; + GLint dstComponents; + GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; + GLint dstLuminanceIndex, dstIntensityIndex; + + dstComponents = _mesa_components_in_format( dstFormat ); + /* source & dest image formats should have been error checked by now */ + assert(dstComponents > 0); + + /* + * Extract image data and convert to RGBA floats + */ + assert(n <= MAX_WIDTH); + if (srcFormat == GL_COLOR_INDEX) { + GLuint indexes[MAX_WIDTH]; + extract_uint_indexes(n, indexes, srcFormat, srcType, source, + unpacking); + + if (applyTransferOps) { + if (ctx->Pixel.MapColorFlag) { + _mesa_map_ci(ctx, n, indexes); + } + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { + _mesa_shift_and_offset_ci(ctx, n, indexes); + } + } + + if (dstFormat == GL_COLOR_INDEX) { + /* convert to GLubyte and return */ + GLuint i; + for (i = 0; i < n; i++) { + dest[i] = (GLubyte) (indexes[i] & 0xff); + } + return; + } + else { + /* Convert indexes to RGBA */ + _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); + } + } + else { + extract_float_rgba(n, rgba, srcFormat, srcType, source, + unpacking->SwapBytes); + + if (applyTransferOps) { + /* scale and bias colors */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, n, rgba); + } + /* color map lookup */ + if (ctx->Pixel.MapColorFlag) { + _mesa_map_rgba(ctx, n, rgba); + } + } + } + + if (applyTransferOps) { + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix transform */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* XXX histogram here */ + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (const GLfloat (*)[4]) rgba); + } + } + + /* clamp to [0,1] */ + { + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); + rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); + rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); + rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); + } + } + + /* Now determine which color channels we need to produce. + * And determine the dest index (offset) within each color tuple. + */ + switch (dstFormat) { + case GL_ALPHA: + dstAlphaIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_LUMINANCE: + dstLuminanceIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstIntensityIndex = -1; + break; + case GL_LUMINANCE_ALPHA: + dstLuminanceIndex = 0; + dstAlphaIndex = 1; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstIntensityIndex = -1; + break; + case GL_INTENSITY: + dstIntensityIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstLuminanceIndex = -1; + break; + case GL_RGB: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_RGBA: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = 3; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + default: + gl_problem(ctx, "bad dstFormat in _mesa_unpack_float_span()"); + return; + } + + /* Now pack results in teh requested dstFormat */ + if (dstRedIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstRedIndex] = rgba[i][RCOMP]; + dst += dstComponents; + } + } + + if (dstGreenIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstGreenIndex] = rgba[i][GCOMP]; + dst += dstComponents; + } + } + + if (dstBlueIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstBlueIndex] = rgba[i][BCOMP]; + dst += dstComponents; + } + } + + if (dstAlphaIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstAlphaIndex] = rgba[i][ACOMP]; + dst += dstComponents; + } + } + + if (dstIntensityIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + assert(dstIntensityIndex == 0); + assert(dstComponents == 1); + for (i = 0; i < n; i++) { + /* Intensity comes from red channel */ + dst[i] = rgba[i][RCOMP]; + } + } + + if (dstLuminanceIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + assert(dstLuminanceIndex == 0); + for (i = 0; i < n; i++) { + /* Luminance comes from red channel */ + dst[0] = rgba[i][RCOMP]; + dst += dstComponents; + } + } + } +} + + + /* * Unpack a row of color index data from a client buffer according to @@ -2462,12 +2766,11 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, if (applyTransferOps) { if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); } - if (ctx->Pixel.MapColorFlag) { /* Apply lookup table */ - gl_map_ci(ctx, n, indexes); + _mesa_map_ci(ctx, n, indexes); } } @@ -2562,7 +2865,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, if (applyTransferOps) { if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); } if (ctx->Pixel.MapStencilFlag) { diff --git a/xc/extras/Mesa/src/image.h b/xc/extras/Mesa/src/image.h index cbe0926da..25b591ec9 100644 --- a/xc/extras/Mesa/src/image.h +++ b/xc/extras/Mesa/src/image.h @@ -79,7 +79,7 @@ _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, extern void -_mesa_pack_rgba_span( const GLcontext *ctx, +_mesa_pack_rgba_span( GLcontext *ctx, GLuint n, CONST GLubyte rgba[][4], GLenum format, GLenum type, GLvoid *dest, const struct gl_pixelstore_attrib *packing, @@ -87,7 +87,7 @@ _mesa_pack_rgba_span( const GLcontext *ctx, extern void -_mesa_unpack_ubyte_color_span( const GLcontext *ctx, +_mesa_unpack_ubyte_color_span( GLcontext *ctx, GLuint n, GLenum dstFormat, GLubyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -96,6 +96,15 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, extern void +_mesa_unpack_float_color_span( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLfloat dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *unpacking, + GLboolean applyTransferOps ); + + +extern void _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, diff --git a/xc/extras/Mesa/src/imaging.c b/xc/extras/Mesa/src/imaging.c index f1d912b6d..6710e2d3e 100644 --- a/xc/extras/Mesa/src/imaging.c +++ b/xc/extras/Mesa/src/imaging.c @@ -24,14 +24,25 @@ */ -/* Stub functions for GL_ARB_imaging subset */ +/* + * Stub functions for GL_ARB_imaging subset + * + * Some of the imaging functions (like blending and color tables) are + * defined elsewhere in Mesa. + * + * There's been some initial work on histogram and minmax support done + * here but there's a lot more to do. Any volunteers? + */ #ifdef PC_HEADER #include "all.h" #else #include "glheader.h" +#include "context.h" #include "imaging.h" +#include "mmath.h" +#include "teximage.h" #endif @@ -40,62 +51,6 @@ -#if 0 -void _mesa_BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) -{ - (void) r; - (void) g; - (void) b; - (void) a; - WARNING("glBlendColor"); -} - -void _mesa_BlendEquation(GLenum eq) -{ - (void) eq; - WARNING("glBlendEquation"); -} - -void _mesa_ColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) -{ - (void) target; - (void) start; - (void) count; - (void) format; - (void) type; - (void) data; - WARNING("glColorSubTable"); -} - -void _mesa_ColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) -{ - (void) target; - (void) internalformat; - (void) width; - (void) format; - (void) type; - (void) table; - WARNING("glColorTable"); -} -#endif - -void _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) -{ - (void) target; - (void) pname; - (void) params; - WARNING("glColorTableParameterfv"); -} - -void _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) -{ - (void) target; - (void) pname; - (void) params; - WARNING("glColorTableParameteriv"); -} - - void _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) { (void) target; @@ -151,26 +106,6 @@ void _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *para WARNING("glConvolutionParameteriv"); } -void _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) -{ - (void) target; - (void) start; - (void) x; - (void) y; - (void) width; - WARNING("glCopyColorSubTable"); -} - -void _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) -{ - (void) target; - (void) internalformat; - (void) x; - (void) y; - (void) width; - WARNING("glCopyColorTable"); -} - void _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { (void) target; @@ -192,33 +127,6 @@ void _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x WARNING("glCopyConvolutionFilter2D"); } -#if 0 -void _mesa_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table) -{ - (void) target; - (void) format; - (void) type; - (void) table; - WARNING("glGetColorTable"); -} - -void _mesa_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - (void) target; - (void) pname; - (void) params; - WARNING("glGetColorTableParameterfv"); -} - -void _mesa_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) -{ - (void) target; - (void) pname; - (void) params; - WARNING("glGetColorTableParameteriv"); -} -#endif - void _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { (void) target; @@ -256,45 +164,182 @@ void _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types void _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { - (void) target; - (void) reset; - (void) format; - (void) type; - (void) values; - WARNING("glGetHistogram"); -} + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogram"); -void _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - (void) target; - (void) pname; - (void) params; - WARNING("glGetHistogramParameterfv"); -} + WARNING("glGetHistogram"); -void _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) -{ - (void) target; - (void) pname; - (void) params; - WARNING("glGetHistogramParameteriv"); + if (target != GL_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(target)"); + return; + } + + if (format != GL_RED && + format != GL_GREEN && + format != GL_BLUE && + format != GL_ALPHA && + format != GL_RGB && + format != GL_RGBA && + format != GL_ABGR_EXT && + format != GL_LUMINANCE && + format != GL_LUMINANCE_ALPHA) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)"); + return; + } + + if (type != GL_UNSIGNED_BYTE && + type != GL_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_SHORT && + type != GL_UNSIGNED_INT && + type != GL_INT && + type != GL_FLOAT) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)"); + return; + } + + /* XXX return values */ + + + if (reset) { + GLuint i; + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + } +} + + +void +_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameterfv"); + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(target)"); + return; + } + + switch (pname) { + case GL_HISTOGRAM_WIDTH: + *params = (GLfloat) ctx->Histogram.Width; + break; + case GL_HISTOGRAM_FORMAT: + *params = (GLfloat) ctx->Histogram.Format; + break; + case GL_HISTOGRAM_RED_SIZE: + *params = (GLfloat) ctx->Histogram.RedSize; + break; + case GL_HISTOGRAM_GREEN_SIZE: + *params = (GLfloat) ctx->Histogram.GreenSize; + break; + case GL_HISTOGRAM_BLUE_SIZE: + *params = (GLfloat) ctx->Histogram.BlueSize; + break; + case GL_HISTOGRAM_ALPHA_SIZE: + *params = (GLfloat) ctx->Histogram.AlphaSize; + break; + case GL_HISTOGRAM_LUMINANCE_SIZE: + *params = (GLfloat) ctx->Histogram.LuminanceSize; + break; + case GL_HISTOGRAM_SINK: + *params = (GLfloat) ctx->Histogram.Sink; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(pname)"); + } +} + + +void +_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameteriv"); + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(target)"); + return; + } + + switch (pname) { + case GL_HISTOGRAM_WIDTH: + *params = (GLint) ctx->Histogram.Width; + break; + case GL_HISTOGRAM_FORMAT: + *params = (GLint) ctx->Histogram.Format; + break; + case GL_HISTOGRAM_RED_SIZE: + *params = (GLint) ctx->Histogram.RedSize; + break; + case GL_HISTOGRAM_GREEN_SIZE: + *params = (GLint) ctx->Histogram.GreenSize; + break; + case GL_HISTOGRAM_BLUE_SIZE: + *params = (GLint) ctx->Histogram.BlueSize; + break; + case GL_HISTOGRAM_ALPHA_SIZE: + *params = (GLint) ctx->Histogram.AlphaSize; + break; + case GL_HISTOGRAM_LUMINANCE_SIZE: + *params = (GLint) ctx->Histogram.LuminanceSize; + break; + case GL_HISTOGRAM_SINK: + *params = (GLint) ctx->Histogram.Sink; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(pname)"); + } +} + + +void +_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameterfv"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameterfv(target)"); + return; + } + if (pname == GL_MINMAX_FORMAT) { + *params = (GLfloat) ctx->MinMax.Format; + } + else if (pname == GL_MINMAX_SINK) { + *params = (GLfloat) ctx->MinMax.Sink; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameterfv(pname)"); + } +} + + +void +_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameteriv"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameteriv(target)"); + return; + } + if (pname == GL_MINMAX_FORMAT) { + *params = (GLint) ctx->MinMax.Format; + } + else if (pname == GL_MINMAX_SINK) { + *params = (GLint) ctx->MinMax.Sink; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameteriv(pname)"); + } } -void _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - (void) target; - (void) pname; - (void) params; - WARNING("glGetMinmaxParameterfv"); -} - -void _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) -{ - (void) target; - (void) pname; - (void) params; - WARNING("glGetMinmaxParameteriv"); -} void _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { @@ -307,36 +352,169 @@ void _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid WARNING("glGetSeperableFilter"); } -void _mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) -{ - (void) target; - (void) width; - (void) internalformat; - (void) sink; - WARNING("glHistogram"); -} -void _mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink) +void +_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { - (void) target; - (void) internalformat; - (void) sink; - WARNING("glMinmax"); -} + GLuint i; + GLboolean error = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHistogram"); + + WARNING("glHistogram"); + return; + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glHistogram(target)"); + return; + } + + if (width < 0 || width > HISTOGRAM_TABLE_SIZE) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + if (width < 0) + gl_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); + else + gl_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)"); + return; + } + } + + if (width != 0 && _mesa_bitcount(width) != 1) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + gl_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); + return; + } + } + + if (_mesa_base_tex_format(internalFormat) < 0 || + internalFormat == 1 || + internalFormat == 2 || + internalFormat == 3 || + internalFormat == 4 || + internalFormat == GL_INTENSITY || + internalFormat == GL_INTENSITY4 || + internalFormat == GL_INTENSITY8 || + internalFormat == GL_INTENSITY12 || + internalFormat == GL_INTENSITY16) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)"); + return; + } + } + + /* reset histograms */ + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + + if (error) { + ctx->Histogram.Width = 0; + ctx->Histogram.Format = 0; + ctx->Histogram.RedSize = 0; + ctx->Histogram.GreenSize = 0; + ctx->Histogram.BlueSize = 0; + ctx->Histogram.AlphaSize = 0; + ctx->Histogram.LuminanceSize = 0; + } + else { + ctx->Histogram.Width = width; + ctx->Histogram.Format = internalFormat; + ctx->Histogram.Sink = sink; + ctx->Histogram.RedSize = 0xffffffff; + ctx->Histogram.GreenSize = 0xffffffff; + ctx->Histogram.BlueSize = 0xffffffff; + ctx->Histogram.AlphaSize = 0xffffffff; + ctx->Histogram.LuminanceSize = 0xffffffff; + } +} + + +void +_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMinmax"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glMinMax(target)"); + return; + } + + if (_mesa_base_tex_format(internalFormat) < 0 || + internalFormat == 1 || + internalFormat == 2 || + internalFormat == 3 || + internalFormat == 4 || + internalFormat == GL_INTENSITY || + internalFormat == GL_INTENSITY4 || + internalFormat == GL_INTENSITY8 || + internalFormat == GL_INTENSITY12 || + internalFormat == GL_INTENSITY16) { + gl_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)"); + return; + } + + ctx->MinMax.Sink = sink; +} + + +void +_mesa_ResetHistogram(GLenum target) +{ + GLuint i; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetHistogram"); -void _mesa_ResetHistogram(GLenum target) -{ - (void) target; WARNING("glResetHistogram"); + + if (target != GL_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glResetHistogram(target)"); + return; + } + + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } } -void _mesa_ResetMinmax(GLenum target) + +void +_mesa_ResetMinmax(GLenum target) { - (void) target; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetMinmax"); + WARNING("glResetMinmax"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glResetMinMax(target)"); + return; + } + + ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; + ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; + ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; + ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; } -void _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) + +void +_mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { (void) target; (void) internalformat; @@ -348,3 +526,60 @@ void _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width (void) column; WARNING("glSeparableFilter2D"); } + + +/* + * Update the min/max values from an array of fragment colors. + */ +void +_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) +{ + GLuint i; + for (i = 0; i < n; i++) { + /* update mins */ + if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) + ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) + ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) + ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) + ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; + + /* update maxs */ + if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) + ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] < ctx->MinMax.Max[GCOMP]) + ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] < ctx->MinMax.Max[BCOMP]) + ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] < ctx->MinMax.Max[ACOMP]) + ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; + } +} + + +/* + * Update the histogram values from an array of fragment colors. + */ +void +_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLchan rgba[][4]) +{ + GLuint i; + switch (ctx->Histogram.Format) { + case GL_RGBA: + for (i = 0; i < n; i++) { + GLubyte r = rgba[i][RCOMP]; + GLubyte g = rgba[i][GCOMP]; + GLubyte b = rgba[i][BCOMP]; + GLubyte a = rgba[i][ACOMP]; + ctx->Histogram.Count[r][RCOMP]++; + ctx->Histogram.Count[g][RCOMP]++; + ctx->Histogram.Count[b][RCOMP]++; + ctx->Histogram.Count[a][RCOMP]++; + } + break; + default: + gl_problem(ctx, "Bad format in _mesa_update_histogram()"); + } +} diff --git a/xc/extras/Mesa/src/imaging.h b/xc/extras/Mesa/src/imaging.h index f376be5f6..220a99576 100644 --- a/xc/extras/Mesa/src/imaging.h +++ b/xc/extras/Mesa/src/imaging.h @@ -32,25 +32,11 @@ #include "all.h" #else #include "glheader.h" +#include "types.h" #endif -#if 0 -extern void _mesa_BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a); - -extern void _mesa_BlendEquation(GLenum eq); - -extern void _mesa_ColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); - -extern void _mesa_ColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -#endif - -extern void _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); - -extern void _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); - - extern void _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); extern void _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); @@ -63,22 +49,10 @@ extern void _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param extern void _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); -extern void _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); - -extern void _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); - extern void _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); extern void _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -#if 0 -extern void _mesa_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table); - -extern void _mesa_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params); - -extern void _mesa_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params); -#endif - extern void _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image); extern void _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); @@ -109,4 +83,12 @@ extern void _mesa_ResetMinmax(GLenum target); extern void _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); + +extern void +_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); + +extern void +_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLchan rgba[][4]); + + #endif diff --git a/xc/extras/Mesa/src/logic.c b/xc/extras/Mesa/src/logic.c index 715eb9ccd..1078cca68 100644 --- a/xc/extras/Mesa/src/logic.c +++ b/xc/extras/Mesa/src/logic.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -203,8 +203,9 @@ static void index_logicop( GLcontext *ctx, GLuint n, * Apply the current logic operator to a span of CI pixels. This is only * used if the device driver can't do logic ops. */ -void gl_logicop_ci_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLuint index[], const GLubyte mask[] ) +void +_mesa_logicop_ci_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + GLuint index[], const GLubyte mask[] ) { GLuint dest[MAX_WIDTH]; /* Read dest values from frame buffer */ @@ -218,9 +219,10 @@ void gl_logicop_ci_span( GLcontext *ctx, GLuint n, GLint x, GLint y, * Apply the current logic operator to an array of CI pixels. This is only * used if the device driver can't do logic ops. */ -void gl_logicop_ci_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLuint index[], const GLubyte mask[] ) +void +_mesa_logicop_ci_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLuint index[], const GLubyte mask[] ) { GLuint dest[PB_SIZE]; /* Read dest values from frame buffer */ @@ -367,9 +369,10 @@ static void rgba_logicop( const GLcontext *ctx, GLuint n, * Apply the current logic operator to a span of RGBA pixels. * This is only used if the device driver can't do logic ops. */ -void gl_logicop_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, - GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_logicop_rgba_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, + GLubyte rgba[][4], const GLubyte mask[] ) { GLubyte dest[MAX_WIDTH][4]; gl_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); @@ -382,14 +385,15 @@ void gl_logicop_rgba_span( GLcontext *ctx, * Apply the current logic operator to an array of RGBA pixels. * This is only used if the device driver can't do logic ops. */ -void gl_logicop_rgba_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_logicop_rgba_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ) { GLubyte dest[PB_SIZE][4]; (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_read_alpha_pixels( ctx, n, x, y, dest, mask ); + _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); } rgba_logicop( ctx, n, mask, (GLuint *) rgba, (const GLuint *) dest ); } diff --git a/xc/extras/Mesa/src/logic.h b/xc/extras/Mesa/src/logic.h index 3c5aad795..ec8060d2a 100644 --- a/xc/extras/Mesa/src/logic.h +++ b/xc/extras/Mesa/src/logic.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -35,24 +35,27 @@ extern void _mesa_LogicOp( GLenum opcode ); -extern void gl_logicop_ci_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLuint index[], - const GLubyte mask[] ); +extern void +_mesa_logicop_ci_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLuint index[], + const GLubyte mask[] ); -extern void gl_logicop_ci_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLuint index[], const GLubyte mask[] ); +extern void +_mesa_logicop_ci_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLuint index[], const GLubyte mask[] ); -extern void gl_logicop_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, - GLubyte rgba[][4], const GLubyte mask[] ); +extern void +_mesa_logicop_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + GLubyte rgba[][4], const GLubyte mask[] ); -extern void gl_logicop_rgba_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[] ); +extern void +_mesa_logicop_rgba_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ); #endif diff --git a/xc/extras/Mesa/src/masking.c b/xc/extras/Mesa/src/masking.c index fa651b34e..f5beda95f 100644 --- a/xc/extras/Mesa/src/masking.c +++ b/xc/extras/Mesa/src/masking.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -83,8 +83,9 @@ _mesa_ColorMask( GLboolean red, GLboolean green, /* * Apply glColorMask to a span of RGBA pixels. */ -void gl_mask_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) +void +_mesa_mask_rgba_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { GLubyte dest[MAX_WIDTH][4]; GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); @@ -105,9 +106,10 @@ void gl_mask_rgba_span( GLcontext *ctx, /* * Apply glColorMask to an array of RGBA pixels. */ -void gl_mask_rgba_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_mask_rgba_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ) { GLubyte dest[PB_SIZE][4]; GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); @@ -118,7 +120,7 @@ void gl_mask_rgba_pixels( GLcontext *ctx, (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_read_alpha_pixels( ctx, n, x, y, dest, mask ); + _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); } for (i=0; i<n; i++) { @@ -131,8 +133,9 @@ void gl_mask_rgba_pixels( GLcontext *ctx, /* * Apply glIndexMask to a span of CI pixels. */ -void gl_mask_index_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLuint index[] ) +void +_mesa_mask_index_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLuint index[] ) { GLuint i; GLuint fbindexes[MAX_WIDTH]; @@ -153,9 +156,10 @@ void gl_mask_index_span( GLcontext *ctx, /* * Apply glIndexMask to an array of CI pixels. */ -void gl_mask_index_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLuint index[], const GLubyte mask[] ) +void +_mesa_mask_index_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLuint index[], const GLubyte mask[] ) { GLuint i; GLuint fbindexes[PB_SIZE]; diff --git a/xc/extras/Mesa/src/masking.h b/xc/extras/Mesa/src/masking.h index f11abe063..9e6b6892d 100644 --- a/xc/extras/Mesa/src/masking.h +++ b/xc/extras/Mesa/src/masking.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -43,35 +43,39 @@ _mesa_ColorMask( GLboolean red, GLboolean green, /* * Implement glColorMask for a span of RGBA pixels. */ -extern void gl_mask_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, - GLubyte rgba[][4] ); +extern void +_mesa_mask_rgba_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ); /* * Implement glColorMask for an array of RGBA pixels. */ -extern void gl_mask_rgba_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[] ); +extern void +_mesa_mask_rgba_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ); /* * Implement glIndexMask for a span of CI pixels. */ -extern void gl_mask_index_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLuint index[] ); +extern void +_mesa_mask_index_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLuint index[] ); /* * Implement glIndexMask for an array of CI pixels. */ -extern void gl_mask_index_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLuint index[], const GLubyte mask[] ); +extern void +_mesa_mask_index_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLuint index[], const GLubyte mask[] ); diff --git a/xc/extras/Mesa/src/matrix.c b/xc/extras/Mesa/src/matrix.c index f9270f75c..5c66ef0e3 100644 --- a/xc/extras/Mesa/src/matrix.c +++ b/xc/extras/Mesa/src/matrix.c @@ -930,6 +930,10 @@ do { \ mat = &ctx->TextureMatrix[ctx->Texture.CurrentTransformUnit]; \ flags |= NEW_TEXTURE_MATRIX; \ break; \ + case GL_COLOR: \ + mat = &ctx->ColorMatrix; \ + flags |= NEW_COLOR_MATRIX; \ + break; \ default: \ gl_problem(ctx, where); \ } \ @@ -1036,6 +1040,7 @@ _mesa_MatrixMode( GLenum mode ) case GL_MODELVIEW: case GL_PROJECTION: case GL_TEXTURE: + case GL_COLOR: ctx->Transform.MatrixMode = mode; break; default: @@ -1089,6 +1094,14 @@ _mesa_PushMatrix( void ) &ctx->TextureMatrix[t] ); } break; + case GL_COLOR: + if (ctx->ColorStackDepth >= MAX_COLOR_STACK_DEPTH - 1) { + gl_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix"); + return; + } + gl_matrix_copy( &ctx->ColorStack[ctx->ColorStackDepth++], + &ctx->ColorMatrix ); + break; default: gl_problem(ctx, "Bad matrix mode in gl_PushMatrix"); } @@ -1146,6 +1159,14 @@ _mesa_PopMatrix( void ) &ctx->TextureStack[t][--ctx->TextureStackDepth[t]]); } break; + case GL_COLOR: + if (ctx->ColorStackDepth==0) { + gl_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix"); + return; + } + gl_matrix_copy(&ctx->ColorMatrix, + &ctx->ColorStack[--ctx->ColorStackDepth]); + break; default: gl_problem(ctx, "Bad matrix mode in gl_PopMatrix"); } diff --git a/xc/extras/Mesa/src/mem.h b/xc/extras/Mesa/src/mem.h index c0203c7c4..6e9e00d73 100644 --- a/xc/extras/Mesa/src/mem.h +++ b/xc/extras/Mesa/src/mem.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -78,6 +78,15 @@ extern void _mesa_free(void *ptr); #endif +/* On some systems we might want to use bzero() (but is bzero portable?) */ +#if defined(__FreeBSD__) +#define BZERO( ADDR, N ) \ + bzero( (void *) (ADDR), (size_t) (N) ) +#else +#define BZERO( ADDR, N ) \ + memset( (void *) (ADDR), 0, (size_t) (N) ) +#endif + /* MACs and BeOS don't support static larger than 32kb, so... */ #if defined(macintosh) && !defined(__MRC__) diff --git a/xc/extras/Mesa/src/mmath.c b/xc/extras/Mesa/src/mmath.c index 06d134955..d93400d20 100644 --- a/xc/extras/Mesa/src/mmath.c +++ b/xc/extras/Mesa/src/mmath.c @@ -140,7 +140,8 @@ init_ubyte_color_tab(void) /* * Initialize tables, etc for fast math functions. */ -void _mesa_init_math(void) +void +_mesa_init_math(void) { static GLboolean initialized = GL_FALSE; @@ -166,3 +167,21 @@ void _mesa_init_math(void) #endif } } + + + +/* + * Return number of bits set in given GLuint. + */ +GLuint +_mesa_bitcount(GLuint n) +{ + GLuint bits; + for (bits = 0; n > 0; n = n >> 1) { + if (n & 1) { + bits++; + } + } + return bits; +} + diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h index 30a300cdb..ad59b948d 100644 --- a/xc/extras/Mesa/src/mmath.h +++ b/xc/extras/Mesa/src/mmath.h @@ -22,7 +22,7 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/mmath.h,v 1.4 2000/03/03 18:30:08 tsi Exp $ */ + /* * Faster arithmetic functions. If the FAST_MATH preprocessor symbol is @@ -47,10 +47,7 @@ * In the worst case, we force the compiler to use a memory access to * truncate the float, by specifying the 'volatile' keyword. */ -#if defined(__linux__) && defined(__i386__) && !defined(IN_MODULE) -/* - * A libc interface is needed for this... - */ +#if defined(__linux__) && defined(__i386__) #include <fpu_control.h> #if !defined(_FPU_SETCW) @@ -82,6 +79,7 @@ typedef unsigned short fpu_control_t; } #endif + /* Put it back how the application had it. */ #define END_FAST_MATH(x) \ @@ -89,6 +87,7 @@ typedef unsigned short fpu_control_t; _FPU_SETCW( x ); \ } + #define HAVE_FAST_MATH #elif defined(__WATCOMC__) && !defined(NO_FAST_MATH) @@ -330,7 +329,13 @@ do { \ } while(0) -extern void _mesa_init_math(void); + +extern void +_mesa_init_math(void); + + +extern GLuint +_mesa_bitcount(GLuint n); #endif diff --git a/xc/extras/Mesa/src/norm_tmp.h b/xc/extras/Mesa/src/norm_tmp.h index 2548284de..074babf12 100644 --- a/xc/extras/Mesa/src/norm_tmp.h +++ b/xc/extras/Mesa/src/norm_tmp.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -28,12 +28,13 @@ */ -static void _XFORMAPI TAG(transform_normalize_normals)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat *lengths, - const GLubyte mask[], - GLvector3f *dest ) +static void _XFORMAPI +TAG(transform_normalize_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector3f *in, + const GLfloat *lengths, + const GLubyte mask[], + GLvector3f *dest ) { GLuint i; const GLfloat *from = in->start; @@ -71,8 +72,8 @@ static void _XFORMAPI TAG(transform_normalize_normals)( const GLmatrix *mat, } } } - } else { - + } + else { /* scale has been snapped to 1.0 if it is close. */ if (scale != 1.0) { @@ -102,12 +103,14 @@ static void _XFORMAPI TAG(transform_normalize_normals)( const GLmatrix *mat, dest->count = in->count; } -static void _XFORMAPI TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat *lengths, - const GLubyte mask[], - GLvector3f *dest ) + +static void _XFORMAPI +TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, + GLfloat scale, + const GLvector3f *in, + const GLfloat *lengths, + const GLubyte mask[], + GLvector3f *dest ) { GLuint i; const GLfloat *from = in->start; @@ -144,7 +147,8 @@ static void _XFORMAPI TAG(transform_normalize_normals_no_rot)( const GLmatrix *m } } } - } else { + } + else { /* scale has been snapped to 1.0 if it is close. */ if (scale != 1.0) { @@ -175,12 +179,13 @@ static void _XFORMAPI TAG(transform_normalize_normals_no_rot)( const GLmatrix *m } -static void _XFORMAPI TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat *lengths, - const GLubyte mask[], - GLvector3f *dest ) +static void _XFORMAPI +TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, + GLfloat scale, + const GLvector3f *in, + const GLfloat *lengths, + const GLubyte mask[], + GLvector3f *dest ) { GLuint i; const GLfloat *from = in->start; @@ -204,12 +209,13 @@ static void _XFORMAPI TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat dest->count = in->count; } -static void _XFORMAPI TAG(transform_rescale_normals)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat *lengths, - const GLubyte mask[], - GLvector3f *dest ) +static void _XFORMAPI +TAG(transform_rescale_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector3f *in, + const GLfloat *lengths, + const GLubyte mask[], + GLvector3f *dest ) { GLuint i; const GLfloat *from = in->start; @@ -237,12 +243,13 @@ static void _XFORMAPI TAG(transform_rescale_normals)( const GLmatrix *mat, } -static void _XFORMAPI TAG(transform_normals_no_rot)(const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat *lengths, - const GLubyte mask[], - GLvector3f *dest ) +static void _XFORMAPI +TAG(transform_normals_no_rot)(const GLmatrix *mat, + GLfloat scale, + const GLvector3f *in, + const GLfloat *lengths, + const GLubyte mask[], + GLvector3f *dest ) { GLuint i; const GLfloat *from = in->start; @@ -267,12 +274,14 @@ static void _XFORMAPI TAG(transform_normals_no_rot)(const GLmatrix *mat, dest->count = in->count; } -static void _XFORMAPI TAG(transform_normals)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat *lengths, - const GLubyte mask[], - GLvector3f *dest ) + +static void _XFORMAPI +TAG(transform_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector3f *in, + const GLfloat *lengths, + const GLubyte mask[], + GLvector3f *dest ) { GLuint i; const GLfloat *from = in->start; @@ -298,12 +307,13 @@ static void _XFORMAPI TAG(transform_normals)( const GLmatrix *mat, } -static void _XFORMAPI TAG(normalize_normals)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat *lengths, - const GLubyte mask[], - GLvector3f *dest ) +static void _XFORMAPI +TAG(normalize_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector3f *in, + const GLfloat *lengths, + const GLubyte mask[], + GLvector3f *dest ) { GLuint i; const GLfloat *from = in->start; @@ -347,12 +357,13 @@ static void _XFORMAPI TAG(normalize_normals)( const GLmatrix *mat, } -static void _XFORMAPI TAG(rescale_normals)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat *lengths, - const GLubyte mask[], - GLvector3f *dest ) +static void _XFORMAPI +TAG(rescale_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector3f *in, + const GLfloat *lengths, + const GLubyte mask[], + GLvector3f *dest ) { GLuint i; const GLfloat *from = in->start; @@ -372,7 +383,8 @@ static void _XFORMAPI TAG(rescale_normals)( const GLmatrix *mat, } -static void _XFORMAPI TAG(init_c_norm_transform)( void ) +static void _XFORMAPI +TAG(init_c_norm_transform)( void ) { gl_normal_tab[NORM_TRANSFORM_NO_ROT][IDX] = TAG(transform_normals_no_rot); @@ -397,5 +409,4 @@ static void _XFORMAPI TAG(init_c_norm_transform)( void ) gl_normal_tab[NORM_NORMALIZE][IDX] = TAG(normalize_normals); - } diff --git a/xc/extras/Mesa/src/pb.c b/xc/extras/Mesa/src/pb.c index 1e5ac03e2..9d5ec6e3d 100644 --- a/xc/extras/Mesa/src/pb.c +++ b/xc/extras/Mesa/src/pb.c @@ -115,10 +115,10 @@ static void multi_write_index_pixels( GLcontext *ctx, GLuint n, /* make copy of incoming indexes */ MEMCPY( indexTmp, indexes, n * sizeof(GLuint) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_pixels( ctx, n, x, y, indexTmp, mask ); + _mesa_logicop_ci_pixels( ctx, n, x, y, indexTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_pixels( ctx, n, x, y, indexTmp, mask ); + _mesa_mask_index_pixels( ctx, n, x, y, indexTmp, mask ); } (*ctx->Driver.WriteCI32Pixels)( ctx, n, x, y, indexTmp, mask ); } @@ -170,20 +170,20 @@ static void multi_write_rgba_pixels( GLcontext *ctx, GLuint n, MEMCPY( rgbaTmp, rgba, 4 * n * sizeof(GLubyte) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); + _mesa_logicop_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_pixels( ctx, n, x, y, rgbaTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); + _mesa_mask_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); } (*ctx->Driver.WriteRGBAPixels)( ctx, n, x, y, (const GLubyte (*)[4])rgbaTmp, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_pixels( ctx, n, x, y, - (const GLubyte (*)[4])rgbaTmp, mask ); + _mesa_write_alpha_pixels( ctx, n, x, y, + (const GLubyte (*)[4])rgbaTmp, mask ); } } } @@ -292,7 +292,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -311,21 +311,21 @@ void gl_flush_pb( GLcontext *ctx ) /* normal case: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_pixels( ctx, PB->count, PB->x, PB->y, - PB->rgba, mask); + _mesa_logicop_rgba_pixels( ctx, PB->count, PB->x, PB->y, + PB->rgba, mask); } else if (ctx->Color.BlendEnabled) { _mesa_blend_pixels( ctx, PB->count, PB->x, PB->y, PB->rgba, mask); } if (ctx->Color.SWmasking) { - gl_mask_rgba_pixels(ctx, PB->count, PB->x, PB->y, PB->rgba, mask); + _mesa_mask_rgba_pixels(ctx, PB->count, PB->x, PB->y, PB->rgba, mask); } (*ctx->Driver.WriteRGBAPixels)( ctx, PB->count, PB->x, PB->y, (const GLubyte (*)[4]) PB->rgba, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_pixels( ctx, PB->count, PB->x, PB->y, + _mesa_write_alpha_pixels( ctx, PB->count, PB->x, PB->y, (const GLubyte (*)[4]) PB->rgba, mask ); } } @@ -344,7 +344,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -382,8 +382,8 @@ void gl_flush_pb( GLcontext *ctx ) (*ctx->Driver.WriteMonoRGBAPixels)( ctx, PB->count, PB->x, PB->y, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_mono_alpha_pixels( ctx, PB->count, PB->x, PB->y, - PB->color[ACOMP], mask ); + _mesa_write_mono_alpha_pixels( ctx, PB->count, PB->x, PB->y, + PB->color[ACOMP], mask ); } } /*** ALL DONE ***/ @@ -416,7 +416,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -433,10 +433,10 @@ void gl_flush_pb( GLcontext *ctx ) /* normal case: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + _mesa_logicop_ci_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + _mesa_mask_index_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); } (*ctx->Driver.WriteCI32Pixels)( ctx, PB->count, PB->x, PB->y, @@ -452,7 +452,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } diff --git a/xc/extras/Mesa/src/pixel.c b/xc/extras/Mesa/src/pixel.c index fd42ba3a9..e70f98414 100644 --- a/xc/extras/Mesa/src/pixel.c +++ b/xc/extras/Mesa/src/pixel.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,11 +24,6 @@ */ -/* - * glPixelStore, glPixelTransfer, glPixelMap, glPixelZoom, etc. - */ - - #ifdef PC_HEADER #include "all.h" #else @@ -561,6 +556,30 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) case GL_DEPTH_BIAS: ctx->Pixel.DepthBias = param; break; + case GL_POST_COLOR_MATRIX_RED_SCALE: + ctx->Pixel.PostColorMatrixRedScale = param; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS: + ctx->Pixel.PostColorMatrixRedBias = param; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE: + ctx->Pixel.PostColorMatrixGreenScale = param; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS: + ctx->Pixel.PostColorMatrixGreenBias = param; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE: + ctx->Pixel.PostColorMatrixBlueScale = param; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS: + ctx->Pixel.PostColorMatrixBlueBias = param; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + ctx->Pixel.PostColorMatrixAlphaScale = param; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + ctx->Pixel.PostColorMatrixAlphaBias = param; + break; default: gl_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" ); return; @@ -575,6 +594,20 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) else { ctx->Pixel.ScaleOrBiasRGBA = GL_FALSE; } + + if (ctx->Pixel.PostColorMatrixRedScale!=1.0F || + ctx->Pixel.PostColorMatrixRedBias!=0.0F || + ctx->Pixel.PostColorMatrixGreenScale!=1.0F || + ctx->Pixel.PostColorMatrixGreenBias!=0.0F || + ctx->Pixel.PostColorMatrixBlueScale!=1.0F || + ctx->Pixel.PostColorMatrixBlueBias!=0.0F || + ctx->Pixel.PostColorMatrixAlphaScale!=1.0F || + ctx->Pixel.PostColorMatrixAlphaBias!=0.0F) { + ctx->Pixel.ScaleOrBiasRGBApcm = GL_TRUE; + } + else { + ctx->Pixel.ScaleOrBiasRGBApcm = GL_FALSE; + } } @@ -586,60 +619,16 @@ _mesa_PixelTransferi( GLenum pname, GLint param ) - -/* - * Pixel processing functions - */ - - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void gl_scale_and_bias_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ) -{ - GLuint i; - for (i=0;i<n;i++) { - GLfloat r = red[i] * ctx->Pixel.RedScale + ctx->Pixel.RedBias; - GLfloat g = green[i] * ctx->Pixel.GreenScale + ctx->Pixel.GreenBias; - GLfloat b = blue[i] * ctx->Pixel.BlueScale + ctx->Pixel.BlueBias; - GLfloat a = alpha[i] * ctx->Pixel.AlphaScale + ctx->Pixel.AlphaBias; - red[i] = CLAMP( r, 0.0F, 1.0F ); - green[i] = CLAMP( g, 0.0F, 1.0F ); - blue[i] = CLAMP( b, 0.0F, 1.0F ); - alpha[i] = CLAMP( a, 0.0F, 1.0F ); - } -} - - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void gl_scale_and_bias_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ) -{ - GLfloat rbias = ctx->Pixel.RedBias * 255.0F; - GLfloat gbias = ctx->Pixel.GreenBias * 255.0F; - GLfloat bbias = ctx->Pixel.BlueBias * 255.0F; - GLfloat abias = ctx->Pixel.AlphaBias * 255.0F; - GLuint i; - for (i=0;i<n;i++) { - GLint r = (GLint) (rgba[i][RCOMP] * ctx->Pixel.RedScale + rbias); - GLint g = (GLint) (rgba[i][GCOMP] * ctx->Pixel.GreenScale + gbias); - GLint b = (GLint) (rgba[i][BCOMP] * ctx->Pixel.BlueScale + bbias); - GLint a = (GLint) (rgba[i][ACOMP] * ctx->Pixel.AlphaScale + abias); - rgba[i][RCOMP] = CLAMP( r, 0, 255 ); - rgba[i][GCOMP] = CLAMP( g, 0, 255 ); - rgba[i][BCOMP] = CLAMP( b, 0, 255 ); - rgba[i][ACOMP] = CLAMP( a, 0, 255 ); - } -} +/**********************************************************************/ +/***** Pixel processing functions ******/ +/**********************************************************************/ /* * Apply scale and bias factors to an array of RGBA pixels. */ -void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +void +_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) { if (ctx->Pixel.RedScale != 1.0 || ctx->Pixel.RedBias != 0.0) { const GLfloat scale = ctx->Pixel.RedScale; @@ -677,32 +666,10 @@ void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[ /* - * Apply pixel mapping to an array of RGBA pixels. - */ -void gl_map_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ) -{ - GLfloat rscale = (ctx->Pixel.MapRtoRsize - 1) / 255.0F; - GLfloat gscale = (ctx->Pixel.MapGtoGsize - 1) / 255.0F; - GLfloat bscale = (ctx->Pixel.MapBtoBsize - 1) / 255.0F; - GLfloat ascale = (ctx->Pixel.MapAtoAsize - 1) / 255.0F; - GLuint i; - for (i=0;i<n;i++) { - GLint ir = (GLint) (rgba[i][RCOMP] * rscale); - GLint ig = (GLint) (rgba[i][GCOMP] * gscale); - GLint ib = (GLint) (rgba[i][BCOMP] * bscale); - GLint ia = (GLint) (rgba[i][ACOMP] * ascale); - rgba[i][RCOMP] = (GLint) (ctx->Pixel.MapRtoR[ir] * 255.0F); - rgba[i][GCOMP] = (GLint) (ctx->Pixel.MapGtoG[ig] * 255.0F); - rgba[i][BCOMP] = (GLint) (ctx->Pixel.MapBtoB[ib] * 255.0F); - rgba[i][ACOMP] = (GLint) (ctx->Pixel.MapAtoA[ia] * 255.0F); - } -} - - -/* * Apply pixel mapping to an array of floating point RGBA pixels. */ -void gl_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +void +_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) { const GLfloat rscale = ctx->Pixel.MapRtoRsize - 1; const GLfloat gscale = ctx->Pixel.MapGtoGsize - 1; @@ -723,22 +690,210 @@ void gl_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) /* - * Apply pixel mapping to an array of RGBA pixels. + * Apply the color matrix and post color matrix scaling and biasing. */ -void gl_map_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ) +void +_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) { - GLfloat rscale = ctx->Pixel.MapRtoRsize - 1; - GLfloat gscale = ctx->Pixel.MapGtoGsize - 1; - GLfloat bscale = ctx->Pixel.MapBtoBsize - 1; - GLfloat ascale = ctx->Pixel.MapAtoAsize - 1; + const GLfloat rs = ctx->Pixel.PostColorMatrixRedScale; + const GLfloat rb = ctx->Pixel.PostColorMatrixRedBias; + const GLfloat gs = ctx->Pixel.PostColorMatrixGreenScale; + const GLfloat gb = ctx->Pixel.PostColorMatrixGreenBias; + const GLfloat bs = ctx->Pixel.PostColorMatrixBlueScale; + const GLfloat bb = ctx->Pixel.PostColorMatrixBlueBias; + const GLfloat as = ctx->Pixel.PostColorMatrixAlphaScale; + const GLfloat ab = ctx->Pixel.PostColorMatrixAlphaBias; + const GLfloat *m = ctx->ColorMatrix.m; GLuint i; - for (i=0;i<n;i++) { - red[i] = ctx->Pixel.MapRtoR[ (GLint) (red[i] * rscale + 0.5F) ]; - green[i] = ctx->Pixel.MapGtoG[ (GLint) (green[i] * gscale + 0.5F) ]; - blue[i] = ctx->Pixel.MapBtoB[ (GLint) (blue[i] * bscale + 0.5F) ]; - alpha[i] = ctx->Pixel.MapAtoA[ (GLint) (alpha[i] * ascale + 0.5F) ]; + for (i = 0; i < n; i++) { + const GLfloat r = rgba[i][RCOMP]; + const GLfloat g = rgba[i][GCOMP]; + const GLfloat b = rgba[i][BCOMP]; + const GLfloat a = rgba[i][ACOMP]; + rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; + rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; + rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; + rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; + } +} + + +/* + * Apply a color table lookup to an array of colors. + */ +void +_mesa_lookup_rgba(const struct gl_color_table *table, + GLuint n, GLfloat rgba[][4]) +{ + ASSERT(table->TableType == GL_FLOAT); + if (!table->Table) + return; + + switch (table->Format) { + case GL_INTENSITY: + /* replace RGBA with I */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j]; + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + } + break; + case GL_LUMINANCE: + /* replace RGB with L */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + break; + case GL_ALPHA: + /* replace A with A */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][ACOMP] = lut[j] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][ACOMP] = lut[j]; + } + } + break; + case GL_LUMINANCE_ALPHA: + /* replace RGBA with LLLA */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jL = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + GLfloat luminance = lut[jL * 2 + 0] * (1.0F / 255.0F); + GLfloat alpha = lut[jA * 2 + 1] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jL = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + GLfloat luminance = lut[jL * 2 + 0]; + GLfloat alpha = lut[jA * 2 + 1]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + break; + case GL_RGB: + /* replace RGB with RGB */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 3 + 0] * (1.0F / 255.0F); + rgba[i][GCOMP] = lut[jG * 3 + 1] * (1.0F / 255.0F); + rgba[i][BCOMP] = lut[jB * 3 + 2] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 3 + 0]; + rgba[i][GCOMP] = lut[jG * 3 + 1]; + rgba[i][BCOMP] = lut[jB * 3 + 2]; + } + } + break; + case GL_RGBA: + /* replace RGBA with RGBA */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 4 + 0] * (1.0F / 255.0F); + rgba[i][GCOMP] = lut[jG * 4 + 1] * (1.0F / 255.0F); + rgba[i][BCOMP] = lut[jB * 4 + 2] * (1.0F / 255.0F); + rgba[i][ACOMP] = lut[jA * 4 + 3] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 4 + 0]; + rgba[i][GCOMP] = lut[jG * 4 + 1]; + rgba[i][BCOMP] = lut[jB * 4 + 2]; + rgba[i][ACOMP] = lut[jA * 4 + 3]; + } + } + break; + default: + gl_problem(NULL, "Bad format in _mesa_lookup_rgba"); + return; } } @@ -747,7 +902,8 @@ void gl_map_color( const GLcontext *ctx, GLuint n, /* * Apply color index shift and offset to an array of pixels. */ -void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) +void +_mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) { GLint shift = ctx->Pixel.IndexShift; GLint offset = ctx->Pixel.IndexOffset; @@ -774,7 +930,8 @@ void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) /* * Apply color index mapping to color indexes. */ -void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) +void +_mesa_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) { GLuint mask = ctx->Pixel.MapItoIsize - 1; GLuint i; @@ -787,8 +944,9 @@ void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) /* * Map color indexes to rgba values. */ -void gl_map_ci_to_rgba( const GLcontext *ctx, GLuint n, const GLuint index[], - GLubyte rgba[][4] ) +void +_mesa_map_ci_to_rgba_ubyte( const GLcontext *ctx, GLuint n, + const GLuint index[], GLubyte rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -811,8 +969,9 @@ void gl_map_ci_to_rgba( const GLcontext *ctx, GLuint n, const GLuint index[], /* * Map color indexes to float rgba values. */ -void gl_map_ci_to_rgba_float( const GLcontext *ctx, GLuint n, const GLuint index[], - GLfloat rgba[][4] ) +void +_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, + const GLuint index[], GLfloat rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -835,8 +994,9 @@ void gl_map_ci_to_rgba_float( const GLcontext *ctx, GLuint n, const GLuint index /* * Map 8-bit color indexes to rgb values. */ -void gl_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], - GLubyte rgba[][4] ) +void +_mesa_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], + GLubyte rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -856,27 +1016,9 @@ void gl_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], } -void gl_map_ci_to_color( const GLcontext *ctx, GLuint n, const GLuint index[], - GLfloat r[], GLfloat g[], - GLfloat b[], GLfloat a[] ) -{ - GLuint rmask = ctx->Pixel.MapItoRsize - 1; - GLuint gmask = ctx->Pixel.MapItoGsize - 1; - GLuint bmask = ctx->Pixel.MapItoBsize - 1; - GLuint amask = ctx->Pixel.MapItoAsize - 1; - GLuint i; - for (i=0;i<n;i++) { - r[i] = ctx->Pixel.MapItoR[index[i] & rmask]; - g[i] = ctx->Pixel.MapItoG[index[i] & gmask]; - b[i] = ctx->Pixel.MapItoB[index[i] & bmask]; - a[i] = ctx->Pixel.MapItoA[index[i] & amask]; - } -} - - - -void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, - GLstencil stencil[] ) +void +_mesa_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, + GLstencil stencil[] ) { GLuint i; GLint shift = ctx->Pixel.IndexShift; @@ -901,8 +1043,8 @@ void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, } - -void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) +void +_mesa_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) { GLuint mask = ctx->Pixel.MapStoSsize - 1; GLuint i; @@ -910,4 +1052,3 @@ void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) stencil[i] = ctx->Pixel.MapStoS[ stencil[i] & mask ]; } } - diff --git a/xc/extras/Mesa/src/pixel.h b/xc/extras/Mesa/src/pixel.h index 3a27d03fa..1b3a459e5 100644 --- a/xc/extras/Mesa/src/pixel.h +++ b/xc/extras/Mesa/src/pixel.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -75,64 +75,56 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); * Pixel processing functions */ -extern void gl_scale_and_bias_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ); - - -extern void gl_scale_and_bias_rgba( const GLcontext *ctx, GLuint n, - GLubyte rgba[][4] ); - - -extern void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, - GLfloat rgba[][4] ); - - -extern void gl_map_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ); +extern void +_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); -extern void gl_map_rgba_float( const GLcontext *ctx, GLuint n, - GLfloat rgba[][4] ); +extern void +_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); -extern void gl_map_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ); +extern void +_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); -extern void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, - GLuint indexes[] ); +extern void +_mesa_lookup_rgba(const struct gl_color_table *table, + GLuint n, GLfloat rgba[][4]); -extern void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ); +extern void +_mesa_shift_and_offset_ci(const GLcontext *ctx, GLuint n, + GLuint indexes[]); -extern void gl_map_ci_to_rgba( const GLcontext *ctx, - GLuint n, const GLuint index[], - GLubyte rgba[][4] ); +extern void +_mesa_map_ci(const GLcontext *ctx, GLuint n, GLuint index[]); -extern void gl_map_ci_to_rgba_float( const GLcontext *ctx, - GLuint n, const GLuint index[], - GLfloat rgba[][4] ); +extern void +_mesa_map_ci_to_rgba_ubyte(const GLcontext *ctx, + GLuint n, const GLuint index[], + GLubyte rgba[][4]); -extern void gl_map_ci8_to_rgba( const GLcontext *ctx, - GLuint n, const GLubyte index[], - GLubyte rgba[][4] ); +extern void +_mesa_map_ci_to_rgba(const GLcontext *ctx, + GLuint n, const GLuint index[], GLfloat rgba[][4]); -extern void gl_map_ci_to_color( const GLcontext *ctx, - GLuint n, const GLuint index[], - GLfloat r[], GLfloat g[], - GLfloat b[], GLfloat a[] ); +extern void +_mesa_map_ci8_to_rgba(const GLcontext *ctx, + GLuint n, const GLubyte index[], + GLubyte rgba[][4]); -extern void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, - GLstencil indexes[] ); +extern void +_mesa_shift_and_offset_stencil(const GLcontext *ctx, GLuint n, + GLstencil indexes[]); -extern void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil index[] ); +extern void +_mesa_map_stencil(const GLcontext *ctx, GLuint n, GLstencil index[]); #endif diff --git a/xc/extras/Mesa/src/pixeltex.c b/xc/extras/Mesa/src/pixeltex.c new file mode 100644 index 000000000..a42869912 --- /dev/null +++ b/xc/extras/Mesa/src/pixeltex.c @@ -0,0 +1,204 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * 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 + * BRIAN PAUL 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. + */ + + +/* + * This file implements both the GL_SGIX_pixel_texture and + * GL_SIGS_pixel_texture extensions. Luckily, they pretty much + * overlap in functionality so we use the same state variables + * and execution code for both. + */ + + +#ifdef PC_HEADER +#include "all.h" +#else +#include "glheader.h" +#include "context.h" +#include "pixeltex.h" +#endif + + +void +_mesa_PixelTexGenSGIX(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelTexGenSGIX"); + + switch (mode) { + case GL_NONE: + ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + break; + case GL_ALPHA: + ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + ctx->Pixel.FragmentAlphaSource = GL_CURRENT_RASTER_COLOR; + break; + case GL_RGB: + ctx->Pixel.FragmentRgbSource = GL_CURRENT_RASTER_COLOR; + ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + break; + case GL_RGBA: + ctx->Pixel.FragmentRgbSource = GL_CURRENT_RASTER_COLOR; + ctx->Pixel.FragmentAlphaSource = GL_CURRENT_RASTER_COLOR; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glPixelTexGenSGIX(mode)"); + return; + } +} + + +void +_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) +{ + _mesa_PixelTexGenParameteriSGIS(target, (GLint) value); +} + + +void +_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) +{ + _mesa_PixelTexGenParameteriSGIS(target, (GLint) *value); +} + + +void +_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelTexGenParameterSGIS"); + + if (value != GL_CURRENT_RASTER_COLOR && value != GL_PIXEL_GROUP_COLOR_SGIS) { + gl_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(value)"); + return; + } + + if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { + ctx->Pixel.FragmentRgbSource = (GLenum) value; + } + else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { + ctx->Pixel.FragmentAlphaSource = (GLenum) value; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(target)"); + } +} + + +void +_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) +{ + _mesa_PixelTexGenParameteriSGIS(target, *value); +} + + +void +_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetPixelTexGenParameterfvSGIS"); + + if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { + *value = (GLfloat) ctx->Pixel.FragmentRgbSource; + } + else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { + *value = (GLfloat) ctx->Pixel.FragmentAlphaSource; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterfvSGIS(target)"); + } +} + + +void +_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetPixelTexGenParameterivSGIS"); + + if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { + *value = (GLint) ctx->Pixel.FragmentRgbSource; + } + else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { + *value = (GLint) ctx->Pixel.FragmentAlphaSource; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)"); + } +} + + + +/* + * Convert RGBA values into strq texture coordinates. + */ +void +_mesa_pixeltexgen(GLcontext *ctx, GLuint n, const GLubyte rgba[][4], + GLfloat s[], GLfloat t[], GLfloat r[], GLfloat q[]) +{ + static GLboolean firstCall = GL_TRUE; + static GLfloat byteToFloat[256]; + + if (firstCall) { + GLuint i; + for (i = 0; i < 256; i++) { + byteToFloat[i] = i / 255.0F; + } + firstCall = GL_FALSE; + } + + if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_COLOR) { + GLuint i; + for (i = 0; i < n; i++) { + s[i] = ctx->Current.RasterColor[RCOMP]; + t[i] = ctx->Current.RasterColor[GCOMP]; + r[i] = ctx->Current.RasterColor[BCOMP]; + } + } + else { + GLuint i; + ASSERT(ctx->Pixel.FragmentRgbSource == GL_PIXEL_GROUP_COLOR_SGIS); + for (i = 0; i < n; i++) { + s[i] = byteToFloat[rgba[i][RCOMP]]; + t[i] = byteToFloat[rgba[i][GCOMP]]; + r[i] = byteToFloat[rgba[i][BCOMP]]; + } + } + + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_COLOR) { + GLuint i; + for (i = 0; i < n; i++) { + q[i] = ctx->Current.RasterColor[ACOMP]; + } + } + else { + GLuint i; + ASSERT(ctx->Pixel.FragmentAlphaSource == GL_PIXEL_GROUP_COLOR_SGIS); + for (i = 0; i < n; i++) { + q[i] = byteToFloat[rgba[i][ACOMP]]; + } + } +} diff --git a/xc/extras/Mesa/src/pixeltex.h b/xc/extras/Mesa/src/pixeltex.h new file mode 100644 index 000000000..d4f0718c1 --- /dev/null +++ b/xc/extras/Mesa/src/pixeltex.h @@ -0,0 +1,69 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * 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 noti_mesa_PixelTexGenParameterfvce 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 + * BRIAN PAUL 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. + */ + + +#ifndef PIXELTEX_H +#define PIXELTEX_H + + +extern void +_mesa_PixelTexGenSGIX(GLenum mode); + +extern void +_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value); + +#ifdef VMS +#define _mesa_PixelTexGenParameterfvSGIS _mesa_PixelTexGenParameterfv +#endif +extern void +_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value); + +extern void +_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value); + +#ifdef VMS +#define _mesa_PixelTexGenParameterivSGIS _mesa_PixelTexGenParameteriv +#endif +extern void +_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value); + +#ifdef VMS +#define _mesa_GetPixelTexGenParameterfvSGIS _mesa_GetPixelTexGenParameterfv +#endif +extern void +_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value); + +#ifdef VMS +#define _mesa_GetPixelTexGenParameterivSGIS _mesa_GetPixelTexGenParameteriv +#endif +extern void +_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value); + +extern void +_mesa_pixeltexgen(GLcontext *ctx, GLuint n, const GLubyte rgba[][4], + GLfloat s[], GLfloat t[], GLfloat r[], GLfloat q[]); + + +#endif diff --git a/xc/extras/Mesa/src/readpix.c b/xc/extras/Mesa/src/readpix.c index 235444e03..cc1823897 100644 --- a/xc/extras/Mesa/src/readpix.c +++ b/xc/extras/Mesa/src/readpix.c @@ -75,11 +75,11 @@ static void read_index_pixels( GLcontext *ctx, (*ctx->Driver.ReadCI32Span)( ctx, readWidth, x, y, index ); if (ctx->Pixel.IndexShift!=0 || ctx->Pixel.IndexOffset!=0) { - gl_shift_and_offset_ci( ctx, readWidth, index); + _mesa_shift_and_offset_ci( ctx, readWidth, index); } if (ctx->Pixel.MapColorFlag) { - gl_map_ci(ctx, readWidth, index); + _mesa_map_ci(ctx, readWidth, index); } dest = _mesa_image_address(packing, pixels, @@ -199,7 +199,7 @@ static void read_depth_pixels( GLcontext *ctx, bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; - if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort) + if (type==GL_UNSIGNED_SHORT && ctx->Visual->DepthBits == 16 && !bias_or_scale && !packing->SwapBytes) { /* Special case: directly read 16-bit unsigned depth values. */ for (j=0;j<height;j++,y++) { @@ -207,7 +207,7 @@ static void read_depth_pixels( GLcontext *ctx, GLushort *dst = (GLushort*) _mesa_image_address( packing, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); GLint i; - (*ctx->Driver.ReadDepthSpan)( ctx, width, x, y, depth); + _mesa_read_depth_span(ctx, width, x, y, depth); for (i = 0; i < width; i++) dst[i] = depth[i]; } @@ -218,11 +218,11 @@ static void read_depth_pixels( GLcontext *ctx, for (j=0;j<height;j++,y++) { GLdepth *dst = (GLdepth *) _mesa_image_address( packing, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); - (*ctx->Driver.ReadDepthSpan)( ctx, width, x, y, dst); + _mesa_read_depth_span(ctx, width, x, y, dst); } } else { - /* General case (slow) */ + /* General case (slower) */ for (j=0;j<height;j++,y++) { GLfloat depth[MAX_WIDTH]; GLvoid *dest; @@ -358,14 +358,14 @@ static void read_stencil_pixels( GLcontext *ctx, GLvoid *dest; GLstencil stencil[MAX_WIDTH]; - gl_read_stencil_span( ctx, readWidth, x, y, stencil ); + _mesa_read_stencil_span( ctx, readWidth, x, y, stencil ); if (shift_or_offset) { - gl_shift_and_offset_stencil( ctx, readWidth, stencil ); + _mesa_shift_and_offset_stencil( ctx, readWidth, stencil ); } if (ctx->Pixel.MapStencilFlag) { - gl_map_stencil( ctx, readWidth, stencil ); + _mesa_map_stencil( ctx, readWidth, stencil ); } dest = _mesa_image_address( packing, pixels, @@ -500,8 +500,17 @@ read_fast_rgba_pixels( GLcontext *ctx, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { - /* can't do scale, bias or mapping */ - if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) + GLboolean applyTransferOps; + + applyTransferOps = ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled; + /* can't do scale, bias, mapping, etc */ + if (applyTransferOps) return GL_FALSE; /* can't do fancy pixel packing */ @@ -559,8 +568,8 @@ read_fast_rgba_pixels( GLcontext *ctx, (*ctx->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY, (GLubyte (*)[4]) dest); if (ctx->Visual->SoftwareAlpha) { - gl_read_alpha_span(ctx, readWidth, srcX, srcY, - (GLubyte (*)[4]) dest); + _mesa_read_alpha_span(ctx, readWidth, srcX, srcY, + (GLubyte (*)[4]) dest); } dest += rowLength * 4; srcY++; @@ -641,13 +650,14 @@ static void read_rgba_pixels( GLcontext *ctx, gl_read_rgba_span( ctx, ctx->ReadBuffer, readWidth, x, y, rgba ); dest = _mesa_image_address( packing, pixels, width, height, - format, type, 0, j, 0); + format, type, 0, j, 0); _mesa_pack_rgba_span( ctx, readWidth, (const GLubyte (*)[4]) rgba, format, type, dest, packing, GL_TRUE ); } } else { + /* Convert color index pixels to RGBA */ GLint j; for (j=0;j<height;j++,y++) { GLubyte rgba[MAX_WIDTH][4]; @@ -657,13 +667,13 @@ static void read_rgba_pixels( GLcontext *ctx, (*ctx->Driver.ReadCI32Span)( ctx, readWidth, x, y, index ); if (ctx->Pixel.IndexShift!=0 || ctx->Pixel.IndexOffset!=0) { - gl_map_ci( ctx, readWidth, index ); + _mesa_map_ci( ctx, readWidth, index ); } - gl_map_ci_to_rgba(ctx, readWidth, index, rgba ); + _mesa_map_ci_to_rgba_ubyte(ctx, readWidth, index, rgba ); dest = _mesa_image_address( packing, pixels, width, height, - format, type, 0, j, 0); + format, type, 0, j, 0); _mesa_pack_rgba_span( ctx, readWidth, (const GLubyte (*)[4]) rgba, format, type, dest, packing, GL_TRUE ); diff --git a/xc/extras/Mesa/src/render_tmp.h b/xc/extras/Mesa/src/render_tmp.h index 3907ee86f..572a06c8c 100644 --- a/xc/extras/Mesa/src/render_tmp.h +++ b/xc/extras/Mesa/src/render_tmp.h @@ -55,6 +55,8 @@ static void TAG(render_vb_points)( struct vertex_buffer *VB, { LOCAL_VARS; (void) parity; + VB->ctx->OcclusionResult = GL_TRUE; + INIT(GL_POINTS); RENDER_POINTS( start, count ); POSTFIX; @@ -68,6 +70,7 @@ static void TAG(render_vb_lines)( struct vertex_buffer *VB, GLuint j; LOCAL_VARS; (void) parity; + VB->ctx->OcclusionResult = GL_TRUE; INIT(GL_LINES); for (j=start+1; j<count; j+=2 ) { @@ -86,6 +89,7 @@ static void TAG(render_vb_line_strip)( struct vertex_buffer *VB, GLuint j; LOCAL_VARS; (void) parity; + VB->ctx->OcclusionResult = GL_TRUE; INIT(GL_LINES); for (j=start+1; j<count; j++ ) { @@ -107,6 +111,7 @@ static void TAG(render_vb_line_loop)( struct vertex_buffer *VB, GLuint i = start < VB->Start ? VB->Start : start + 1; LOCAL_VARS; (void) parity; + VB->ctx->OcclusionResult = GL_TRUE; INIT(GL_LINES); for ( ; i < count ; i++) { diff --git a/xc/extras/Mesa/src/span.c b/xc/extras/Mesa/src/span.c index 39059ab3b..a5d1a7c9b 100644 --- a/xc/extras/Mesa/src/span.c +++ b/xc/extras/Mesa/src/span.c @@ -148,10 +148,10 @@ static void multi_write_index_span( GLcontext *ctx, GLuint n, /* make copy of incoming indexes */ MEMCPY( indexTmp, indexes, n * sizeof(GLuint) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_span( ctx, n, x, y, indexTmp, mask ); + _mesa_logicop_ci_span( ctx, n, x, y, indexTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_span( ctx, n, x, y, indexTmp ); + _mesa_mask_index_span( ctx, n, x, y, indexTmp ); } (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask ); } @@ -218,7 +218,7 @@ void gl_write_index_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } } @@ -237,10 +237,10 @@ void gl_write_index_span( GLcontext *ctx, else { /* normal situation: draw to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_span( ctx, n, x, y, index, mask ); + _mesa_logicop_ci_span( ctx, n, x, y, index, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_span( ctx, n, x, y, index ); + _mesa_mask_index_span( ctx, n, x, y, index ); } /* write pixels */ @@ -281,7 +281,7 @@ void gl_write_monoindex_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } } @@ -311,11 +311,11 @@ void gl_write_monoindex_span( GLcontext *ctx, } if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_span( ctx, n, x, y, indexes, mask ); + _mesa_logicop_ci_span( ctx, n, x, y, indexes, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_span( ctx, n, x, y, indexes ); + _mesa_mask_index_span( ctx, n, x, y, indexes ); } if (ctx->RasterMask & MULTI_DRAW_BIT) { @@ -325,10 +325,10 @@ void gl_write_monoindex_span( GLcontext *ctx, else { /* normal situation: draw to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_span( ctx, n, x, y, indexes, mask ); + _mesa_logicop_ci_span( ctx, n, x, y, indexes, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_span( ctx, n, x, y, indexes ); + _mesa_mask_index_span( ctx, n, x, y, indexes ); } (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask ); } @@ -392,20 +392,20 @@ static void multi_write_rgba_span( GLcontext *ctx, GLuint n, MEMCPY( rgbaTmp, rgba, 4 * n * sizeof(GLubyte) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgbaTmp, mask ); + _mesa_logicop_rgba_span( ctx, n, x, y, rgbaTmp, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_span( ctx, n, x, y, rgbaTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgbaTmp ); + _mesa_mask_rgba_span( ctx, n, x, y, rgbaTmp ); } (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4]) rgbaTmp, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, - (const GLubyte (*)[4])rgbaTmp, mask ); + _mesa_write_alpha_span( ctx, n, x, y, + (const GLubyte (*)[4])rgbaTmp, mask ); } } } @@ -476,7 +476,7 @@ void gl_write_rgba_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } write_all = GL_FALSE; @@ -504,7 +504,7 @@ void gl_write_rgba_span( GLcontext *ctx, /* normal: write to exactly one buffer */ /* logic op or blending */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_span( ctx, n, x, y, rgba, mask ); @@ -512,7 +512,7 @@ void gl_write_rgba_span( GLcontext *ctx, /* Color component masking */ if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgba ); + _mesa_mask_rgba_span( ctx, n, x, y, rgba ); } /* write pixels */ @@ -521,9 +521,9 @@ void gl_write_rgba_span( GLcontext *ctx, write_all ? Null : mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, - (const GLubyte (*)[4]) rgba, - write_all ? Null : mask ); + _mesa_write_alpha_span( ctx, n, x, y, + (const GLubyte (*)[4]) rgba, + write_all ? Null : mask ); } } @@ -589,7 +589,7 @@ void gl_write_monocolor_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } write_all = GL_FALSE; @@ -629,7 +629,7 @@ void gl_write_monocolor_span( GLcontext *ctx, else { /* normal: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_span( ctx, n, x, y, rgba, mask ); @@ -637,7 +637,7 @@ void gl_write_monocolor_span( GLcontext *ctx, /* Color component masking */ if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgba ); + _mesa_mask_rgba_span( ctx, n, x, y, rgba ); } /* write pixels */ @@ -645,9 +645,9 @@ void gl_write_monocolor_span( GLcontext *ctx, (const GLubyte (*)[4]) rgba, write_all ? Null : mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, - (const GLubyte (*)[4]) rgba, - write_all ? Null : mask ); + _mesa_write_alpha_span( ctx, n, x, y, + (const GLubyte (*)[4]) rgba, + write_all ? Null : mask ); } } } @@ -670,8 +670,8 @@ void gl_write_monocolor_span( GLcontext *ctx, else { (*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_mono_alpha_span( ctx, n, x, y, (GLubyte) color[ACOMP], - write_all ? Null : mask ); + _mesa_write_mono_alpha_span( ctx, n, x, y, (GLubyte) color[ACOMP], + write_all ? Null : mask ); } } } @@ -744,7 +744,7 @@ void gl_write_texture_span( GLcontext *ctx, } /* Texture */ - ASSERT(ctx->Texture.Enabled); + ASSERT(ctx->Texture.ReallyEnabled); gl_texture_pixels( ctx, 0, n, s, t, u, lambda, rgba ); /* Add base and specular colors */ @@ -781,7 +781,7 @@ void gl_write_texture_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } write_all = GL_FALSE; @@ -807,20 +807,20 @@ void gl_write_texture_span( GLcontext *ctx, else { /* normal: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_span( ctx, n, x, y, rgba, mask ); } if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgba ); + _mesa_mask_rgba_span( ctx, n, x, y, rgba ); } (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4])rgba, write_all ? Null : mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, - write_all ? Null : mask ); + _mesa_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, + write_all ? Null : mask ); } } } @@ -871,7 +871,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, } /* Texture */ - ASSERT(ctx->Texture.Enabled); + ASSERT(ctx->Texture.ReallyEnabled); ASSERT(texUnits <= MAX_TEXTURE_UNITS); for (i=0;i<texUnits;i++) { gl_texture_pixels( ctx, i, n, s[i], t[i], u[i], lambda[i], rgba ); @@ -911,7 +911,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } write_all = GL_FALSE; @@ -938,19 +938,19 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, /* normal: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_span( ctx, n, x, y, rgba, mask ); } if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgba ); + _mesa_mask_rgba_span( ctx, n, x, y, rgba ); } (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4])rgba, write_all ? Null : mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4])rgba, - write_all ? Null : mask ); + _mesa_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4])rgba, + write_all ? Null : mask ); } } } @@ -969,7 +969,7 @@ void gl_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, || x + (GLint) n < 0 || x >= buffer->Width) { /* completely above, below, or right */ /* XXX maybe leave undefined? */ - MEMSET( rgba, 0, 4 * n * sizeof(GLubyte)); + BZERO(rgba, 4 * n * sizeof(GLubyte)); } else { GLint skip, length; @@ -1002,7 +1002,7 @@ void gl_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, (*ctx->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip ); if (ctx->Visual->SoftwareAlpha) { - gl_read_alpha_span( ctx, length, x + skip, y, rgba + skip ); + _mesa_read_alpha_span( ctx, length, x + skip, y, rgba + skip ); } } } @@ -1020,7 +1020,7 @@ void gl_read_index_span( GLcontext *ctx, GLframebuffer *buffer, if (y < 0 || y >= buffer->Height || x + (GLint) n < 0 || x >= buffer->Width) { /* completely above, below, or right */ - MEMSET(indx, 0, n * sizeof(GLuint)); + BZERO(indx, n * sizeof(GLuint)); } else { GLint skip, length; diff --git a/xc/extras/Mesa/src/state.c b/xc/extras/Mesa/src/state.c index fda6210ba..b2ec15607 100644 --- a/xc/extras/Mesa/src/state.c +++ b/xc/extras/Mesa/src/state.c @@ -63,6 +63,7 @@ #include "mmath.h" #include "pipeline.h" #include "pixel.h" +#include "pixeltex.h" #include "points.h" #include "polygon.h" #include "quads.h" @@ -524,6 +525,17 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; + /* GL_SGIX_pixel_texture */ + exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX; + + /* GL_SGIS_pixel_texture */ + exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS; + exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS; + exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS; + exec->PixelTexGenParameterfvSGIS = _mesa_PixelTexGenParameterfvSGIS; + exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; + exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; + /* GL_EXT_compiled_vertex_array */ exec->LockArraysEXT = _mesa_LockArraysEXT; exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; @@ -790,16 +802,9 @@ static void update_rasterflags( GLcontext *ctx ) ctx->RasterMask |= WINCLIP_BIT; } - if (ctx->Depth.OcclusionTest) { - if (ctx->Color.ColorMask[0] == 0 && - ctx->Color.ColorMask[1] == 0 && - ctx->Color.ColorMask[2] == 0 && - ctx->Color.ColorMask[3] == 0 && - ctx->Depth.Mask == GL_FALSE && - !ctx->Stencil.Enabled) { - ctx->RasterMask |= OCCLUSION_BIT; - } - } + if (ctx->Depth.OcclusionTest) + ctx->RasterMask |= OCCLUSION_BIT; + /* If we're not drawing to exactly one color buffer set the * MULTI_DRAW_BIT flag. Also set it if we're drawing to no @@ -1142,6 +1147,10 @@ void gl_update_state( GLcontext *ctx ) ctx->ModelProjectWinMatrixUptodate = 0; } + if (ctx->NewState & NEW_COLOR_MATRIX) { + gl_matrix_analyze( &ctx->ColorMatrix ); + } + /* Figure out whether we can light in object space or not. If we * can, find the current positions of the lights in object space */ diff --git a/xc/extras/Mesa/src/stencil.c b/xc/extras/Mesa/src/stencil.c index a0703339d..5e0494328 100644 --- a/xc/extras/Mesa/src/stencil.c +++ b/xc/extras/Mesa/src/stencil.c @@ -541,9 +541,9 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], * */ static GLboolean -stencil_and_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], GLstencil stencil[], - GLubyte mask[] ) +stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLdepth z[], GLstencil stencil[], + GLubyte mask[] ) { ASSERT(ctx->Stencil.Enabled); ASSERT(n <= PB_SIZE); @@ -624,8 +624,8 @@ stencil_and_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y, * */ GLboolean -gl_stencil_and_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], GLubyte mask[] ) +_mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLdepth z[], GLubyte mask[] ) { GLstencil stencilRow[MAX_WIDTH]; GLstencil *stencil; @@ -647,7 +647,7 @@ gl_stencil_and_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y, } /* do all the stencil/depth testing/updating */ - result = stencil_and_depth_test_span( ctx, n, x, y, z, stencil, mask ); + result = stencil_and_ztest_span( ctx, n, x, y, z, stencil, mask ); if (ctx->Driver.WriteStencilSpan) { /* Write updated stencil values into hardware stencil buffer */ @@ -1016,7 +1016,7 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, * This is used both for software and hardware stencil buffers. * * The comments in this function are a bit sparse but the code is - * almost identical to stencil_and_depth_test_span(), which is well + * almost identical to stencil_and_ztest_span(), which is well * commented. * * Input: n - number of pixels in the array @@ -1028,9 +1028,9 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, * GL_FALSE - one or more fragments passed the testing */ GLboolean -gl_stencil_and_depth_test_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - const GLdepth z[], GLubyte mask[] ) +_mesa_stencil_and_ztest_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLdepth z[], GLubyte mask[] ) { ASSERT(ctx->Stencil.Enabled); ASSERT(n <= PB_SIZE); @@ -1129,24 +1129,44 @@ gl_stencil_and_depth_test_pixels( GLcontext *ctx, * x,y - location of first pixel * Output: stencil - the array of stencil values */ -void gl_read_stencil_span( GLcontext *ctx, - GLint n, GLint x, GLint y, GLstencil stencil[] ) +void +_mesa_read_stencil_span( GLcontext *ctx, + GLint n, GLint x, GLint y, GLstencil stencil[] ) { + if (y < 0 || y >= ctx->DrawBuffer->Height || + x + n <= 0 || x >= ctx->DrawBuffer->Width) { + /* span is completely outside framebuffer */ + return; /* undefined values OK */ + } + + if (x < 0) { + GLint dx = -x; + x = 0; + n -= dx; + stencil += dx; + } + if (x + n > ctx->DrawBuffer->Width) { + GLint dx = x + n - ctx->DrawBuffer->Width; + n -= dx; + } + if (n <= 0) { + return; + } + + ASSERT(n >= 0); - if (ctx->DrawBuffer->Stencil) { - if (ctx->Driver.ReadStencilSpan) { - (*ctx->Driver.ReadStencilSpan)( ctx, (GLuint) n, x, y, stencil ); - } - else { - const GLstencil *s = STENCIL_ADDRESS( x, y ); + if (ctx->Driver.ReadStencilSpan) { + (*ctx->Driver.ReadStencilSpan)( ctx, (GLuint) n, x, y, stencil ); + } + else if (ctx->DrawBuffer->Stencil) { + const GLstencil *s = STENCIL_ADDRESS( x, y ); #if STENCIL_BITS == 8 - MEMCPY( stencil, s, n * sizeof(GLstencil) ); + MEMCPY( stencil, s, n * sizeof(GLstencil) ); #else - GLuint i; - for (i=0;i<n;i++) - stencil[i] = s[i]; + GLuint i; + for (i=0;i<n;i++) + stencil[i] = s[i]; #endif - } } } @@ -1159,41 +1179,42 @@ void gl_read_stencil_span( GLcontext *ctx, * x, y - location of first pixel * stencil - the array of stencil values */ -void gl_write_stencil_span( GLcontext *ctx, - GLint n, GLint x, GLint y, - const GLstencil stencil[] ) +void +_mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, + const GLstencil stencil[] ) { - ASSERT(n >= 0); - if (ctx->DrawBuffer->Stencil) { - /* do clipping */ - if (y < ctx->DrawBuffer->Ymin || y > ctx->DrawBuffer->Ymax) - return; - if (x < ctx->DrawBuffer->Xmin) { - GLint diff = ctx->DrawBuffer->Xmin - x; - n -= diff; - stencil += diff; - x = ctx->DrawBuffer->Xmin; - } - if (x + n > ctx->DrawBuffer->Xmax) { - GLint diff = x + n - ctx->DrawBuffer->Xmax; - n -= diff; - } + if (y < 0 || y >= ctx->DrawBuffer->Height || + x + n <= 0 || x >= ctx->DrawBuffer->Width) { + /* span is completely outside framebuffer */ + return; /* undefined values OK */ + } - ASSERT( n >= 0); + if (x < 0) { + GLint dx = -x; + x = 0; + n -= dx; + stencil += dx; + } + if (x + n > ctx->DrawBuffer->Width) { + GLint dx = x + n - ctx->DrawBuffer->Width; + n -= dx; + } + if (n <= 0) { + return; + } - if (ctx->Driver.WriteStencilSpan) { - (*ctx->Driver.WriteStencilSpan)( ctx, n, x, y, stencil, NULL ); - } - else { - GLstencil *s = STENCIL_ADDRESS( x, y ); + if (ctx->Driver.WriteStencilSpan) { + (*ctx->Driver.WriteStencilSpan)( ctx, n, x, y, stencil, NULL ); + } + else if (ctx->DrawBuffer->Stencil) { + GLstencil *s = STENCIL_ADDRESS( x, y ); #if STENCIL_BITS == 8 - MEMCPY( s, stencil, n * sizeof(GLstencil) ); + MEMCPY( s, stencil, n * sizeof(GLstencil) ); #else - GLuint i; - for (i=0;i<n;i++) - s[i] = stencil[i]; + GLuint i; + for (i=0;i<n;i++) + s[i] = stencil[i]; #endif - } } } @@ -1203,7 +1224,8 @@ void gl_write_stencil_span( GLcontext *ctx, * Allocate a new stencil buffer. If there's an old one it will be * deallocated first. The new stencil buffer will be uninitialized. */ -void gl_alloc_stencil_buffer( GLcontext *ctx ) +void +_mesa_alloc_stencil_buffer( GLcontext *ctx ) { GLuint buffersize = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; @@ -1218,7 +1240,7 @@ void gl_alloc_stencil_buffer( GLcontext *ctx ) if (!ctx->DrawBuffer->Stencil) { /* out of memory */ _mesa_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE ); - gl_error( ctx, GL_OUT_OF_MEMORY, "gl_alloc_stencil_buffer" ); + gl_error( ctx, GL_OUT_OF_MEMORY, "_mesa_alloc_stencil_buffer" ); } } @@ -1390,7 +1412,8 @@ clear_hardware_stencil_buffer( GLcontext *ctx ) /* * Clear the stencil buffer. */ -void gl_clear_stencil_buffer( GLcontext *ctx ) +void +_mesa_clear_stencil_buffer( GLcontext *ctx ) { if (ctx->Driver.WriteStencilSpan) { ASSERT(ctx->Driver.ReadStencilSpan); diff --git a/xc/extras/Mesa/src/stencil.h b/xc/extras/Mesa/src/stencil.h index 259b5bf04..38a1ac1a0 100644 --- a/xc/extras/Mesa/src/stencil.h +++ b/xc/extras/Mesa/src/stencil.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -49,33 +49,31 @@ _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); extern GLboolean -gl_stencil_and_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], GLubyte mask[] ); +_mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLdepth z[], GLubyte mask[] ); -#ifdef VMS /* VMS allows externals of 31 characters maximum */ -#define gl_stencil_and_depth_test_pixels gl_stencil_and_depth_test_pixel -#endif extern GLboolean -gl_stencil_and_depth_test_pixels( GLcontext *ctx, GLuint n, - const GLint x[], const GLint y[], - const GLdepth z[], GLubyte mask[] ); - +_mesa_stencil_and_ztest_pixels( GLcontext *ctx, GLuint n, + const GLint x[], const GLint y[], + const GLdepth z[], GLubyte mask[] ); extern void -gl_read_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, - GLstencil stencil[] ); +_mesa_read_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, + GLstencil stencil[] ); extern void -gl_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, - const GLstencil stencil[] ); +_mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, + const GLstencil stencil[] ); -extern void gl_alloc_stencil_buffer( GLcontext *ctx ); +extern void +_mesa_alloc_stencil_buffer( GLcontext *ctx ); -extern void gl_clear_stencil_buffer( GLcontext *ctx ); +extern void +_mesa_clear_stencil_buffer( GLcontext *ctx ); #endif diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c index bafac922a..330943b57 100644 --- a/xc/extras/Mesa/src/texobj.c +++ b/xc/extras/Mesa/src/texobj.c @@ -28,6 +28,7 @@ #include "all.h" #else #include "glheader.h" +#include "colortab.h" #include "context.h" #include "enums.h" #include "hash.h" @@ -73,13 +74,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MinMagThresh = 0.0F; - obj->Palette.Table[0] = 255; - obj->Palette.Table[1] = 255; - obj->Palette.Table[2] = 255; - obj->Palette.Table[3] = 255; - obj->Palette.Size = 1; - obj->Palette.IntFormat = GL_RGBA; - obj->Palette.Format = GL_RGBA; + _mesa_init_colortable(&obj->Palette); /* insert into linked list */ if (shared) { @@ -143,7 +138,9 @@ void gl_free_texture_object( struct gl_shared_state *shared, _mesa_HashRemove(shared->TexObjects, t->Name); } - /* free texture image */ + _mesa_free_colortable_data(&t->Palette); + + /* free texture images */ { GLuint i; for (i=0;i<MAX_TEXTURE_LEVELS;i++) { diff --git a/xc/extras/Mesa/src/texture.c b/xc/extras/Mesa/src/texture.c index db20c8c36..d101e2518 100644 --- a/xc/extras/Mesa/src/texture.c +++ b/xc/extras/Mesa/src/texture.c @@ -246,11 +246,13 @@ static void palette_sample(const struct gl_texture_object *tObj, GLenum format; if (ctx->Texture.SharedPalette) { - palette = ctx->Texture.Palette.Table; + ASSERT(ctx->Texture.Palette.TableType == GL_UNSIGNED_BYTE); + palette = (const GLubyte *) ctx->Texture.Palette.Table; format = ctx->Texture.Palette.Format; } else { - palette = tObj->Palette.Table; + ASSERT(tObj->Palette.TableType == GL_UNSIGNED_BYTE); + palette = (const GLubyte *) tObj->Palette.Table; format = tObj->Palette.Format; } diff --git a/xc/extras/Mesa/src/triangle.c b/xc/extras/Mesa/src/triangle.c index 4c89ae9f5..29f85a4ef 100644 --- a/xc/extras/Mesa/src/triangle.c +++ b/xc/extras/Mesa/src/triangle.c @@ -615,14 +615,16 @@ static void affine_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1, * Render an perspective corrected RGB/RGBA textured triangle. * The Q (aka V in Mesa) coordinate must be zero such that the divide * by interpolated Q/W comes out right. - * - * XXX (May 15, 1999) this function not used for now because repeating - * of negative texture coords not handled correctly!!! */ -#if 000 static void persp_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv ) { +/* The BIAS value is used to shift negative values into positive values. + * Without this, negative texture values don't GL_REPEAT correctly at just + * below zero. We're not going to worry about texture coords less than -BIAS. + * Only seems to be a problem with GL_NEAREST filtering. + */ +#define BIAS 4096.0F #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE @@ -686,8 +688,8 @@ static void persp_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1, #define SPAN1(DO_TEX,COMP) \ for (i=0;i<n;i++) { \ GLfloat invQ = 1.0f / vv; \ - GLint s = (int)(SS * invQ) & smask; \ - GLint t = (int)(TT * invQ) & tmask; \ + GLint s = (int)(SS * invQ + BIAS) & smask; \ + GLint t = (int)(TT * invQ + BIAS) & tmask; \ GLint pos = COMP * ((t << twidth_log2) + s); \ GLubyte *tex00 = texture + pos; \ zspan[i] = FixedToDepth(ffz); \ @@ -842,8 +844,8 @@ static void persp_textured_triangle( GLcontext *ctx, GLuint v0, GLuint v1, #include "tritemp.h" #undef SPAN1 #undef SPAN2 +#undef BIAS } -#endif @@ -1028,7 +1030,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx, GLuint v0, /* * Compute the lambda value for a fragment. (texture level of detail) */ -static GLfloat +static INLINE GLfloat compute_lambda( GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat invQ, GLfloat width, GLfloat height ) { @@ -1426,6 +1428,35 @@ static void lambda_multitextured_triangle( GLcontext *ctx, GLuint v0, } + +static void occlusion_zless_triangle( GLcontext *ctx, GLuint v0, GLuint v1, + GLuint v2, GLuint pv ) +{ + (void)pv; + if (ctx->OcclusionResult) { + return; + } + +#define DO_OCCLUSION_TEST +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define INNER_LOOP( LEFT, RIGHT, Y ) \ + { \ + GLint i, len = RIGHT-LEFT; \ + for (i=0;i<len;i++) { \ + GLdepth z = FixedToDepth(ffz); \ + if (z < zRow[i]) { \ + ctx->OcclusionResult = GL_TRUE; \ + return; \ + } \ + ffz += fdzdx; \ + } \ + } +#include "tritemp.h" +} + + + /* * Null rasterizer for measuring transformation speed. */ @@ -1473,6 +1504,23 @@ void gl_set_triangle_function( GLcontext *ctx ) return; } + if (ctx->Depth.OcclusionTest && + ctx->Depth.Mask == GL_FALSE && + ctx->Depth.Func == GL_LESS && + !ctx->Stencil.Enabled) { + if ((ctx->Visual->RGBAflag && + ctx->Color.ColorMask[0] == 0 && + ctx->Color.ColorMask[1] == 0 && + ctx->Color.ColorMask[2] == 0 && + ctx->Color.ColorMask[3] == 0) + || + (!ctx->Visual->RGBAflag && ctx->Color.IndexMask == 0)) { + dputs("occlusion_test_triangle"); + ctx->Driver.TriangleFunc = occlusion_zless_triangle; + return; + } + } + if (ctx->Texture.ReallyEnabled) { /* Ugh, we do a _lot_ of tests to pick the best textured tri func */ GLint format, filter; @@ -1521,8 +1569,7 @@ void gl_set_triangle_function( GLcontext *ctx ) } } else { - /*ctx->Driver.TriangleFunc = persp_textured_triangle;*/ - ctx->Driver.TriangleFunc = general_textured_triangle; + ctx->Driver.TriangleFunc = persp_textured_triangle; dputs("persp_textured_triangle"); } } diff --git a/xc/extras/Mesa/src/tritemp.h b/xc/extras/Mesa/src/tritemp.h index dd87a2994..684f4656b 100644 --- a/xc/extras/Mesa/src/tritemp.h +++ b/xc/extras/Mesa/src/tritemp.h @@ -152,6 +152,10 @@ oneOverArea = 1.0F / area; } +#ifndef DO_OCCLUSION_TEST + ctx->OcclusionResult = GL_TRUE; +#endif + /* Edge setup. For a triangle strip these could be reused... */ { /* fixed point Y coordinates */ @@ -1078,3 +1082,5 @@ #undef T_SCALE #undef FixedToDepth + +#undef DO_OCCLUSION_TEST diff --git a/xc/extras/Mesa/src/types.h b/xc/extras/Mesa/src/types.h index e96740e78..78a40ace1 100644 --- a/xc/extras/Mesa/src/types.h +++ b/xc/extras/Mesa/src/types.h @@ -208,10 +208,17 @@ struct gl_texture_image { /* Data structure for color tables */ struct gl_color_table { - GLubyte Table[4 * MAX_TEXTURE_PALETTE_SIZE]; + GLvoid *Table; + GLenum TableType; /* GL_UNSIGNED_BYTE or GL_FLOAT */ GLuint Size; /* number of entries (rows) in table */ GLenum Format; GLenum IntFormat; + GLint RedSize; + GLint GreenSize; + GLint BlueSize; + GLint AlphaSize; + GLint LuminanceSize; + GLint IntensitySize; }; @@ -400,6 +407,7 @@ struct gl_enable_attrib { GLboolean DepthTest; GLboolean Dither; GLboolean Fog; + GLboolean Histogram; GLboolean Light[MAX_LIGHTS]; GLboolean Lighting; GLboolean LineSmooth; @@ -424,7 +432,9 @@ struct gl_enable_attrib { GLboolean Map2TextureCoord4; GLboolean Map2Vertex3; GLboolean Map2Vertex4; + GLboolean MinMax; GLboolean Normalize; + GLboolean PixelTexture; GLboolean PointSmooth; GLboolean PolygonOffsetPoint; GLboolean PolygonOffsetLine; @@ -490,7 +500,7 @@ struct gl_hint_attrib { /* GL_PGI_misc_hints */ GLenum AllowDrawWin; - GLenum AllowDrawSpn; + GLenum AllowDrawFrg; GLenum AllowDrawMem; GLenum StrictLighting; @@ -499,6 +509,26 @@ struct gl_hint_attrib { }; +struct gl_histogram_attrib { + GLuint Width; + GLint Format; + GLboolean Sink; + GLuint RedSize; + GLuint GreenSize; + GLuint BlueSize; + GLuint AlphaSize; + GLuint LuminanceSize; + GLuint Count[HISTOGRAM_TABLE_SIZE][4]; +}; + + +struct gl_minmax_attrib { + GLenum Format; + GLboolean Sink; + GLfloat Min[4], Max[4]; /* RGBA */ +}; + + struct gl_light_attrib { struct gl_light Light[MAX_LIGHTS]; /* Array of lights */ struct gl_lightmodel Model; /* Lighting model */ @@ -554,8 +584,7 @@ struct gl_pixel_attrib { GLint IndexShift, IndexOffset; GLboolean MapColorFlag; GLboolean MapStencilFlag; - GLfloat ZoomX; /* Pixel zoom X factor */ - GLfloat ZoomY; /* Pixel zoom Y factor */ + GLfloat ZoomX, ZoomY; GLint MapStoSsize; /* Size of each pixel map */ GLint MapItoIsize; GLint MapItoRsize; @@ -580,6 +609,33 @@ struct gl_pixel_attrib { GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE]; GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE]; GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE]; + /* GL_EXT_histogram */ + GLboolean HistogramEnabled; + GLboolean MinMaxEnabled; + /* GL_SGIS_pixel_texture */ + GLboolean PixelTextureEnabled; + GLenum FragmentRgbSource; + GLenum FragmentAlphaSource; + /* GL_SGI_color_matrix */ + GLfloat PostColorMatrixRedScale; + GLfloat PostColorMatrixRedBias; + GLfloat PostColorMatrixGreenScale; + GLfloat PostColorMatrixGreenBias; + GLfloat PostColorMatrixBlueScale; + GLfloat PostColorMatrixBlueBias; + GLfloat PostColorMatrixAlphaScale; + GLfloat PostColorMatrixAlphaBias; + GLboolean ScaleOrBiasRGBApcm; + /* GL_SGI_color_table */ + GLfloat ColorTableScale[4]; + GLfloat ColorTableBias[4]; + GLboolean ColorTableEnabled; + GLfloat PCCTscale[4]; + GLfloat PCCTbias[4]; + GLboolean PostConvolutionColorTableEnabled; + GLfloat PCMCTscale[4]; + GLfloat PCMCTbias[4]; + GLboolean PostColorMatrixColorTableEnabled; }; @@ -1180,6 +1236,7 @@ struct gl_visual { GLboolean RGBAflag; /* Is frame buffer in RGBA mode, not CI? */ GLboolean DBflag; /* Is color buffer double buffered? */ GLboolean StereoFlag; /* stereo buffer? */ + GLboolean SoftwareAlpha; /* Implement software alpha buffer? */ GLint RedBits; /* Bits per color component */ GLint GreenBits; @@ -1188,11 +1245,13 @@ struct gl_visual { GLint IndexBits; /* Bits/pixel if in color index mode */ - GLint AccumBits; /* Number of bits per color channel, or 0 */ + GLint AccumRedBits; /* Number of bits in red accum channel */ + GLint AccumGreenBits; /* Number of bits in green accum channel */ + GLint AccumBlueBits; /* Number of bits in blue accum channel */ + GLint AccumAlphaBits; /* Number of bits in alpha accum channel */ GLint DepthBits; /* Number of bits in depth buffer, or 0 */ GLint StencilBits; /* Number of bits in stencil buffer, or 0 */ - - GLboolean SoftwareAlpha; /* Implement software alpha buffer? */ + GLint NumSamples; /* Samples/pixel for multisampling */ GLuint DepthMax; /* Max depth buffer value */ GLfloat DepthMaxF; /* Float max depth buffer value */ @@ -1253,6 +1312,7 @@ struct gl_constants { GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */ GLfloat LineWidthGranularity; GLuint NumAuxBuffers; + GLuint MaxColorTableSize; }; @@ -1309,6 +1369,7 @@ struct gl_extensions { #define NEW_NORMAL_TRANSFORM 0x8000 #define NEW_VIEWPORT 0x10000 #define NEW_TEXTURE_ENABLE 0x20000 +#define NEW_COLOR_MATRIX 0x40000 #define NEW_ALL ~0 @@ -1345,6 +1406,8 @@ struct gl_extensions { #define DD_STENCIL 0x1000000 #define DD_CLIP_FOG_COORD 0x2000000 + + #define DD_SW_SETUP (DD_TRI_CULL| \ DD_TRI_CULL_FRONT_BACK| \ DD_TRI_OFFSET| \ @@ -1683,6 +1746,11 @@ struct gl_context { GLuint TextureStackDepth[MAX_TEXTURE_UNITS]; GLmatrix TextureStack[MAX_TEXTURE_UNITS][MAX_TEXTURE_STACK_DEPTH - 1]; + /* Color matrix and stack */ + GLmatrix ColorMatrix; + GLuint ColorStackDepth; + GLmatrix ColorStack[MAX_COLOR_STACK_DEPTH - 1]; + /* Display lists */ GLuint CallDepth; /* Current recursion calling depth */ GLboolean ExecuteFlag; /* Execute GL commands? */ @@ -1718,9 +1786,11 @@ struct gl_context { struct gl_eval_attrib Eval; struct gl_fog_attrib Fog; struct gl_hint_attrib Hint; + struct gl_histogram_attrib Histogram; struct gl_light_attrib Light; struct gl_line_attrib Line; struct gl_list_attrib List; + struct gl_minmax_attrib MinMax; struct gl_pixel_attrib Pixel; struct gl_point_attrib Point; struct gl_polygon_attrib Polygon; @@ -1744,6 +1814,13 @@ struct gl_context { struct gl_feedback Feedback; /* Feedback */ struct gl_selection Select; /* Selection */ + struct gl_color_table ColorTable; /* Pre-convolution */ + struct gl_color_table ProxyColorTable; /* Pre-convolution */ + struct gl_color_table PostConvolutionColorTable; + struct gl_color_table ProxyPostConvolutionColorTable; + struct gl_color_table PostColorMatrixColorTable; + struct gl_color_table ProxyPostColorMatrixColorTable; + /* Optimized Accumulation buffer info */ GLboolean IntegerAccumMode; /* Storing unscaled integers? */ GLfloat IntegerAccumScaler; /* Implicit scale factor */ @@ -1798,6 +1875,7 @@ struct gl_context { GLfloat backface_sign; GLboolean OcclusionResult; /* GL_HP_occlusion_test */ + GLboolean OcclusionResultSaved; /* GL_HP_occlusion_test */ /* Destination of immediate mode commands */ struct immediate *input; diff --git a/xc/extras/Mesa/src/varray.c b/xc/extras/Mesa/src/varray.c index 786793da7..dc758594a 100644 --- a/xc/extras/Mesa/src/varray.c +++ b/xc/extras/Mesa/src/varray.c @@ -682,7 +682,6 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->Primitive[VB->CopyStart] = mode; ctx->Array.Flag[count] |= VERT_END_VB; - ctx->Array.Flag[count] |= VERT_END_VB; /* Transform and render. */ gl_run_pipeline( VB ); diff --git a/xc/extras/Mesa/src/vbcull.c b/xc/extras/Mesa/src/vbcull.c index bbb0ad662..927e485c6 100644 --- a/xc/extras/Mesa/src/vbcull.c +++ b/xc/extras/Mesa/src/vbcull.c @@ -546,11 +546,6 @@ static GLuint gl_copy_overflow( struct vertex_buffer *VB, return 0; } - - - - - static void gl_fast_copy_noop( struct vertex_buffer *VB, GLuint start, GLuint count, GLuint ovf) @@ -802,7 +797,7 @@ static void build_clip_vert_bits( GLubyte *clipmask, const GLubyte *cullmask, GLuint gl_cull_vb( struct vertex_buffer *VB ) { const GLcontext *ctx = VB->ctx; - GLuint i, next, prim, n; + GLuint i, next, prim = 0xffffffff, n; GLfloat (*proj)[4] = VB->Projected->data; GLuint *in_prim = VB->Primitive; GLuint *out_prim = VB->IM->Primitive; diff --git a/xc/extras/Mesa/src/vbcull.h b/xc/extras/Mesa/src/vbcull.h index 2742634dc..6953092d3 100644 --- a/xc/extras/Mesa/src/vbcull.h +++ b/xc/extras/Mesa/src/vbcull.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,8 +24,6 @@ */ - - #ifndef VCULL_H #define VCULL_H @@ -38,6 +36,7 @@ extern const char *gl_prim_name[GL_POLYGON+2]; extern GLuint gl_cull_vb( struct vertex_buffer *VB ); extern void gl_dont_cull_vb( struct vertex_buffer *VB ); + extern void gl_fast_copy_vb( struct vertex_buffer *VB ); extern void gl_make_normal_cullmask( struct vertex_buffer *VB ); diff --git a/xc/extras/Mesa/src/vbfill.c b/xc/extras/Mesa/src/vbfill.c index 75a576467..4ee9d52a3 100644 --- a/xc/extras/Mesa/src/vbfill.c +++ b/xc/extras/Mesa/src/vbfill.c @@ -57,7 +57,7 @@ void -_mesa_Begin(GLenum mode ) +_mesa_Begin( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -70,7 +70,8 @@ _mesa_Begin(GLenum mode ) } -void gl_Begin( GLcontext *ctx, GLenum p ) +void +gl_Begin( GLcontext *ctx, GLenum p ) { struct immediate *IM = ctx->input; GLuint inflags, state; @@ -172,7 +173,8 @@ _mesa_End(void) } -void gl_End( GLcontext *ctx ) +void +gl_End( GLcontext *ctx ) { struct immediate *IM = ctx->input; GLuint state = IM->BeginState; @@ -221,7 +223,7 @@ void gl_End( GLcontext *ctx ) * to implement that mechanism to get good performance from * color-material and vertex arrays. */ -#define COLOR( IM, r,g,b,a ) \ +#define COLOR( IM, r, g, b, a ) \ { \ GLuint count = IM->Count; \ IM->Flag[count] |= VERT_RGBA; \ @@ -240,19 +242,16 @@ void gl_End( GLcontext *ctx ) void -_mesa_Color3b(GLbyte red, GLbyte green, GLbyte blue ) +_mesa_Color3b( GLbyte red, GLbyte green, GLbyte blue ) { GET_IMMEDIATE; - COLOR( IM, - BYTE_TO_UBYTE(red), - BYTE_TO_UBYTE(green), - BYTE_TO_UBYTE(blue), - 255 ); + COLOR( IM, BYTE_TO_UBYTE(red), BYTE_TO_UBYTE(green), + BYTE_TO_UBYTE(blue), 255 ); } void -_mesa_Color3d(GLdouble red, GLdouble green, GLdouble blue ) +_mesa_Color3d( GLdouble red, GLdouble green, GLdouble blue ) { GLubyte col[4]; GLfloat r = red; @@ -268,7 +267,7 @@ _mesa_Color3d(GLdouble red, GLdouble green, GLdouble blue ) void -_mesa_Color3f(GLfloat red, GLfloat green, GLfloat blue ) +_mesa_Color3f( GLfloat red, GLfloat green, GLfloat blue ) { GLubyte col[4]; GET_IMMEDIATE; @@ -281,29 +280,25 @@ _mesa_Color3f(GLfloat red, GLfloat green, GLfloat blue ) void -_mesa_Color3i(GLint red, GLint green, GLint blue ) +_mesa_Color3i( GLint red, GLint green, GLint blue ) { GET_IMMEDIATE; - COLOR( IM, INT_TO_UBYTE(red), - INT_TO_UBYTE(green), - INT_TO_UBYTE(blue), - 255); + COLOR( IM, INT_TO_UBYTE(red), INT_TO_UBYTE(green), + INT_TO_UBYTE(blue), 255); } void -_mesa_Color3s(GLshort red, GLshort green, GLshort blue ) +_mesa_Color3s( GLshort red, GLshort green, GLshort blue ) { GET_IMMEDIATE; - COLOR( IM, SHORT_TO_UBYTE(red), - SHORT_TO_UBYTE(green), - SHORT_TO_UBYTE(blue), - 255); + COLOR( IM, SHORT_TO_UBYTE(red), SHORT_TO_UBYTE(green), + SHORT_TO_UBYTE(blue), 255); } void -_mesa_Color3ub(GLubyte red, GLubyte green, GLubyte blue ) +_mesa_Color3ub( GLubyte red, GLubyte green, GLubyte blue ) { GET_IMMEDIATE; COLOR( IM, red, green, blue, 255 ); @@ -311,28 +306,25 @@ _mesa_Color3ub(GLubyte red, GLubyte green, GLubyte blue ) void -_mesa_Color3ui(GLuint red, GLuint green, GLuint blue ) +_mesa_Color3ui( GLuint red, GLuint green, GLuint blue ) { GET_IMMEDIATE; - COLOR( IM, UINT_TO_UBYTE(red), - UINT_TO_UBYTE(green), - UINT_TO_UBYTE(blue), - 255 ); + COLOR( IM, UINT_TO_UBYTE(red), UINT_TO_UBYTE(green), + UINT_TO_UBYTE(blue), 255 ); } void -_mesa_Color3us(GLushort red, GLushort green, GLushort blue ) +_mesa_Color3us( GLushort red, GLushort green, GLushort blue ) { GET_IMMEDIATE; COLOR( IM, USHORT_TO_UBYTE(red), USHORT_TO_UBYTE(green), - USHORT_TO_UBYTE(blue), - 255 ); + USHORT_TO_UBYTE(blue), 255 ); } void -_mesa_Color4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) +_mesa_Color4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) { GET_IMMEDIATE; COLOR( IM, BYTE_TO_UBYTE(red), BYTE_TO_UBYTE(green), @@ -341,7 +333,7 @@ _mesa_Color4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) void -_mesa_Color4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) +_mesa_Color4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) { GLubyte col[4]; GLfloat r = red; @@ -358,7 +350,7 @@ _mesa_Color4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) void -_mesa_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +_mesa_Color4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GLubyte col[4]; GET_IMMEDIATE; @@ -371,7 +363,7 @@ _mesa_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) void -_mesa_Color4i(GLint red, GLint green, GLint blue, GLint alpha ) +_mesa_Color4i( GLint red, GLint green, GLint blue, GLint alpha ) { GET_IMMEDIATE; COLOR( IM, INT_TO_UBYTE(red), INT_TO_UBYTE(green), @@ -380,7 +372,7 @@ _mesa_Color4i(GLint red, GLint green, GLint blue, GLint alpha ) void -_mesa_Color4s(GLshort red, GLshort green, GLshort blue, GLshort alpha ) +_mesa_Color4s( GLshort red, GLshort green, GLshort blue, GLshort alpha ) { GET_IMMEDIATE; COLOR( IM, SHORT_TO_UBYTE(red), SHORT_TO_UBYTE(green), @@ -388,14 +380,14 @@ _mesa_Color4s(GLshort red, GLshort green, GLshort blue, GLshort alpha ) } void -_mesa_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) +_mesa_Color4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { GET_IMMEDIATE; COLOR( IM, red, green, blue, alpha ); } void -_mesa_Color4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha ) +_mesa_Color4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha ) { GET_IMMEDIATE; COLOR( IM, UINT_TO_UBYTE(red), UINT_TO_UBYTE(green), @@ -403,7 +395,7 @@ _mesa_Color4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha ) } void -_mesa_Color4us(GLushort red, GLushort green, GLushort blue, GLushort alpha ) +_mesa_Color4us( GLushort red, GLushort green, GLushort blue, GLushort alpha ) { GET_IMMEDIATE; COLOR( IM, USHORT_TO_UBYTE(red), USHORT_TO_UBYTE(green), @@ -412,7 +404,7 @@ _mesa_Color4us(GLushort red, GLushort green, GLushort blue, GLushort alpha ) void -_mesa_Color3bv(const GLbyte *v ) +_mesa_Color3bv( const GLbyte *v ) { GET_IMMEDIATE; COLOR( IM, BYTE_TO_UBYTE(v[0]), BYTE_TO_UBYTE(v[1]), @@ -421,7 +413,7 @@ _mesa_Color3bv(const GLbyte *v ) void -_mesa_Color3dv(const GLdouble *v ) +_mesa_Color3dv( const GLdouble *v ) { GLubyte col[4]; GLfloat r = v[0]; @@ -437,7 +429,7 @@ _mesa_Color3dv(const GLdouble *v ) void -_mesa_Color3fv(const GLfloat *v ) +_mesa_Color3fv( const GLfloat *v ) { GLubyte col[4]; GET_IMMEDIATE; @@ -450,7 +442,7 @@ _mesa_Color3fv(const GLfloat *v ) void -_mesa_Color3iv(const GLint *v ) +_mesa_Color3iv( const GLint *v ) { GET_IMMEDIATE; COLOR( IM, INT_TO_UBYTE(v[0]), INT_TO_UBYTE(v[1]), @@ -459,7 +451,7 @@ _mesa_Color3iv(const GLint *v ) void -_mesa_Color3sv(const GLshort *v ) +_mesa_Color3sv( const GLshort *v ) { GET_IMMEDIATE; COLOR( IM, SHORT_TO_UBYTE(v[0]), SHORT_TO_UBYTE(v[1]), @@ -468,7 +460,7 @@ _mesa_Color3sv(const GLshort *v ) void -_mesa_Color3ubv(const GLubyte *v ) +_mesa_Color3ubv( const GLubyte *v ) { GET_IMMEDIATE; COLOR( IM, v[0], v[1], v[2], 255 ); @@ -476,7 +468,7 @@ _mesa_Color3ubv(const GLubyte *v ) void -_mesa_Color3uiv(const GLuint *v ) +_mesa_Color3uiv( const GLuint *v ) { GET_IMMEDIATE; COLOR( IM, UINT_TO_UBYTE(v[0]), UINT_TO_UBYTE(v[1]), @@ -485,7 +477,7 @@ _mesa_Color3uiv(const GLuint *v ) void -_mesa_Color3usv(const GLushort *v ) +_mesa_Color3usv( const GLushort *v ) { GET_IMMEDIATE; COLOR( IM, USHORT_TO_UBYTE(v[0]), USHORT_TO_UBYTE(v[1]), @@ -495,7 +487,7 @@ _mesa_Color3usv(const GLushort *v ) void -_mesa_Color4bv(const GLbyte *v ) +_mesa_Color4bv( const GLbyte *v ) { GET_IMMEDIATE; COLOR( IM, BYTE_TO_UBYTE(v[0]), BYTE_TO_UBYTE(v[1]), @@ -504,7 +496,7 @@ _mesa_Color4bv(const GLbyte *v ) void -_mesa_Color4dv(const GLdouble *v ) +_mesa_Color4dv( const GLdouble *v ) { GLubyte col[4]; GLfloat r = v[0]; @@ -521,7 +513,7 @@ _mesa_Color4dv(const GLdouble *v ) void -_mesa_Color4fv(const GLfloat *v ) +_mesa_Color4fv( const GLfloat *v ) { GLubyte col[4]; GET_IMMEDIATE; @@ -534,7 +526,7 @@ _mesa_Color4fv(const GLfloat *v ) void -_mesa_Color4iv(const GLint *v ) +_mesa_Color4iv( const GLint *v ) { GET_IMMEDIATE; COLOR( IM, INT_TO_UBYTE(v[0]), INT_TO_UBYTE(v[1]), @@ -543,7 +535,7 @@ _mesa_Color4iv(const GLint *v ) void -_mesa_Color4sv(const GLshort *v) +_mesa_Color4sv( const GLshort *v) { GET_IMMEDIATE; COLOR( IM, SHORT_TO_UBYTE(v[0]), SHORT_TO_UBYTE(v[1]), @@ -552,7 +544,7 @@ _mesa_Color4sv(const GLshort *v) void -_mesa_Color4ubv(const GLubyte *v) +_mesa_Color4ubv( const GLubyte *v) { GET_IMMEDIATE; COLORV( IM, v ); @@ -560,7 +552,7 @@ _mesa_Color4ubv(const GLubyte *v) void -_mesa_Color4uiv(const GLuint *v) +_mesa_Color4uiv( const GLuint *v) { GET_IMMEDIATE; COLOR( IM, UINT_TO_UBYTE(v[0]), UINT_TO_UBYTE(v[1]), @@ -569,7 +561,7 @@ _mesa_Color4uiv(const GLuint *v) void -_mesa_Color4usv(const GLushort *v) +_mesa_Color4usv( const GLushort *v) { GET_IMMEDIATE; COLOR( IM, USHORT_TO_UBYTE(v[0]), USHORT_TO_UBYTE(v[1]), @@ -615,7 +607,7 @@ _mesa_EdgeFlagv( const GLboolean *flag ) void _mesa_Indexd( GLdouble c ) { - INDEX( (GLuint) (GLint) c ); + INDEX( ( GLuint) (GLint) c ); } @@ -690,7 +682,7 @@ _mesa_Indexubv( const GLubyte *c ) * call. The Flag member allows the identification of missing * (ie shared) normals. */ -#define NORMAL( x,y,z ) \ +#define NORMAL( x, y, z ) \ { \ GLuint count; \ GLfloat *normal; \ @@ -1099,7 +1091,8 @@ _mesa_Vertex2f( GLfloat x, GLfloat y ) /* Internal use: */ -void gl_Vertex2f( GLcontext *ctx, GLfloat x, GLfloat y ) +void +gl_Vertex2f( GLcontext *ctx, GLfloat x, GLfloat y ) { struct immediate *im = ctx->input; VERTEX2( im, x, y ); diff --git a/xc/extras/Mesa/src/vbfill.h b/xc/extras/Mesa/src/vbfill.h index 3b7cf94ae..969e6724a 100644 --- a/xc/extras/Mesa/src/vbfill.h +++ b/xc/extras/Mesa/src/vbfill.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff --git a/xc/extras/Mesa/src/zoom.c b/xc/extras/Mesa/src/zoom.c index 54a751515..86a87eff8 100644 --- a/xc/extras/Mesa/src/zoom.c +++ b/xc/extras/Mesa/src/zoom.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -402,6 +402,6 @@ gl_write_zoomed_stencil_span( GLcontext *ctx, /* write the span */ for (r=r0; r<r1; r++) { - gl_write_stencil_span( ctx, m, x+skipcol, r, zstencil ); + _mesa_write_stencil_span( ctx, m, x+skipcol, r, zstencil ); } } diff --git a/xc/extras/Mesa/src/zoom.h b/xc/extras/Mesa/src/zoom.h index eb98164c5..83cb5e78e 100644 --- a/xc/extras/Mesa/src/zoom.h +++ b/xc/extras/Mesa/src/zoom.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff --git a/xc/include/GL/glx.h b/xc/include/GL/glx.h index 0254b6064..b752f5f09 100644 --- a/xc/include/GL/glx.h +++ b/xc/include/GL/glx.h @@ -1,26 +1,41 @@ #ifndef __GLX_glx_h__ #define __GLX_glx_h__ -/* $XFree86: xc/include/GL/glx.h,v 1.5 2000/03/02 16:07:29 martin Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2000/04/20 16:36:37 $ $Revision: 1.7 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glx.h,v 1.7 2000/04/20 16:36:37 brianp Exp $ */ #include <X11/Xlib.h> @@ -39,19 +54,19 @@ extern "C" { typedef XID GLXContextID; typedef XID GLXPixmap; typedef XID GLXDrawable; -/* GLX 1.3 */ -typedef XID GLXFBConfigID; -typedef XID GLXPfuffer; -typedef XID GLXWindow; typedef XID GLXPbuffer; -typedef XID GLXFBConfig; - +typedef XID GLXWindow; +typedef XID GLXFBConfigID; /* ** GLXContext is a pointer to opaque data. -**/ +*/ typedef struct __GLXcontextRec *GLXContext; +/* +** GLXFBConfig is a pointer to opaque data. +*/ +typedef struct __GLXFBConfigRec *GLXFBConfig; /************************************************************************/ @@ -76,34 +91,57 @@ extern const char * glXGetClientString (Display *dpy, int name ); extern const char * glXQueryServerString (Display *dpy, int screen, int name ); extern const char * glXQueryExtensionsString (Display *dpy, int screen ); -/* GLX 1.3 */ -extern GLXFBConfig glXChooseFBConfig (Display *dpy, int screen, const int *attribList, int *nitems); +/* New for GLX 1.3 */ +extern GLXFBConfig * glXGetFBConfigs (Display *dpy, int screen, int *nelements); +extern GLXFBConfig * glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements); extern int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value); extern XVisualInfo * glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config); -extern GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attribList); -extern void glXDestroyWindow (Display *dpy, GLXWindow window); -extern GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config,Pixmap pixmap, const int *attribList); +extern GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +extern void glXDestroyWindow (Display *dpy, GLXWindow win); +extern GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); extern void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap); -extern GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attribList); +extern GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list); extern void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf); extern void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); -extern GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct); -extern Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +extern GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +extern Bool glXMakeContextCurrent (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); extern GLXDrawable glXGetCurrentReadDrawable (void); +extern Display * glXGetCurrentDisplay (void); extern int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value); -extern void glXSelectEvent (Display *dpy, GLXDrawable drawable, unsigned long mask); -extern void glXGetSelectedEvent (Display *dpy, GLXDrawable drawable, unsigned long *mask); +extern void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask); +extern void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask); -/* Extensions */ -extern Display * glXGetCurrentDisplay (void); +/*** SGI GLX extensions */ extern GLXContextID glXGetContextIDEXT (const GLXContext ctx); extern GLXDrawable glXGetCurrentDrawableEXT (void); extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID); extern void glXFreeContextEXT (Display *dpy, GLXContext ctx); extern int glXQueryContextInfoEXT (Display *dpy, GLXContext ctx, int attribute, int *value); + extern void (*glXGetProcAddressARB(const GLubyte *procName))( void ); +/*** Should these go here, or in another header? */ +/* +** GLX Events +*/ +typedef struct { + int event_type; /* GLX_DAMAGED or GLX_SAVED */ + int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* XID of Drawable */ + unsigned int buffer_mask; /* mask indicating which buffers are affected */ + unsigned int aux_buffer; /* which aux buffer was affected */ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXPbufferClobberEvent; +typedef union __GLXEvent { + GLXPbufferClobberEvent glxpbufferclobber; + long pad[24]; +} GLXEvent; #ifdef __cplusplus } diff --git a/xc/include/GL/glxtokens.h b/xc/include/GL/glxtokens.h index 5a3e219c3..4779c1329 100644 --- a/xc/include/GL/glxtokens.h +++ b/xc/include/GL/glxtokens.h @@ -1,26 +1,41 @@ #ifndef __GLX_glxtokens_h__ #define __GLX_glxtokens_h__ -/* $XFree86: xc/include/GL/glxtokens.h,v 1.3 2000/02/15 07:13:24 martin Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ +** $Date: 2000/04/20 16:36:37 $ $Revision: 1.4 $ +** $Header: /home/ajax/dri-backup/xc/xc/include/GL/glxtokens.h,v 1.4 2000/04/20 16:36:37 brianp Exp $ */ #ifdef __cplusplus @@ -29,9 +44,10 @@ extern "C" { #define GLX_VERSION_1_1 1 #define GLX_VERSION_1_2 1 +#define GLX_VERSION_1_3 1 /* -** Names for attributes to glXGetConfig. +** Visual Config Attributes (glXGetConfig, glXGetFBConfigAttrib) */ #define GLX_USE_GL 1 /* support GLX rendering */ #define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ @@ -39,7 +55,7 @@ extern "C" { #define GLX_RGBA 4 /* true if RGBA mode */ #define GLX_DOUBLEBUFFER 5 /* double buffering supported */ #define GLX_STEREO 6 /* stereo buffering supported */ -#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ +#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ #define GLX_RED_SIZE 8 /* number of red component bits */ #define GLX_GREEN_SIZE 9 /* number of green component bits */ #define GLX_BLUE_SIZE 10 /* number of blue component bits */ @@ -50,6 +66,25 @@ extern "C" { #define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ #define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ #define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ +/* +** FBConfig-specific attributes +*/ +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT_EXT */ +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_VISUAL_ID 0x800B /* ** Error return values from glXGetConfig. Success is indicated by @@ -59,9 +94,85 @@ extern "C" { #define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ #define GLX_NO_EXTENSION 3 /* no glx extension on server */ #define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ -#define GLX_BAD_CONTEXT 5 -#define GLX_BAD_VALUE 6 -#define GLX_BAD_ENUM 7 +#define GLX_BAD_CONTEXT 5 /* returned only by import_context EXT? */ +#define GLX_BAD_VALUE 6 /* returned only by glXSwapIntervalSGI? */ +#define GLX_BAD_ENUM 7 /* unused? */ + +/* FBConfig attribute values */ + +/* +** Generic "don't care" value for glX ChooseFBConfig attributes (except +** GLX_LEVEL) +*/ +#define GLX_DONT_CARE 0xFFFFFFFF + +/* GLX_RENDER_TYPE bits */ +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 + +/* GLX_DRAWABLE_TYPE bits */ +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 + +/* GLX_CONFIG_CAVEAT attribute values */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_NON_CONFORMANT_CONFIG 0x800D + +/* GLX_X_VISUAL_TYPE attribute values */ +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 + +/* GLX_TRANSPARENT_TYPE attribute values */ +/* #define GLX_NONE 0x8000 */ +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 + +/* glXCreateGLXPbuffer attributes */ +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ +#define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ + +/* glXQueryGLXPBuffer attributes */ +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F + +/* glXCreateNewContext render_type attribute values */ +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 + +/* glXQueryContext attributes */ +/* #define GLX_FBCONFIG_ID 0x8013 */ +/* #define GLX_RENDER_TYPE 0x8011 */ +#define GLX_SCREEN 0x800C + +/* glXSelectEvent event mask bits */ +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 + +/* GLXPbufferClobberEvent event_type values */ +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 + +/* GLXPbufferClobberEvent draw_type values */ +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 + +/* GLXPbufferClobberEvent buffer_mask bits */ +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 /* ** Extension return values from glXGetConfig. These are also @@ -71,27 +182,27 @@ extern "C" { #define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ #define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ -#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ -#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ /* Property values for visual_type */ -#define GLX_TRUE_COLOR_EXT 0x8002 -#define GLX_DIRECT_COLOR_EXT 0x8003 -#define GLX_PSEUDO_COLOR_EXT 0x8004 -#define GLX_STATIC_COLOR_EXT 0x8005 -#define GLX_GRAY_SCALE_EXT 0x8006 -#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 /* Property values for transparent pixel */ -#define GLX_NONE_EXT 0x8000 -#define GLX_TRANSPARENT_RGB_EXT 0x8008 -#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 /* Property values for visual_rating */ -#define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ -#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ +#define GLX_SLOW_VISUAL_EXT 0x8001 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D /* @@ -109,11 +220,12 @@ extern "C" { #define GLX_SCREEN_EXT 0x800C /* screen number */ /* GLX Extension Strings */ -#define GLX_EXT_import_context 1 -#define GLX_EXT_visual_info 1 -#define GLX_EXT_visual_rating 1 +#define GLX_EXT_import_context 1 +#define GLX_EXT_visual_info 1 +#define GLX_EXT_visual_rating 1 #define GLX_ARB_get_proc_address 1 + #ifdef __cplusplus } #endif diff --git a/xc/lib/GL/dri/XF86dri.c b/xc/lib/GL/dri/XF86dri.c index cd485680b..7cad48ab6 100644 --- a/xc/lib/GL/dri/XF86dri.c +++ b/xc/lib/GL/dri/XF86dri.c @@ -185,6 +185,8 @@ Bool XF86DRIOpenConnection(dpy, screen, hSAREA, busIdString) if (rep.length) { if (!(*busIdString = (char *)Xcalloc(rep.length + 1, 1))) { _XEatData(dpy, ((rep.busIdStringLength+3) & ~3)); + UnlockDisplay(dpy); + SyncHandle(); return False; } _XReadPad(dpy, *busIdString, rep.busIdStringLength); diff --git a/xc/lib/GL/dri/dri_glx.c b/xc/lib/GL/dri/dri_glx.c index 4f7822750..22cc354e5 100644 --- a/xc/lib/GL/dri/dri_glx.c +++ b/xc/lib/GL/dri/dri_glx.c @@ -187,9 +187,15 @@ static void *OpenDriver(const char *driverName) sprintf(realDriverName, "%s/%s_dri.so", libDir, driverName); sprintf(info, "trying %s", realDriverName); InfoMessage(info); - handle = dlopen(realDriverName, RTLD_LAZY); - if (handle) + handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL); + if (handle) { return handle; + } + else { + char message[1000]; + snprintf(message, 1000, "dlopen failed: %s", dlerror()); + ErrorMessage(message); + } } return NULL; @@ -251,12 +257,7 @@ static void Find_CreateScreenFuncs(Display *dpy, * __driCreateScreen function. */ handle = OpenDriver(driverName); - if (!handle) { - char message[1000]; - snprintf(message, 1000, "dlopen failed: %s", dlerror()); - ErrorMessage(message); - } - else { + if (handle) { CreateScreenFunc createScreenFunc; createScreenFunc = (CreateScreenFunc) dlsym(handle, "__driCreateScreen"); if (createScreenFunc) { @@ -466,13 +467,10 @@ __glXRegisterExtensions(void) } } } -#endif alreadyCalled = GL_TRUE; +#endif } #endif /* GLX_DIRECT_RENDERING */ - - - diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c index 935f9b155..6cc0f1169 100644 --- a/xc/lib/GL/glx/glxcmds.c +++ b/xc/lib/GL/glx/glxcmds.c @@ -1191,7 +1191,7 @@ static char *combine_strings( const char *cext_string, const char *sext_string ) s1 = (char *) malloc( slen + 2 ); strcpy( s1, sext_string ); s2 = cext_string; } else { - combo_string = (char *) malloc( clen + 2 ); + combo_string = (char *) Xmalloc( clen + 2 ); s1 = (char *) Xmalloc( clen + 2 ); strcpy( s1, cext_string); s2 = sext_string; } @@ -1498,7 +1498,7 @@ void glXFreeContextEXT(Display *dpy, GLXContext ctx) * GLX 1.3 functions - these are just stubs for now! */ -GLXFBConfig glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) +GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) { (void) dpy; (void) screen; @@ -1575,6 +1575,15 @@ GLXDrawable glXGetCurrentReadDrawable(void) } +GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements) +{ + (void) dpy; + (void) screen; + (void) nelements; + return 0; +} + + int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value) { (void) dpy; @@ -1640,6 +1649,48 @@ void glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask) /* +** Mesa extension stubs. These will help reduce portability problems. +*/ + +void glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ) +{ + (void) dpy; + (void) d; + /* no-op stub */ +} + + +GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, + Pixmap pixmap, Colormap cmap ) +{ + (void) dpy; + (void) visual; + (void) pixmap; + (void) cmap; + return 0; +} + + +void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, + int x, int y, int width, int height ) +{ + (void) dpy; + (void) drawable; + (void) x; + (void) y; + (void) width; + (void) height; +} + + +GLboolean glXSet3DfxModeMESA( GLint mode ) +{ + (void) mode; + return GL_FALSE; +} + + +/* ** glXGetProcAddress support */ @@ -1683,6 +1734,7 @@ static struct name_address_pair GLX_functions[] = { { "glXDestroyWindow", (GLvoid *) glXDestroyWindow }, { "glXGetCurrentReadDrawable", (GLvoid *) glXGetCurrentReadDrawable }, { "glXGetFBConfigAttrib", (GLvoid *) glXGetFBConfigAttrib }, + { "glXGetFBConfigs", (GLvoid *) glXGetFBConfigs }, { "glXGetSelectedEvent", (GLvoid *) glXGetSelectedEvent }, { "glXGetVisualFromFBConfig", (GLvoid *) glXGetVisualFromFBConfig }, { "glXMakeContextCurrent", (GLvoid *) glXMakeContextCurrent }, @@ -1698,6 +1750,12 @@ static struct name_address_pair GLX_functions[] = { { "glXQueryContextInfoEXT", (GLvoid *) glXQueryContextInfoEXT }, { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB }, + /* Mesa extensions */ + { "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA }, + { "glXCreateGLXPixmapMESA", (GLvoid *) glXCreateGLXPixmapMESA }, + { "glXCopySubBufferMESA", (GLvoid *) glXCopySubBufferMESA }, + { "glXSet3DfxModeMESA", (GLvoid *) glXSet3DfxModeMESA }, + { NULL, NULL } /* end of list */ }; diff --git a/xc/lib/GL/glx/xfont.c b/xc/lib/GL/glx/xfont.c index 29963289a..5da962f98 100644 --- a/xc/lib/GL/glx/xfont.c +++ b/xc/lib/GL/glx/xfont.c @@ -360,7 +360,7 @@ bm_height); glEndList (); } - free (bm); + Xfree(bm); XFreeFontInfo( NULL, fs, 0 ); XFreeGC (dpy, gc); diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c index b2ee7e3e0..ea2f05b07 100644 --- a/xc/lib/GL/mesa/dri/dri_mesa.c +++ b/xc/lib/GL/mesa/dri/dri_mesa.c @@ -652,7 +652,12 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, config->depthSize, config->stencilSize, config->accumRedSize, - config->level); + config->accumGreenSize, + config->accumBlueSize, + config->accumAlphaSize, + 0, /* num samples */ + config->level, + GLX_NONE_EXT /* caveat */); if (!psp->visuals[i].xm_vis) { /* Free the visuals so far created */ while (--i >= 0) { diff --git a/xc/lib/GL/mesa/dri/dri_xmesaapi.h b/xc/lib/GL/mesa/dri/dri_xmesaapi.h index 18aa3db8d..19aa95d58 100644 --- a/xc/lib/GL/mesa/dri/dri_xmesaapi.h +++ b/xc/lib/GL/mesa/dri/dri_xmesaapi.h @@ -47,16 +47,21 @@ struct __XMESAapiRec { GLboolean (*InitDriver)(__DRIscreenPrivate *driScrnPriv); void (*ResetDriver)(__DRIscreenPrivate *driScrnPriv); XMesaVisual (*CreateVisual)(XMesaDisplay *display, - XMesaVisualInfo visinfo, - GLboolean rgb_flag, - GLboolean alpha_flag, - GLboolean db_flag, - GLboolean stereo_flag, - GLboolean ximage_flag, - GLint depth_size, - GLint stencil_size, - GLint accum_size, - GLint level); + XMesaVisualInfo visinfo, + GLboolean rgb_flag, + GLboolean alpha_flag, + GLboolean db_flag, + GLboolean stereo_flag, + GLboolean ximage_flag, + GLint depth_size, + GLint stencil_size, + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ); void (*DestroyVisual)(XMesaVisual v); XMesaContext (*CreateContext)(XMesaVisual v, XMesaContext share_list, __DRIcontextPrivate *driContextPriv); diff --git a/xc/lib/GL/mesa/src/Imakefile b/xc/lib/GL/mesa/src/Imakefile index 08a6852ae..386b58c69 100644 --- a/xc/lib/GL/mesa/src/Imakefile +++ b/xc/lib/GL/mesa/src/Imakefile @@ -123,6 +123,8 @@ LinkSourceFile(pipeline.c, ../../../../extras/Mesa/src) LinkSourceFile(pipeline.h, ../../../../extras/Mesa/src) LinkSourceFile(pixel.c, ../../../../extras/Mesa/src) LinkSourceFile(pixel.h, ../../../../extras/Mesa/src) +LinkSourceFile(pixeltex.c, ../../../../extras/Mesa/src) +LinkSourceFile(pixeltex.h, ../../../../extras/Mesa/src) LinkSourceFile(points.c, ../../../../extras/Mesa/src) LinkSourceFile(points.h, ../../../../extras/Mesa/src) LinkSourceFile(polygon.c, ../../../../extras/Mesa/src) @@ -237,6 +239,7 @@ LinkSourceFile(zoom.h, ../../../../extras/Mesa/src) pb.c \ pipeline.c \ pixel.c \ + pixeltex.c \ points.c \ polygon.c \ quads.c \ @@ -309,6 +312,7 @@ LinkSourceFile(zoom.h, ../../../../extras/Mesa/src) pb.o \ pipeline.o \ pixel.o \ + pixeltex.o \ points.o \ polygon.o \ quads.o \ diff --git a/xc/lib/GL/mesa/src/drv/common/spantmp.h b/xc/lib/GL/mesa/src/drv/common/spantmp.h index b475c6b18..1e69d7b7f 100644 --- a/xc/lib/GL/mesa/src/drv/common/spantmp.h +++ b/xc/lib/GL/mesa/src/drv/common/spantmp.h @@ -70,12 +70,12 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx, { for (;i<n1;i++,x1++) if (mask[i]) - WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 0 ); + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); } else { for (;i<n1;i++,x1++) - WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 0 ); + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); } } HW_ENDCLIPLOOP(); diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c index 1f968e39b..e0415cf9b 100644 --- a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c @@ -36,7 +36,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <X11/Xlibint.h> #include "gamma_init.h" +#include "gamma_gl.h" #include "glapi.h" +#include "context.h" XMesaContext nullCC = NULL; @@ -84,16 +86,21 @@ void XMesaResetDriver(__DRIscreenPrivate *driScrnPriv) } XMesaVisual XMesaCreateVisual(XMesaDisplay *display, - XMesaVisualInfo visinfo, - GLboolean rgb_flag, - GLboolean alpha_flag, - GLboolean db_flag, - GLboolean stereo_flag, - GLboolean ximage_flag, - GLint depth_size, - GLint stencil_size, - GLint accum_size, - GLint level) + XMesaVisualInfo visinfo, + GLboolean rgb_flag, + GLboolean alpha_flag, + GLboolean db_flag, + GLboolean stereo_flag, + GLboolean ximage_flag, + GLint depth_size, + GLint stencil_size, + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ) { XMesaVisual v; @@ -116,28 +123,30 @@ XMesaVisual XMesaCreateVisual(XMesaDisplay *display, v->display = display; v->level = level; + v->VisualCaveat = visualCaveat; + v->gl_visual = _mesa_create_visual(rgb_flag, + GL_FALSE, /* alpha flag */ + db_flag, stereo_flag, + count_bits(visinfo->red_mask), + count_bits(visinfo->green_mask), + count_bits(visinfo->blue_mask), + 0, /* alpha bits */ + 0, /* index bits */ + depth_size, + stencil_size, + accum_red_size, + accum_green_size, + accum_blue_size, + accum_alpha_size, + 0 /* num samples */ ); - v->gl_visual = (GLvisual *)Xmalloc(sizeof(GLvisual)); if (!v->gl_visual) { - Xfree(v->visinfo); XFree(v); return NULL; } - - v->gl_visual->RGBAflag = rgb_flag; - v->gl_visual->DBflag = db_flag; - v->gl_visual->StereoFlag = stereo_flag; - - v->gl_visual->RedBits = count_bits(visinfo->red_mask); - v->gl_visual->GreenBits = count_bits(visinfo->green_mask); - v->gl_visual->BlueBits = count_bits(visinfo->blue_mask); - v->gl_visual->AlphaBits = 0; /* Not currently supported */ - - v->gl_visual->AccumBits = accum_size; - v->gl_visual->DepthBits = depth_size; - v->gl_visual->StencilBits = stencil_size; - - return v; + else { + return v; + } } void XMesaDestroyVisual(XMesaVisual v) diff --git a/xc/lib/GL/mesa/src/drv/i810/Imakefile b/xc/lib/GL/mesa/src/drv/i810/Imakefile index 5c6a33796..1f0798e4d 100644 --- a/xc/lib/GL/mesa/src/drv/i810/Imakefile +++ b/xc/lib/GL/mesa/src/drv/i810/Imakefile @@ -56,7 +56,8 @@ MESA_INCLUDES = -I. -I.. -I../../include i810pipeline.o i810span.o i810state.o i810swap.o \ i810tex.o i810tris.o i810vb.o i810fastpath.o i810ioctl.o - MESASRCS = ../../accum.c \ + MESASRCS = ../../aatriangle.c \ + ../../accum.c \ ../../alpha.c \ ../../alphabuf.c \ ../../attrib.c \ @@ -97,6 +98,7 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../pb.c \ ../../pipeline.c \ ../../pixel.c \ + ../../pixeltex.c \ ../../points.c \ ../../polygon.c \ ../../quads.c \ @@ -113,6 +115,7 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../texobj.c \ ../../texstate.c \ ../../texture.c \ + ../../texutil.c \ ../../translate.c \ ../../triangle.c \ ../../varray.c \ @@ -129,7 +132,8 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../zoom.c \ ../../X86/common_x86.c - MESAOBJS = ../../accum.o \ + MESAOBJS = ../../aatriangle.o \ + ../../accum.o \ ../../alpha.o \ ../../alphabuf.o \ ../../attrib.o \ @@ -168,6 +172,7 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../pb.o \ ../../pipeline.o \ ../../pixel.o \ + ../../pixeltex.o \ ../../points.o \ ../../polygon.o \ ../../quads.o \ @@ -184,6 +189,7 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../texobj.o \ ../../texstate.o \ ../../texture.o \ + ../../texutil.o \ ../../translate.o \ ../../triangle.o \ ../../varray.o \ diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c index 7716b4634..18976a23e 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c @@ -222,8 +222,13 @@ XMesaVisual XMesaCreateVisual(XMesaDisplay *display, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, - GLint accum_size, - GLint level) + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ) { XMesaVisual v; @@ -242,24 +247,35 @@ XMesaVisual XMesaCreateVisual(XMesaDisplay *display, v->display = display; v->level = level; - v->gl_visual = gl_create_visual(rgb_flag, GL_FALSE, db_flag, stereo_flag, - depth_size, stencil_size, accum_size, 0, - count_bits(visinfo->red_mask), - count_bits(visinfo->green_mask), - count_bits(visinfo->blue_mask), - GL_FALSE); + v->VisualCaveat = visualCaveat; + v->gl_visual = _mesa_create_visual(rgb_flag, + GL_FALSE, /* alpha flag */ + db_flag, + stereo_flag, + count_bits(visinfo->red_mask), + count_bits(visinfo->green_mask), + count_bits(visinfo->blue_mask), + 0, /* alpha bits */ + 0, /* index bits */ + depth_size, + stencil_size, + accum_red_size, + accum_green_size, + accum_blue_size, + accum_alpha_size, + 0 /* num samples */ ); if (!v->gl_visual) { Xfree(v->visinfo); Xfree(v); return NULL; } - - return v; + else + return v; } void XMesaDestroyVisual(XMesaVisual v) { - Xfree(v->gl_visual); + _mesa_destroy_visual(v->gl_visual); Xfree(v->visinfo); Xfree(v); } @@ -331,7 +347,7 @@ XMesaContext XMesaCreateContext(XMesaVisual v, XMesaContext share_list, imesa->glBuffer = gl_create_framebuffer(v->gl_visual, GL_FALSE, v->gl_visual->StencilBits > 0, - v->gl_visual->AccumBits > 0, + v->gl_visual->AccumRedBits > 0, v->gl_visual->AlphaBits > 0); diff --git a/xc/lib/GL/mesa/src/drv/i810/i810dd.c b/xc/lib/GL/mesa/src/drv/i810/i810dd.c index a2d7b7274..b5a3a2fc8 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810dd.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810dd.c @@ -58,7 +58,7 @@ static const GLubyte *i810DDGetString( GLcontext *ctx, GLenum name ) case GL_VENDOR: return "Keith Whitwell, Precision Insight Inc."; case GL_RENDERER: - return "Mesa DRI I810 20000404"; + return "Mesa DRI I810 20000415"; default: return 0; } diff --git a/xc/lib/GL/mesa/src/drv/i810/i810span.c b/xc/lib/GL/mesa/src/drv/i810/i810span.c index c47bf2f40..20159da3c 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810span.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810span.c @@ -90,7 +90,7 @@ do { \ rgba[0] = (p >> 8) & 0xf8; \ rgba[1] = (p >> 3) & 0xfc; \ rgba[2] = (p << 3) & 0xf8; \ - rgba[3] = 0; /* or 255? */ \ + rgba[3] = 255; \ } while(0) #define TAG(x) i810##x##_565 @@ -115,7 +115,7 @@ do { \ rgba[0] = (p >> 7) & 0xf8; \ rgba[1] = (p >> 3) & 0xf8; \ rgba[2] = (p << 3) & 0xf8; \ - rgba[3] = 0; /* or 255? */ \ + rgba[3] = 255; \ } while(0) #define TAG(x) i810##x##_555 diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile b/xc/lib/GL/mesa/src/drv/mga/Imakefile index 1ca3bde8a..6c32a0d9d 100644 --- a/xc/lib/GL/mesa/src/drv/mga/Imakefile +++ b/xc/lib/GL/mesa/src/drv/mga/Imakefile @@ -66,7 +66,8 @@ MESA_INCLUDES = -I. -I.. -I../../include mgaspan.o mgastate.o mgatex.o \ mgatris.o mgavb.o mgaioctl.o mga_xmesa.o mgabuffers.o - MESASRCS = ../../accum.c \ + MESASRCS = ../../aatriangle.c \ + ../../accum.c \ ../../alpha.c \ ../../alphabuf.c \ ../../attrib.c \ @@ -107,6 +108,7 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../pb.c \ ../../pipeline.c \ ../../pixel.c \ + ../../pixeltex.c \ ../../points.c \ ../../polygon.c \ ../../quads.c \ @@ -123,6 +125,7 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../texobj.c \ ../../texstate.c \ ../../texture.c \ + ../../texutil.c \ ../../translate.c \ ../../triangle.c \ ../../varray.c \ @@ -139,7 +142,8 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../zoom.c \ ../../X86/common_x86.c - MESAOBJS = ../../accum.o \ + MESAOBJS = ../../aatriangle.o \ + ../../accum.o \ ../../alpha.o \ ../../alphabuf.o \ ../../attrib.o \ @@ -178,6 +182,7 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../pb.o \ ../../pipeline.o \ ../../pixel.o \ + ../../pixeltex.o \ ../../points.o \ ../../polygon.o \ ../../quads.o \ @@ -194,6 +199,7 @@ MESA_INCLUDES = -I. -I.. -I../../include ../../texobj.o \ ../../texstate.o \ ../../texture.o \ + ../../texutil.o \ ../../translate.o \ ../../triangle.o \ ../../varray.o \ diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c index 996dc3819..985ae7ca2 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c @@ -115,9 +115,6 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreenPrivate *mgaScreen; MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; - - fprintf(stderr, "XMesaInitDriver\n"); - /* Allocate the private area */ mgaScreen = (mgaScreenPrivate *)Xmalloc(sizeof(mgaScreenPrivate)); if (!mgaScreen) return GL_FALSE; @@ -125,7 +122,9 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->sPriv = sPriv; sPriv->private = (void *)mgaScreen; + /* fprintf(stderr, "serverInfo->chipset: %d\n", serverInfo->chipset); + */ if (serverInfo->chipset != MGA_CARD_TYPE_G200 && serverInfo->chipset != MGA_CARD_TYPE_G400) @@ -162,9 +161,11 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->textureOffset[MGA_AGP_HEAP] = (mgaScreen->agp_tex.handle | PDEA_pagpxfer_enable | 1); + /* fprintf(stderr, "CARD texture size %x, granul %d --> %x\n", serverInfo->textureSize, serverInfo->logTextureGranularity, 1<<serverInfo->logTextureGranularity); + */ mgaScreen->textureSize[MGA_CARD_HEAP] = serverInfo->textureSize; mgaScreen->textureSize[MGA_AGP_HEAP] = serverInfo->agpTextureSize; @@ -181,17 +182,15 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->mAccess = serverInfo->mAccess; + /* fprintf(stderr, "\n\n\nbackOffset: %x pitch %x\n", mgaScreen->backOffset, mgaScreen->backPitch); + */ - mgaScreen->Attrib = MGA_PF_565; - - mgaScreen->bufs = drmMapBufs(sPriv->fd); - /* Other mgaglx stuff, too?? */ memset(&mgaglx, 0, sizeof(mgaglx)); @@ -221,13 +220,16 @@ XMesaVisual XMesaCreateVisual(XMesaDisplay *display, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, - GLint accum_size, - GLint level) + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ) { XMesaVisual v; - fprintf(stderr, "XMesaCreateVisual\n"); - /* Only RGB visuals are supported on the MGA boards */ if (!rgb_flag) return 0; @@ -243,24 +245,35 @@ XMesaVisual XMesaCreateVisual(XMesaDisplay *display, v->display = display; v->level = level; - v->gl_visual = gl_create_visual(rgb_flag, GL_FALSE, db_flag, stereo_flag, - depth_size, stencil_size, accum_size, 0, - count_bits(visinfo->red_mask), - count_bits(visinfo->green_mask), - count_bits(visinfo->blue_mask), - GL_FALSE); + v->VisualCaveat = visualCaveat; + v->gl_visual = _mesa_create_visual(rgb_flag, + GL_FALSE, /* alpha flag */ + db_flag, + stereo_flag, + count_bits(visinfo->red_mask), + count_bits(visinfo->green_mask), + count_bits(visinfo->blue_mask), + 0, /* alpha bits */ + 0, /* index bits */ + depth_size, + stencil_size, + accum_red_size, + accum_green_size, + accum_blue_size, + accum_alpha_size, + 0 /* num samples */ ); if (!v->gl_visual) { Xfree(v->visinfo); Xfree(v); return NULL; } - - return v; + else + return v; } void XMesaDestroyVisual(XMesaVisual v) { - Xfree(v->gl_visual); + _mesa_destroy_visual(v->gl_visual); Xfree(v->visinfo); Xfree(v); } @@ -278,8 +291,7 @@ XMesaContext XMesaCreateContext(XMesaVisual v, XMesaContext share_list, sizeof(XF86DRISAREARec)); GLcontext *shareCtx = 0; - fprintf(stderr, "XMesaCreateContext\n"); - + /*fprintf(stderr, "XMesaCreateContext\n");*/ c = (XMesaContext)Xmalloc(sizeof(struct xmesa_context)); if (!c) { @@ -316,7 +328,7 @@ XMesaContext XMesaCreateContext(XMesaVisual v, XMesaContext share_list, mmesa->glBuffer=gl_create_framebuffer(v->gl_visual, GL_FALSE, /* software depth buffer? */ v->gl_visual->StencilBits > 0, - v->gl_visual->AccumBits > 0, + v->gl_visual->AccumRedBits > 0, v->gl_visual->AlphaBits > 0); diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c index a482bb6c6..438ef254c 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c @@ -63,9 +63,9 @@ static const GLubyte *mgaDDGetString( GLcontext *ctx, GLenum name ) case GL_VENDOR: return "Precision Insight, Inc."; case GL_RENDERER: - if (MGA_IS_G200(mmesa)) return "Mesa DRI G200 20000404"; - if (MGA_IS_G400(mmesa)) return "Mesa DRI G400 20000404"; - return "Mesa DRI MGA 20000404"; + if (MGA_IS_G200(mmesa)) return "Mesa DRI G200 20000415"; + if (MGA_IS_G400(mmesa)) return "Mesa DRI G400 20000415"; + return "Mesa DRI MGA 20000415"; default: return 0; } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c index 9bf62391c..61405cbe7 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c @@ -92,13 +92,13 @@ #define WRITE_PIXEL( _x, _y, p ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = p -#define READ_RGBA( rgba, _x, _y ) \ -do { \ +#define READ_RGBA( rgba, _x, _y ) \ +do { \ GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 8) & 0xf8; \ - rgba[1] = (p >> 3) & 0xfc; \ - rgba[2] = (p << 3) & 0xf8; \ - rgba[3] = 0; /* or 255? */ \ + rgba[0] = (p >> 8) & 0xf8; \ + rgba[1] = (p >> 3) & 0xfc; \ + rgba[2] = (p << 3) & 0xf8; \ + rgba[3] = 255; \ } while(0) #define TAG(x) mga##x##_565 @@ -116,13 +116,13 @@ do { \ #define WRITE_PIXEL( _x, _y, p ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = p -#define READ_RGBA( rgba, _x, _y ) \ -do { \ +#define READ_RGBA( rgba, _x, _y ) \ +do { \ GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 7) & 0xf8; \ - rgba[1] = (p >> 3) & 0xf8; \ - rgba[2] = (p << 3) & 0xf8; \ - rgba[3] = 0; /* or 255? */ \ + rgba[0] = (p >> 7) & 0xf8; \ + rgba[1] = (p >> 3) & 0xf8; \ + rgba[2] = (p << 3) & 0xf8; \ + rgba[3] = 255; \ } while(0) #define TAG(x) mga##x##_555 diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile index 0ac770c90..46dce349c 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile +++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile @@ -121,6 +121,7 @@ LinkSourceFile(fxvs_tmp.h, ../../../../../../extras/Mesa/src/FX) ../../pb.c \ ../../pipeline.c \ ../../pixel.c \ + ../../pixeltex.c \ ../../points.c \ ../../polygon.c \ ../../quads.c \ @@ -194,6 +195,7 @@ LinkSourceFile(fxvs_tmp.h, ../../../../../../extras/Mesa/src/FX) ../../pb.o \ ../../pipeline.o \ ../../pixel.o \ + ../../pixeltex.o \ ../../points.o \ ../../polygon.o \ ../../quads.o \ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c index f9cc8cd10..4851e38d4 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c @@ -90,41 +90,60 @@ XMesaVisual XMesaCreateVisual(XMesaDisplay *display, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, - GLint accum_size, - GLint level) + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ) { - XMesaVisual v; + XMesaVisual v; - /* Only RGB visuals are supported on the TDFX boards */ - if (!rgb_flag) return 0; + /* Only RGB visuals are supported on the TDFX boards */ + if (!rgb_flag) return 0; - v = (XMesaVisual)Xmalloc(sizeof(struct xmesa_visual)); - if (!v) return 0; + v = (XMesaVisual)Xmalloc(sizeof(struct xmesa_visual)); + if (!v) return 0; - v->visinfo = (XVisualInfo *)Xmalloc(sizeof(*visinfo)); - if(!v->visinfo) { - Xfree(v); - return 0; - } - memcpy(v->visinfo, visinfo, sizeof(*visinfo)); - - v->display = display; - v->level = level; - v->gl_visual = gl_create_visual(rgb_flag, GL_FALSE, db_flag, stereo_flag, - depth_size, stencil_size, accum_size, 0, - count_bits(visinfo->red_mask), - count_bits(visinfo->green_mask), - count_bits(visinfo->blue_mask), - GL_FALSE); - if (!v->gl_visual) - return NULL; - else - return v; + v->visinfo = (XVisualInfo *)Xmalloc(sizeof(*visinfo)); + if(!v->visinfo) { + Xfree(v); + return 0; + } + memcpy(v->visinfo, visinfo, sizeof(*visinfo)); + + v->display = display; + v->level = level; + v->VisualCaveat = visualCaveat; + v->gl_visual = _mesa_create_visual(rgb_flag, + GL_FALSE, /* alpha flag */ + db_flag, + stereo_flag, + count_bits(visinfo->red_mask), + count_bits(visinfo->green_mask), + count_bits(visinfo->blue_mask), + 0, /* alpha bits */ + 0, /* index bits */ + depth_size, + stencil_size, + accum_red_size, + accum_green_size, + accum_blue_size, + accum_alpha_size, + 0 /* num samples */ ); + if (!v->gl_visual) { + Xfree(v->visinfo); + Xfree(v); + return NULL; + } + else + return v; } void XMesaDestroyVisual(XMesaVisual v) { - gl_destroy_visual(v->gl_visual); + _mesa_destroy_visual(v->gl_visual); Xfree(v->visinfo); Xfree(v); } @@ -162,7 +181,7 @@ XMesaContext XMesaCreateContext(XMesaVisual v, XMesaContext share_list, cPriv->glBuffer=gl_create_framebuffer(v->gl_visual, GL_FALSE, /* software depth buffer? */ v->gl_visual->StencilBits > 0, - v->gl_visual->AccumBits > 0, + v->gl_visual->AccumRedBits > 0, v->gl_visual->AlphaBits > 0 ); diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 22780d753..a4b2684d5 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -101,7 +101,7 @@ DRIScreenInit( DRIScreenPrivPtr pDRIPriv; drmContextPtr reserved; int reserved_count; - int i; + int i, fd, drmWasAvailable; if (DRIGeneration != serverGeneration) { if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) @@ -109,27 +109,35 @@ DRIScreenInit( DRIGeneration = serverGeneration; } - if (!drmAvailable()) { - return FALSE; + drmWasAvailable = drmAvailable(); + + /* Note that drmOpen will try to load the kernel module, if needed. */ + fd = drmOpen(pDRIInfo->drmDriverName, NULL); + if (fd < 0) { + /* failed to open DRM */ + pScreen->devPrivates[DRIScreenPrivIndex].ptr = 0; + return FALSE; } - if (!(pDRIPriv = (DRIScreenPrivPtr)xalloc(sizeof(DRIScreenPrivRec)))) { - return FALSE; + if (!drmWasAvailable) { + /* drmOpen loaded the kernel module, print a message to say so */ + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] loaded kernel module \"%s\"\n", + pDRIInfo->drmDriverName); + } + + pDRIPriv = (DRIScreenPrivPtr) xalloc(sizeof(DRIScreenPrivRec)); + if (!pDRIPriv) { + pScreen->devPrivates[DRIScreenPrivIndex].ptr = 0; + return FALSE; } - pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer)pDRIPriv; + pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv; + pDRIPriv->drmFD = fd; pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->pDriverInfo = pDRIInfo; pDRIPriv->nrWindows = 0; - /* setup device independent direct rendering memory maps */ - - if ((pDRIPriv->drmFD = drmOpen(pDRIPriv->pDriverInfo->drmDriverName, - NULL)) < 0) { - pDRIPriv->directRenderingSupport = FALSE; - return FALSE; - } - if (drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString) < 0) { pDRIPriv->directRenderingSupport = FALSE; drmClose(pDRIPriv->drmFD); diff --git a/xc/programs/Xserver/GL/glx/glxcmds.c b/xc/programs/Xserver/GL/glx/glxcmds.c index 2504ffa29..6c23fe534 100644 --- a/xc/programs/Xserver/GL/glx/glxcmds.c +++ b/xc/programs/Xserver/GL/glx/glxcmds.c @@ -139,8 +139,13 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) ** NOTE: no support for sharing display lists between direct ** contexts, even if they are in the same address space. */ +#if 0 + /* Disabling this code seems to allow shared display lists + * and texture objects to work. We'll leave it disabled for now. + */ client->errorValue = shareList; return BadMatch; +#endif } else { /* ** Create an indirect context regardless of what the client asked diff --git a/xc/programs/Xserver/GL/mesa/src/Imakefile b/xc/programs/Xserver/GL/mesa/src/Imakefile index 457d1dc89..b3351b984 100644 --- a/xc/programs/Xserver/GL/mesa/src/Imakefile +++ b/xc/programs/Xserver/GL/mesa/src/Imakefile @@ -118,6 +118,8 @@ LinkSourceFile(pipeline.c,../../../../../extras/Mesa/src) LinkSourceFile(pipeline.h,../../../../../extras/Mesa/src) LinkSourceFile(pixel.c,../../../../../extras/Mesa/src) LinkSourceFile(pixel.h,../../../../../extras/Mesa/src) +LinkSourceFile(pixeltex.c,../../../../../extras/Mesa/src) +LinkSourceFile(pixeltex.h,../../../../../extras/Mesa/src) LinkSourceFile(points.c,../../../../../extras/Mesa/src) LinkSourceFile(points.h,../../../../../extras/Mesa/src) LinkSourceFile(polygon.c,../../../../../extras/Mesa/src) @@ -230,6 +232,7 @@ LinkSourceFile(zoom.h,../../../../../extras/Mesa/src) pb.c \ pipeline.c \ pixel.c \ + pixeltex.c \ points.c \ polygon.c \ quads.c \ @@ -305,6 +308,7 @@ LinkSourceFile(zoom.h,../../../../../extras/Mesa/src) pb.o \ pipeline.o \ pixel.o \ + pixeltex.o \ points.o \ polygon.o \ quads.o \ diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c index 86e70490b..effcf9921 100644 --- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c +++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c @@ -29,6 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: * Kevin E. Martin <kevin@precisioninsight.com> + * Brian E. Paul <brian@precisioninsight.com> * */ @@ -100,6 +101,7 @@ int numConfigs = 0; __GLXvisualConfig *visualConfigs = NULL; void **visualPrivates = NULL; + static int count_bits(unsigned int n) { int bits = 0; @@ -111,6 +113,7 @@ static int count_bits(unsigned int n) return bits; } + static XMesaVisual find_mesa_visual(int screen, VisualID vid) { XMesaVisual xm_vis = NULL; @@ -129,251 +132,148 @@ static XMesaVisual find_mesa_visual(int screen, VisualID vid) return xm_vis; } -#define VISUAL_CONFIG(rgba,accum,back,depth,stencil,rating) \ -{ \ - -1, /* vid */ \ - -1, /* class */ \ - rgba, /* rgba */ \ - -1, -1, -1, 0, /* rgba sizes, alpha not supported, yet */ \ - -1, -1, -1, 0, /* rgba masks, alpha not supported, yet */ \ - accum, accum, accum, accum, /* rgba accum sizes */ \ - back, /* doubleBuffer */ \ - GL_FALSE, /* stereo */ \ - -1, /* bufferSize */ \ - depth, /* depthSize */ \ - stencil, /* stencilSize */ \ - 0, /* auxBuffers */ \ - 0, /* level */ \ - rating, /* visualRating */ \ - 0, /* transparentPixel */ \ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ \ - 0 /* transparentIndex */ \ -} -#define IS_RGBA GL_TRUE -#define IS_CI GL_FALSE -#define HAS_ACCUM ACCUM_BITS -#define NO_ACCUM 0 -#define HAS_BACK GL_TRUE -#define NO_BACK GL_FALSE -#define HAS_DEPTH DEFAULT_SOFTWARE_DEPTH_BITS -#define NO_DEPTH 0 -#define HAS_STENCIL STENCIL_BITS -#define NO_STENCIL 0 - -static __GLXvisualConfig __MESAvisualConfigs[] = { - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, HAS_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, HAS_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, HAS_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, HAS_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0), +/* + * In the case the driver has no GLX visuals we'll use these. + * [0] = RGB, double buffered + * [1] = RGB, double buffered, stencil, accum + * [2] = CI, double buffered + */ +#define NUM_FALLBACK_CONFIGS 3 +static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 16, 16, 16, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + { + -1, /* vid */ + -1, /* class */ + False, /* color index */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, }; -static int __numMESAvisualConfigs = - sizeof(__MESAvisualConfigs)/sizeof(__GLXvisualConfig); -static int __numRGBconfigs = -1; -static int __numCIconfigs = -1; static Bool init_visuals(int *nvisualp, VisualPtr *visualp, VisualID *defaultVisp, int ndepth, DepthPtr pdepth, int rootDepth) { + int numRGBconfigs; + int numCIconfigs; int numVisuals = *nvisualp; - int numMesaVisuals = 0; - int numMergedVisualConfigs = 0; + int numNewVisuals; + int numNewConfigs; VisualPtr pVisual = *visualp; VisualPtr pVisualNew = NULL; VisualID *orig_vid = NULL; __GLXvisualConfig *glXVisualPtr = NULL; - __GLXvisualConfig *pMergedVisualConfigs = NULL; + __GLXvisualConfig *pNewVisualConfigs = NULL; void **glXVisualPriv; - void **pMergedVisualPriv; - int *mesaConfigUsed; - int *driverConfigUsed; - int found_default = FALSE; + void **pNewVisualPriv; + int found_default; int i, j, k; - int is_rgb; - Bool match; - - /* Alloc space for the list of merged GLX visuals */ - pMergedVisualConfigs = - (__GLXvisualConfig *)__glXMalloc((numConfigs + - __numMESAvisualConfigs) * - sizeof(__GLXvisualConfig)); - if (!pMergedVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of merged GLX visual privates */ - pMergedVisualPriv = - (void **)__glXMalloc((numConfigs + __numMESAvisualConfigs) * - sizeof(void *)); - if (!pMergedVisualPriv) { - __glXFree(pMergedVisualConfigs); - return FALSE; - } - /* Compute the intersection of the driver's visual configs */ - mesaConfigUsed = __glXCalloc(__numMESAvisualConfigs, sizeof(int)); - driverConfigUsed = __glXCalloc(numConfigs, sizeof(int)); - - for (i = j = 0; i < numConfigs; i++) { - k = 0; - while ((k < __numMESAvisualConfigs) && (!driverConfigUsed[i])) { - if (!mesaConfigUsed[k]) { - -#ifdef DEBUG_VISUAL_CONFIG -#define TEST_AND_COPY(fld) do { \ - if (match) { \ - if ((__MESAvisualConfigs[k].fld == visualConfigs[i].fld) || \ - (__MESAvisualConfigs[k].fld == -1)) { \ - pMergedVisualConfigs[j].fld = visualConfigs[i].fld; \ - } \ - else if (visualConfigs[i].fld == -1) { \ - pMergedVisualConfigs[j].fld = __MESAvisualConfigs[k].fld; \ - } \ - else { \ - match = FALSE; \ - xf86DrvMsg (0, 0, "[GLXVisualInit] mismatch: " \ - "(%s) DriverVisualConfig[%d] MesaVisualConfig[%d]\n", \ - #fld, i, k); \ - } \ - } \ - } while (0) -#else -#define TEST_AND_COPY(fld) do { \ - if (match) { \ - if ((__MESAvisualConfigs[k].fld == visualConfigs[i].fld) || \ - (__MESAvisualConfigs[k].fld == -1)) { \ - pMergedVisualConfigs[j].fld = visualConfigs[i].fld; \ - } \ - else if (visualConfigs[i].fld == -1) { \ - pMergedVisualConfigs[j].fld = __MESAvisualConfigs[k].fld; \ - } \ - else { \ - match = FALSE; \ - } \ - } \ - } while (0) -#endif + if (numConfigs > 0) + numNewConfigs = numConfigs; + else + numNewConfigs = NUM_FALLBACK_CONFIGS; - match = TRUE; - TEST_AND_COPY(class); - TEST_AND_COPY(rgba); - TEST_AND_COPY(redSize); - TEST_AND_COPY(greenSize); - TEST_AND_COPY(blueSize); - TEST_AND_COPY(alphaSize); - TEST_AND_COPY(redMask); - TEST_AND_COPY(greenMask); - TEST_AND_COPY(blueMask); - TEST_AND_COPY(alphaMask); - TEST_AND_COPY(accumRedSize); - TEST_AND_COPY(accumGreenSize); - TEST_AND_COPY(accumBlueSize); - TEST_AND_COPY(accumAlphaSize); - TEST_AND_COPY(doubleBuffer); - TEST_AND_COPY(stereo); - TEST_AND_COPY(bufferSize); - TEST_AND_COPY(depthSize); - TEST_AND_COPY(stencilSize); - TEST_AND_COPY(auxBuffers); - TEST_AND_COPY(level); - TEST_AND_COPY(visualRating); - TEST_AND_COPY(transparentPixel); - TEST_AND_COPY(transparentRed); - TEST_AND_COPY(transparentGreen); - TEST_AND_COPY(transparentBlue); - TEST_AND_COPY(transparentAlpha); - TEST_AND_COPY(transparentIndex); - if (match) { - driverConfigUsed[i] = TRUE; - mesaConfigUsed[k] = TRUE; - pMergedVisualPriv[j] = visualPrivates[i]; - j++; -#ifdef DEBUG_VISUAL_CONFIG - xf86DrvMsg (0, 0, "[GLXVisualInit] MATCH: " - "DriverVisualConfig[%d] MesaVisualConfig[%d]\n", i, k); -#endif - } - } - k++; - } + /* Alloc space for the list of new GLX visuals */ + pNewVisualConfigs = (__GLXvisualConfig *) + __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); + if (!pNewVisualConfigs) { + return FALSE; } - /* - ** If SetVisualConfigs was not called, then just make all of Mesa's - ** visual configs available. - */ - if (!numConfigs) { - memcpy(pMergedVisualConfigs, __MESAvisualConfigs, - sizeof(__GLXvisualConfig) * __numMESAvisualConfigs); - memset(pMergedVisualPriv, 0, sizeof(void *) * __numMESAvisualConfigs); - memset(mesaConfigUsed, TRUE, sizeof(int) * __numMESAvisualConfigs); - j = __numMESAvisualConfigs; + /* Alloc space for the list of new GLX visual privates */ + pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); + if (!pNewVisualPriv) { + __glXFree(pNewVisualConfigs); + return FALSE; } /* - ** This code is not currently used. When the visual caveat - ** extension is supported by the DRI and Mesa, we can take advantage - ** of this code. + ** If SetVisualConfigs was not called, then use default GLX + ** visual configs. */ -#if 0 - /* Add any unclaimed MESA configs w/ slow caveat */ - for (i = 0; i < __numMESAvisualConfigs; i++) { - if (!mesaConfigUsed[i]) { - memcpy(&pMergedVisualConfigs[j], &__MESAvisualConfigs[i], - sizeof(__GLXvisualConfig)); - pMergedVisualConfigs[j].visualRating = GLX_SLOW_VISUAL_EXT; - j++; -#ifdef DEBUG_VISUAL_CONFIG - xf86DrvMsg (0, 0, "[GLXVisualInit] slow config: " - "MesaVisualConfig[%d]\n", i); -#endif - } + if (numConfigs == 0) { + memcpy(pNewVisualConfigs, FallbackConfigs, + NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); + memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); } - - /* Add any unclaimed driver configs w/ nonconformant caveat */ - for (i = 0; i < numConfigs; i++) { - if (!driverConfigUsed[i]) { - memcpy(&pMergedVisualConfigs[j], &visualConfigs[i], - sizeof(__GLXvisualConfig)); - pMergedVisualConfigs[j].visualRating = GLX_NON_CONFORMANT_VISUAL_EXT; - j++; -#ifdef DEBUG_VISUAL_CONFIG - xf86DrvMsg (0, 0, "[GLXVisualInit] non-conformant config: " - "DriverVisualConfig[%d]\n", i); -#endif - } + else { + /* copy driver's visual config info */ + for (i = 0; i < numConfigs; i++) { + pNewVisualConfigs[i] = visualConfigs[i]; + pNewVisualPriv[i] = visualPrivates[i]; + } } -#endif - numMergedVisualConfigs = j; /* Count the number of RGB and CI visual configs */ - __numRGBconfigs = __numCIconfigs = 0; - for (i = 0; i < numMergedVisualConfigs; i++) { - if (pMergedVisualConfigs[i].rgba) - __numRGBconfigs++; + numRGBconfigs = 0; + numCIconfigs = 0; + for (i = 0; i < numNewConfigs; i++) { + if (pNewVisualConfigs[i].rgba) + numRGBconfigs++; else - __numCIconfigs++; + numCIconfigs++; } /* Count the total number of visuals to compute */ + numNewVisuals = 0; for (i = 0; i < numVisuals; i++) { - numMesaVisuals += + numNewVisuals += (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) - ? __numRGBconfigs : __numCIconfigs; + ? numRGBconfigs : numCIconfigs; } /* Reset variables for use with the next screen/driver's visual configs */ @@ -381,51 +281,52 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, numConfigs = 0; /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numMesaVisuals * sizeof(VisualID)); + orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); if (!orig_vid) { - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); return FALSE; } /* Alloc space for the list of glXVisuals */ - glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numMesaVisuals * + glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals * sizeof(__GLXvisualConfig)); if (!glXVisualPtr) { __glXFree(orig_vid); - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); return FALSE; } /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numMesaVisuals * sizeof(void *)); + glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); if (!glXVisualPriv) { __glXFree(glXVisualPtr); __glXFree(orig_vid); - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); return FALSE; } /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numMesaVisuals * sizeof(VisualRec)); + pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); if (!pVisualNew) { __glXFree(glXVisualPriv); __glXFree(glXVisualPtr); __glXFree(orig_vid); - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); return FALSE; } /* Initialize the new visuals */ + found_default = FALSE; for (i = j = 0; i < numVisuals; i++) { - is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); + int is_rgb = (pVisual[i].class == TrueColor || + pVisual[i].class == DirectColor); - for (k = 0; k < numMergedVisualConfigs; k++) { - if (pMergedVisualConfigs[k].rgba != is_rgb) + for (k = 0; k < numNewConfigs; k++) { + if (pNewVisualConfigs[k].rgba != is_rgb) continue; /* Initialize the new visual */ @@ -442,7 +343,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, orig_vid[j] = pVisual[i].vid; /* Initialize the glXVisual */ - glXVisualPtr[j] = pMergedVisualConfigs[k]; + glXVisualPtr[j] = pNewVisualConfigs[k]; glXVisualPtr[j].vid = pVisualNew[j].vid; /* @@ -456,23 +357,25 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask); glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask); glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask); - glXVisualPtr[j].alphaSize = 0; /* Not supported in Mesa */ + glXVisualPtr[j].alphaSize = count_bits(glXVisualPtr[i].alphaMask); glXVisualPtr[j].redMask = pVisual[i].redMask; glXVisualPtr[j].greenMask = pVisual[i].greenMask; glXVisualPtr[j].blueMask = pVisual[i].blueMask; - glXVisualPtr[j].alphaMask = 0; /* Not supported in Mesa */ + /*glXVisualPtr[j].alphaMask = 0; Not supported in Mesa */ glXVisualPtr[j].bufferSize = rootDepth; } /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pMergedVisualPriv[k]; + glXVisualPriv[j] = pNewVisualPriv[k]; j++; } } + assert(j <= numNewVisuals); + /* Save the GLX visuals in the screen structure */ - MESAScreens[screenInfo.numScreens-1].num_vis = numMesaVisuals; + MESAScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; MESAScreens[screenInfo.numScreens-1].glx_vis = glXVisualPtr; MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv; @@ -484,7 +387,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, /* Count the new number of VisualIDs at this depth */ for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numMesaVisuals; k++) + for (k = 0; k < numNewVisuals; k++) if (pdepth[i].vids[j] == orig_vid[k]) numVids++; @@ -493,7 +396,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, /* Initialize the new list of VisualIDs for this depth */ for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numMesaVisuals; k++) + for (k = 0; k < numNewVisuals; k++) if (pdepth[i].vids[j] == orig_vid[k]) pVids[n++] = pVisualNew[k].vid; @@ -504,7 +407,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, } /* Update the X server's visuals */ - *nvisualp = numMesaVisuals; + *nvisualp = numNewVisuals; *visualp = pVisualNew; /* Free the old list of the X server's visuals */ @@ -512,11 +415,12 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, /* Clean up temporary allocations */ __glXFree(orig_vid); - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); /* Free the private list created by DDX HW driver */ - if (visualPrivates) xfree(visualPrivates); + if (visualPrivates) + xfree(visualPrivates); visualPrivates = NULL; return TRUE; @@ -603,18 +507,22 @@ static void init_screen_visuals(int screen) /* Create the XMesa visual */ pXMesaVisual[i] = - XMesaCreateVisual(pScreen, - pVis, - pGLXVis->rgba, - (pGLXVis->alphaSize > 0), - pGLXVis->doubleBuffer, - pGLXVis->stereo, - GL_TRUE, /* ximage_flag */ - pGLXVis->depthSize, - pGLXVis->stencilSize, - pGLXVis->accumRedSize, - pGLXVis->level); - + XMesaCreateVisual(pScreen, + pVis, + pGLXVis->rgba, + (pGLXVis->alphaSize > 0), + pGLXVis->doubleBuffer, + pGLXVis->stereo, + GL_TRUE, /* ximage_flag */ + pGLXVis->depthSize, + pGLXVis->stencilSize, + pGLXVis->accumRedSize, + pGLXVis->accumGreenSize, + pGLXVis->accumBlueSize, + pGLXVis->accumAlphaSize, + 0, /* numSamples */ + pGLXVis->level, + pGLXVis->visualRating ); /* Set the VisualID */ pGLXVis->vid = pVis->vid; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c index ca69d37c1..5498f4146 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c @@ -133,7 +133,7 @@ MGAInitVisualConfigs(ScreenPtr pScreen) __GLXvisualConfig *pConfigs = 0; MGAConfigPrivPtr pMGAConfigs = 0; MGAConfigPrivPtr *pMGAConfigPtrs = 0; - int i; + int i, db, depth, stencil, accum; switch (pScrn->bitsPerPixel) { case 8: @@ -161,126 +161,69 @@ MGAInitVisualConfigs(ScreenPtr pScreen) for (i=0; i<numConfigs; i++) pMGAConfigPtrs[i] = &pMGAConfigs[i]; - /* config 0: db=FALSE, depth=0 - config 1: db=FALSE, depth=16 - config 2: db=TRUE, depth=0; - config 3: db=TRUE, depth=16 - */ - pConfigs[0].vid = -1; - pConfigs[0].class = -1; - pConfigs[0].rgba = TRUE; - pConfigs[0].redSize = 5; - pConfigs[0].greenSize = 6; - pConfigs[0].blueSize = 5; - pConfigs[0].redMask = 0x0000F800; - pConfigs[0].greenMask = 0x000007E0; - pConfigs[0].blueMask = 0x0000001F; - pConfigs[0].alphaMask = 0; - pConfigs[0].accumRedSize = 0; - pConfigs[0].accumGreenSize = 0; - pConfigs[0].accumBlueSize = 0; - pConfigs[0].accumAlphaSize = 0; - pConfigs[0].doubleBuffer = FALSE; - pConfigs[0].stereo = FALSE; - pConfigs[0].bufferSize = 16; - pConfigs[0].depthSize = 16; - pConfigs[0].stencilSize = 0; - pConfigs[0].auxBuffers = 0; - pConfigs[0].level = 0; - pConfigs[0].visualRating = 0; - pConfigs[0].transparentPixel = 0; - pConfigs[0].transparentRed = 0; - pConfigs[0].transparentGreen = 0; - pConfigs[0].transparentBlue = 0; - pConfigs[0].transparentAlpha = 0; - pConfigs[0].transparentIndex = 0; - - pConfigs[1].vid = -1; - pConfigs[1].class = -1; - pConfigs[1].rgba = TRUE; - pConfigs[1].redSize = 5; - pConfigs[1].greenSize = 6; - pConfigs[1].blueSize = 5; - pConfigs[1].redMask = 0x0000F800; - pConfigs[1].greenMask = 0x000007E0; - pConfigs[1].blueMask = 0x0000001F; - pConfigs[1].alphaMask = 0; - pConfigs[1].accumRedSize = 0; - pConfigs[1].accumGreenSize = 0; - pConfigs[1].accumBlueSize = 0; - pConfigs[1].accumAlphaSize = 0; - pConfigs[1].doubleBuffer = FALSE; - pConfigs[1].stereo = FALSE; - pConfigs[1].bufferSize = 16; - pConfigs[1].depthSize = 16; - pConfigs[1].stencilSize = 0; - pConfigs[1].auxBuffers = 0; - pConfigs[1].level = 0; - pConfigs[1].visualRating = 0; - pConfigs[1].transparentPixel = 0; - pConfigs[1].transparentRed = 0; - pConfigs[1].transparentGreen = 0; - pConfigs[1].transparentBlue = 0; - pConfigs[1].transparentAlpha = 0; - pConfigs[1].transparentIndex = 0; - - pConfigs[2].vid = -1; - pConfigs[2].class = -1; - pConfigs[2].rgba = TRUE; - pConfigs[2].redSize = 5; - pConfigs[2].greenSize = 6; - pConfigs[2].blueSize = 5; - pConfigs[2].redMask = 0x0000F800; - pConfigs[2].greenMask = 0x000007E0; - pConfigs[2].blueMask = 0x0000001F; - pConfigs[2].alphaMask = 0; - pConfigs[2].accumRedSize = 0; - pConfigs[2].accumGreenSize = 0; - pConfigs[2].accumBlueSize = 0; - pConfigs[2].accumAlphaSize = 0; - pConfigs[2].doubleBuffer = TRUE; - pConfigs[2].stereo = FALSE; - pConfigs[2].bufferSize = 16; - pConfigs[2].depthSize = 16; - pConfigs[2].stencilSize = 0; - pConfigs[2].auxBuffers = 0; - pConfigs[2].level = 0; - pConfigs[2].visualRating = 0; - pConfigs[2].transparentPixel = 0; - pConfigs[2].transparentRed = 0; - pConfigs[2].transparentGreen = 0; - pConfigs[2].transparentBlue = 0; - pConfigs[2].transparentAlpha = 0; - pConfigs[2].transparentIndex = 0; - - pConfigs[3].vid = -1; - pConfigs[3].class = -1; - pConfigs[3].rgba = TRUE; - pConfigs[3].redSize = 5; - pConfigs[3].greenSize = 6; - pConfigs[3].blueSize = 5; - pConfigs[3].redMask = 0x0000F800; - pConfigs[3].greenMask = 0x000007E0; - pConfigs[3].blueMask = 0x0000001F; - pConfigs[3].alphaMask = 0; - pConfigs[3].accumRedSize = 0; - pConfigs[3].accumGreenSize = 0; - pConfigs[3].accumBlueSize = 0; - pConfigs[3].accumAlphaSize = 0; - pConfigs[3].doubleBuffer = TRUE; - pConfigs[3].stereo = FALSE; - pConfigs[3].bufferSize = 16; - pConfigs[3].depthSize = 16; - pConfigs[3].stencilSize = 0; - pConfigs[3].auxBuffers = 0; - pConfigs[3].level = 0; - pConfigs[3].visualRating = 0; - pConfigs[3].transparentPixel = 0; - pConfigs[3].transparentRed = 0; - pConfigs[3].transparentGreen = 0; - pConfigs[3].transparentBlue = 0; - pConfigs[3].transparentAlpha = 0; - pConfigs[3].transparentIndex = 0; + i = 0; + depth = 1; + for (accum = 0; accum <= 1; accum++) { + for (stencil = 0; stencil <= 0; stencil++) { /* no stencil for now */ + for (db=0; db<=1; db++) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0; + if (accum) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + if (db) + pConfigs[i].doubleBuffer = TRUE; + else + pConfigs[i].doubleBuffer = FALSE; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 16; + if (depth) + pConfigs[i].depthSize = 16; + else + pConfigs[i].depthSize = 0; + if (stencil) + pConfigs[i].stencilSize = 8; + else + pConfigs[i].stencilSize = 0; + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (stencil) + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + else + pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } + } + if (i!=numConfigs) { + ErrorF("Incorrect initialization of visuals\n"); + return FALSE; + } + break; + default: + ; /* unexpected bits/pixelx */ } pMGA->numVisualConfigs = numConfigs; pMGA->pVisualConfigs = pConfigs; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index c22791520..0304d8f19 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -56,7 +56,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) case 32: break; case 16: - numConfigs = 2; + numConfigs = 8; if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), numConfigs))) { @@ -77,55 +77,60 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) pTDFXConfigPtrs[i] = &pTDFXConfigs[i]; i=0; - accum=0; - stencil=0; depth=1; - for (db=0; db<=1; db++) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 5; - pConfigs[i].greenSize = 6; - pConfigs[i].blueSize = 5; - pConfigs[i].redMask = 0x0000F800; - pConfigs[i].greenMask = 0x000007E0; - pConfigs[i].blueMask = 0x0000001F; - pConfigs[i].alphaMask = 0; - if (accum) { - pConfigs[i].accumRedSize = 8; - pConfigs[i].accumGreenSize = 8; - pConfigs[i].accumBlueSize = 8; - pConfigs[i].accumAlphaSize = 8; - } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; + for (accum = 0; accum <= 1; accum++) { + for (stencil = 0; stencil <= 1; stencil++) { + for (db=0; db<=1; db++) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0; + if (accum) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + if (db) + pConfigs[i].doubleBuffer = TRUE; + else + pConfigs[i].doubleBuffer = FALSE; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 16; + if (depth) + pConfigs[i].depthSize = 16; + else + pConfigs[i].depthSize = 0; + if (stencil) + pConfigs[i].stencilSize = 8; + else + pConfigs[i].stencilSize = 0; + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (stencil) + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + else + pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } } - if (db) - pConfigs[i].doubleBuffer = TRUE; - else - pConfigs[i].doubleBuffer = FALSE; - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 16; - if (depth) - pConfigs[i].depthSize = 16; - else - pConfigs[i].depthSize = 0; - if (stencil) - pConfigs[i].stencilSize = 8; - else - pConfigs[i].stencilSize = 0; - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - pConfigs[i].visualRating = 0; - pConfigs[i].transparentPixel = 0; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; - i++; } if (i!=numConfigs) { ErrorF("Incorrect initialization of visuals\n"); @@ -147,14 +152,14 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) DRIInfoPtr pDRIInfo; TDFXDRIPtr pTDFXDRI; - if (pScrn->bitsPerPixel!=16) return FALSE; + if (pScrn->bitsPerPixel != 16) return FALSE; #if XFree86LOADER - /* Check that the GLX, DRI, and DRM modules have been loaded by testing - for canonical symbols in each module. */ - if (!LoaderSymbol("GlxSetVisualConfigs")) return FALSE; - if (!LoaderSymbol("DRIScreenInit")) return FALSE; - if (!LoaderSymbol("drmAvailable")) return FALSE; + /* Check that the GLX, DRI, and DRM modules have been loaded by testing + for canonical symbols in each module. */ + if (!LoaderSymbol("GlxSetVisualConfigs")) return FALSE; + if (!LoaderSymbol("DRIScreenInit")) return FALSE; + if (!LoaderSymbol("drmAvailable")) return FALSE; #endif pDRIInfo = DRICreateInfoRec(); @@ -266,9 +271,9 @@ TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - TDFXPtr pTDFX = TDFXPTR(pScrn); - TDFXConfigPrivPtr pTDFXConfig = (TDFXConfigPrivPtr)pVisualConfigPriv; + /*ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];*/ + /*TDFXPtr pTDFX = TDFXPTR(pScrn);*/ + /*TDFXConfigPrivPtr pTDFXConfig = (TDFXConfigPrivPtr)pVisualConfigPriv;*/ TDFXDRIContextPtr ctx; ctx=(TDFXDRIContextPtr)contextStore; diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c index d91457078..5a134e0d3 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c +++ b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c @@ -231,6 +231,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86GetSerialModemState) SYMFUNC(xf86SerialModemSetBits) SYMFUNC(xf86SerialModemClearBits) + SYMFUNC(xf86LoadKernelModule) SYMFUNC(xf86OSMouseInit) #ifdef XINPUT diff --git a/xc/programs/Xserver/hw/xfree86/os-support/amoeba/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/amoeba/Imakefile index e4deae416..1a5463273 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/amoeba/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/amoeba/Imakefile @@ -13,9 +13,9 @@ IOOBJ = inout.o #endif SRCS = am_init.c am_video.c am_io.c mapVT_noop.c ioperm_noop.c \ - VTsw_noop.c $(IOSRC) + VTsw_noop.c $(IOSRC) kmod_noop.c OBJS = am_init.o am_video.o am_io.o mapVT_noop.o ioperm_noop.o \ - VTsw_noop.o $(IOOBJ) + VTsw_noop.o $(IOOBJ) kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) @@ -27,6 +27,7 @@ NormalAsmObjectRule() ObjectFromSpecialSource(mapVT_noop,../shared/mapVT_noop,/**/) ObjectFromSpecialSource(ioperm_noop,../shared/ioperm_noop,/**/) ObjectFromSpecialSource(VTsw_noop,../shared/VTsw_noop,/**/) +ObjectFromSpecialSource(kmod_noop,../shared/kmod_noop,/**/) #if AckToolset ObjectFromSpecialAsmSource(inout,../shared/inout,/**/) #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile index 76b4260ae..e8cea6ed0 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/12 1996/10/27 11:06:35 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.30 1999/08/22 11:59:50 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.41 2000/03/05 16:59:16 dawes Exp $ #include <Server.tmpl> @@ -32,45 +32,84 @@ SHARED_CFLAGS = PositionIndependentCFlags # else IOPERMDEFINES = -DUSE_I386_IOPL # endif -#elif defined(FreeBSDArchitecture) +#elif defined(FreeBSDArchitecture) && !defined(AlphaBsdArchitecture) IOPERMDEFINES = -DUSE_DEV_IO #else +# if defined(AlphaBsdArchitecture) + IOPERMDEFINES = -DUSE_ALPHA_PORTS +# else IOPERM_SRC = ioperm_noop.c IOPERM_OBJ = ioperm_noop.o +# endif #endif -#if NewInput MOUSESRC = bsd_mouse.c MOUSEOBJ = bsd_mouse.o -#else -MOUSESRC = std_mouse.c std_mseEv.c -MOUSEOBJ = std_mouse.o std_mseEv.o -#endif #if HasMTRRSupport MTRRDEFINES = -DHAS_MTRR_SUPPORT #endif +#if UsbMouseSupport +USBMOUSEDEFINES = -DUSBMOUSE_SUPPORT +#if !HasLibUsb +LIBUSBINCLUDES = -Ilibusb +#define IHaveSubdirs +SUBDIRS = libusb +#endif +#endif + + +#if defined(NetBSDArchitecture) || defined(OpenBSDArchitecture) +APMSRC = bsd_apm.c +APMOBJ = bsd_apm.o +#else +APMSRC = pm_noop.c +APMOBJ = pm_noop.o +#endif + +#if defined(i386Architecture) || defined(ia64Architecture) +RES_SRC=stdResource.c +RES_OBJ=stdResource.o +#else +RES_SRC=bsdResource.c +RES_OBJ=bsdResource.o +#endif + +#if defined(AlphaArchitecture) +AXP_SRC=bsd_ev56.c +AXP_OBJ=bsd_ev56.o +#endif + SRCS = bsd_init.c bsd_video.c bsd_io.c bsd_VTsw.c \ libc_wrapper.c $(IOPERM_SRC) std_kbdEv.c posix_tty.c $(MOUSESRC) \ - stdResource.c vidmem.c $(JOYSTICK_SRC) + $(RES_SRC) stdPci.c vidmem.c $(JOYSTICK_SRC) sigio.c $(APMSRC) \ + $(AXP_SRC) kmod_noop.c OBJS = bsd_init.o bsd_video.o bsd_io.o bsd_VTsw.o \ libc_wrapper.o $(IOPERM_OBJ) std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - stdResource.o vidmem.o $(JOYSTICK_OBJ) + $(RES_OBJ) stdPci.o vidmem.o $(JOYSTICK_OBJ) sigio.o $(APMOBJ) \ + $(AXP_OBJ) kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi + -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi -I$(APINCLUDES) \ + $(LIBUSBINCLUDES) CONSDEFINES = XFree86ConsoleDefines RESDEFINES = -DUSESTDRES #if HasNetBSDApertureDriver +APDIR = NetBSDApertureDir APDEFINES = -DHAS_APERTURE_DRV +APINCLUDES = $(APDIR)/include #endif DEFINES = $(CONSDEFINES) $(APDEFINES) $(IOPERMDEFINES) $(RESDEFINES) \ - $(MTRRDEFINES) + $(MTRRDEFINES) $(USBMOUSEDEFINES) + +#if defined(AlphaArchitecture) +SpecialObjectRule(bsd_ev56.o, bsd_ev56.c, -mcpu=ev56) +#endif SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() @@ -80,25 +119,33 @@ NormalLibraryObjectRule() # if JoystickSupport AllTarget(bsd_jstk.o) #if 0 -InstallDynamicModule(bsd_jstk.o,$(MODULEDIR)) +InstallDynamicModule(bsd_jstk.o,$(MODULEDIR),input) #endif # endif # endif #endif +#if !defined(NetBSDArchitecture) && !defined(OpenBSDArchitecture) +LinkSourceFile(pm_noop.c,../shared) +#endif LinkSourceFile(ioperm_noop.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(posix_tty.c,../shared) -#if !NewInput -LinkSourceFile(std_mouse.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -#endif LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) LinkSourceFile(vidmem.c,../shared) +LinkSourceFile(sigio.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() +#if UsbMouseSupport && !HasLibUsb +MakeSubdirs($(SUBDIRS)) + +DependSubdirs($(SUBDIRS)) +#endif + #if 0 InstallDriverSDKDynamicModule(bsd_jstk.o,$(DRIVERSDKMODULEDIR)) #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile index f30431d12..d51e6183c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile,v 3.6 1999/05/22 08:40:08 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile,v 3.10 2000/02/13 03:36:06 dawes Exp $ @@ -7,21 +7,18 @@ XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:23:38 rws $ #include <Server.tmpl> -#if NewInput MOUSESRC = bsdi_mouse.c MOUSEOBJ = bsdi_mouse.o -#else -MOUSESRC = std_mouse.c std_mseEv.c -MOUSEOBJ = std_mouse.o std_mseEv.o -#endif SRCS = bsdi_init.c bsdi_video.c bsdi_io.c bios_devmem.c \ mapVT_noop.c VTsw_noop.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ - libc_wrapper.c stdResource.c + libc_wrapper.c stdResource.c stdPci.c sigiostubs.c pm_noop.c \ + kmod_noop.c OBJS = bsdi_init.o bsdi_video.o bsdi_io.o bios_devmem.o \ mapVT_noop.o VTsw_noop.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - libc_wrapper.o stdResource.o + libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \ + kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) @@ -38,12 +35,12 @@ LinkSourceFile(mapVT_noop.c,../shared) LinkSourceFile(VTsw_noop.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(posix_tty.c,../shared) -#if !NewInput -LinkSourceFile(std_mouse.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -#endif LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile index d62452b9b..49fb043d9 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile @@ -1,15 +1,15 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile,v 1.2 1999/04/04 00:20:56 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile,v 1.5 2000/02/13 03:36:07 dawes Exp $ #include <Server.tmpl> BIOS_MOD = bios_DGmmap SRCS = dgux_init.c dgux_video.c IO_utils.c dgux_io.c $(BIOS_MOD).c VTsw_noop.c \ dgux_kbd.c dgux_kbdEv.c dgux_tty.c std_mouse.c std_mseEv.c \ - stdResource.c + stdResource.c stdPci.c sigiostubs.c pm_noop.c kmod_noop.c OBJS = dgux_init.o dgux_video.o IO_utils.o dgux_io.o $(BIOS_MOD).o VTsw_noop.o \ dgux_kbd.o dgux_kbdEv.o dgux_tty.o std_mouse.o std_mseEv.o \ - stdResource.o + stdResource.o stdPci.o sigiostubs.o pm_noop.o kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) @@ -26,5 +26,9 @@ LinkSourceFile(IO_utils,../shared) LinkSourceFile(std_mouse,../shared) LinkSourceFile(std_mseEv,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile index 27d8575dd..ce5c27bfa 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile @@ -1,24 +1,19 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile,v 1.5 1999/05/22 08:40:11 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile,v 1.9 2000/02/13 03:36:08 dawes Exp $ #include <Server.tmpl> BIOS_MOD = bios_mmap -#if NewInput MOUSESRC = hurd_mouse.c MOUSEOBJ = hurd_mouse.o -#else -MOUSESRC = std_mouse.c std_mseEv.c -MOUSEOBJ = std_mouse.o std_mseEv.o -#endif SRCS = hurd_init.c hurd_video.c hurd_io.c libc_wrapper.c $(BIOS_MOD).c \ mapVT_noop.c VTsw_noop.c posix_tty.c std_kbdEv.c $(MOUSESRC) \ - stdResource.c + stdResource.c stdPci.c sigiostubs.c pm_noop.c kmod_noop.c OBJS = hurd_init.o hurd_video.o hurd_io.o libc_wrapper.o $(BIOS_MOD).o \ mapVT_noop.o VTsw_noop.o posix_tty.o std_kbdEv.o $(MOUSEOBJ) \ - stdResource.o + stdResource.o stdPci.o sigiostubs.o pm_noop.o kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi @@ -34,13 +29,13 @@ NormalLibraryObjectRule() LinkSourceFile(VTsw_noop.c,../shared) LinkSourceFile(mapVT_noop.c,../shared) LinkSourceFile(posix_tty.c,../shared) -#if !NewInput -LinkSourceFile(std_mouse.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -#endif LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile index c5c378e2e..ed314b993 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile @@ -1,6 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/10/19 18:06:19 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile,v 3.23 1999/08/14 10:50:05 dawes Exp $ -XCOMM $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile,v 1.9 1999/06/07 13:01:42 faith Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile,v 3.38 2000/02/23 04:47:22 martin Exp $ #include <Server.tmpl> @@ -21,41 +20,64 @@ SHARED_CFLAGS = PositionIndependentCFlags MTRRDEFINES = -DHAS_MTRR_SUPPORT #endif -#if BuildXF86DRI DRI_SRC = sigio.c DRI_OBJ = sigio.o -#endif -#if NewInput MOUSESRC = lnx_mouse.c MOUSEOBJ = lnx_mouse.o + +#if defined(i386Architecture) || defined(ia64Architecture) +RES_SRCS=stdResource.c +RES_OBJS=stdResource.o #else -MOUSESRC = std_mouse.c std_mseEv.c -MOUSEOBJ = std_mouse.o std_mseEv.o +RES_SRCS=lnxResource.c +RES_OBJS=lnxResource.o +#endif + +#if defined(AlphaArchitecture) +AXP_SRC=lnx_ev56.c +AXP_OBJ=lnx_ev56.o #endif SRCS = lnx_init.c lnx_video.c lnx_io.c libc_wrapper.c bios_mmap.c \ mapVT_noop.c VTsw_usl.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ - stdResource.c vidmem.c $(JOYSTICK_SRC) $(DRI_SRC) + lnx_pci.c vidmem.c lnx_apm.c $(JOYSTICK_SRC) $(DRI_SRC) $(RES_SRCS) \ + $(AXP_SRC) lnx_kmod.c OBJS = lnx_init.o lnx_video.o lnx_io.o libc_wrapper.o bios_mmap.o \ mapVT_noop.o VTsw_usl.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - stdResource.o vidmem.o $(JOYSTICK_OBJ) $(DRI_OBJ) + lnx_pci.o vidmem.o lnx_apm.o $(JOYSTICK_OBJ) $(DRI_OBJ) $(RES_OBJS) \ + $(AXP_OBJ) lnx_kmod.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) RESDEFINES = -DUSESTDRES -DEFINES = $(MTRRDEFINES) $(RESDEFINES) +DEFINES = $(MTRRDEFINES) $(RESDEFINES) -DHAVE_SYSV_IPC + +#if defined(AlphaArchitecture) +SpecialObjectRule(lnx_ev56.o, lnx_ev56.c, -mcpu=ev56) +#endif SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() #if BuildXF86DRI +DRISUBDIR = drm +#endif +TESTVAR = XF86INT10_BUILD + +#if XF86INT10_BUILD > X86EMU_GENERIC +INT10SUBDIR = int10 +#endif + +#if BuildXF86DRI || (XF86INT10_BUILD > X86EMU_GENERIC) #define IHaveSubdirs -SUBDIRS = drm +SUBDIRS = $(DRISUBDIR) $(INT10SUBDIR) +#endif +#ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif @@ -65,7 +87,7 @@ DependSubdirs($(SUBDIRS)) # if JoystickSupport AllTarget(lnx_jstk.o) #if 0 -InstallDynamicModule(lnx_jstk.o,$(MODULEDIR)) +InstallDynamicModule(lnx_jstk.o,$(MODULEDIR),input) #endif # endif # endif @@ -73,19 +95,17 @@ InstallDynamicModule(lnx_jstk.o,$(MODULEDIR)) LinkSourceFile(bios_mmap.c,../shared) LinkSourceFile(mapVT_noop.c,../shared) -LinkSourceFile(VTsw_usl.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(posix_tty.c,../shared) -#if !NewInput -LinkSourceFile(std_mouse.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -#endif LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) LinkSourceFile(vidmem.c,../shared) +LinkSourceFile(VTsw_usl.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) -#if BuildXF86DRI -LinkSourceFile(sigio.c,../shared) +LinkSourceFile($(DRI_SRC),../shared) + +#if defined(i386Architecture) || defined(ia64Architecture) +LinkSourceFile(stdResource.c,../shared) #endif DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c index 8b97c7da9..3b66c19a8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c @@ -217,6 +217,20 @@ static int drmOpenByName(const char *name) group = xf86ConfigDRI.group ? xf86ConfigDRI.group : DRM_DEV_GID; #endif +#if defined(XFree86Server) + if (!drmAvailable()) { + /* try to load the kernel module now */ + if (!xf86LoadKernelModule(name)) { + ErrorF("[drm] failed to load kernel module \"%s\"\n", + name); + return -1; + } + } +#else + if (!drmAvailable()) + return -1; +#endif + if (!geteuid()) { dirmode = mode; if (dirmode & S_IRUSR) dirmode |= S_IXUSR; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c new file mode 100644 index 000000000..f80b30d3e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c @@ -0,0 +1,79 @@ +#include <errno.h> +#include <fcntl.h> +#include <unistd.h> +#include <sys/wait.h> +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + + +#define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe" +#define MAX_PATH 1024 + + +/* XFree86 #defines execl to be the xf86execl() function which does + * a fork AND exec. We don't want that. We want the regular, + * standard execl(). + */ +#ifdef execl +#undef execl +#endif + + + +/* + * Load a Linux kernel module. + * This is used by the DRI/DRM to load a DRM kernel module when + * the X server starts. It could be used for other purposes in the future. + * Input: + * modName - name of the kernel module (Ex: "tdfx") + * Return: + * 0 for failure, 1 for success + */ +int xf86LoadKernelModule(const char *modName) +{ + char mpPath[MAX_PATH] = ""; + int fd = -1, status, n; + pid_t pid; + + /* get the path to the modprobe program */ + fd = open(MODPROBE_PATH_FILE, O_RDONLY); + if (fd >= 0) { + int count = read(fd, mpPath, MAX_PATH - 1); + if (count <= 0) { + mpPath[0] = 0; + } + else if (mpPath[count - 1] == '\n') { + mpPath[count - 1] = 0; /* replaces \n with \0 */ + } + close(fd); + /* if this worked, mpPath will be "/sbin/modprobe" or similar. */ + } + + if (mpPath[0] == 0) { + /* we failed to get the path from the system, use a default */ + xf86strcpy(mpPath, "/sbin/modprobe"); + } + + /* now fork/exec the modprobe command */ + switch (pid = fork()) { + case 0: /* child */ + n = execl(mpPath, "modprobe", modName, NULL); + exit(EXIT_FAILURE); /* if we get here the child's exec failed */ + break; + case -1: /* fork failed */ + return 0; + default: /* fork worked */ + if (waitpid(pid, &status, 0) == -1) { + return 0; + } + if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { + return 1; /* success! */ + } + else { + return 0; + } + } + + /* never get here */ + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile index adaeb532a..36013ddb4 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile @@ -1,7 +1,10 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile,v 3.12 1999/07/10 07:24:48 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile,v 3.18 2000/02/13 03:36:09 dawes Exp $ #include <Server.tmpl> #if !defined(PpcArchitecture) +#if HasMTRRSupport +MTRRDEFINES = -DHAS_MTRR_SUPPORT +#endif IOPERM_SRCS=ioperm_noop.c IOPERM_OBJS=ioperm_noop.o #endif @@ -11,30 +14,25 @@ PPC_SRCS=lynx_noinline.c lynx_ppc.S PPC_OBJS=lynx_noinline.o lynx_ppc.o #endif -#if NewInput MOUSESRC = lynx_mouse.c MOUSEOBJ = lynx_mouse.o -#else -MOUSESRC = std_mouse.c std_mseEv.c -MOUSEOBJ = std_mouse.o std_mseEv.o -#endif SRCS = lynx_init.c lynx_video.c lynx_io.c lynx_mmap.c mapVT_noop.c \ VTsw_usl.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ - $(IOPERM_SRCS) $(PPC_SRCS) libc_wrapper.c stdResource.c \ - vidmem.c + $(IOPERM_SRCS) $(PPC_SRCS) libc_wrapper.c stdResource.c stdPci.c \ + vidmem.c sigio.c pm_noop.c kmod_noop.c OBJS = lynx_init.o lynx_video.o lynx_io.o lynx_mmap.o mapVT_noop.o \ VTsw_usl.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - $(IOPERM_OBJS) $(PPC_OBJS) libc_wrapper.o stdResource.o \ - vidmem.o + $(IOPERM_OBJS) $(PPC_OBJS) libc_wrapper.o stdResource.o stdPci.o \ + vidmem.o sigio.o pm_noop.o kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) RESDEFINES = -DUSESTDRES -DEFINES = $(RESDEFINES) +DEFINES = $(RESDEFINES) $(MTRRDEFINES) SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() @@ -46,12 +44,12 @@ LinkSourceFile(mapVT_noop.c,../shared) LinkSourceFile(VTsw_usl.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(posix_tty.c,../shared) -#if !NewInput -LinkSourceFile(std_mouse.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -#endif LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) LinkSourceFile(vidmem.c,../shared) +LinkSourceFile(sigio.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/mach/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/mach/Imakefile index 01f2843fc..19bc8517a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/mach/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/mach/Imakefile @@ -14,10 +14,10 @@ BIOS_MOD = bios_mmap #endif SRCS = mach_init.c mach_video.c mach_io.c $(BIOS_MOD).c mapVT_noop.c \ - VTsw_noop.c + VTsw_noop.c kmod_noop.c OBJS = mach_init.o mach_video.o mach_io.o $(BIOS_MOD).o mapVT_noop.o \ - VTsw_noop.o + VTsw_noop.o kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) @@ -30,6 +30,7 @@ ObjectFromSpecialSource(bios_devmem,../shared/bios_devmem,/**/) #endif ObjectFromSpecialSource(mapVT_noop,../shared/mapVT_noop,/**/) ObjectFromSpecialSource(VTsw_noop,../shared/VTsw_noop,/**/) +ObjectFromSpecialSource(kmod_noop,../shared/kmod_noop,/**/) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/minix/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/minix/Imakefile index 5022a0ce6..5d0f0f964 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/minix/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/minix/Imakefile @@ -9,10 +9,10 @@ XCOMM $XConsortium: Imakefile /main/5 1996/09/28 17:24:04 rws $ #include <Server.tmpl> SRCS = mnx_init.c mnx_video.c mnx_io.c bios_devmem.c mapVT_noop.c \ - ioperm_noop.c VTsw_noop.c std_mouse.c posix_tty.c + ioperm_noop.c VTsw_noop.c std_mouse.c posix_tty.c kmod_noop.c OBJS = mnx_init.o mnx_video.o mnx_io.o bios_devmem.o mapVT_noop.o \ - ioperm_noop.o VTsw_noop.o posix_tty.o + ioperm_noop.o VTsw_noop.o posix_tty.o kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) @@ -25,5 +25,6 @@ ObjectFromSpecialSource(mapVT_noop,../shared/mapVT_noop,/**/) ObjectFromSpecialSource(ioperm_noop,../shared/ioperm_noop,/**/) ObjectFromSpecialSource(VTsw_noop,../shared/VTsw_noop,/**/) ObjectFromSpecialSource(posix_tty,../shared/posix_tty,/**/) +ObjectFromSpecialSource(kmod_noop,../shared/kmod_noop,/**/) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile index 078406136..74e3eea12 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile @@ -5,10 +5,10 @@ XCOMM SRCS = nto_io.c nto_init.c nto_kbdEv.c mapVT_noop.c nto_ioperm.c nto_video.c \ - VTsw_noop.c posix_tty.c std_mseEv.c std_mouse.c + VTsw_noop.c posix_tty.c std_mseEv.c std_mouse.c kmod_noop.c OBJS = nto_io.o nto_init.o nto_kbdEv.o mapVT_noop.o nto_ioperm.o nto_video.o \ - VTsw_noop.o posix_tty.o std_mseEv.o std_mouse.o + VTsw_noop.o posix_tty.o std_mseEv.o std_mouse.o kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) @@ -23,5 +23,6 @@ ObjectFromSpecialSource(VTsw_noop,../shared/VTsw_noop,/**/) ObjectFromSpecialSource(posix_tty,../shared/posix_tty,/**/) ObjectFromSpecialSource(std_mseEv,../shared/std_mseEv,/**/) ObjectFromSpecialSource(std_mouse,../shared/std_mouse,/**/) +ObjectFromSpecialSource(kmod_noop,../shared/kmod_noop,/**/) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile index 8d475b755..806a98585 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile @@ -4,18 +4,20 @@ XCOMM $XConsortium: Imakefile /main/7 1996/09/28 17:24:18 rws $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile,v 3.11 1999/04/29 09:13:47 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile,v 3.14 2000/02/13 03:36:09 dawes Exp $ #include <Server.tmpl> BIOS_MOD = os2_bios SRCS = os2_init.c os2_video.c os2_io.c $(BIOS_MOD).c mapVT_noop.c \ os2_ioperm.c os2_VTsw.c os2_mouse.c os2_KbdEv.c os2_stubs.c \ - os2_select.c os2_diag.c libc_wrapper.c stdResource.c vidmem.c + os2_select.c os2_diag.c libc_wrapper.c stdResource.c stdPci.c \ + vidmem.c sigiostubs.c pm_noop.c kmod_noop.c OBJS = os2_init.o os2_video.o os2_io.o $(BIOS_MOD).o mapVT_noop.o \ os2_ioperm.o os2_VTsw.o os2_mouse.o os2_kbdEv.o os2_stubs.o \ - os2_select.o os2_diag.o libc_wrapper.o stdResource.o vidmem.o + os2_select.o os2_diag.o libc_wrapper.o stdResource.o stdPci.o \ + vidmem.o sigiostubs.o pm_noop.o kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) @@ -32,6 +34,10 @@ LinkSourceFile(mapVT_noop.c,../shared) LinkSourceFile(VTsw_noop.c,../shared) LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) LinkSourceFile(vidmem.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile index f165a1397..fe69c7231 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile @@ -1,25 +1,23 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile,v 1.4 1999/05/22 08:40:15 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile,v 1.8 2000/02/13 03:36:10 dawes Exp $ #include <Server.tmpl> -#if NewInput -MOUSESRC = bsd_mouse.c -MOUSEOBJ = bsd_mouse.o -#else -MOUSESRC = std_mouse.c std_mseEv.c -MOUSEOBJ = std_mouse.o std_mseEv.o -#endif +MOUSESRC = pmax_mouse.c +MOUSEOBJ = pmax_mouse.o SRCS = pmax_devs.c pmax_init.c pmax_map.c pmax_pci.c pmax_ppc.c \ bios_V4mmap.c VTsw_usl.c sysv_kbd.c std_kbdEv.c \ posix_tty.c $(MOUSESRC) xqueue.c ioperm_noop.c \ - libc_wrapper.c stdResource.c + libc_wrapper.c stdResource.c stdPci.o sigiostubs.c pm_noop.c \ + kmod_noop.c OBJS = pmax_devs.o pmax_init.o pmax_map.o pmax_pci.o pmax_ppc.o \ bios_V4mmap.o VTsw_usl.o sysv_kbd.o std_kbdEv.o \ posix_tty.o $(MOUSESRC) xqueue.o ioperm_noop.o \ - libc_wrapper.o stdResource.o + libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \ + kmod_noop.o + INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(XF86OSSRC)/bus -I. \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I../sysv @@ -36,12 +34,12 @@ LinkSourceFile(ioperm_noop.c,../shared) LinkSourceFile(sysv_kbd.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(posix_tty.c,../shared) -#if !NewInput -LinkSourceFile(std_mouse.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -#endif LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) LinkSourceFile(bios_V4mmap.c,../sysv) LinkSourceFile(xqueue.c,../sysv) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile index 6e959dcb4..d6cbd6223 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile @@ -1,5 +1,5 @@ XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile,v 1.1 1999/12/27 00:45:46 robin Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile,v 1.3 2000/02/13 03:36:10 dawes Exp $ XCOMM #include <Server.tmpl> @@ -7,11 +7,13 @@ XCOMM SRCS = qnx_io.c qnx_init.c qnx_utils.c mapVT_noop.c ioperm_noop.c qnx_video.c \ qnx_VTsw.c qnx_kbd.c posix_tty.c qnx_mouse.c qnx_select.c \ - libc_wrapper.c stdResource.c + libc_wrapper.c stdResource.c stdPci.c sigiostubs.c pm_noop.c \ + kmod_noop.c OBJS = qnx_io.o qnx_init.o qnx_utils.o mapVT_noop.o ioperm_noop.o qnx_video.o \ qnx_VTsw.o qnx_kbd.o posix_tty.o qnx_mouse.o qnx_select.o \ - libc_wrapper.o stdResource.o + libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \ + kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) @@ -29,5 +31,9 @@ LinkSourceFile(posix_tty.c,../shared) LinkSourceFile(mapVT_noop.c,../shared) LinkSourceFile(ioperm_noop.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile index 35a86f41e..619dcb008 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile,v 3.4 1999/04/04 00:20:59 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile,v 3.7 2000/02/13 03:36:11 dawes Exp $ @@ -9,11 +9,13 @@ XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:24:25 rws $ SRCS = sco_init.c sco_video.c sco_io.c bios_devmem.c mapVT_noop.c VTsw_sco.c \ sysv_kbd.c std_kbdEv.c sysv_tty.c std_mseEv.c sco_mouse.c \ - libc_wrapper.c stdResource.c + libc_wrapper.c stdResource.c stdPci.o sigiostubs.c pm_noop.c \ + kmod_noop.c OBJS = sco_init.o sco_video.o sco_io.o bios_devmem.o mapVT_noop.o VTsw_sco.o \ sysv_kbd.o std_kbdEv.o sysv_tty.o std_mseEv.o sco_mouse.o \ - libc_wrapper.o stdResource.o + libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \ + kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) @@ -33,6 +35,10 @@ LinkSourceFile(sysv_tty.c,../shared) LinkSourceFile(std_mseEv.c,../shared) LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c new file mode 100644 index 000000000..80f487593 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c @@ -0,0 +1,8 @@ + +#include "xf86_OSproc.h" + +int xf86LoadKernelModule(const char *pathname) +{ + (void) pathname; + return 0; /* failure */ +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile index 6418ceab1..0ac6d3044 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile,v 1.3 1999/12/03 19:17:46 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile,v 1.4 2000/02/13 03:36:11 dawes Exp $ @@ -19,12 +19,14 @@ MOUSEOBJ = sol8_mouse.o SRCS = sol8_init.c sol8_vid.c sol8_bios.c sol8_kbd.c sol8_io.c \ VTsw_noop.c sol8_kbd.c sol8_kbdEv.c posix_tty.c $(MOUSESRC) \ libc_wrapper.c $(PROWORKS_INOUT_SRC) stdResource.c stdPci.c \ - sol8_kbdgetmapping.c sol8_postkbdevents.c sigiostubs.c + sol8_kbdgetmapping.c sol8_postkbdevents.c sigiostubs.c pm_noop.c \ + kmod_noop.c OBJS = sol8_init.o sol8_vid.o sol8_bios.o sol8_kbd.o sol8_io.o \ VTsw_noop.o sol8_kbd.o sol8_kbdEv.o posix_tty.o $(MOUSEOBJ) \ libc_wrapper.o $(PROWORKS_INOUT_OBJ) stdResource.o stdPci.o \ - sol8_kbdgetmapping.o sol8_postkbdevents.o sigiostubs.o + sol8_kbdgetmapping.o sol8_postkbdevents.o sigiostubs.o pm_noop.o \ + kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) @@ -43,5 +45,7 @@ LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) LinkSourceFile(stdPci.c,../shared) LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile index 3a10a4f43..970351ced 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile,v 3.12 1999/07/18 15:37:25 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile,v 3.16 2000/02/13 03:36:12 dawes Exp $ @@ -13,21 +13,18 @@ PROWORKS_INOUT_SRC = solx86_iout.s PROWORKS_INOUT_OBJ = solx86_iout.o #endif -#if NewInput MOUSESRC = solx86_mouse.c MOUSEOBJ = solx86_mouse.o -#else -MOUSESRC = std_mouse.c std_mseEv.c -MOUSEOBJ = std_mouse.o std_mseEv.o -#endif SRCS = solx86_init.c solx86_vid.c solx86_bios.c sysv_io.c \ VTsw_usl.c sysv_kbd.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ - libc_wrapper.c $(PROWORKS_INOUT_SRC) stdResource.c + libc_wrapper.c $(PROWORKS_INOUT_SRC) stdResource.c stdPci.c \ + sigiostubs.c pm_noop.c kmod_noop.c OBJS = solx86_init.o solx86_vid.o solx86_bios.o sysv_io.o \ VTsw_usl.o sysv_kbd.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - libc_wrapper.o $(PROWORKS_INOUT_OBJ) stdResource.o + libc_wrapper.o $(PROWORKS_INOUT_OBJ) stdResource.o stdPci.o \ + sigiostubs.o pm_noop.o kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) @@ -43,13 +40,13 @@ NormalAsmObjectRule() LinkSourceFile(VTsw_usl.c,../shared) LinkSourceFile(sysv_kbd.c,../shared) LinkSourceFile(posix_tty.c,../shared) -#if !NewInput -LinkSourceFile(std_mouse.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -#endif LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(sysv_io.c,../sysv) LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile index 9297a77ed..ca5c6134a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile,v 3.17 1999/05/22 14:52:28 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile,v 3.21 2000/02/13 03:36:12 dawes Exp $ @@ -14,21 +14,18 @@ BIOS_MOD = bios_mmap BIOS_MOD = bios_devmem #endif -#if NewInput MOUSESRC = sysv_mouse.c MOUSEOBJ = sysv_mouse.o -#else -MOUSESRC = std_mouse.c std_mseEv.c -MOUSEOBJ = std_mouse.o std_mseEv.o -#endif SRCS = sysv_init.c sysv_video.c sysv_io.c $(BIOS_MOD).c VTsw_usl.c \ sysv_kbd.c std_kbdEv.c posix_tty.c $(MOUSESRC) xqueue.c \ - libc_wrapper.c stdResource.c vidmem.c + libc_wrapper.c stdResource.c stdPci.c vidmem.c sigiostubs.c pm_noop.c \ + kmod_noop.c OBJS = sysv_init.o sysv_video.o sysv_io.o $(BIOS_MOD).o VTsw_usl.o \ sysv_kbd.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) xqueue.o \ - libc_wrapper.o stdResource.o vidmem.o + libc_wrapper.o stdResource.o stdPci.o vidmem.o sigiostubs.o pm_noop.o \ + kmod_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi @@ -49,12 +46,12 @@ LinkSourceFile(VTsw_usl.c,../shared) LinkSourceFile(sysv_kbd.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) LinkSourceFile(posix_tty.c,../shared) -#if !NewInput -LinkSourceFile(std_mouse.c,../shared) -LinkSourceFile(std_mseEv.c,../shared) -#endif LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) +LinkSourceFile(stdPci.c,../shared) LinkSourceFile(vidmem.c,../shared) +LinkSourceFile(sigiostubs.c,../shared) +LinkSourceFile(pm_noop.c,../shared) +LinkSourceFile(kmod_noop.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h index 092cead2f..d190da8f6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h @@ -164,7 +164,7 @@ extern int xf86SetSerialModemState(int fd, int state); extern int xf86GetSerialModemState(int fd); extern int xf86SerialModemSetBits(int fd, int bits); extern int xf86SerialModemClearBits(int fd, int bits); - +extern int xf86LoadKernelModule(const char *pathname); #if defined(__alpha__) /* entry points for Mmio memory access routines */ |