summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/compiler.h2
-rw-r--r--src/mesa/main/config.h3
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/main/dd.h20
-rw-r--r--src/mesa/main/dlopen.c14
-rw-r--r--src/mesa/main/fog.c11
-rw-r--r--src/mesa/main/framebuffer.c26
-rw-r--r--src/mesa/main/framebuffer.h5
-rw-r--r--src/mesa/main/get.c17
-rw-r--r--src/mesa/main/get_gen.py5
-rw-r--r--src/mesa/main/light.c20
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/points.c11
-rw-r--r--src/mesa/main/texgen.c6
-rw-r--r--src/mesa/main/texobj.c2
-rw-r--r--src/mesa/main/texparam.c25
16 files changed, 119 insertions, 55 deletions
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 87c3b2e562..4eb249b4af 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -234,7 +234,7 @@ extern "C" {
#elif defined(__APPLE__)
#include <CoreFoundation/CFByteOrder.h>
#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
-#elif defined(_AIX)
+#elif (defined(_AIX) || defined(__blrts))
#define CPU_TO_LE32( x ) x = ((x & 0x000000ff) << 24) | \
((x & 0x0000ff00) << 8) | \
((x & 0x00ff0000) >> 8) | \
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index c5048970cc..2eac1cc2ed 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -243,7 +243,8 @@
/*@{*/
#define MAX_VERTEX_GENERIC_ATTRIBS 16
#define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS
-#define MAX_COMBINED_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS
+#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_VERTEX_TEXTURE_IMAGE_UNITS + \
+ MAX_TEXTURE_IMAGE_UNITS)
/*@}*/
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 03fc57e665..5c20ce017f 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -564,10 +564,6 @@ _mesa_init_constants(GLcontext *ctx)
/* GL_ARB_draw_buffers */
ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS;
- /* GL_OES_read_format */
- ctx->Const.ColorReadFormat = GL_RGBA;
- ctx->Const.ColorReadType = GL_UNSIGNED_BYTE;
-
#if FEATURE_EXT_framebuffer_object
ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
ctx->Const.MaxRenderbufferSize = MAX_WIDTH;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 27ed921761..6dadf5c079 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -182,7 +182,7 @@ struct dd_function_table {
*
* This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
* functions. The driver should examine \p internalFormat and return a
- * pointer to an appropriate gl_texture_format.
+ * gl_format value.
*/
GLuint (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat,
GLenum srcFormat, GLenum srcType );
@@ -538,11 +538,6 @@ struct dd_function_table {
struct gl_texture_object *t );
/**
- * Called by glActiveTextureARB() to set current texture unit.
- */
- void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
-
- /**
* Called when the texture's color lookup table is changed.
*
* If \p tObj is NULL then the shared texture palette
@@ -766,13 +761,13 @@ struct dd_function_table {
/* May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
*/
- void * (*MapBufferRange)( GLcontext *ctx, GLenum target,
- GLintptr offset, GLsizeiptr length, GLbitfield access,
+ void * (*MapBufferRange)( GLcontext *ctx, GLenum target, GLintptr offset,
+ GLsizeiptr length, GLbitfield access,
struct gl_buffer_object *obj);
- void (*FlushMappedBufferRange) (GLcontext *ctx, GLenum target,
- GLintptr offset, GLsizeiptr length,
- struct gl_buffer_object *obj);
+ void (*FlushMappedBufferRange)(GLcontext *ctx, GLenum target,
+ GLintptr offset, GLsizeiptr length,
+ struct gl_buffer_object *obj);
GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target,
struct gl_buffer_object *obj );
@@ -787,7 +782,8 @@ struct dd_function_table {
struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name);
struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name);
void (*BindFramebuffer)(GLcontext *ctx, GLenum target,
- struct gl_framebuffer *fb, struct gl_framebuffer *fbread);
+ struct gl_framebuffer *drawFb,
+ struct gl_framebuffer *readFb);
void (*FramebufferRenderbuffer)(GLcontext *ctx,
struct gl_framebuffer *fb,
GLenum attachment,
diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c
index 414cfad8e2..81e032081d 100644
--- a/src/mesa/main/dlopen.c
+++ b/src/mesa/main/dlopen.c
@@ -31,7 +31,7 @@
#include "compiler.h"
#include "dlopen.h"
-#if defined(_GNU_SOURCE) && !defined(__MINGW32__)
+#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts)
#include <dlfcn.h>
#endif
#if defined(_WIN32)
@@ -46,7 +46,9 @@
void *
_mesa_dlopen(const char *libname, int flags)
{
-#if defined(_GNU_SOURCE)
+#if defined(__blrts)
+ return NULL;
+#elif defined(_GNU_SOURCE)
flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
return dlopen(libname, flags);
#elif defined(__MINGW32__)
@@ -65,7 +67,9 @@ _mesa_dlopen(const char *libname, int flags)
GenericFunc
_mesa_dlsym(void *handle, const char *fname)
{
-#if defined(__DJGPP__)
+#if defined(__blrts)
+ return (GenericFunc) NULL;
+#elif defined(__DJGPP__)
/* need '_' prefix on symbol names */
char fname2[1000];
fname2[0] = '_';
@@ -88,7 +92,9 @@ _mesa_dlsym(void *handle, const char *fname)
void
_mesa_dlclose(void *handle)
{
-#if defined(_GNU_SOURCE)
+#if defined(__blrts)
+ (void) handle;
+#elif defined(_GNU_SOURCE)
dlclose(handle);
#elif defined(__MINGW32__)
FreeLibrary(handle);
diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c
index 4323d3db82..269ff3f8b9 100644
--- a/src/mesa/main/fog.c
+++ b/src/mesa/main/fog.c
@@ -34,15 +34,20 @@
void GLAPIENTRY
_mesa_Fogf(GLenum pname, GLfloat param)
{
- _mesa_Fogfv(pname, &param);
+ GLfloat fparam[4];
+ fparam[0] = param;
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
+ _mesa_Fogfv(pname, fparam);
}
void GLAPIENTRY
_mesa_Fogi(GLenum pname, GLint param )
{
- GLfloat fparam = (GLfloat) param;
- _mesa_Fogfv(pname, &fparam);
+ GLfloat fparam[4];
+ fparam[0] = (GLfloat) param;
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
+ _mesa_Fogfv(pname, fparam);
}
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 154dedacd5..d958dbf7d4 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -969,3 +969,29 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
/* OK */
return GL_TRUE;
}
+
+GLenum
+_mesa_get_color_read_format(GLcontext *ctx)
+{
+ switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
+ case MESA_FORMAT_ARGB8888:
+ return GL_BGRA;
+ case MESA_FORMAT_RGB565:
+ return GL_BGR;
+ default:
+ return GL_RGBA;
+ }
+}
+
+GLenum
+_mesa_get_color_read_type(GLcontext *ctx)
+{
+ switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
+ case MESA_FORMAT_ARGB8888:
+ return GL_UNSIGNED_BYTE;
+ case MESA_FORMAT_RGB565:
+ return GL_UNSIGNED_SHORT_5_6_5_REV;
+ default:
+ return GL_UNSIGNED_BYTE;
+ }
+}
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index 45a4703ba9..ef21dd98e8 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -81,5 +81,10 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format);
extern GLboolean
_mesa_dest_buffer_exists(GLcontext *ctx, GLenum format);
+extern GLenum
+_mesa_get_color_read_type(GLcontext *ctx);
+
+extern GLenum
+_mesa_get_color_read_format(GLcontext *ctx);
#endif /* FRAMEBUFFER_H */
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index e8932f83b6..3d32649bad 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -13,6 +13,7 @@
#include "mtypes.h"
#include "state.h"
#include "texcompress.h"
+#include "framebuffer.h"
#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
@@ -1767,11 +1768,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
CHECK_EXT1(OES_read_format, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType);
+ params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_type(ctx));
break;
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
CHECK_EXT1(OES_read_format, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat);
+ params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_format(ctx));
break;
case GL_NUM_FRAGMENT_REGISTERS_ATI:
CHECK_EXT1(ATI_fragment_shader, "GetBooleanv");
@@ -3602,11 +3603,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
CHECK_EXT1(OES_read_format, "GetFloatv");
- params[0] = (GLfloat)(ctx->Const.ColorReadType);
+ params[0] = (GLfloat)(_mesa_get_color_read_type(ctx));
break;
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
CHECK_EXT1(OES_read_format, "GetFloatv");
- params[0] = (GLfloat)(ctx->Const.ColorReadFormat);
+ params[0] = (GLfloat)(_mesa_get_color_read_format(ctx));
break;
case GL_NUM_FRAGMENT_REGISTERS_ATI:
CHECK_EXT1(ATI_fragment_shader, "GetFloatv");
@@ -5437,11 +5438,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
CHECK_EXT1(OES_read_format, "GetIntegerv");
- params[0] = ctx->Const.ColorReadType;
+ params[0] = _mesa_get_color_read_type(ctx);
break;
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
CHECK_EXT1(OES_read_format, "GetIntegerv");
- params[0] = ctx->Const.ColorReadFormat;
+ params[0] = _mesa_get_color_read_format(ctx);
break;
case GL_NUM_FRAGMENT_REGISTERS_ATI:
CHECK_EXT1(ATI_fragment_shader, "GetIntegerv");
@@ -7273,11 +7274,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
CHECK_EXT1(OES_read_format, "GetInteger64v");
- params[0] = (GLint64)(ctx->Const.ColorReadType);
+ params[0] = (GLint64)(_mesa_get_color_read_type(ctx));
break;
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
CHECK_EXT1(OES_read_format, "GetInteger64v");
- params[0] = (GLint64)(ctx->Const.ColorReadFormat);
+ params[0] = (GLint64)(_mesa_get_color_read_format(ctx));
break;
case GL_NUM_FRAGMENT_REGISTERS_ATI:
CHECK_EXT1(ATI_fragment_shader, "GetInteger64v");
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index a29962d334..01170a42a7 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -942,9 +942,9 @@ StateVars = [
# GL_OES_read_format
( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
- ["ctx->Const.ColorReadType"], "", ["OES_read_format"] ),
+ ["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ),
( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
- ["ctx->Const.ColorReadFormat"], "", ["OES_read_format"] ),
+ ["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ),
# GL_ATI_fragment_shader
( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ),
@@ -1159,6 +1159,7 @@ def EmitHeader():
#include "mtypes.h"
#include "state.h"
#include "texcompress.h"
+#include "framebuffer.h"
#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 1c8a081e9a..654faa5c77 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -206,7 +206,10 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
void GLAPIENTRY
_mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
{
- _mesa_Lightfv( light, pname, &param );
+ GLfloat fparam[4];
+ fparam[0] = param;
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
+ _mesa_Lightfv( light, pname, fparam );
}
@@ -285,7 +288,10 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
void GLAPIENTRY
_mesa_Lighti( GLenum light, GLenum pname, GLint param )
{
- _mesa_Lightiv( light, pname, &param );
+ GLint iparam[4];
+ iparam[0] = param;
+ iparam[1] = iparam[2] = iparam[3] = 0;
+ _mesa_Lightiv( light, pname, iparam );
}
@@ -537,14 +543,20 @@ _mesa_LightModeliv( GLenum pname, const GLint *params )
void GLAPIENTRY
_mesa_LightModeli( GLenum pname, GLint param )
{
- _mesa_LightModeliv( pname, &param );
+ GLint iparam[4];
+ iparam[0] = param;
+ iparam[1] = iparam[2] = iparam[3] = 0;
+ _mesa_LightModeliv( pname, iparam );
}
void GLAPIENTRY
_mesa_LightModelf( GLenum pname, GLfloat param )
{
- _mesa_LightModelfv( pname, &param );
+ GLfloat fparam[4];
+ fparam[0] = param;
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
+ _mesa_LightModelfv( pname, fparam );
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 5f01244827..b52c84b491 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2356,9 +2356,6 @@ struct gl_constants
GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */
- GLenum ColorReadFormat; /**< GL_OES_read_format */
- GLenum ColorReadType; /**< GL_OES_read_format */
-
GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */
GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */
GLuint MaxSamples; /**< GL_ARB_framebuffer_object */
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index b330544890..dcaeccd90d 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -69,8 +69,10 @@ _mesa_PointSize( GLfloat size )
void GLAPIENTRY
_mesa_PointParameteri( GLenum pname, GLint param )
{
- const GLfloat value = (GLfloat) param;
- _mesa_PointParameterfv(pname, &value);
+ GLfloat p[3];
+ p[0] = (GLfloat) param;
+ p[1] = p[2] = 0.0F;
+ _mesa_PointParameterfv(pname, p);
}
@@ -90,7 +92,10 @@ _mesa_PointParameteriv( GLenum pname, const GLint *params )
void GLAPIENTRY
_mesa_PointParameterf( GLenum pname, GLfloat param)
{
- _mesa_PointParameterfv(pname, &param);
+ GLfloat p[3];
+ p[0] = param;
+ p[1] = p[2] = 0.0F;
+ _mesa_PointParameterfv(pname, p);
}
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
index 5abb1ff0ab..be4e03bc56 100644
--- a/src/mesa/main/texgen.c
+++ b/src/mesa/main/texgen.c
@@ -186,8 +186,10 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
static void GLAPIENTRY
_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
{
- GLfloat p = (GLfloat) param;
- _mesa_TexGenfv( coord, pname, &p );
+ GLfloat p[4];
+ p[0] = (GLfloat) param;
+ p[1] = p[2] = p[3] = 0.0F;
+ _mesa_TexGenfv( coord, pname, p );
}
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 7e8a2489ac..09fe7b85ba 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -415,7 +415,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
/* Detect cases where the application set the base level to an invalid
* value.
*/
- if ((baseLevel < 0) || (baseLevel > MAX_TEXTURE_LEVELS)) {
+ if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) {
char s[100];
_mesa_sprintf(s, "base level = %d is invalid", baseLevel);
incomplete(t, s);
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 310d594cd5..db4c7a5eda 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -595,8 +595,10 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
case GL_DEPTH_TEXTURE_MODE_ARB:
{
/* convert float param to int */
- GLint p = (GLint) params[0];
- need_update = set_tex_parameteri(ctx, texObj, pname, &p);
+ GLint p[4];
+ p[0] = (GLint) params[0];
+ p[1] = p[2] = p[3] = 0;
+ need_update = set_tex_parameteri(ctx, texObj, pname, p);
}
break;
@@ -645,14 +647,21 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
case GL_TEXTURE_LOD_BIAS:
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
{
- GLfloat fparam = (GLfloat) param;
+ GLfloat fparam[4];
+ fparam[0] = (GLfloat) param;
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
/* convert int param to float */
- need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
+ need_update = set_tex_parameterf(ctx, texObj, pname, fparam);
}
break;
default:
/* this will generate an error if pname is illegal */
- need_update = set_tex_parameteri(ctx, texObj, pname, &param);
+ {
+ GLint iparam[4];
+ iparam[0] = param;
+ iparam[1] = iparam[2] = iparam[3] = 0;
+ need_update = set_tex_parameteri(ctx, texObj, pname, iparam);
+ }
}
if (ctx->Driver.TexParameter && need_update) {
@@ -694,8 +703,10 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
{
/* convert int param to float */
- GLfloat fparam = (GLfloat) params[0];
- need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
+ GLfloat fparams[4];
+ fparams[0] = (GLfloat) params[0];
+ fparams[1] = fparams[2] = fparams[3] = 0.0F;
+ need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
}
break;
default: