argument of a message to print. Make some assert(0)s use sis_fatal_error.
addr = sisAllocFB( smesa, totalBytes, &smesa->zbFree );
if (addr == NULL)
- {
- fprintf (stderr, "SIS driver : out of video memory\n");
- sis_fatal_error ();
- }
+ sis_fatal_error("Failure to allocate Z buffer.\n");
if (SIS_VERBOSE & VERBOSE_SIS_BUFFER) {
fprintf(stderr, "sis_alloc_z_stencil_buffer: addr=%p\n", addr);
/* Fixme: unique context alloc/free back-buffer? */
addr = sisAllocFB( smesa, size, &smesa->bbFree );
if (addr == NULL)
- {
- fprintf (stderr, "SIS driver : out of video memory\n");
- sis_fatal_error ();
- }
+ sis_fatal_error("Failure to allocate back buffer.\n");
addr = (char *)ALIGNMENT( (unsigned long)addr, DRAW_BUFFER_HW_ALIGNMENT );
smesa->clearColorPattern |= smesa->clearColorPattern << 16;
break;
default:
- assert(0);
+ sis_fatal_error("Bad dst color format\n");
}
}
zPattern = FLOAT_TO_UINT(z);
break;
default:
- assert(0);
+ sis_fatal_error("Bad Z format\n");
}
smesa->clearZStencilPattern = zPattern;
}
smesa->colorFormat = DST_FORMAT_RGB_565;
break;
default:
- assert (0);
+ sis_fatal_error("Bad bytesPerPixel.\n");
}
/* Parse configuration files */
smesa->GlobalFlag &= ~GFLAG_TEXTURE_STATES;
}
-void
-sis_fatal_error (void)
-{
- /* free video memory, or the framebuffer device will do it automatically */
-
- fprintf(stderr, "Fatal errors in sis_dri.so\n");
- exit (-1);
-}
*(GLint *)(GET_IOBase(smesa) + 0x8b60) = (GLint)(-1); \
}
+#define sis_fatal_error(msg) \
+do { \
+ fprintf(stderr, "[%s:%d]: %s", __FILE__, __LINE__, msg); \
+ exit(-1); \
+} while (0)
+
/* Lock required */
#define mWait3DCmdQueue(wLen) \
/* Update the mirrored queue pointer if it doesn't indicate enough space */ \
extern void sis_update_texture_state( sisContextPtr smesa );
extern void sis_update_render_state( sisContextPtr smesa );
-void sis_fatal_error (void);
-
#endif
z_depth = 4;
break;
default:
- assert( 0 );
+ sis_fatal_error("Bad Z format\n");
}
current->hwZ &= ~MASK_ZBufferPitch;
swdd->ReadRGBAPixels = sisReadRGBAPixels_8888;
break;
default:
- assert(0);
+ sis_fatal_error("Bad bytesPerPixel.\n");
break;
}
t->hwformat = TEXEL_ARGB_0888_32;
break;
default:
- assert(0);
+ sis_fatal_error("Bad texture format.\n");
}
}
assert(t->format == image->Format);
addr = sisAllocFB( smesa, size, &t->image[level].handle );
if (addr == NULL) {
addr = sisAllocAGP( smesa, size, &t->image[level].handle );
- if (addr == NULL) {
- fprintf (stderr, "SIS driver : out of video/agp memory\n");
- sis_fatal_error();
- }
+ if (addr == NULL)
+ sis_fatal_error("Failure to allocate texture memory.\n");
t->image[level].memType = AGP_TYPE;
}
else