From b5fbdef7ec3deb823ad1db8a7b7a731800082f75 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 9 Jan 2009 15:47:05 -0800 Subject: swrast: Enable GL_EXT_stencil_two_side --- src/mesa/drivers/dri/swrast/swrast.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/drivers/dri/swrast') diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 15b57244dcd..4197603871b 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -72,6 +72,7 @@ #define need_GL_EXT_framebuffer_blit #define need_GL_EXT_gpu_program_parameters #define need_GL_EXT_paletted_texture +#define need_GL_EXT_stencil_two_side #define need_GL_IBM_multimode_draw_arrays #define need_GL_MESA_resize_buffers #define need_GL_NV_vertex_program @@ -103,6 +104,7 @@ const struct dri_extension card_extensions[] = { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, + { "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions }, { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, -- cgit v1.2.3 From 474cda6fa912a766821d20b5b21d6eeba6ea9225 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 27 Jan 2009 18:16:51 -0800 Subject: Make GL_{EXT,SUN}_multi_draw_arrays and GL_IBM_multimode_draw_arrays mandatory Signed-off-by: Ian Romanick --- src/mesa/drivers/dri/common/utils.c | 4 ++++ src/mesa/drivers/dri/intel/intel_extensions.c | 2 -- src/mesa/drivers/dri/mga/mga_xmesa.c | 2 -- src/mesa/drivers/dri/r200/r200_context.c | 2 -- src/mesa/drivers/dri/r300/r300_context.c | 2 -- src/mesa/drivers/dri/swrast/swrast.c | 2 -- src/mesa/drivers/dri/tdfx/tdfx_context.c | 4 ---- src/mesa/drivers/glide/fxdd.c | 2 -- src/mesa/drivers/x11/xm_api.c | 2 -- src/mesa/main/extensions.c | 12 ++++++------ 10 files changed, 10 insertions(+), 24 deletions(-) (limited to 'src/mesa/drivers/dri/swrast') diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 3fd88ea8fba..04d334f278b 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -185,9 +185,11 @@ driGetRendererString( char * buffer, const char * hardware_name, #define need_GL_ARB_vertex_buffer_object #define need_GL_ARB_window_pos #define need_GL_EXT_compiled_vertex_array +#define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_polygon_offset #define need_GL_EXT_texture_object #define need_GL_EXT_vertex_array +#define need_GL_IBM_multimode_draw_arrays #define need_GL_MESA_window_pos /* These are needed in *all* drivers because Mesa internally implements @@ -207,9 +209,11 @@ static const struct dri_extension all_mesa_extensions[] = { { "GL_ARB_window_pos", GL_ARB_window_pos_functions }, { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions }, { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions }, + { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, { "GL_EXT_polygon_offset", GL_EXT_polygon_offset_functions }, { "GL_EXT_texture_object", GL_EXT_texture_object_functions }, { "GL_EXT_vertex_array", GL_EXT_vertex_array_functions }, + { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, { "GL_MESA_window_pos", GL_MESA_window_pos_functions }, { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, { NULL, NULL } diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index c963892d986..549b239bd31 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -45,7 +45,6 @@ #define need_GL_EXT_fog_coord #define need_GL_EXT_framebuffer_object #define need_GL_EXT_framebuffer_blit -#define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_point_parameters #define need_GL_EXT_secondary_color #define need_GL_EXT_stencil_two_side @@ -85,7 +84,6 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_blend_subtract", NULL }, { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, { "GL_EXT_packed_depth_stencil", NULL }, { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions }, { "GL_EXT_stencil_wrap", NULL }, diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 23ab5bca2d1..41fa9b29ffc 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -72,7 +72,6 @@ #define need_GL_ARB_vertex_program #define need_GL_EXT_fog_coord #define need_GL_EXT_gpu_program_parameters -#define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color #if 0 #define need_GL_EXT_paletted_texture @@ -385,7 +384,6 @@ static const struct dri_extension card_extensions[] = { "GL_ARB_texture_rectangle", NULL }, { "GL_EXT_blend_logic_op", NULL }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, /* paletted_textures currently doesn't work, but we could fix them later */ #if defined( need_GL_EXT_paletted_texture ) { "GL_EXT_shared_texture_palette", NULL }, diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 51b216a5f88..47ecd4b05a1 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -66,7 +66,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define need_GL_ATI_fragment_shader #define need_GL_EXT_blend_minmax #define need_GL_EXT_fog_coord -#define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color #define need_GL_EXT_blend_equation_separate #define need_GL_EXT_blend_func_separate @@ -127,7 +126,6 @@ const struct dri_extension card_extensions[] = { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, { "GL_EXT_blend_subtract", NULL }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions }, { "GL_EXT_stencil_wrap", NULL }, { "GL_EXT_texture_edge_clamp", NULL }, diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index bdf41e5392b..e74d29e5803 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -85,7 +85,6 @@ int hw_tcl_on = 1; #define need_GL_EXT_blend_minmax //#define need_GL_EXT_fog_coord #define need_GL_EXT_gpu_program_parameters -#define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color #define need_GL_EXT_stencil_two_side #define need_GL_ATI_separate_stencil @@ -113,7 +112,6 @@ const struct dri_extension card_extensions[] = { {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, {"GL_EXT_blend_subtract", NULL}, // {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions}, {"GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions}, {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, {"GL_EXT_shadow_funcs", NULL}, diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 4197603871b..07e4ba07104 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -73,7 +73,6 @@ #define need_GL_EXT_gpu_program_parameters #define need_GL_EXT_paletted_texture #define need_GL_EXT_stencil_two_side -#define need_GL_IBM_multimode_draw_arrays #define need_GL_MESA_resize_buffers #define need_GL_NV_vertex_program #define need_GL_NV_fragment_program @@ -105,7 +104,6 @@ const struct dri_extension card_extensions[] = { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, { "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions }, - { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index 1cebb59571f..aeb267a64a2 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -65,10 +65,8 @@ #define need_GL_EXT_blend_func_separate #define need_GL_EXT_blend_minmax #define need_GL_EXT_fog_coord -#define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_paletted_texture /* #define need_GL_EXT_secondary_color */ -#define need_GL_IBM_multimode_draw_arrays /* #define need_GL_MESA_program_debug */ /* #define need_GL_NV_vertex_program */ #include "extension_helper.h" @@ -84,13 +82,11 @@ const struct dri_extension card_extensions[] = { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, { "GL_EXT_shared_texture_palette", NULL }, { "GL_EXT_stencil_wrap", NULL }, { "GL_EXT_texture_env_add", NULL }, { "GL_EXT_texture_lod_bias", NULL }, - { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, #ifdef need_GL_ARB_point_parameters { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 2088f037dc7..e93ada28931 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1915,8 +1915,6 @@ fxDDInitExtensions(GLcontext * ctx) } /* core-level extensions */ - _mesa_enable_extension(ctx, "GL_EXT_multi_draw_arrays"); - _mesa_enable_extension(ctx, "GL_IBM_multimode_draw_arrays"); /* dangerous */ if (getenv("MESA_FX_ALLOW_VP")) { _mesa_enable_extension(ctx, "GL_ARB_vertex_program"); diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 18aa8bcc096..00ce3ba7237 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1325,7 +1325,6 @@ xmesa_convert_from_x_visual_type( int visualType ) #define need_GL_EXT_framebuffer_blit #define need_GL_EXT_gpu_program_parameters #define need_GL_EXT_paletted_texture -#define need_GL_IBM_multimode_draw_arrays #define need_GL_MESA_resize_buffers #define need_GL_NV_vertex_program #define need_GL_NV_fragment_program @@ -1355,7 +1354,6 @@ const struct dri_extension card_extensions[] = { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, - { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 0205a529aae..ec6ba708002 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -99,7 +99,7 @@ static const struct { { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) }, { OFF, "GL_EXT_histogram", F(EXT_histogram) }, - { OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, + { ON, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil) }, { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) }, { OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) }, @@ -141,7 +141,7 @@ static const struct { { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)}, { OFF, "GL_ATI_fragment_shader", F(ATI_fragment_shader)}, { OFF, "GL_ATI_separate_stencil", F(ATI_separate_stencil)}, - { OFF, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) }, + { ON, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) }, { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) }, { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) }, @@ -170,7 +170,7 @@ static const struct { { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, { OFF, "GL_SGIX_depth_texture", F(ARB_depth_texture) }, - { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, + { ON, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_S3_s3tc", F(S3_s3tc) }, }; @@ -253,7 +253,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_framebuffer_blit = GL_TRUE; #endif ctx->Extensions.EXT_histogram = GL_TRUE; - ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; + /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/ ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; ctx->Extensions.EXT_paletted_texture = GL_TRUE; #if FEATURE_EXT_pixel_buffer_object @@ -275,7 +275,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #endif ctx->Extensions.EXT_texture_swizzle = GL_TRUE; ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; - ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE; + /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/ ctx->Extensions.MESA_pack_invert = GL_TRUE; #if FEATURE_MESA_program_debug ctx->Extensions.MESA_program_debug = GL_TRUE; @@ -372,7 +372,7 @@ _mesa_enable_1_4_extensions(GLcontext *ctx) ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_blend_subtract = GL_TRUE; ctx->Extensions.EXT_fog_coord = GL_TRUE; - ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; + /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/ ctx->Extensions.EXT_point_parameters = GL_TRUE; ctx->Extensions.EXT_secondary_color = GL_TRUE; ctx->Extensions.EXT_stencil_wrap = GL_TRUE; -- cgit v1.2.3 From 3ee21f30cda27e0ee1357f930163526622ba9434 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jan 2009 14:57:49 -0800 Subject: intel: Expose more FBconfigs in the 3D driver. We can support any combination of (a8r8g8b8, x8r8g8b8, r5g6b5) x (z0,z24,z24s8) on either class of chipsets. The only restriction is no mixing bpp when also mixing tiling. This shouldn't be occurring currently. --- src/mesa/drivers/dri/common/utils.c | 3 +- src/mesa/drivers/dri/common/utils.h | 3 +- src/mesa/drivers/dri/intel/intel_screen.c | 54 +++++++++++++++++++++++++++++-- src/mesa/drivers/dri/swrast/swrast.c | 8 ++--- 4 files changed, 60 insertions(+), 8 deletions(-) (limited to 'src/mesa/drivers/dri/swrast') diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index e4d228c575e..d6de1c0e9bb 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -744,7 +744,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, return configs; } -const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b) +const __DRIconfig **driConcatConfigs(const __DRIconfig **a, + const __DRIconfig **b) { const __DRIconfig **all; int i, j, index; diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 0c974dbff3b..b0908e530a5 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -133,7 +133,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes); -const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b); +const __DRIconfig **driConcatConfigs(const __DRIconfig **a, + const __DRIconfig **b); int driGetConfigAttrib(const __DRIconfig *config, diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index fe890c390f3..aad53fb72d1 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -671,6 +671,17 @@ static const __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) { intelScreenPrivate *intelScreen; + GLenum fb_format[3]; + GLenum fb_type[3]; + /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't + * support pageflipping at all. + */ + static const GLenum back_buffer_modes[] = { + GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML + }; + uint8_t depth_bits[4], stencil_bits[4]; + int color; + const __DRIconfig **configs = NULL; /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure @@ -710,8 +721,47 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) intelScreen->irq_active = 1; psp->extensions = intelScreenExtensions; - return driConcatConfigs(intelFillInModes(psp, 16, 16, 0, 1), - intelFillInModes(psp, 32, 24, 8, 1)); + depth_bits[0] = 0; + stencil_bits[0] = 0; + depth_bits[1] = 16; + stencil_bits[1] = 0; + depth_bits[2] = 24; + stencil_bits[2] = 0; + depth_bits[3] = 24; + stencil_bits[3] = 8; + + fb_format[0] = GL_RGB; + fb_type[0] = GL_UNSIGNED_SHORT_5_6_5; + + fb_format[1] = GL_RGB; + fb_type[1] = GL_UNSIGNED_INT_8_8_8_8_REV; + + fb_format[2] = GL_RGBA; + fb_type[2] = GL_UNSIGNED_INT_8_8_8_8_REV; + + for (color = 0; color < ARRAY_SIZE(fb_format); color++) { + const __DRIconfig **new_configs; + + new_configs = (const __DRIconfig **) + driCreateConfigs(fb_format[color], fb_type[color], + depth_bits, + stencil_bits, + ARRAY_SIZE(depth_bits), + back_buffer_modes, + ARRAY_SIZE(back_buffer_modes)); + if (configs == NULL) + configs = new_configs; + else + configs = driConcatConfigs(configs, new_configs); + } + + if (configs == NULL) { + fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, + __LINE__); + return NULL; + } + + return configs; } const struct __DriverAPIRec driDriverAPI = { diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 07e4ba07104..390b8f918a2 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -127,7 +127,7 @@ setupLoaderExtensions(__DRIscreen *psp, } } -static __DRIconfig ** +static const __DRIconfig ** swrastFillInModes(__DRIscreen *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer) @@ -187,7 +187,7 @@ swrastFillInModes(__DRIscreen *psp, return NULL; } - return configs; + return (const __DRIconfig **)configs; } static __DRIscreen * @@ -196,7 +196,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, { static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; - __DRIconfig **configs8, **configs16, **configs32; + const __DRIconfig **configs8, **configs16, **configs32; (void) data; @@ -215,7 +215,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, configs16 = swrastFillInModes(psp, 16, 16, 0, 1); configs32 = swrastFillInModes(psp, 32, 24, 8, 1); - configs16 = (__DRIconfig **)driConcatConfigs(configs8, configs16); + configs16 = driConcatConfigs(configs8, configs16); *driver_configs = driConcatConfigs(configs16, configs32); -- cgit v1.2.3 From 529d1d720e1422bad1880ef33fae1c9423112d2e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 3 Feb 2009 19:29:11 -0800 Subject: swrast: Add support for x8r8g8b8 fbconfig. This lets swrast produce an fbconfig suitable for the root visual now that the server's not allowing mismatched fbconfigs. --- src/mesa/drivers/dri/swrast/swrast.c | 72 ++++++++++++++++++------------- src/mesa/drivers/dri/swrast/swrast_priv.h | 10 +++-- src/mesa/drivers/dri/swrast/swrast_span.c | 72 +++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 33 deletions(-) (limited to 'src/mesa/drivers/dri/swrast') diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 390b8f918a2..a90b30b49d3 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -164,17 +164,27 @@ swrastFillInModes(__DRIscreen *psp, depth_buffer_factor = 4; back_buffer_factor = 2; - if (pixel_bits == 8) { + switch (pixel_bits) { + case 8: fb_format = GL_RGB; fb_type = GL_UNSIGNED_BYTE_2_3_3_REV; - } - else if (pixel_bits == 16) { + break; + case 16: fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { + break; + case 24: + fb_format = GL_BGR; + fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + case 32: fb_format = GL_BGRA; fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + default: + fprintf(stderr, "[%s:%u] bad depth %d\n", __func__, __LINE__, + pixel_bits); + return NULL; } configs = driCreateConfigs(fb_format, fb_type, @@ -196,7 +206,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, { static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; - const __DRIconfig **configs8, **configs16, **configs32; + const __DRIconfig **configs8, **configs16, **configs24, **configs32; (void) data; @@ -213,11 +223,12 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, configs8 = swrastFillInModes(psp, 8, 8, 0, 1); configs16 = swrastFillInModes(psp, 16, 16, 0, 1); + configs24 = swrastFillInModes(psp, 24, 24, 8, 1); configs32 = swrastFillInModes(psp, 32, 24, 8, 1); configs16 = driConcatConfigs(configs8, configs16); - - *driver_configs = driConcatConfigs(configs16, configs32); + configs24 = driConcatConfigs(configs16, configs24); + *driver_configs = driConcatConfigs(configs24, configs32); driInitExtensions( NULL, card_extensions, GL_FALSE ); @@ -249,19 +260,24 @@ static GLuint choose_pixel_format(const GLvisual *v) { if (v->rgbMode) { - int bpp = v->rgbBits; + int depth = v->rgbBits; - if (bpp == 32 + if (depth == 32 && v->redMask == 0xff0000 && v->greenMask == 0x00ff00 && v->blueMask == 0x0000ff) return PF_A8R8G8B8; - else if (bpp == 16 + else if (depth == 24 + && v->redMask == 0xff0000 + && v->greenMask == 0x00ff00 + && v->blueMask == 0x0000ff) + return PF_X8R8G8B8; + else if (depth == 16 && v->redMask == 0xf800 && v->greenMask == 0x07e0 && v->blueMask == 0x001f) return PF_R5G6B5; - else if (bpp == 8 + else if (depth == 8 && v->redMask == 0x07 && v->greenMask == 0x38 && v->blueMask == 0xc0) @@ -290,7 +306,6 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); - int bpp; unsigned mask = PITCH_ALIGN_BITS - 1; TRACE; @@ -299,23 +314,8 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->Width = width; rb->Height = height; - switch (internalFormat) { - case GL_RGB: - bpp = rb->RedBits + rb->GreenBits + rb->BlueBits; - break; - case GL_RGBA: - bpp = rb->RedBits + rb->GreenBits + rb->BlueBits + rb->AlphaBits; - break; - case GL_COLOR_INDEX8_EXT: - bpp = rb->IndexBits; - break; - default: - _mesa_problem( NULL, "unexpected format in %s", __FUNCTION__ ); - return GL_FALSE; - } - /* always pad to PITCH_ALIGN_BITS */ - xrb->pitch = ((width * bpp + mask) & ~mask) / 8; + xrb->pitch = ((width * xrb->bpp + mask) & ~mask) / 8; return GL_TRUE; } @@ -371,6 +371,17 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) xrb->Base.GreenBits = 8 * sizeof(GLubyte); xrb->Base.BlueBits = 8 * sizeof(GLubyte); xrb->Base.AlphaBits = 8 * sizeof(GLubyte); + xrb->bpp = 32; + break; + case PF_X8R8G8B8: + xrb->Base.InternalFormat = GL_RGB; + xrb->Base._BaseFormat = GL_RGB; + xrb->Base.DataType = GL_UNSIGNED_BYTE; + xrb->Base.RedBits = 8 * sizeof(GLubyte); + xrb->Base.GreenBits = 8 * sizeof(GLubyte); + xrb->Base.BlueBits = 8 * sizeof(GLubyte); + xrb->Base.AlphaBits = 0; + xrb->bpp = 32; break; case PF_R5G6B5: xrb->Base.InternalFormat = GL_RGB; @@ -380,6 +391,7 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) xrb->Base.GreenBits = 6 * sizeof(GLubyte); xrb->Base.BlueBits = 5 * sizeof(GLubyte); xrb->Base.AlphaBits = 0; + xrb->bpp = 16; break; case PF_R3G3B2: xrb->Base.InternalFormat = GL_RGB; @@ -389,12 +401,14 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) xrb->Base.GreenBits = 3 * sizeof(GLubyte); xrb->Base.BlueBits = 2 * sizeof(GLubyte); xrb->Base.AlphaBits = 0; + xrb->bpp = 8; break; case PF_CI8: xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT; xrb->Base._BaseFormat = GL_COLOR_INDEX; xrb->Base.DataType = GL_UNSIGNED_BYTE; xrb->Base.IndexBits = 8 * sizeof(GLubyte); + xrb->bpp = 8; break; default: return NULL; diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h index a707ffc40a8..1a5fb31d5a8 100644 --- a/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -90,6 +90,8 @@ struct swrast_renderbuffer { /* renderbuffer pitch (in bytes) */ GLuint pitch; + /* bits per pixel of storage */ + GLuint bpp; }; static INLINE __DRIcontext * @@ -115,10 +117,10 @@ swrast_renderbuffer(struct gl_renderbuffer *rb) * Pixel formats we support */ #define PF_CI8 1 /**< Color Index mode */ -#define PF_A8R8G8B8 2 /**< 32-bit TrueColor: 8-A, 8-R, 8-G, 8-B bits */ -#define PF_R5G6B5 3 /**< 16-bit TrueColor: 5-R, 6-G, 5-B bits */ -#define PF_R3G3B2 4 /**< 8-bit TrueColor: 3-R, 3-G, 2-B bits */ - +#define PF_A8R8G8B8 2 /**< 32bpp TrueColor: 8-A, 8-R, 8-G, 8-B bits */ +#define PF_R5G6B5 3 /**< 16bpp TrueColor: 5-R, 6-G, 5-B bits */ +#define PF_R3G3B2 4 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */ +#define PF_X8R8G8B8 5 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */ /** * Renderbuffer pitch alignment (in bits). diff --git a/src/mesa/drivers/dri/swrast/swrast_span.c b/src/mesa/drivers/dri/swrast/swrast_span.c index 5e990368b2e..2d3c25dcbef 100644 --- a/src/mesa/drivers/dri/swrast/swrast_span.c +++ b/src/mesa/drivers/dri/swrast/swrast_span.c @@ -79,6 +79,24 @@ static const GLubyte kernel[16] = { DST[BCOMP] = SRC[0] +/* 32-bit BGRX */ +#define STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) \ + DST[3] = 0xff; \ + DST[2] = VALUE[RCOMP]; \ + DST[1] = VALUE[GCOMP]; \ + DST[0] = VALUE[BCOMP] +#define STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE) \ + DST[3] = 0xff; \ + DST[2] = VALUE[RCOMP]; \ + DST[1] = VALUE[GCOMP]; \ + DST[0] = VALUE[BCOMP] +#define FETCH_PIXEL_X8R8G8B8(DST, SRC) \ + DST[ACOMP] = 0xff; \ + DST[RCOMP] = SRC[2]; \ + DST[GCOMP] = SRC[1]; \ + DST[BCOMP] = SRC[0] + + /* 16-bit BGR */ #define STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) \ do { \ @@ -139,6 +157,24 @@ static const GLubyte kernel[16] = { #include "swrast/s_spantemp.h" +/* 32-bit BGRX */ +#define NAME(FUNC) FUNC##_X8R8G8B8 +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 4; +#define INC_PIXEL_PTR(P) P += 4 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) +#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ + STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE) +#define FETCH_PIXEL(DST, SRC) \ + FETCH_PIXEL_X8R8G8B8(DST, SRC) + +#include "swrast/s_spantemp.h" + + /* 16-bit BGR */ #define NAME(FUNC) FUNC##_R5G6B5 #define RB_TYPE GLubyte @@ -210,6 +246,24 @@ static const GLubyte kernel[16] = { #include "swrast_spantemp.h" +/* 32-bit BGRX */ +#define NAME(FUNC) FUNC##_X8R8G8B8_front +#define RB_TYPE GLubyte +#define SPAN_VARS \ + struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)row; +#define INC_PIXEL_PTR(P) P += 4 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) +#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ + STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE) +#define FETCH_PIXEL(DST, SRC) \ + FETCH_PIXEL_X8R8G8B8(DST, SRC) + +#include "swrast_spantemp.h" + + /* 16-bit BGR */ #define NAME(FUNC) FUNC##_R5G6B5_front #define RB_TYPE GLubyte @@ -279,6 +333,15 @@ swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb, xrb->Base.PutValues = put_values_A8R8G8B8; xrb->Base.PutMonoValues = put_mono_values_A8R8G8B8; break; + case PF_X8R8G8B8: + xrb->Base.GetRow = get_row_X8R8G8B8; + xrb->Base.GetValues = get_values_X8R8G8B8; + xrb->Base.PutRow = put_row_X8R8G8B8; + xrb->Base.PutRowRGB = put_row_rgb_X8R8G8B8; + xrb->Base.PutMonoRow = put_mono_row_X8R8G8B8; + xrb->Base.PutValues = put_values_X8R8G8B8; + xrb->Base.PutMonoValues = put_mono_values_X8R8G8B8; + break; case PF_R5G6B5: xrb->Base.GetRow = get_row_R5G6B5; xrb->Base.GetValues = get_values_R5G6B5; @@ -334,6 +397,15 @@ swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb, xrb->Base.PutValues = put_values_A8R8G8B8_front; xrb->Base.PutMonoValues = put_mono_values_A8R8G8B8_front; break; + case PF_X8R8G8B8: + xrb->Base.GetRow = get_row_X8R8G8B8_front; + xrb->Base.GetValues = get_values_X8R8G8B8_front; + xrb->Base.PutRow = put_row_X8R8G8B8_front; + xrb->Base.PutRowRGB = put_row_rgb_X8R8G8B8_front; + xrb->Base.PutMonoRow = put_mono_row_X8R8G8B8_front; + xrb->Base.PutValues = put_values_X8R8G8B8_front; + xrb->Base.PutMonoValues = put_mono_values_X8R8G8B8_front; + break; case PF_R5G6B5: xrb->Base.GetRow = get_row_R5G6B5_front; xrb->Base.GetValues = get_values_R5G6B5_front; -- cgit v1.2.3 From eaf15db895e3a5c6c5ccc2f23a4f0fa522855868 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 10 Feb 2009 13:47:49 +0100 Subject: gallium: Fixups for driCreateConfigs MSAA support. Add the MSAA samples array or make sure its contents are initialized. --- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 2 ++ src/mesa/drivers/dri/i810/i810screen.c | 2 ++ src/mesa/drivers/dri/intel/intel_screen.c | 4 ++++ src/mesa/drivers/dri/mach64/mach64_screen.c | 2 ++ src/mesa/drivers/dri/mga/mga_xmesa.c | 2 ++ src/mesa/drivers/dri/r128/r128_screen.c | 2 ++ src/mesa/drivers/dri/radeon/radeon_screen.c | 4 +++- src/mesa/drivers/dri/savage/savage_xmesa.c | 2 ++ src/mesa/drivers/dri/sis/sis_screen.c | 2 ++ src/mesa/drivers/dri/swrast/swrast.c | 5 ++++- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 2 ++ src/mesa/drivers/dri/unichrome/via_screen.c | 2 +- 12 files changed, 28 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/dri/swrast') diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index eb086e3055a..00bdcec7a69 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -642,6 +642,8 @@ ffbFillInModes( __DRIscreenPrivate *psp, stencil_bits_array[1] = 0; stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; back_buffer_factor = (have_back_buffer) ? 3 : 1; diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 6d7cf1f38b2..9a5a39c1dbc 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -89,6 +89,8 @@ i810FillInModes( __DRIscreenPrivate *psp, stencil_bits_array[0] = 0; stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index f29e0e966b7..4c06170cdf3 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -495,6 +495,8 @@ intelFillInModes(__DRIscreenPrivate *psp, stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; back_buffer_factor = (have_back_buffer) ? 3 : 1; @@ -733,6 +735,8 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) depth_bits[3] = 24; stencil_bits[3] = 8; + msaa_samples_array[0] = 0; + fb_format[0] = GL_RGB; fb_type[0] = GL_UNSIGNED_SHORT_5_6_5; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 59a35738985..43e59594dd5 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -105,6 +105,8 @@ mach64FillInModes( __DRIscreenPrivate *psp, stencil_bits_array[0] = 0; stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 98185a6c9e9..926534d6dff 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -144,6 +144,8 @@ mgaFillInModes( __DRIscreenPrivate *psp, stencil_bits_array[1] = 0; stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index e72ca45be98..7cda4ca5d38 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -434,6 +434,8 @@ r128FillInModes( __DRIscreenPrivate *psp, stencil_bits_array[0] = 0; stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index b52a084777b..56c22faafa7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -288,6 +288,8 @@ radeonFillInModes( __DRIscreenPrivate *psp, stencil_bits_array[0] = 0; stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; @@ -304,7 +306,7 @@ radeonFillInModes( __DRIscreenPrivate *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1); if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index ba4008e6447..326d595352f 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -922,6 +922,8 @@ savageFillInModes( __DRIscreenPrivate *psp, stencil_bits_array[0] = 0; stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index e31b5223f7a..9eb27fef087 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -88,6 +88,8 @@ sisFillInModes(__DRIscreenPrivate *psp, int bpp) depth_bits_array[3] = 32; stencil_bits_array[3] = 0; + msaa_samples_array[0] = 0; + depth_buffer_factor = 4; back_buffer_factor = 2; diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index a90b30b49d3..b00f4ff2fe2 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -147,6 +147,7 @@ swrastFillInModes(__DRIscreen *psp, uint8_t depth_bits_array[4]; uint8_t stencil_bits_array[4]; + uint8_t msaa_samples_array[1]; depth_bits_array[0] = 0; depth_bits_array[1] = 0; @@ -161,6 +162,8 @@ swrastFillInModes(__DRIscreen *psp, stencil_bits_array[2] = 0; stencil_bits_array[3] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = 4; back_buffer_factor = 2; @@ -190,7 +193,7 @@ swrastFillInModes(__DRIscreen *psp, configs = driCreateConfigs(fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, - back_buffer_factor); + back_buffer_factor, msaa_samples_array, 1); if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 90a4a2c3c07..6d509a4d883 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -378,6 +378,8 @@ tdfxFillInModes(__DRIscreenPrivate *psp, stencil_bits_array[3] = 8; } + msaa_samples_array[0] = 0; + return driCreateConfigs( deep ? GL_RGBA : GL_RGB, deep ? GL_UNSIGNED_INT_8_8_8_8 : GL_UNSIGNED_SHORT_5_6_5, diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index c25b87b4a42..e9f566161c2 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -342,7 +342,7 @@ viaFillInModes( __DRIscreenPrivate *psp, */ static const uint8_t depth_bits_array[4] = { 0, 16, 24, 32 }; static const uint8_t stencil_bits_array[4] = { 0, 0, 8, 0 }; - uint8_t msaa_samples_array[1]; + uint8_t msaa_samples_array[1] = { 0 }; const unsigned depth_buffer_factor = 3; if ( pixel_bits == 16 ) { -- cgit v1.2.3 From 5d5ae371eaeca7e33e638af3aee1ae8e162db0a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Feb 2009 14:30:38 -0800 Subject: intel: Add x8r8g8b8 visuals to DRI1 fbconfigs alongside a8r8gb8. This involved fixing driConcatConfigs to not return const (which had made a mess of a previous patch too). --- src/mesa/drivers/dri/common/utils.c | 6 ++-- src/mesa/drivers/dri/common/utils.h | 4 +-- src/mesa/drivers/dri/intel/intel_screen.c | 60 ++++++++++++++++++------------- src/mesa/drivers/dri/swrast/swrast.c | 9 ++--- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 17 ++++----- 5 files changed, 54 insertions(+), 42 deletions(-) (limited to 'src/mesa/drivers/dri/swrast') diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 5175ab0abbf..6b44ed9a673 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -754,10 +754,10 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, return configs; } -const __DRIconfig **driConcatConfigs(const __DRIconfig **a, - const __DRIconfig **b) +__DRIconfig **driConcatConfigs(__DRIconfig **a, + __DRIconfig **b) { - const __DRIconfig **all; + __DRIconfig **all; int i, j, index; i = 0; diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index a4ef5092478..9e9e5bc224b 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -134,8 +134,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, const GLenum * db_modes, unsigned num_db_modes, const uint8_t * msaa_samples, unsigned num_msaa_modes); -const __DRIconfig **driConcatConfigs(const __DRIconfig **a, - const __DRIconfig **b); +__DRIconfig **driConcatConfigs(__DRIconfig **a, + __DRIconfig **b); int driGetConfigAttrib(const __DRIconfig *config, diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 4c06170cdf3..a52271158c6 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -465,8 +465,6 @@ intelFillInModes(__DRIscreenPrivate *psp, __GLcontextModes *m; unsigned depth_buffer_factor; unsigned back_buffer_factor; - GLenum fb_format; - GLenum fb_type; int i; /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't @@ -501,20 +499,33 @@ intelFillInModes(__DRIscreenPrivate *psp, back_buffer_factor = (have_back_buffer) ? 3 : 1; if (pixel_bits == 16) { - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_SHORT_5_6_5; + configs = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor, + msaa_samples_array, 1); } else { - fb_format = GL_BGRA; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; + __DRIconfig **configs_a8r8g8b8; + __DRIconfig **configs_x8r8g8b8; + + configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + depth_bits_array, + stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, + back_buffer_factor, + msaa_samples_array, 1); + configs_x8r8g8b8 = driCreateConfigs(GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV, + depth_bits_array, + stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, + back_buffer_factor, + msaa_samples_array, 1); + configs = driConcatConfigs(configs_a8r8g8b8, configs_x8r8g8b8); } - configs = driCreateConfigs(fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, back_buffer_modes, - back_buffer_factor, - msaa_samples_array, 1); - if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); @@ -686,7 +697,7 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) }; uint8_t depth_bits[4], stencil_bits[4], msaa_samples_array[1]; int color; - const __DRIconfig **configs = NULL; + __DRIconfig **configs = NULL; /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure @@ -747,17 +758,16 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) fb_type[2] = GL_UNSIGNED_INT_8_8_8_8_REV; for (color = 0; color < ARRAY_SIZE(fb_format); color++) { - const __DRIconfig **new_configs; - - new_configs = (const __DRIconfig **) - driCreateConfigs(fb_format[color], fb_type[color], - depth_bits, - stencil_bits, - ARRAY_SIZE(depth_bits), - back_buffer_modes, - ARRAY_SIZE(back_buffer_modes), - msaa_samples_array, ARRAY_SIZE(msaa_samples_array)); - + __DRIconfig **new_configs; + + new_configs = driCreateConfigs(fb_format[color], fb_type[color], + depth_bits, + stencil_bits, + ARRAY_SIZE(depth_bits), + back_buffer_modes, + ARRAY_SIZE(back_buffer_modes), + msaa_samples_array, + ARRAY_SIZE(msaa_samples_array)); if (configs == NULL) configs = new_configs; else @@ -770,7 +780,7 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) return NULL; } - return configs; + return (const __DRIconfig **)configs; } const struct __DriverAPIRec driDriverAPI = { diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index b00f4ff2fe2..2e7f11327e6 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -127,7 +127,7 @@ setupLoaderExtensions(__DRIscreen *psp, } } -static const __DRIconfig ** +static __DRIconfig ** swrastFillInModes(__DRIscreen *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer) @@ -200,7 +200,7 @@ swrastFillInModes(__DRIscreen *psp, return NULL; } - return (const __DRIconfig **)configs; + return configs; } static __DRIscreen * @@ -209,7 +209,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, { static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; - const __DRIconfig **configs8, **configs16, **configs24, **configs32; + __DRIconfig **configs8, **configs16, **configs24, **configs32; (void) data; @@ -231,7 +231,8 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, configs16 = driConcatConfigs(configs8, configs16); configs24 = driConcatConfigs(configs16, configs24); - *driver_configs = driConcatConfigs(configs24, configs32); + *driver_configs = (const __DRIconfig **) + driConcatConfigs(configs24, configs32); driInitExtensions( NULL, card_extensions, GL_FALSE ); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 6d509a4d883..5f2f5cfff51 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -380,14 +380,15 @@ tdfxFillInModes(__DRIscreenPrivate *psp, msaa_samples_array[0] = 0; - return driCreateConfigs( - deep ? GL_RGBA : GL_RGB, - deep ? GL_UNSIGNED_INT_8_8_8_8 : GL_UNSIGNED_SHORT_5_6_5, - depth_bits_array, - stencil_bits_array, - deep ? 2 : 4, - db_modes, 2, - msaa_samples_array, 1); + return (const __DRIconfig **) + driCreateConfigs(deep ? GL_RGBA : GL_RGB, + deep ? GL_UNSIGNED_INT_8_8_8_8 : + GL_UNSIGNED_SHORT_5_6_5, + depth_bits_array, + stencil_bits_array, + deep ? 2 : 4, + db_modes, 2, + msaa_samples_array, 1); } /** -- cgit v1.2.3