#include "utils.h"
#include "dri_util.h"
-
-uint64_t
-driParseDebugString( const char * debug,
- const struct dri_debug_control * control )
-{
- uint64_t flag = 0;
-
- if ( debug != NULL ) {
- while( control->string != NULL ) {
- if ( !strcmp( debug, "all" ) ||
- strstr( debug, control->string ) != NULL ) {
- flag |= control->flag;
- }
-
- control++;
- }
- }
-
- return flag;
-}
-
-
-
/**
* Create the \c GL_RENDERER string for DRI drivers.
*
* \param msaa_samples Array of msaa sample count. 0 represents a visual
* without a multisample buffer.
* \param num_msaa_modes Number of entries in \c msaa_samples.
- * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or
- * \c GLX_DIRECT_COLOR.
+ * \param enable_accum Add an accum buffer to the configs
+ * \param color_depth_match Whether the color depth must match the zs depth
+ * This forces 32-bit color to have 24-bit depth, and
+ * 16-bit color to have 16-bit depth.
*
* \returns
* Pointer to any array of pointers to the \c __DRIconfig structures created
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
const uint8_t * msaa_samples, unsigned num_msaa_modes,
- GLboolean enable_accum)
+ GLboolean enable_accum, GLboolean color_depth_match)
{
static const uint32_t masks_table[][4] = {
/* MESA_FORMAT_B5G6R5_UNORM */
{ 0x3FF00000, 0x000FFC00, 0x000003FF, 0x00000000 },
/* MESA_FORMAT_B10G10R10A2_UNORM */
{ 0x3FF00000, 0x000FFC00, 0x000003FF, 0xC0000000 },
+ /* MESA_FORMAT_R8G8B8A8_UNORM */
+ { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 },
+ /* MESA_FORMAT_R8G8B8X8_UNORM */
+ { 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 },
};
const uint32_t * masks;
case MESA_FORMAT_B8G8R8A8_SRGB:
masks = masks_table[2];
break;
+ case MESA_FORMAT_R8G8B8A8_UNORM:
+ masks = masks_table[5];
+ break;
+ case MESA_FORMAT_R8G8B8X8_UNORM:
+ masks = masks_table[6];
+ break;
case MESA_FORMAT_B10G10R10X2_UNORM:
masks = masks_table[3];
break;
for ( i = 0 ; i < num_db_modes ; i++ ) {
for ( h = 0 ; h < num_msaa_modes; h++ ) {
for ( j = 0 ; j < num_accum_bits ; j++ ) {
+ if (color_depth_match &&
+ (depth_bits[k] || stencil_bits[k])) {
+ /* Depth can really only be 0, 16, 24, or 32. A 32-bit
+ * color format still matches 24-bit depth, as there
+ * is an implicit 8-bit stencil. So really we just
+ * need to make sure that color/depth are both 16 or
+ * both non-16.
+ */
+ if ((depth_bits[k] + stencil_bits[k] == 16) !=
+ (red_bits + green_bits + blue_bits + alpha_bits == 16))
+ continue;
+ }
+
*c = malloc (sizeof **c);
modes = &(*c)->modes;
c++;