/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.3
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 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"),
#include "imports.h"
#include "context.h"
+#include "version.h"
#define MAXSTRING 4000 /* for vsnprintf() */
/**
* Convert a 4-byte float to a 2-byte half float.
+ * Based on code from:
+ * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
*/
-GLhalfNV
+GLhalfARB
_mesa_float_to_half(float val)
{
- const int flt = *((int *) &val);
+ const int flt = *((int *) (void *) &val);
const int flt_m = flt & 0x7fffff;
const int flt_e = (flt >> 23) & 0xff;
const int flt_s = (flt >> 31) & 0x1;
- int s, e, m;
- GLhalfNV result;
+ int s, e, m = 0;
+ GLhalfARB result;
/* sign bit */
s = flt_s;
/* handle special cases */
if ((flt_e == 0) && (flt_m == 0)) {
/* zero */
- m = 0;
+ /* m = 0; - already set */
e = 0;
}
else if ((flt_e == 0) && (flt_m != 0)) {
/* denorm -- denorm float maps to 0 half */
- m = 0;
+ /* m = 0; - already set */
e = 0;
}
else if ((flt_e == 0xff) && (flt_m == 0)) {
/* infinity */
- m = 0;
+ /* m = 0; - already set */
e = 31;
}
else if ((flt_e == 0xff) && (flt_m != 0)) {
const int new_exp = flt_e - 127;
if (new_exp < -24) {
/* this maps to 0 */
- m = 0;
+ /* m = 0; - already set */
e = 0;
}
else if (new_exp < -14) {
case 0:
_mesa_warning(NULL,
"float_to_half: logical error in denorm creation!\n");
- m = 0;
+ /* m = 0; - already set */
break;
case 1: m = 512 + (flt_m >> 14); break;
case 2: m = 256 + (flt_m >> 15); break;
}
else if (new_exp > 15) {
/* map this value to infinity */
- m = 0;
+ /* m = 0; - already set */
e = 31;
}
else {
/**
* Convert a 2-byte half float to a 4-byte float.
+ * Based on code from:
+ * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
*/
float
-_mesa_half_to_float(GLhalfNV val)
+_mesa_half_to_float(GLhalfARB val)
{
/* XXX could also use a 64K-entry lookup table */
const int m = val & 0x3ff;
}
flt = (flt_s << 31) | (flt_e << 23) | flt_m;
- result = *((float *) &flt);
+ result = *((float *) (void *) &flt);
return result;
}
va_end( args );
#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86fprintf(stderr, "Mesa implementation error: %s\n", str);
- xf86fprintf(stderr, "Please report to the DRI project at dri.sourceforge.net\n");
+ xf86fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str);
+ xf86fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
#else
- fprintf(stderr, "Mesa implementation error: %s\n", str);
- fprintf(stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" );
+ fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str);
+ fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
#endif
}
{
char s[MAXSTRING];
va_list args;
+ (void) ctx;
va_start(args, fmtString);
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
{
int r;
va_list args;
+ (void) gc;
va_start( args, fmt );
r = vsprintf( str, fmt, args );
va_end( args );
static void * CAPI
default_fopen(__GLcontext *gc, const char *path, const char *mode)
{
+ (void) gc;
return fopen(path, mode);
}
static int CAPI
default_fclose(__GLcontext *gc, void *stream)
{
+ (void) gc;
return fclose((FILE *) stream);
}
{
int r;
va_list args;
+ (void) gc;
va_start( args, fmt );
r = vfprintf( (FILE *) stream, fmt, args );
va_end( args );
static __GLdrawablePrivate *
default_GetDrawablePrivate(__GLcontext *gc)
{
+ (void) gc;
return NULL;
}