updated mesa to 7.0

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21622 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2007-07-15 22:28:49 +00:00
parent 5d92d947c2
commit 0de9b61d51
51 changed files with 10798 additions and 1598 deletions

View File

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.1
* Version: 7.0
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),

View File

@ -1028,22 +1028,24 @@ _glapi_check_table(const struct _glapi_table *table)
#if defined(PTHREADS) || defined(GLX_USE_TLS)
/**
* Perform platform-specific GL API entry-point fixups.
*
*
*/
static void
init_glapi_relocs( void )
{
#if defined( USE_X86_ASM ) && defined( GLX_USE_TLS )
extern void * _x86_get_dispatch(void);
const GLubyte * const get_disp = (const GLubyte *) _x86_get_dispatch;
#if defined(USE_X86_ASM) && defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
extern unsigned long _x86_get_dispatch(void);
char run_time_patch[] = {
0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
};
GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */
const GLubyte * const get_disp = (const GLubyte *) run_time_patch;
GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start;
*offset = _x86_get_dispatch();
while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) {
(void) memcpy( curr_func, get_disp, 6 );
(void) memcpy( curr_func, get_disp, sizeof(run_time_patch));
curr_func += DISPATCH_FUNCTION_SIZE;
}
#endif /* defined( USE_X86_ASM ) && defined( GLX_USE_TLS ) */
}
#endif
}
#endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */

View File

@ -764,6 +764,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, obj->MagFilter);
_mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, obj->MinLod);
_mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, obj->MaxLod);
_mesa_TexParameterf(target, GL_TEXTURE_LOD_BIAS, obj->LodBias);
_mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel);
if (target != GL_TEXTURE_RECTANGLE_ARB)
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel);

View File

@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.2
* Version: 7.0
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@ -240,10 +240,7 @@
/**
* Bits per depth buffer value.
*
* Any reasonable value up to 31 will work. 32 doesn't work because of integer
* overflow problems in the rasterizer code.
* Bits per depth buffer value (max is 32).
*/
#ifndef DEFAULT_SOFTWARE_DEPTH_BITS
#define DEFAULT_SOFTWARE_DEPTH_BITS 16

View File

@ -6,9 +6,9 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
* Version: 7.0
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@ -1382,8 +1382,11 @@ check_compatible(const GLcontext *ctx, const GLframebuffer *buffer)
return GL_FALSE;
if (ctxvis->blueMask && ctxvis->blueMask != bufvis->blueMask)
return GL_FALSE;
#if 0
/* disabled (see bug 11161) */
if (ctxvis->depthBits && ctxvis->depthBits != bufvis->depthBits)
return GL_FALSE;
#endif
if (ctxvis->stencilBits && ctxvis->stencilBits != bufvis->stencilBits)
return GL_FALSE;

View File

@ -190,6 +190,25 @@ _mesa_DisableClientState( GLenum cap )
}
/**
* Helper function to enable or disable a texture target.
*/
static GLboolean
enable_texture(GLcontext *ctx, GLboolean state, GLbitfield bit)
{
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
const GLuint newenabled = (!state)
? (texUnit->Enabled & ~bit) : (texUnit->Enabled | bit);
if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled)
return GL_FALSE;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->Enabled = newenabled;
return GL_TRUE;
}
/**
* Helper function to enable or disable state.
@ -558,45 +577,21 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.Enabled = state;
break;
case GL_TEXTURE_1D: {
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT;
if (state)
newenabled |= TEXTURE_1D_BIT;
if (!ctx->DrawBuffer->Visual.rgbMode
|| texUnit->Enabled == newenabled)
case GL_TEXTURE_1D:
if (!enable_texture(ctx, state, TEXTURE_1D_BIT)) {
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->Enabled = newenabled;
}
break;
}
case GL_TEXTURE_2D: {
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT;
if (state)
newenabled |= TEXTURE_2D_BIT;
if (!ctx->DrawBuffer->Visual.rgbMode
|| texUnit->Enabled == newenabled)
case GL_TEXTURE_2D:
if (!enable_texture(ctx, state, TEXTURE_2D_BIT)) {
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->Enabled = newenabled;
}
break;
}
case GL_TEXTURE_3D: {
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT;
if (state)
newenabled |= TEXTURE_3D_BIT;
if (!ctx->DrawBuffer->Visual.rgbMode
|| texUnit->Enabled == newenabled)
case GL_TEXTURE_3D:
if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) {
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->Enabled = newenabled;
}
break;
}
case GL_TEXTURE_GEN_Q: {
GLuint unit = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@ -715,18 +710,9 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
/* GL_ARB_texture_cube_map */
case GL_TEXTURE_CUBE_MAP_ARB:
{
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT;
CHECK_EXTENSION(ARB_texture_cube_map, cap);
if (state)
newenabled |= TEXTURE_CUBE_BIT;
if (!ctx->DrawBuffer->Visual.rgbMode
|| texUnit->Enabled == newenabled)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->Enabled = newenabled;
CHECK_EXTENSION(ARB_texture_cube_map, cap);
if (!enable_texture(ctx, state, TEXTURE_CUBE_BIT)) {
return;
}
break;
@ -879,18 +865,8 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
CHECK_EXTENSION(NV_texture_rectangle, cap);
{
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT;
CHECK_EXTENSION(NV_texture_rectangle, cap);
if (state)
newenabled |= TEXTURE_RECT_BIT;
if (!ctx->DrawBuffer->Visual.rgbMode
|| texUnit->Enabled == newenabled)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->Enabled = newenabled;
if (!enable_texture(ctx, state, TEXTURE_RECT_BIT)) {
return;
}
break;
@ -1001,6 +977,18 @@ _mesa_Disable( GLenum cap )
}
/**
* Helper function to determine whether a texture target is enabled.
*/
static GLboolean
is_texture_enabled(GLcontext *ctx, GLbitfield bit)
{
const struct gl_texture_unit *const texUnit =
&ctx->Texture.Unit[ctx->Texture.CurrentUnit];
return (texUnit->Enabled & bit) ? GL_TRUE : GL_FALSE;
}
/**
* Return simple enable/disable state.
*
@ -1117,23 +1105,11 @@ _mesa_IsEnabled( GLenum cap )
case GL_STENCIL_TEST:
return ctx->Stencil.Enabled;
case GL_TEXTURE_1D:
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE;
}
return is_texture_enabled(ctx, TEXTURE_1D_BIT);
case GL_TEXTURE_2D:
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE;
}
return is_texture_enabled(ctx, TEXTURE_2D_BIT);
case GL_TEXTURE_3D:
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE;
}
return is_texture_enabled(ctx, TEXTURE_3D_BIT);
case GL_TEXTURE_GEN_Q:
{
const struct gl_texture_unit *texUnit;
@ -1219,11 +1195,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL_ARB_texture_cube_map */
case GL_TEXTURE_CUBE_MAP_ARB:
CHECK_EXTENSION(ARB_texture_cube_map);
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE;
}
return is_texture_enabled(ctx, TEXTURE_CUBE_BIT);
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
@ -1343,11 +1315,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
CHECK_EXTENSION(NV_texture_rectangle);
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE;
}
return is_texture_enabled(ctx, TEXTURE_RECT_BIT);
/* GL_EXT_stencil_two_side */
case GL_STENCIL_TEST_TWO_SIDE_EXT:

View File

@ -1144,20 +1144,19 @@ _mesa_CheckFramebufferStatusEXT(GLenum target)
* Common code called by glFramebufferTexture1D/2D/3DEXT().
*/
static void
framebuffer_texture(GLuint dims, GLenum target, GLenum attachment,
GLenum textarget, GLuint texture,
framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target,
GLenum attachment, GLenum textarget, GLuint texture,
GLint level, GLint zoffset)
{
struct gl_renderbuffer_attachment *att;
struct gl_texture_object *texObj = NULL;
struct gl_framebuffer *fb;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target != GL_FRAMEBUFFER_EXT) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glFramebufferTexture%dDEXT(target)", dims);
"glFramebufferTexture%sEXT(target)", caller);
return;
}
@ -1167,83 +1166,53 @@ framebuffer_texture(GLuint dims, GLenum target, GLenum attachment,
/* check framebuffer binding */
if (fb->Name == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferTexture%dDEXT", dims);
"glFramebufferTexture%sEXT", caller);
return;
}
if (texture) {
texObj = _mesa_lookup_texture(ctx, texture);
}
/* Check dimension-dependent things */
switch (dims) {
case 1:
if (textarget != GL_TEXTURE_1D) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glFramebufferTexture1DEXT(textarget)");
return;
/* The textarget, level, and zoffset parameters are only validated if
* texture is non-zero.
*/
if (texture) {
GLboolean err = GL_TRUE;
texObj = _mesa_lookup_texture(ctx, texture);
if (texObj != NULL) {
err = (texObj->Target == GL_TEXTURE_CUBE_MAP)
? !IS_CUBE_FACE(textarget)
: (texObj->Target != textarget);
}
if (texObj && texObj->Target != GL_TEXTURE_1D) {
if (err) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferTexture1DEXT(texture target mismatch)");
"glFramebufferTexture%sEXT(texture target mismatch)",
caller);
return;
}
break;
case 2:
if (textarget != GL_TEXTURE_2D &&
textarget != GL_TEXTURE_RECTANGLE_ARB &&
!IS_CUBE_FACE(textarget)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glFramebufferTexture2DEXT(textarget)");
return;
}
if (texObj) {
if ((texObj->Target == GL_TEXTURE_2D && textarget != GL_TEXTURE_2D) ||
(texObj->Target == GL_TEXTURE_RECTANGLE_ARB
&& textarget != GL_TEXTURE_RECTANGLE_ARB) ||
(texObj->Target == GL_TEXTURE_CUBE_MAP
&& !IS_CUBE_FACE(textarget))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferTexture1DEXT(texture target mismatch)");
return;
}
}
break;
case 3:
if (textarget != GL_TEXTURE_3D) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glFramebufferTexture3DEXT(textarget)");
return;
}
if (texObj && texObj->Target != GL_TEXTURE_3D) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferTexture3DEXT(texture target mismatch)");
return;
}
{
if (texObj->Target == GL_TEXTURE_3D) {
const GLint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
if (zoffset < 0 || zoffset >= maxSize) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glFramebufferTexture3DEXT(zoffset)");
"glFramebufferTexture%sEXT(zoffset)",
caller);
return;
}
}
break;
default:
_mesa_problem(ctx, "Unexpected dims in error_check_framebuffer_texture");
return;
}
if ((level < 0) || level >= _mesa_max_texture_levels(ctx, textarget)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glFramebufferTexture%dDEXT(level)", dims);
return;
if ((level < 0) ||
(level >= _mesa_max_texture_levels(ctx, texObj->Target))) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glFramebufferTexture%sEXT(level)", caller);
return;
}
}
att = _mesa_get_attachment(ctx, fb, attachment);
if (att == NULL) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glFramebufferTexture%dDEXT(attachment)", dims);
"glFramebufferTexture%sEXT(attachment)", caller);
return;
}
@ -1271,9 +1240,16 @@ void GLAPIENTRY
_mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture, GLint level)
{
const GLint zoffset = 0;
framebuffer_texture(1, target, attachment, textarget, texture,
level, zoffset);
GET_CURRENT_CONTEXT(ctx);
if ((texture != 0) && (textarget != GL_TEXTURE_1D)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glFramebufferTexture1DEXT(textarget)");
return;
}
framebuffer_texture(ctx, "1D", target, attachment, textarget, texture,
level, 0);
}
@ -1281,9 +1257,19 @@ void GLAPIENTRY
_mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture, GLint level)
{
const GLint zoffset = 0;
framebuffer_texture(2, target, attachment, textarget, texture,
level, zoffset);
GET_CURRENT_CONTEXT(ctx);
if ((texture != 0) &&
(textarget != GL_TEXTURE_2D) &&
(textarget != GL_TEXTURE_RECTANGLE_ARB) &&
(!IS_CUBE_FACE(textarget))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferTexture2DEXT(textarget)");
return;
}
framebuffer_texture(ctx, "2D", target, attachment, textarget, texture,
level, 0);
}
@ -1292,12 +1278,19 @@ _mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture,
GLint level, GLint zoffset)
{
framebuffer_texture(3, target, attachment, textarget, texture,
GET_CURRENT_CONTEXT(ctx);
if ((texture != 0) && (textarget != GL_TEXTURE_3D)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glFramebufferTexture3DEXT(textarget)");
return;
}
framebuffer_texture(ctx, "3D", target, attachment, textarget, texture,
level, zoffset);
}
void GLAPIENTRY
_mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
GLenum renderbufferTarget,

View File

@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.3
* Version: 7.0
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@ -64,27 +64,27 @@
*/
static GLboolean
_mesa_type_is_packed(GLenum type)
{
switch (type) {
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
case GL_UNSIGNED_INT_8_8_8_8:
case GL_UNSIGNED_INT_8_8_8_8_REV:
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
case GL_UNSIGNED_SHORT_8_8_MESA:
case GL_UNSIGNED_SHORT_8_8_REV_MESA:
case GL_UNSIGNED_INT_24_8_EXT:
return GL_TRUE;
}
{
switch (type) {
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
case GL_UNSIGNED_INT_8_8_8_8:
case GL_UNSIGNED_INT_8_8_8_8_REV:
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
case GL_UNSIGNED_SHORT_8_8_MESA:
case GL_UNSIGNED_SHORT_8_8_REV_MESA:
case GL_UNSIGNED_INT_24_8_EXT:
return GL_TRUE;
}
return GL_FALSE;
return GL_FALSE;
}
/**
@ -103,9 +103,8 @@ _mesa_type_is_packed(GLenum type)
static void
flip_bytes( GLubyte *p, GLuint n )
{
register GLuint i, a, b;
for (i=0;i<n;i++) {
GLuint i, a, b;
for (i = 0; i < n; i++) {
b = (GLuint) p[i]; /* words are often faster than bytes */
a = ((b & 0x01) << 7) |
((b & 0x02) << 5) |
@ -129,9 +128,8 @@ flip_bytes( GLubyte *p, GLuint n )
void
_mesa_swap2( GLushort *p, GLuint n )
{
register GLuint i;
for (i=0;i<n;i++) {
GLuint i;
for (i = 0; i < n; i++) {
p[i] = (p[i] >> 8) | ((p[i] << 8) & 0xff00);
}
}
@ -144,9 +142,8 @@ _mesa_swap2( GLushort *p, GLuint n )
void
_mesa_swap4( GLuint *p, GLuint n )
{
register GLuint i, a, b;
for (i=0;i<n;i++) {
GLuint i, a, b;
for (i = 0; i < n; i++) {
b = p[i];
a = (b >> 24)
| ((b >> 8) & 0xff00)
@ -4263,60 +4260,68 @@ _mesa_unpack_image( GLuint dimensions,
const GLvoid *src = _mesa_image_address(dimensions, unpack, pixels,
width, height, format, type, img, row, 0);
if ((type == GL_BITMAP) && (unpack->SkipPixels & 0x7)) {
GLint i;
flipBytes = GL_FALSE;
if (unpack->LsbFirst) {
GLubyte srcMask = 1 << (unpack->SkipPixels & 0x7);
GLubyte dstMask = 128;
const GLubyte *s = src;
GLubyte *d = dst;
*d = 0;
for (i = 0; i < width; i++) {
if (*s & srcMask) {
*d |= dstMask;
}
if (srcMask == 128) {
srcMask = 1;
s++;
} else {
srcMask = srcMask << 1;
}
if (dstMask == 1) {
dstMask = 128;
d++;
*d = 0;
} else {
dstMask = dstMask >> 1;
}
}
} else {
GLubyte srcMask = 128 >> (unpack->SkipPixels & 0x7);
GLubyte dstMask = 128;
const GLubyte *s = src;
GLubyte *d = dst;
if ((type == GL_BITMAP) && (unpack->SkipPixels & 0x7)) {
GLint i;
flipBytes = GL_FALSE;
if (unpack->LsbFirst) {
GLubyte srcMask = 1 << (unpack->SkipPixels & 0x7);
GLubyte dstMask = 128;
const GLubyte *s = src;
GLubyte *d = dst;
*d = 0;
for (i = 0; i < width; i++) {
if (*s & srcMask) {
*d |= dstMask;
}
if (srcMask == 128) {
srcMask = 1;
s++;
}
else {
srcMask = srcMask << 1;
}
if (dstMask == 1) {
dstMask = 128;
d++;
*d = 0;
for (i = 0; i < width; i++) {
if (*s & srcMask) {
*d |= dstMask;
}
if (srcMask == 1) {
srcMask = 128;
s++;
} else {
srcMask = srcMask >> 1;
}
if (dstMask == 1) {
dstMask = 128;
d++;
*d = 0;
} else {
dstMask = dstMask >> 1;
}
}
}
} else
_mesa_memcpy(dst, src, bytesPerRow);
}
else {
dstMask = dstMask >> 1;
}
}
}
else {
GLubyte srcMask = 128 >> (unpack->SkipPixels & 0x7);
GLubyte dstMask = 128;
const GLubyte *s = src;
GLubyte *d = dst;
*d = 0;
for (i = 0; i < width; i++) {
if (*s & srcMask) {
*d |= dstMask;
}
if (srcMask == 1) {
srcMask = 128;
s++;
}
else {
srcMask = srcMask >> 1;
}
if (dstMask == 1) {
dstMask = 128;
d++;
*d = 0;
}
else {
dstMask = dstMask >> 1;
}
}
}
}
else {
_mesa_memcpy(dst, src, bytesPerRow);
}
/* byte flipping/swapping */
if (flipBytes) {
flip_bytes((GLubyte *) dst, bytesPerRow);

View File

@ -20,9 +20,9 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
* Version: 7.0
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@ -921,14 +921,11 @@ _mesa_vsprintf( char *str, const char *fmt, va_list args )
/*@{*/
/**
* Display a warning.
* Report a warning (a recoverable error condition) to stderr if
* either DEBUG is defined or the MESA_DEBUG env var is set.
*
* \param ctx GL context.
* \param fmtString printf() alike format string.
*
* If debugging is enabled (either at compile-time via the DEBUG macro, or
* run-time via the MESA_DEBUG environment variable), prints the warning to
* stderr via fprintf().
*/
void
_mesa_warning( GLcontext *ctx, const char *fmtString, ... )
@ -951,13 +948,11 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
}
/**
* This function is called when the Mesa user has stumbled into a code
* path which may not be implemented fully or correctly.
* Report an internla implementation problem.
* Prints the message to stderr via fprintf().
*
* \param ctx GL context.
* \param s problem description string.
*
* Prints the message to stderr via fprintf().
*/
void
_mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
@ -975,18 +970,16 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
}
/**
* Display an error message.
* Record an OpenGL state error. These usually occur when the users
* passes invalid parameters to a GL function.
*
* If in debug mode, print error message.
* Also, record the error code by calling _mesa_record_error().
* If debugging is enabled (either at compile-time via the DEBUG macro, or
* run-time via the MESA_DEBUG environment variable), report the error with
* _mesa_debug().
*
* \param ctx the GL context.
* \param error the error value.
* \param fmtString printf() style format string, followed by optional args
*
* If debugging is enabled (either at compile-time via the DEBUG macro, or
* run-time via the MESA_DEBUG environment variable), interperts the error code and
* prints the error message via _mesa_debug().
*/
void
_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
@ -1056,12 +1049,11 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
}
/**
* Report debug information.
* Report debug information. Print error message to stderr via fprintf().
* No-op if DEBUG mode not enabled.
*
* \param ctx GL context.
* \param fmtString printf() alike format string.
*
* Prints the message to stderr via fprintf().
* \param fmtString printf()-style format string, followed by optional args.
*/
void
_mesa_debug( const GLcontext *ctx, const char *fmtString, ... )

View File

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.3
* Version: 7.0
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@ -1117,6 +1117,13 @@ compute_light_positions( GLcontext *ctx )
}
light->_VP_inf_spot_attenuation = 1.0;
}
else {
/* positional light w/ homogeneous coordinate, divide by W */
GLfloat wInv = 1.0 / light->_Position[3];
light->_Position[0] *= wInv;
light->_Position[1] *= wInv;
light->_Position[2] *= wInv;
}
if (light->_Flags & LIGHT_SPOT) {
if (ctx->_NeedEyeCoords) {

View File

@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.1
* Version: 7.0
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@ -61,10 +61,6 @@ _mesa_PointSize( GLfloat size )
ctx->Point.MinSize,
ctx->Point.MaxSize);
ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
ctx->Point.Params[1] != 0.0 ||
ctx->Point.Params[2] != 0.0);
if (ctx->Driver.PointSize)
ctx->Driver.PointSize(ctx, size);
}
@ -122,6 +118,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
return;
FLUSH_VERTICES(ctx, _NEW_POINT);
COPY_3V(ctx->Point.Params, params);
ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
ctx->Point.Params[1] != 0.0 ||
ctx->Point.Params[2] != 0.0);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,

View File

@ -1299,6 +1299,20 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
}
/**
* Helper function to determine whether a target supports compressed textures
*/
static GLboolean
target_can_be_compressed(GLcontext *ctx, GLenum target)
{
return (((target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D))
|| ((ctx->Extensions.ARB_texture_cube_map &&
(target == GL_PROXY_TEXTURE_CUBE_MAP ||
(target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)))));
}
/**
* Test the glTexImage[123]D() parameters for errors.
*
@ -1329,8 +1343,9 @@ texture_error_check( GLcontext *ctx, GLenum target,
GLint depth, GLint border )
{
const GLboolean isProxy = _mesa_is_proxy_texture(target);
GLboolean sizeOK;
GLboolean sizeOK = GL_TRUE;
GLboolean colorFormat, indexFormat;
GLenum proxy_target;
/* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
@ -1365,10 +1380,9 @@ texture_error_check( GLcontext *ctx, GLenum target,
*/
if (dimensions == 1) {
if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) {
sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D,
level, internalFormat,
format, type,
width, 1, 1, border);
proxy_target = GL_PROXY_TEXTURE_1D;
height = 1;
width = 1;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );
@ -1376,11 +1390,9 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
}
else if (dimensions == 2) {
depth = 1;
if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D) {
sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D,
level, internalFormat,
format, type,
width, height, 1, border);
proxy_target = GL_PROXY_TEXTURE_2D;
}
else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
(target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
@ -1389,10 +1401,8 @@ texture_error_check( GLcontext *ctx, GLenum target,
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
return GL_TRUE;
}
sizeOK = (width == height) &&
ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB,
level, internalFormat, format, type,
width, height, 1, border);
proxy_target = GL_PROXY_TEXTURE_CUBE_MAP_ARB;
sizeOK = (width == height);
}
else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV ||
target == GL_TEXTURE_RECTANGLE_NV) {
@ -1400,11 +1410,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
return GL_TRUE;
}
sizeOK = ctx->Driver.TestProxyTexImage(ctx,
GL_PROXY_TEXTURE_RECTANGLE_NV,
level, internalFormat,
format, type,
width, height, 1, border);
proxy_target = GL_PROXY_TEXTURE_RECTANGLE_NV;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
@ -1413,10 +1419,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
else if (dimensions == 3) {
if (target == GL_PROXY_TEXTURE_3D || target == GL_TEXTURE_3D) {
sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_3D,
level, internalFormat,
format, type,
width, height, depth, border);
proxy_target = GL_PROXY_TEXTURE_3D;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" );
@ -1428,6 +1431,10 @@ texture_error_check( GLcontext *ctx, GLenum target,
return GL_TRUE;
}
sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxy_target, level,
internalFormat, format,
type, width, height,
depth, border);
if (!sizeOK) {
if (!isProxy) {
_mesa_error(ctx, GL_INVALID_VALUE,
@ -1522,21 +1529,10 @@ texture_error_check( GLcontext *ctx, GLenum target,
/* additional checks for compressed textures */
if (is_compressed_format(ctx, internalFormat)) {
if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) {
/* OK */
}
else if (ctx->Extensions.ARB_texture_cube_map &&
(target == GL_PROXY_TEXTURE_CUBE_MAP ||
(target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
/* OK */
}
else {
if (!isProxy) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexImage%d(target)", dimensions);
return GL_TRUE;
}
if (!target_can_be_compressed(ctx, target) && !isProxy) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexImage%d(target)", dimensions);
return GL_TRUE;
}
if (border != 0) {
if (!isProxy) {
@ -1711,16 +1707,7 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions,
#endif
if (destTex->IsCompressed) {
if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) {
/* OK */
}
else if (ctx->Extensions.ARB_texture_cube_map &&
(target == GL_PROXY_TEXTURE_CUBE_MAP ||
(target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
/* OK */
}
else {
if (!target_can_be_compressed(ctx, target)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexSubImage%D(target)", dimensions);
return GL_TRUE;

View File

@ -630,40 +630,34 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj)
for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) {
struct gl_texture_unit *unit = &ctx->Texture.Unit[u];
struct gl_texture_object **curr = NULL;
if (texObj == unit->Current1D) {
curr = &unit->Current1D;
unit->Current1D = ctx->Shared->Default1D;
ctx->Shared->Default1D->RefCount++;
texObj->RefCount--;
if (texObj == unit->_Current)
unit->_Current = unit->Current1D;
}
else if (texObj == unit->Current2D) {
curr = &unit->Current2D;
unit->Current2D = ctx->Shared->Default2D;
ctx->Shared->Default2D->RefCount++;
texObj->RefCount--;
if (texObj == unit->_Current)
unit->_Current = unit->Current2D;
}
else if (texObj == unit->Current3D) {
curr = &unit->Current3D;
unit->Current3D = ctx->Shared->Default3D;
ctx->Shared->Default3D->RefCount++;
texObj->RefCount--;
if (texObj == unit->_Current)
unit->_Current = unit->Current3D;
}
else if (texObj == unit->CurrentCubeMap) {
curr = &unit->CurrentCubeMap;
unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
ctx->Shared->DefaultCubeMap->RefCount++;
texObj->RefCount--;
if (texObj == unit->_Current)
unit->_Current = unit->CurrentCubeMap;
}
else if (texObj == unit->CurrentRect) {
curr = &unit->CurrentRect;
unit->CurrentRect = ctx->Shared->DefaultRect;
ctx->Shared->DefaultRect->RefCount++;
}
if (curr) {
(*curr)->RefCount++;
texObj->RefCount--;
if (texObj == unit->_Current)
unit->_Current = unit->CurrentRect;
unit->_Current = *curr;
}
}
}

View File

@ -849,108 +849,48 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
}
break;
case GL_SOURCE0_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.SourceRGB[0];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_SOURCE1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.SourceRGB[1];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_SOURCE2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.SourceRGB[2];
const unsigned rgb_idx = pname - GL_SOURCE0_RGB;
*params = (GLfloat) texUnit->Combine.SourceRGB[rgb_idx];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_SOURCE0_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.SourceA[0];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_SOURCE1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.SourceA[1];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_SOURCE2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.SourceA[2];
const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA;
*params = (GLfloat) texUnit->Combine.SourceA[alpha_idx];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_OPERAND0_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.OperandRGB[0];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_OPERAND1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.OperandRGB[1];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_OPERAND2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.OperandRGB[2];
const unsigned op_rgb = pname - GL_OPERAND0_RGB;
*params = (GLfloat) texUnit->Combine.OperandRGB[op_rgb];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_OPERAND0_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.OperandA[0];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_OPERAND1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.OperandA[1];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
case GL_OPERAND2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->Combine.OperandA[2];
const unsigned op_alpha = pname - GL_OPERAND0_ALPHA;
*params = (GLfloat) texUnit->Combine.OperandA[op_alpha];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
@ -1073,108 +1013,48 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
}
break;
case GL_SOURCE0_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.SourceRGB[0];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_SOURCE1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.SourceRGB[1];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_SOURCE2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.SourceRGB[2];
const unsigned rgb_idx = pname - GL_SOURCE0_RGB;
*params = (GLint) texUnit->Combine.SourceRGB[rgb_idx];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_SOURCE0_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.SourceA[0];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_SOURCE1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.SourceA[1];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_SOURCE2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.SourceA[2];
const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA;
*params = (GLint) texUnit->Combine.SourceA[alpha_idx];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_OPERAND0_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.OperandRGB[0];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_OPERAND1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.OperandRGB[1];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_OPERAND2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.OperandRGB[2];
const unsigned op_rgb = pname - GL_OPERAND0_RGB;
*params = (GLint) texUnit->Combine.OperandRGB[op_rgb];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_OPERAND0_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.OperandA[0];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_OPERAND1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.OperandA[1];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
case GL_OPERAND2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->Combine.OperandA[2];
const unsigned op_alpha = pname - GL_OPERAND0_ALPHA;
*params = (GLint) texUnit->Combine.OperandA[op_alpha];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");

View File

@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.3
* Version: 7.0
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@ -28,10 +28,10 @@
/* Mesa version */
#define MESA_MAJOR 6
#define MESA_MINOR 5
#define MESA_PATCH 3
#define MESA_VERSION_STRING "6.5.3"
#define MESA_MAJOR 7
#define MESA_MINOR 0
#define MESA_PATCH 0
#define MESA_VERSION_STRING "7.0"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
@ -40,9 +40,9 @@
/* OpenGL API version */
#define OPENGL_MAJOR 2
#define OPENGL_MINOR 0
#define OPENGL_MINOR 1
#define OPENGL_PATCH 0
#define OPENGL_VERSION_STRING "2.0"
#define OPENGL_VERSION_STRING "2.1"
/* To make version comparison easy */
#define OPENGL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

View File

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.2
* Version: 7.0
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@ -703,10 +703,18 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
* The spec says that even if this query returns true, there's
* no guarantee that the program will run in hardware.
*/
if (ctx->Driver.IsProgramNative)
if (prog->Id == 0) {
/* default/null program */
*params = GL_FALSE;
}
else if (ctx->Driver.IsProgramNative) {
/* ask the driver */
*params = ctx->Driver.IsProgramNative( ctx, target, prog );
else
}
else {
/* probably running in software */
*params = GL_TRUE;
}
return;
default:
/* continue with fragment-program only queries below */

View File

@ -218,120 +218,64 @@ fetch_vector4(const struct prog_src_register *source,
}
}
#if 0
/**
* Fetch the derivative with respect to X for the given register.
* \return GL_TRUE if it was easily computed or GL_FALSE if we
* need to execute another instance of the program (ugh)!
* Fetch the derivative with respect to X or Y for the given register.
* XXX this currently only works for fragment program input attribs.
*/
static GLboolean
static void
fetch_vector4_deriv(GLcontext * ctx,
const struct prog_src_register *source,
const SWspan * span,
char xOrY, GLint column, GLfloat result[4])
const struct gl_program_machine *machine,
char xOrY, GLfloat result[4])
{
GLfloat src[4];
if (source->File == PROGRAM_INPUT && source->Index < machine->NumDeriv) {
const GLint col = machine->CurElement;
const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3];
const GLfloat invQ = 1.0f / w;
GLfloat deriv[4];
ASSERT(xOrY == 'X' || xOrY == 'Y');
switch (source->Index) {
case FRAG_ATTRIB_WPOS:
if (xOrY == 'X') {
src[0] = 1.0;
src[1] = 0.0;
src[2] = span->attrStepX[FRAG_ATTRIB_WPOS][2]
/ ctx->DrawBuffer->_DepthMaxF;
src[3] = span->attrStepX[FRAG_ATTRIB_WPOS][3];
deriv[0] = machine->DerivX[source->Index][0] * invQ;
deriv[1] = machine->DerivX[source->Index][1] * invQ;
deriv[2] = machine->DerivX[source->Index][2] * invQ;
deriv[3] = machine->DerivX[source->Index][3] * invQ;
}
else {
src[0] = 0.0;
src[1] = 1.0;
src[2] = span->attrStepY[FRAG_ATTRIB_WPOS][2]
/ ctx->DrawBuffer->_DepthMaxF;
src[3] = span->attrStepY[FRAG_ATTRIB_WPOS][3];
deriv[0] = machine->DerivY[source->Index][0] * invQ;
deriv[1] = machine->DerivY[source->Index][1] * invQ;
deriv[2] = machine->DerivY[source->Index][2] * invQ;
deriv[3] = machine->DerivY[source->Index][3] * invQ;
}
break;
case FRAG_ATTRIB_COL0:
case FRAG_ATTRIB_COL1:
if (xOrY == 'X') {
src[0] = span->attrStepX[source->Index][0] * (1.0F / CHAN_MAXF);
src[1] = span->attrStepX[source->Index][1] * (1.0F / CHAN_MAXF);
src[2] = span->attrStepX[source->Index][2] * (1.0F / CHAN_MAXF);
src[3] = span->attrStepX[source->Index][3] * (1.0F / CHAN_MAXF);
}
else {
src[0] = span->attrStepY[source->Index][0] * (1.0F / CHAN_MAXF);
src[1] = span->attrStepY[source->Index][1] * (1.0F / CHAN_MAXF);
src[2] = span->attrStepY[source->Index][2] * (1.0F / CHAN_MAXF);
src[3] = span->attrStepY[source->Index][3] * (1.0F / CHAN_MAXF);
}
break;
case FRAG_ATTRIB_FOGC:
if (xOrY == 'X') {
src[0] = span->attrStepX[FRAG_ATTRIB_FOGC][0] * (1.0F / CHAN_MAXF);
src[1] = 0.0;
src[2] = 0.0;
src[3] = 0.0;
}
else {
src[0] = span->attrStepY[FRAG_ATTRIB_FOGC][0] * (1.0F / CHAN_MAXF);
src[1] = 0.0;
src[2] = 0.0;
src[3] = 0.0;
}
break;
default:
assert(source->Index < FRAG_ATTRIB_MAX);
/* texcoord or varying */
if (xOrY == 'X') {
/* this is a little tricky - I think I've got it right */
const GLfloat invQ = 1.0f / (span->attrStart[source->Index][3]
+
span->attrStepX[source->Index][3] *
column);
src[0] = span->attrStepX[source->Index][0] * invQ;
src[1] = span->attrStepX[source->Index][1] * invQ;
src[2] = span->attrStepX[source->Index][2] * invQ;
src[3] = span->attrStepX[source->Index][3] * invQ;
}
else {
/* Tricky, as above, but in Y direction */
const GLfloat invQ = 1.0f / (span->attrStart[source->Index][3]
+ span->attrStepY[source->Index][3]);
src[0] = span->attrStepY[source->Index][0] * invQ;
src[1] = span->attrStepY[source->Index][1] * invQ;
src[2] = span->attrStepY[source->Index][2] * invQ;
src[3] = span->attrStepY[source->Index][3] * invQ;
}
break;
}
result[0] = src[GET_SWZ(source->Swizzle, 0)];
result[1] = src[GET_SWZ(source->Swizzle, 1)];
result[2] = src[GET_SWZ(source->Swizzle, 2)];
result[3] = src[GET_SWZ(source->Swizzle, 3)];
if (source->NegateBase) {
result[0] = -result[0];
result[1] = -result[1];
result[2] = -result[2];
result[3] = -result[3];
result[0] = deriv[GET_SWZ(source->Swizzle, 0)];
result[1] = deriv[GET_SWZ(source->Swizzle, 1)];
result[2] = deriv[GET_SWZ(source->Swizzle, 2)];
result[3] = deriv[GET_SWZ(source->Swizzle, 3)];
if (source->NegateBase) {
result[0] = -result[0];
result[1] = -result[1];
result[2] = -result[2];
result[3] = -result[3];
}
if (source->Abs) {
result[0] = FABSF(result[0]);
result[1] = FABSF(result[1]);
result[2] = FABSF(result[2]);
result[3] = FABSF(result[3]);
}
if (source->NegateAbs) {
result[0] = -result[0];
result[1] = -result[1];
result[2] = -result[2];
result[3] = -result[3];
}
}
if (source->Abs) {
result[0] = FABSF(result[0]);
result[1] = FABSF(result[1]);
result[2] = FABSF(result[2]);
result[3] = FABSF(result[3]);
else {
ASSIGN_4V(result, 0.0, 0.0, 0.0, 0.0);
}
if (source->NegateAbs) {
result[0] = -result[0];
result[1] = -result[1];
result[2] = -result[2];
result[3] = -result[3];
}
return GL_TRUE;
}
#endif
/**
@ -519,106 +463,6 @@ store_vector4(const struct prog_instruction *inst,
}
#if 0
/**
* Initialize a new machine state instance from an existing one, adding
* the partial derivatives onto the input registers.
* Used to implement DDX and DDY instructions in non-trivial cases.
*/
static void
init_machine_deriv(GLcontext * ctx,
const struct gl_program_machine *machine,
const struct gl_fragment_program *program,
const SWspan * span, char xOrY,
struct gl_program_machine *dMachine)
{
GLuint attr;
ASSERT(xOrY == 'X' || xOrY == 'Y');
/* copy existing machine */
_mesa_memcpy(dMachine, machine, sizeof(struct gl_program_machine));
if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) {
/* XXX also need to do this when using valgrind */
/* Clear temporary registers (undefined for ARB_f_p) */
_mesa_bzero((void *) machine->Temporaries,
MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
}
/* Add derivatives */
if (program->Base.InputsRead & FRAG_BIT_WPOS) {
GLfloat *wpos = machine->Attribs[FRAG_ATTRIB_WPOS][machine->CurElement];
if (xOrY == 'X') {
wpos[0] += 1.0F;
wpos[1] += 0.0F;
wpos[2] += span->attrStepX[FRAG_ATTRIB_WPOS][2];
wpos[3] += span->attrStepX[FRAG_ATTRIB_WPOS][3];
}
else {
wpos[0] += 0.0F;
wpos[1] += 1.0F;
wpos[2] += span->attrStepY[FRAG_ATTRIB_WPOS][2];
wpos[3] += span->attrStepY[FRAG_ATTRIB_WPOS][3];
}
}
/* primary, secondary colors */
for (attr = FRAG_ATTRIB_COL0; attr <= FRAG_ATTRIB_COL1; attr++) {
if (program->Base.InputsRead & (1 << attr)) {
GLfloat *col = machine->Attribs[attr][machine->CurElement];
if (xOrY == 'X') {
col[0] += span->attrStepX[attr][0] * (1.0F / CHAN_MAXF);
col[1] += span->attrStepX[attr][1] * (1.0F / CHAN_MAXF);
col[2] += span->attrStepX[attr][2] * (1.0F / CHAN_MAXF);
col[3] += span->attrStepX[attr][3] * (1.0F / CHAN_MAXF);
}
else {
col[0] += span->attrStepY[attr][0] * (1.0F / CHAN_MAXF);
col[1] += span->attrStepY[attr][1] * (1.0F / CHAN_MAXF);
col[2] += span->attrStepY[attr][2] * (1.0F / CHAN_MAXF);
col[3] += span->attrStepY[attr][3] * (1.0F / CHAN_MAXF);
}
}
}
if (program->Base.InputsRead & FRAG_BIT_FOGC) {
GLfloat *fogc = machine->Attribs[FRAG_ATTRIB_FOGC][machine->CurElement];
if (xOrY == 'X') {
fogc[0] += span->attrStepX[FRAG_ATTRIB_FOGC][0];
}
else {
fogc[0] += span->attrStepY[FRAG_ATTRIB_FOGC][0];
}
}
/* texcoord and varying vars */
for (attr = FRAG_ATTRIB_TEX0; attr < FRAG_ATTRIB_MAX; attr++) {
if (program->Base.InputsRead & (1 << attr)) {
GLfloat *val = machine->Attribs[attr][machine->CurElement];
/* XXX perspective-correct interpolation */
if (xOrY == 'X') {
val[0] += span->attrStepX[attr][0];
val[1] += span->attrStepX[attr][1];
val[2] += span->attrStepX[attr][2];
val[3] += span->attrStepX[attr][3];
}
else {
val[0] += span->attrStepY[attr][0];
val[1] += span->attrStepY[attr][1];
val[2] += span->attrStepY[attr][2];
val[3] += span->attrStepY[attr][3];
}
}
}
/* init condition codes */
dMachine->CondCodes[0] = COND_EQ;
dMachine->CondCodes[1] = COND_EQ;
dMachine->CondCodes[2] = COND_EQ;
dMachine->CondCodes[3] = COND_EQ;
}
#endif
/**
* Execute the given vertex/fragment program.
*
@ -762,57 +606,18 @@ _mesa_execute_program(GLcontext * ctx,
break;
case OPCODE_DDX: /* Partial derivative with respect to X */
{
#if 0
GLfloat a[4], aNext[4], result[4];
struct gl_program_machine dMachine;
if (!fetch_vector4_deriv(ctx, &inst->SrcReg[0], span, 'X',
column, result)) {
/* This is tricky. Make a copy of the current machine state,
* increment the input registers by the dx or dy partial
* derivatives, then re-execute the program up to the
* preceeding instruction, then fetch the source register.
* Finally, find the difference in the register values for
* the original and derivative runs.
*/
fetch_vector4(&inst->SrcReg[0], machine, program, a);
init_machine_deriv(ctx, machine, program, span,
'X', &dMachine);
execute_program(ctx, program, pc, &dMachine, span, column);
fetch_vector4(&inst->SrcReg[0], &dMachine, program,
aNext);
result[0] = aNext[0] - a[0];
result[1] = aNext[1] - a[1];
result[2] = aNext[2] - a[2];
result[3] = aNext[3] - a[3];
}
GLfloat result[4];
fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine,
'X', result);
store_vector4(inst, machine, result);
#else
store_vector4(inst, machine, ZeroVec);
#endif
}
break;
case OPCODE_DDY: /* Partial derivative with respect to Y */
{
#if 0
GLfloat a[4], aNext[4], result[4];
struct gl_program_machine dMachine;
if (!fetch_vector4_deriv(ctx, &inst->SrcReg[0], span, 'Y',
column, result)) {
init_machine_deriv(ctx, machine, program, span,
'Y', &dMachine);
fetch_vector4(&inst->SrcReg[0], machine, program, a);
execute_program(ctx, program, pc, &dMachine, span, column);
fetch_vector4(&inst->SrcReg[0], &dMachine, program,
aNext);
result[0] = aNext[0] - a[0];
result[1] = aNext[1] - a[1];
result[2] = aNext[2] - a[2];
result[3] = aNext[3] - a[3];
}
GLfloat result[4];
fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine,
'Y', result);
store_vector4(inst, machine, result);
#else
store_vector4(inst, machine, ZeroVec);
#endif
}
break;
case OPCODE_DP3:

View File

@ -48,6 +48,9 @@ struct gl_program_machine
/** Fragment Input attributes */
GLfloat (*Attribs)[MAX_WIDTH][4];
GLfloat (*DerivX)[4];
GLfloat (*DerivY)[4];
GLuint NumDeriv; /**< Max index into DerivX/Y arrays */
GLuint CurElement; /**< Index into Attribs arrays */
/** Vertex Input attribs */

View File

@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.3
* Version: 7.0
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@ -121,17 +121,17 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
return;
case STATE_HALF_VECTOR:
{
GLfloat eye_z[] = {0, 0, 1};
static const GLfloat eye_z[] = {0, 0, 1};
GLfloat p[3];
/* Compute infinite half angle vector:
* half-vector = light_position + (0, 0, 1)
* and then normalize. w = 0
*
* halfVector = normalize(normalize(lightPos) + (0, 0, 1))
* light.EyePosition.w should be 0 for infinite lights.
*/
ADD_3V(value, eye_z, ctx->Light.Light[ln].EyePosition);
COPY_3V(p, ctx->Light.Light[ln].EyePosition);
NORMALIZE_3FV(p);
ADD_3V(value, p, eye_z);
NORMALIZE_3FV(value);
value[3] = 0;
value[3] = 1.0;
}
return;
case STATE_POSITION_NORMALIZED:

View File

@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.3
* Version: 7.0
*
* Copyright (C) 2004-2007 Brian Paul All Rights Reserved.
*
@ -1072,12 +1072,20 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
* If we're setting a sampler, we must use glUniformi1()!
*/
if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) {
GLint unit;
if (type != GL_INT || count != 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUniform(only glUniform1i can be used "
"to set sampler uniforms)");
return;
}
/* check that the sampler (tex unit index) is legal */
unit = ((GLint *) values)[0];
if (unit >= ctx->Const.MaxTextureImageUnits) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glUniform1(invalid sampler/tex unit index)");
return;
}
}
if (count < 0) {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,200 @@
/*
* Mesa 3-D graphics library
* Version: 6.6
*
* Copyright (C) 2006 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//
// From Shader Spec, ver. 1.20, rev. 6
//
//
// 8.5 Matrix Functions
//
mat2x3 matrixCompMult (mat2x3 m, mat2x3 n) {
return mat2x3 (m[0] * n[0], m[1] * n[1]);
}
mat2x4 matrixCompMult (mat2x4 m, mat2x4 n) {
return mat2x4 (m[0] * n[0], m[1] * n[1]);
}
mat3x2 matrixCompMult (mat3x2 m, mat3x2 n) {
return mat3x2 (m[0] * n[0], m[1] * n[1], m[2] * n[2]);
}
mat3x4 matrixCompMult (mat3x4 m, mat3x4 n) {
return mat3x4 (m[0] * n[0], m[1] * n[1], m[2] * n[2]);
}
mat4x2 matrixCompMult (mat4x2 m, mat4x2 n) {
return mat4x2 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]);
}
mat4x3 matrixCompMult (mat4x3 m, mat4x3 n) {
return mat4x3 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]);
}
mat2 outerProduct (vec2 c, vec2 r) {
return mat2 (
c.x * r.x, c.y * r.x,
c.x * r.y, c.y * r.y
);
}
mat3 outerProduct (vec3 c, vec3 r) {
return mat3 (
c.x * r.x, c.y * r.x, c.z * r.x,
c.x * r.y, c.y * r.y, c.z * r.y,
c.x * r.z, c.y * r.z, c.z * r.z
);
}
mat4 outerProduct (vec4 c, vec4 r) {
return mat4 (
c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x,
c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y,
c.x * r.z, c.y * r.z, c.z * r.z, c.w * r.z,
c.x * r.w, c.y * r.w, c.z * r.w, c.w * r.w
);
}
mat2x3 outerProduct (vec3 c, vec2 r) {
return mat2x3 (
c.x * r.x, c.y * r.x, c.z * r.x,
c.x * r.y, c.y * r.y, c.z * r.y
);
}
mat3x2 outerProduct (vec2 c, vec3 r) {
return mat3x2 (
c.x * r.x, c.y * r.x,
c.x * r.y, c.y * r.y,
c.x * r.z, c.y * r.z
);
}
mat2x4 outerProduct (vec4 c, vec2 r) {
return mat2x4 (
c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x,
c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y
);
}
mat4x2 outerProduct (vec2 c, vec4 r) {
return mat4x2 (
c.x * r.x, c.y * r.x,
c.x * r.y, c.y * r.y,
c.x * r.z, c.y * r.z,
c.x * r.w, c.y * r.w
);
}
mat3x4 outerProduct (vec4 c, vec3 r) {
return mat3x4 (
c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x,
c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y,
c.x * r.z, c.y * r.z, c.z * r.z, c.w * r.z
);
}
mat4x3 outerProduct (vec3 c, vec4 r) {
return mat4x3 (
c.x * r.x, c.y * r.x, c.z * r.x,
c.x * r.y, c.y * r.y, c.z * r.y,
c.x * r.z, c.y * r.z, c.z * r.z,
c.x * r.w, c.y * r.w, c.z * r.w
);
}
mat2 transpose (mat2 m) {
return mat2 (
m[0].x, m[1].x,
m[0].y, m[1].y
);
}
mat3 transpose (mat3 m) {
return mat3 (
m[0].x, m[1].x, m[2].x,
m[0].y, m[1].y, m[2].y,
m[0].z, m[1].z, m[2].z
);
}
mat4 transpose (mat4 m) {
return mat4 (
m[0].x, m[1].x, m[2].x, m[3].x,
m[0].y, m[1].y, m[2].y, m[3].y,
m[0].z, m[1].z, m[2].z, m[3].z,
m[0].w, m[1].w, m[2].w, m[3].w
);
}
mat2x3 transpose (mat3x2 m) {
return mat2x3 (
m[0].x, m[1].x, m[2].x,
m[0].y, m[1].y, m[2].y
);
}
mat3x2 transpose (mat2x3 m) {
return mat3x2 (
m[0].x, m[1].x,
m[0].y, m[1].y,
m[0].z, m[1].z
);
}
mat2x4 transpose (mat4x2 m) {
return mat2x4 (
m[0].x, m[1].x, m[2].x, m[3].x,
m[0].y, m[1].y, m[2].y, m[3].y
);
}
mat4x2 transpose (mat2x4 m) {
return mat4x2 (
m[0].x, m[1].x,
m[0].y, m[1].y,
m[0].z, m[1].z,
m[0].w, m[1].w
);
}
mat3x4 transpose (mat4x3 m) {
return mat3x4 (
m[0].x, m[1].x, m[2].x, m[3].x,
m[0].y, m[1].y, m[2].y, m[3].y,
m[0].z, m[1].z, m[2].z, m[3].z
);
}
mat4x3 transpose (mat3x4 m) {
return mat4x3 (
m[0].x, m[1].x, m[2].x,
m[0].y, m[1].y, m[2].y,
m[0].z, m[1].z, m[2].z,
m[0].w, m[1].w, m[2].w
);
}

View File

@ -1,104 +0,0 @@
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */
/* slang_builtin_120_common.gc */
3,1,0,26,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,26,109,0,0,1,0,0,26,110,0,
0,0,1,8,58,109,97,116,50,120,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,
49,0,57,18,110,0,16,10,49,0,57,48,0,0,0,0,1,0,28,0,109,97,116,114,105,120,67,111,109,112,77,117,
108,116,0,1,0,0,28,109,0,0,1,0,0,28,110,0,0,0,1,8,58,109,97,116,50,120,52,0,18,109,0,16,8,48,0,57,
18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,0,0,0,1,0,27,0,109,
97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,27,109,0,0,1,0,0,27,110,0,0,0,1,8,58,109,
97,116,51,120,50,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,
0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,0,0,0,1,0,30,0,109,97,116,
114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,30,109,0,0,1,0,0,30,110,0,0,0,1,8,58,109,97,116,
51,120,52,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,
49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,0,0,0,1,0,29,0,109,97,116,114,105,
120,67,111,109,112,77,117,108,116,0,1,0,0,29,109,0,0,1,0,0,29,110,0,0,0,1,8,58,109,97,116,52,120,
50,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,
57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,18,109,0,16,10,51,0,57,18,110,0,16,10,
51,0,57,48,0,0,0,0,1,0,31,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,31,109,0,
0,1,0,0,31,110,0,0,0,1,8,58,109,97,116,52,120,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,
0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,
48,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,48,0,0,0,0,1,0,13,0,111,117,116,101,114,80,114,
111,100,117,99,116,0,1,0,0,10,99,0,0,1,0,0,10,114,0,0,0,1,8,58,109,97,116,50,0,18,99,0,59,120,0,18,
114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,
0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,0,0,0,1,0,14,0,111,117,116,101,114,80,114,111,100,117,99,
116,0,1,0,0,11,99,0,0,1,0,0,11,114,0,0,0,1,8,58,109,97,116,51,0,18,99,0,59,120,0,18,114,0,59,120,0,
48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,
120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,
121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,
59,122,0,18,114,0,59,122,0,48,0,0,0,0,1,0,15,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,
0,12,99,0,0,1,0,0,12,114,0,0,0,1,8,58,109,97,116,52,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,
99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,119,0,18,
114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,
0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,119,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,
18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,
48,0,18,99,0,59,119,0,18,114,0,59,122,0,48,0,18,99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,
121,0,18,114,0,59,119,0,48,0,18,99,0,59,122,0,18,114,0,59,119,0,48,0,18,99,0,59,119,0,18,114,0,59,
119,0,48,0,0,0,0,1,0,26,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,11,99,0,0,1,0,0,10,
114,0,0,0,1,8,58,109,97,116,50,120,51,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,
18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,
48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,0,0,0,1,0,27,
0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,10,99,0,0,1,0,0,11,114,0,0,0,1,8,58,109,97,
116,51,120,50,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,
99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,
114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,0,0,0,1,0,28,0,111,117,116,101,114,80,
114,111,100,117,99,116,0,1,0,0,12,99,0,0,1,0,0,10,114,0,0,0,1,8,58,109,97,116,50,120,52,0,18,99,0,
59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,
59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,
99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,119,0,18,
114,0,59,121,0,48,0,0,0,0,1,0,29,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,10,99,0,0,
1,0,0,12,114,0,0,0,1,8,58,109,97,116,52,120,50,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,
59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,
59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,
99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,121,0,18,114,0,59,119,0,48,0,0,0,0,1,0,30,0,111,
117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,12,99,0,0,1,0,0,11,114,0,0,0,1,8,58,109,97,116,
51,120,52,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,
0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,
0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,
99,0,59,119,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,
114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,0,18,99,0,59,119,0,18,114,0,59,122,0,48,
0,0,0,0,1,0,31,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,11,99,0,0,1,0,0,12,114,0,0,
0,1,8,58,109,97,116,52,120,51,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,
59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,
99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,
114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,
0,18,99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,121,0,18,114,0,59,119,0,48,0,18,99,0,59,122,0,
18,114,0,59,119,0,48,0,0,0,0,1,0,13,0,116,114,97,110,115,112,111,115,101,0,1,0,0,13,109,0,0,0,1,8,
58,109,97,116,50,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,
8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,0,0,0,1,0,14,0,116,114,97,110,115,112,111,
115,101,0,1,0,0,14,109,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,
10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,
16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,
0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,59,122,0,0,0,0,0,1,0,15,0,116,114,97,110,115,112,
111,115,101,0,1,0,0,15,109,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,
16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,10,51,0,57,59,120,0,0,18,
109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,
18,109,0,16,10,51,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,
0,18,109,0,16,10,50,0,57,59,122,0,0,18,109,0,16,10,51,0,57,59,122,0,0,18,109,0,16,8,48,0,57,59,119,
0,0,18,109,0,16,10,49,0,57,59,119,0,0,18,109,0,16,10,50,0,57,59,119,0,0,18,109,0,16,10,51,0,57,59,
119,0,0,0,0,0,1,0,26,0,116,114,97,110,115,112,111,115,101,0,1,0,0,27,109,0,0,0,1,8,58,109,97,116,
50,120,51,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,
57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,
0,57,59,121,0,0,0,0,0,1,0,27,0,116,114,97,110,115,112,111,115,101,0,1,0,0,26,109,0,0,0,1,8,58,109,
97,116,51,120,50,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,
8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,
16,10,49,0,57,59,122,0,0,0,0,0,1,0,28,0,116,114,97,110,115,112,111,115,101,0,1,0,0,29,109,0,0,0,1,
8,58,109,97,116,50,120,52,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,
109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,
18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,51,0,57,59,121,
0,0,0,0,0,1,0,29,0,116,114,97,110,115,112,111,115,101,0,1,0,0,28,109,0,0,0,1,8,58,109,97,116,52,
120,50,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,8,48,0,57,
59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,
57,59,122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,16,10,49,0,57,59,119,0,0,0,0,0,1,0,30,0,
116,114,97,110,115,112,111,115,101,0,1,0,0,31,109,0,0,0,1,8,58,109,97,116,51,120,52,0,18,109,0,16,
8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,
16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,
0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,51,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,
109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,59,122,0,0,18,109,0,16,10,51,0,57,59,122,0,0,
0,0,0,1,0,31,0,116,114,97,110,115,112,111,115,101,0,1,0,0,30,109,0,0,0,1,8,58,109,97,116,52,120,51,
0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,
0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,
121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,
59,122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,16,10,49,0,57,59,119,0,0,18,109,0,16,10,50,0,
57,59,119,0,0,0,0,0,0

View File

@ -0,0 +1,30 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 2006 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//
// From Shader Spec, ver. 1.20, rev. 6
//
varying vec2 gl_PointCoord;

View File

@ -1,5 +0,0 @@
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */
/* slang_builtin_120_fragment.gc */
3,2,2,3,10,1,103,108,95,80,111,105,110,116,67,111,111,114,100,0,0,0,0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,239 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 2006 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//
// From Shader Spec, ver. 1.10, rev. 59
//
__fixed_input vec4 gl_FragCoord;
__fixed_input bool gl_FrontFacing;
__fixed_output vec4 gl_FragColor;
__fixed_output vec4 gl_FragData[gl_MaxDrawBuffers];
__fixed_output float gl_FragDepth;
varying vec4 gl_Color;
varying vec4 gl_SecondaryColor;
varying vec4 gl_TexCoord[gl_MaxTextureCoords];
varying float gl_FogFragCoord;
//// 8.7 Texture Lookup Functions (with bias)
vec4 texture1D(const sampler1D sampler, const float coord, const float bias)
{
vec4 coord4;
coord4.x = coord;
coord4.w = bias;
__asm vec4_texb1d __retVal, sampler, coord4;
}
vec4 texture1DProj(const sampler1D sampler, const vec2 coord, const float bias)
{
// do projection here (there's no vec4_texbp1d instruction)
vec4 pcoord;
pcoord.x = coord.x / coord.y;
pcoord.w = bias;
__asm vec4_texb1d __retVal, sampler, pcoord;
}
vec4 texture1DProj(const sampler1D sampler, const vec4 coord, const float bias)
{
// do projection here (there's no vec4_texbp1d instruction)
vec4 pcoord;
pcoord.x = coord.x / coord.z;
pcoord.w = bias;
__asm vec4_texb1d __retVal, sampler, pcoord;
}
vec4 texture2D(const sampler2D sampler, const vec2 coord, const float bias)
{
vec4 coord4;
coord4.xy = coord.xy;
coord4.w = bias;
__asm vec4_texb2d __retVal, sampler, coord4;
}
vec4 texture2DProj(const sampler2D sampler, const vec3 coord, const float bias)
{
// do projection here (there's no vec4_texbp2d instruction)
vec4 pcoord;
pcoord.xy = coord.xy / coord.z;
pcoord.w = bias;
__asm vec4_texb2d __retVal, sampler, pcoord;
}
vec4 texture2DProj(const sampler2D sampler, const vec4 coord, const float bias)
{
// do projection here (there's no vec4_texbp2d instruction)
vec4 pcoord;
pcoord.xy = coord.xy / coord.w;
pcoord.w = bias;
__asm vec4_texb2d __retVal, sampler, pcoord;
}
vec4 texture3D(const sampler3D sampler, const vec3 coord, const float bias)
{
vec4 coord4;
coord4.xyz = coord.xyz;
coord4.w = bias;
__asm vec4_texb3d __retVal, sampler, coord4;
}
vec4 texture3DProj(const sampler3D sampler, const vec4 coord, const float bias)
{
// do projection here (there's no vec4_texbp3d instruction)
vec4 pcoord;
pcoord.xyz = coord.xyz / coord.w;
pcoord.w = bias;
__asm vec4_texb3d __retVal, sampler, pcoord;
}
vec4 textureCube(const samplerCube sampler, const vec3 coord, const float bias)
{
vec4 coord4;
coord4.xyz = coord;
coord4.w = bias;
__asm vec4_texcube __retVal, sampler, coord4;
}
// For shadow textures, we use the regular tex instructions since they should
// do the depth comparison step.
vec4 shadow1D(const sampler1DShadow sampler, const vec3 coord, const float bias)
{
vec4 coord4;
coord4.xyz = coord;
coord4.w = bias;
__asm vec4_texb1d __retVal, sampler, coord4;
}
vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord, const float bias)
{
vec4 pcoord;
pcoord.x = coord.x / coord.w;
pcoord.z = coord.z;
pcoord.w = bias;
__asm vec4_texb1d __retVal, sampler, pcoord;
}
vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord, const float bias)
{
vec4 coord4;
coord4.xyz = coord;
coord4.w = bias;
__asm vec4_texb2d __retVal, sampler, coord4;
}
vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord, const float bias)
{
vec4 pcoord;
pcoord.xy = coord.xy / coord.w;
pcoord.z = coord.z;
pcoord.w = bias;
__asm vec4_texb2d __retVal, sampler, pcoord;
}
//
// 8.8 Fragment Processing Functions
//
float dFdx(const float p)
{
__asm vec4_ddx __retVal.x, p.xxxx;
}
vec2 dFdx(const vec2 p)
{
__asm vec4_ddx __retVal.xy, p.xyyy;
}
vec3 dFdx(const vec3 p)
{
__asm vec4_ddx __retVal.xyz, p.xyzz;
}
vec4 dFdx(const vec4 p)
{
__asm vec4_ddx __retVal, p;
}
float dFdy(const float p)
{
__asm vec4_ddy __retVal.x, p.xxxx;
}
vec2 dFdy(const vec2 p)
{
__asm vec4_ddy __retVal.xy, p.xyyy;
}
vec3 dFdy(const vec3 p)
{
__asm vec4_ddy __retVal.xyz, p.xyzz;
}
vec4 dFdy(const vec4 p)
{
__asm vec4_ddy __retVal, p;
}
float fwidth (const float p)
{
// XXX hand-write with __asm
return abs(dFdx(p)) + abs(dFdy(p));
}
vec2 fwidth(const vec2 p)
{
// XXX hand-write with __asm
return abs(dFdx(p)) + abs(dFdy(p));
}
vec3 fwidth(const vec3 p)
{
// XXX hand-write with __asm
return abs(dFdx(p)) + abs(dFdy(p));
}
vec4 fwidth(const vec4 p)
{
// XXX hand-write with __asm
return abs(dFdx(p)) + abs(dFdy(p));
}

View File

@ -0,0 +1,385 @@
/*
* Mesa 3-D graphics library
* Version: 6.6
*
* Copyright (C) 2006 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file slang_pp_directives.syn
* slang preprocessor directives parser
* \author Michal Krol
*/
.syntax source;
/*
* This syntax script preprocesses a GLSL shader.
* It is assumed, that the #version directive has been parsed. Separate pass for parsing
* version gives better control on behavior depending on the version number given.
*
* The output is a source string with comments and directives removed. White spaces and comments
* are replaced with on or more spaces. All new-lines are preserved and converted to Linux format.
* Directives are escaped with a null character. The end of the source string is marked by
* two consecutive null characters. The consumer is responsible for executing the escaped
* directives, removing dead portions of code and expanding macros.
*/
.emtcode ESCAPE_TOKEN 0
/*
* The TOKEN_* symbols follow the ESCAPE_TOKEN.
*
* NOTE:
* There is no TOKEN_IFDEF and neither is TOKEN_IFNDEF. They are handled with TOKEN_IF and
* operator defined.
* The "#ifdef SYMBOL" is replaced with "#if defined SYMBOL"
* The "#ifndef SYMBOL" is replaced with "#if !defined SYMBOL"
*/
.emtcode TOKEN_END 0
.emtcode TOKEN_DEFINE 1
.emtcode TOKEN_UNDEF 2
.emtcode TOKEN_IF 3
.emtcode TOKEN_ELSE 4
.emtcode TOKEN_ELIF 5
.emtcode TOKEN_ENDIF 6
.emtcode TOKEN_ERROR 7
.emtcode TOKEN_PRAGMA 8
.emtcode TOKEN_EXTENSION 9
.emtcode TOKEN_LINE 10
/*
* The PARAM_* symbols follow the TOKEN_DEFINE.
*/
.emtcode PARAM_END 0
.emtcode PARAM_PARAMETER 1
/*
* The BEHAVIOR_* symbols follow the TOKEN_EXTENSION.
*/
.emtcode BEHAVIOR_REQUIRE 1
.emtcode BEHAVIOR_ENABLE 2
.emtcode BEHAVIOR_WARN 3
.emtcode BEHAVIOR_DISABLE 4
source
optional_directive .and .loop source_element .and '\0' .emit ESCAPE_TOKEN .emit TOKEN_END;
source_element
c_style_comment_block .or cpp_style_comment_block .or new_line_directive .or source_token;
c_style_comment_block
'/' .and '*' .and c_style_comment_rest .and .true .emit ' ';
c_style_comment_rest
.loop c_style_comment_body .and c_style_comment_end;
c_style_comment_body
c_style_comment_char_nostar .or c_style_comment_char_star_noslashstar;
c_style_comment_char_nostar
new_line .or '\x2B'-'\xFF' .or '\x01'-'\x29';
c_style_comment_char_star_noslashstar
'*' .and c_style_comment_char_star_noslashstar_1;
c_style_comment_char_star_noslashstar_1
c_style_comment_char_noslashstar .or c_style_comment_char_star_noslashstar;
c_style_comment_char_noslashstar
new_line .or '\x30'-'\xFF' .or '\x01'-'\x29' .or '\x2B'-'\x2E';
c_style_comment_end
'*' .and .loop c_style_comment_char_star .and '/';
c_style_comment_char_star
'*';
cpp_style_comment_block
'/' .and '/' .and cpp_style_comment_block_1;
cpp_style_comment_block_1
cpp_style_comment_block_2 .or cpp_style_comment_block_3;
cpp_style_comment_block_2
.loop cpp_style_comment_char .and new_line_directive;
cpp_style_comment_block_3
.loop cpp_style_comment_char;
cpp_style_comment_char
'\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
new_line_directive
new_line .and optional_directive;
new_line
generic_new_line .emit '\n';
generic_new_line
carriage_return_line_feed .or line_feed_carriage_return .or '\n' .or '\r';
carriage_return_line_feed
'\r' .and '\n';
line_feed_carriage_return
'\n' .and '\r';
optional_directive
directive .emit ESCAPE_TOKEN .or .true;
directive
dir_define .emit TOKEN_DEFINE .or
dir_undef .emit TOKEN_UNDEF .or
dir_if .emit TOKEN_IF .or
dir_ifdef .emit TOKEN_IF .emit 'd' .emit 'e' .emit 'f' .emit 'i' .emit 'n' .emit 'e' .emit 'd'
.emit ' ' .or
dir_ifndef .emit TOKEN_IF .emit '!' .emit 'd' .emit 'e' .emit 'f' .emit 'i' .emit 'n' .emit 'e'
.emit 'd' .emit ' ' .or
dir_else .emit TOKEN_ELSE .or
dir_elif .emit TOKEN_ELIF .or
dir_endif .emit TOKEN_ENDIF .or
dir_ext .emit TOKEN_EXTENSION .or
dir_line .emit TOKEN_LINE;
dir_define
optional_space .and '#' .and optional_space .and "define" .and symbol .and opt_parameters .and
definition;
dir_undef
optional_space .and '#' .and optional_space .and "undef" .and symbol;
dir_if
optional_space .and '#' .and optional_space .and "if" .and expression;
dir_ifdef
optional_space .and '#' .and optional_space .and "ifdef" .and symbol;
dir_ifndef
optional_space .and '#' .and optional_space .and "ifndef" .and symbol;
dir_else
optional_space .and '#' .and optional_space .and "else";
dir_elif
optional_space .and '#' .and optional_space .and "elif" .and expression;
dir_endif
optional_space .and '#' .and optional_space .and "endif";
dir_ext
optional_space .and '#' .and optional_space .and "extension" .and space .and extension_name .and
optional_space .and ':' .and optional_space .and extension_behavior;
dir_line
optional_space .and '#' .and optional_space .and "line" .and expression;
symbol
space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';
opt_parameters
parameters .or .true .emit PARAM_END;
parameters
'(' .and parameters_1 .and optional_space .and ')' .emit PARAM_END;
parameters_1
parameters_2 .or .true;
parameters_2
parameter .emit PARAM_PARAMETER .and .loop parameters_3;
parameters_3
optional_space .and ',' .and parameter .emit PARAM_PARAMETER;
parameter
optional_space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and
.true .emit '\0';
definition
.loop definition_character .emit * .and .true .emit '\0';
definition_character
'\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
expression
expression_element .and .loop expression_element .and .true .emit '\0';
expression_element
expression_character .emit *;
expression_character
'\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
extension_name
symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';
extension_behavior
"require" .emit BEHAVIOR_REQUIRE .or
"enable" .emit BEHAVIOR_ENABLE .or
"warn" .emit BEHAVIOR_WARN .or
"disable" .emit BEHAVIOR_DISABLE;
optional_space
.loop single_space;
space
single_space .and .loop single_space;
single_space
' ' .or '\t';
source_token
space .emit ' ' .or complex_token .or source_token_1;
source_token_1
simple_token .emit ' ' .and .true .emit ' ';
/*
* All possible tokens.
*/
complex_token
identifier .or number;
simple_token
increment .or decrement .or lequal .or gequal .or equal .or nequal .or and .or xor .or or .or
addto .or subtractfrom .or multiplyto .or divideto .or other;
identifier
identifier_char1 .emit * .and .loop identifier_char2 .emit *;
identifier_char1
'a'-'z' .or 'A'-'Z' .or '_';
identifier_char2
'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';
number
float .or integer;
digit_oct
'0'-'7';
digit_dec
'0'-'9';
digit_hex
'0'-'9' .or 'A'-'F' .or 'a'-'f';
float
float_1 .or float_2;
float_1
float_fractional_constant .and float_optional_exponent_part;
float_2
float_digit_sequence .and float_exponent_part;
float_fractional_constant
float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;
float_fractional_constant_1
float_digit_sequence .and '.' .emit '.' .and float_digit_sequence;
float_fractional_constant_2
float_digit_sequence .and '.' .emit '.';
float_fractional_constant_3
'.' .emit '.' .and float_digit_sequence;
float_optional_exponent_part
float_exponent_part .or .true;
float_digit_sequence
digit_dec .emit * .and .loop digit_dec .emit *;
float_exponent_part
float_exponent_part_1 .or float_exponent_part_2;
float_exponent_part_1
'e' .emit 'e' .and float_optional_sign .and float_digit_sequence;
float_exponent_part_2
'E' .emit 'E' .and float_optional_sign .and float_digit_sequence;
float_optional_sign
'+' .emit '+' .or '-' .emit '-' .or .true;
integer
integer_hex .or integer_oct .or integer_dec;
integer_hex
'0' .emit '0' .and integer_hex_1 .emit * .and digit_hex .emit * .and
.loop digit_hex .emit *;
integer_hex_1
'x' .or 'X';
integer_oct
'0' .emit '0' .and .loop digit_oct .emit *;
integer_dec
digit_dec .emit * .and .loop digit_dec .emit *;
increment
'+' .emit * .and '+' .emit *;
decrement
'-' .emit * .and '-' .emit *;
lequal
'<' .emit * .and '=' .emit *;
gequal
'>' .emit * .and '=' .emit *;
equal
'=' .emit * .and '=' .emit *;
nequal
'!' .emit * .and '=' .emit *;
and
'&' .emit * .and '&' .emit *;
xor
'^' .emit * .and '^' .emit *;
or
'|' .emit * .and '|' .emit *;
addto
'+' .emit * .and '=' .emit *;
subtractfrom
'-' .emit * .and '=' .emit *;
multiplyto
'*' .emit * .and '=' .emit *;
divideto
'/' .emit * .and '=' .emit *;
/*
* All characters except '\0' and '#'.
*/
other
'\x24'-'\xFF' .emit * .or '\x01'-'\x22' .emit *;
symbol_character
'A'-'Z' .or 'a'-'z' .or '_';
symbol_character2
'A'-'Z' .or 'a'-'z' .or '0'-'9' .or '_';
.string string_lexer;
string_lexer
lex_first_identifier_character .and .loop lex_next_identifier_character;
lex_first_identifier_character
'a'-'z' .or 'A'-'Z' .or '_';
lex_next_identifier_character
'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';

View File

@ -0,0 +1,265 @@
/*
* Mesa 3-D graphics library
* Version: 6.6
*
* Copyright (C) 2006 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file slang_pp_expression.syn
* slang preprocessor expression parser
* \author Michal Krol
*/
/*
* Parses one or two (optional) expressions on literal integer constants. Those expressions come
* from #if #elif and #line directives. The preprocessor already parsed those directives and
* expanded the expression (expressions). All occurences of the operator "defined" are already
* replaced with either "0" or "1" literals.
*/
.syntax expression;
/*
* Those separate individual expressions.
* For #if/#elif case it is: EXP_EXPRESSION ... EXP_END
* For #line case it may be: EXP_EXPRESSION ... EXP_EXPRESSION ... EXP_END
*/
.emtcode EXP_END 0
.emtcode EXP_EXPRESSION 1
.emtcode OP_END 0
.emtcode OP_PUSHINT 1
.emtcode OP_LOGICALOR 2
.emtcode OP_LOGICALAND 3
.emtcode OP_OR 4
.emtcode OP_XOR 5
.emtcode OP_AND 6
.emtcode OP_EQUAL 7
.emtcode OP_NOTEQUAL 8
.emtcode OP_LESSEQUAL 9
.emtcode OP_GREATEREQUAL 10
.emtcode OP_LESS 11
.emtcode OP_GREATER 12
.emtcode OP_LEFTSHIFT 13
.emtcode OP_RIGHTSHIFT 14
.emtcode OP_ADD 15
.emtcode OP_SUBTRACT 16
.emtcode OP_MULTIPLY 17
.emtcode OP_DIVIDE 18
.emtcode OP_MODULUS 19
.emtcode OP_PLUS 20
.emtcode OP_MINUS 21
.emtcode OP_NEGATE 22
.emtcode OP_COMPLEMENT 23
expression
first_expression .and optional_second_expression .and optional_space .and '\0' .emit EXP_END;
first_expression
optional_space .and logical_or_expression .emit EXP_EXPRESSION .and .true .emit OP_END;
optional_second_expression
second_expression .or .true;
second_expression
space .and logical_or_expression .emit EXP_EXPRESSION .and .true .emit OP_END;
logical_or_expression
logical_and_expression .and .loop logical_or_expression_1;
logical_or_expression_1
barbar .and logical_and_expression .and .true .emit OP_LOGICALOR;
logical_and_expression
or_expression .and .loop logical_and_expression_1;
logical_and_expression_1
ampersandampersand .and or_expression .and .true .emit OP_LOGICALAND;
or_expression
xor_expression .and .loop or_expression_1;
or_expression_1
bar .and xor_expression .and .true .emit OP_OR;
xor_expression
and_expression .and .loop xor_expression_1;
xor_expression_1
caret .and and_expression .and .true .emit OP_XOR;
and_expression
equality_expression .and .loop and_expression_1;
and_expression_1
ampersand .and equality_expression .and .true .emit OP_AND;
equality_expression
relational_expression .and .loop equality_expression_1;
equality_expression_1
equality_expression_2 .or equality_expression_3;
equality_expression_2
equalsequals .and relational_expression .and .true .emit OP_EQUAL;
equality_expression_3
bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;
relational_expression
shift_expression .and .loop relational_expression_1;
relational_expression_1
relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or
relational_expression_5;
relational_expression_2
lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;
relational_expression_3
greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;
relational_expression_4
less .and shift_expression .and .true .emit OP_LESS;
relational_expression_5
greater .and shift_expression .and .true .emit OP_GREATER;
shift_expression
additive_expression .and .loop shift_expression_1;
shift_expression_1
shift_expression_2 .or shift_expression_3;
shift_expression_2
lessless .and additive_expression .and .true .emit OP_LEFTSHIFT;
shift_expression_3
greatergreater .and additive_expression .and .true .emit OP_RIGHTSHIFT;
additive_expression
multiplicative_expression .and .loop additive_expression_1;
additive_expression_1
additive_expression_2 .or additive_expression_3;
additive_expression_2
plus .and multiplicative_expression .and .true .emit OP_ADD;
additive_expression_3
dash .and multiplicative_expression .and .true .emit OP_SUBTRACT;
multiplicative_expression
unary_expression .and .loop multiplicative_expression_1;
multiplicative_expression_1
multiplicative_expression_2 .or multiplicative_expression_3 .or multiplicative_expression_4;
multiplicative_expression_2
star .and unary_expression .and .true .emit OP_MULTIPLY;
multiplicative_expression_3
slash .and unary_expression .and .true .emit OP_DIVIDE;
multiplicative_expression_4
percent .and unary_expression .and .true .emit OP_MODULUS;
unary_expression
primary_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or
unary_expression_4;
unary_expression_1
plus .and unary_expression .and .true .emit OP_PLUS;
unary_expression_2
dash .and unary_expression .and .true .emit OP_MINUS;
unary_expression_3
bang .and unary_expression .and .true .emit OP_NEGATE;
unary_expression_4
tilda .and unary_expression .and .true .emit OP_COMPLEMENT;
primary_expression
intconstant .or primary_expression_1;
primary_expression_1
lparen .and logical_or_expression .and rparen;
intconstant
integer .emit OP_PUSHINT;
integer
integer_dec;
integer_dec
digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
digit_dec
'0'-'9';
optional_space
.loop single_space;
space
single_space .and .loop single_space;
single_space
' ' .or '\t';
ampersand
optional_space .and '&' .and optional_space;
ampersandampersand
optional_space .and '&' .and '&' .and optional_space;
bang
optional_space .and '!' .and optional_space;
bangequals
optional_space .and '!' .and '=' .and optional_space;
bar
optional_space .and '|' .and optional_space;
barbar
optional_space .and '|' .and '|' .and optional_space;
caret
optional_space .and '^' .and optional_space;
dash
optional_space .and '-' .and optional_space;
equalsequals
optional_space .and '=' .and '=' .and optional_space;
greater
optional_space .and '>' .and optional_space;
greaterequals
optional_space .and '>' .and '=' .and optional_space;
greatergreater
optional_space .and '>' .and '>' .and optional_space;
less
optional_space .and '<' .and optional_space;
lessequals
optional_space .and '<' .and '=' .and optional_space;
lessless
optional_space .and '<' .and '<' .and optional_space;
lparen
optional_space .and '(' .and optional_space;
percent
optional_space .and '%' .and optional_space;
plus
optional_space .and '+' .and optional_space;
rparen
optional_space .and ')' .and optional_space;
slash
optional_space .and '/' .and optional_space;
star
optional_space .and '*' .and optional_space;
tilda
optional_space .and '~' .and optional_space;

View File

@ -0,0 +1,121 @@
/*
* Mesa 3-D graphics library
* Version: 6.6
*
* Copyright (C) 2005-2006 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file slang_pp_version.syn
* slang #version directive syntax
* \author Michal Krol
*/
.syntax version_directive;
version_directive
version_directive_1 .and .loop version_directive_2;
version_directive_1
prior_optional_spaces .and optional_version_directive .and .true .emit $;
version_directive_2
prior_optional_spaces .and version_directive_body .and .true .emit $;
optional_version_directive
version_directive_body .or .true .emit 10 .emit 1;
version_directive_body
'#' .and optional_space .and "version" .and space .and version_number .and optional_space .and
new_line;
version_number
version_number_110 .or version_number_120;
version_number_110
leading_zeroes .and "110" .emit 10 .emit 1;
version_number_120
leading_zeroes .and "120" .emit 20 .emit 1;
leading_zeroes
.loop zero;
zero
'0';
space
single_space .and .loop single_space;
optional_space
.loop single_space;
single_space
' ' .or '\t';
prior_optional_spaces
.loop prior_space;
prior_space
c_style_comment_block .or cpp_style_comment_block .or space .or new_line;
c_style_comment_block
'/' .and '*' .and c_style_comment_rest;
c_style_comment_rest
.loop c_style_comment_char_no_star .and c_style_comment_rest_1;
c_style_comment_rest_1
c_style_comment_end .or c_style_comment_rest_2;
c_style_comment_rest_2
'*' .and c_style_comment_rest;
c_style_comment_char_no_star
'\x2B'-'\xFF' .or '\x01'-'\x29';
c_style_comment_end
'*' .and '/';
cpp_style_comment_block
'/' .and '/' .and cpp_style_comment_block_1;
cpp_style_comment_block_1
cpp_style_comment_block_2 .or cpp_style_comment_block_3;
cpp_style_comment_block_2
.loop cpp_style_comment_char .and new_line;
cpp_style_comment_block_3
.loop cpp_style_comment_char;
cpp_style_comment_char
'\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
new_line
cr_lf .or lf_cr .or '\n' .or '\r';
cr_lf
'\r' .and '\n';
lf_cr
'\n' .and '\r';
.string __string_filter;
__string_filter
.loop __identifier_char;
__identifier_char
'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,118 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 2005 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file slang_version.syn
* slang #version directive syntax
* \author Michal Krol
*/
.syntax version_directive;
version_directive
version_directive_1 .and .loop version_directive_2;
version_directive_1
prior_optional_spaces .and optional_version_directive .and .true .emit $;
version_directive_2
prior_optional_spaces .and version_directive_body .and .true .emit $;
optional_version_directive
version_directive_body .or .true .emit 10 .emit 1;
version_directive_body
'#' .and optional_space .and "version" .and space .and version_number .and optional_space .and
new_line;
version_number
version_number_110;
version_number_110
leading_zeroes .and "110" .emit 10 .emit 1;
leading_zeroes
.loop zero;
zero
'0';
space
single_space .and .loop single_space;
optional_space
.loop single_space;
single_space
' ' .or '\t';
prior_optional_spaces
.loop prior_space;
prior_space
c_style_comment_block .or cpp_style_comment_block .or space .or new_line;
c_style_comment_block
'/' .and '*' .and c_style_comment_rest;
c_style_comment_rest
.loop c_style_comment_char_no_star .and c_style_comment_rest_1;
c_style_comment_rest_1
c_style_comment_end .or c_style_comment_rest_2;
c_style_comment_rest_2
'*' .and c_style_comment_rest;
c_style_comment_char_no_star
'\x2B'-'\xFF' .or '\x01'-'\x29';
c_style_comment_end
'*' .and '/';
cpp_style_comment_block
'/' .and '/' .and cpp_style_comment_block_1;
cpp_style_comment_block_1
cpp_style_comment_block_2 .or cpp_style_comment_block_3;
cpp_style_comment_block_2
.loop cpp_style_comment_char .and new_line;
cpp_style_comment_block_3
.loop cpp_style_comment_char;
cpp_style_comment_char
'\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
new_line
cr_lf .or lf_cr .or '\n' .or '\r';
cr_lf
'\r' .and '\n';
lf_cr
'\n' .and '\r';
.string __string_filter;
__string_filter
.loop __identifier_char;
__identifier_char
'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';

View File

@ -0,0 +1,187 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 2006 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//
// From Shader Spec, ver. 1.10, rev. 59
//
__fixed_output vec4 gl_Position;
__fixed_output float gl_PointSize;
__fixed_output vec4 gl_ClipVertex;
attribute vec4 gl_Color;
attribute vec4 gl_SecondaryColor;
attribute vec3 gl_Normal;
attribute vec4 gl_Vertex;
attribute vec4 gl_MultiTexCoord0;
attribute vec4 gl_MultiTexCoord1;
attribute vec4 gl_MultiTexCoord2;
attribute vec4 gl_MultiTexCoord3;
attribute vec4 gl_MultiTexCoord4;
attribute vec4 gl_MultiTexCoord5;
attribute vec4 gl_MultiTexCoord6;
attribute vec4 gl_MultiTexCoord7;
attribute float gl_FogCoord;
varying vec4 gl_FrontColor;
varying vec4 gl_BackColor;
varying vec4 gl_FrontSecondaryColor;
varying vec4 gl_BackSecondaryColor;
varying vec4 gl_TexCoord[gl_MaxTextureCoords];
varying float gl_FogFragCoord;
//
// Geometric Functions
//
vec4 ftransform()
{
__retVal = gl_Vertex * gl_ModelViewProjectionMatrixTranspose;
}
//
// 8.7 Texture Lookup Functions
// These are pretty much identical to the ones in slang_fragment_builtin.gc
// When used in a vertex program, the texture sample instructions should not
// be using a LOD term so it's effectively zero. Adding 'lod' to that does
// what we want.
//
vec4 texture1DLod(const sampler1D sampler, const float coord, const float lod)
{
vec4 coord4;
coord4.x = coord;
coord4.w = lod;
__asm vec4_texb1d __retVal, sampler, coord4;
}
vec4 texture1DProjLod(const sampler1D sampler, const vec2 coord, const float lod)
{
vec4 pcoord;
pcoord.x = coord.x / coord.y;
pcoord.w = lod;
__asm vec4_texb1d __retVal, sampler, pcoord;
}
vec4 texture1DProjLod(const sampler1D sampler, const vec4 coord, const float lod)
{
vec4 pcoord;
pcoord.x = coord.x / coord.z;
pcoord.w = lod;
__asm vec4_texb1d __retVal, sampler, pcoord;
}
vec4 texture2DLod(const sampler2D sampler, const vec2 coord, const float lod)
{
vec4 coord4;
coord4.xy = coord.xy;
coord4.w = lod;
__asm vec4_texb2d __retVal, sampler, coord4;
}
vec4 texture2DProjLod(const sampler2D sampler, const vec3 coord, const float lod)
{
vec4 pcoord;
pcoord.xy = coord.xy / coord.z;
pcoord.w = lod;
__asm vec4_texb2d __retVal, sampler, pcoord;
}
vec4 texture2DProjLod(const sampler2D sampler, const vec4 coord, const float lod)
{
vec4 pcoord;
pcoord.xy = coord.xy / coord.z;
pcoord.w = lod;
__asm vec4_texb2d __retVal, sampler, pcoord;
}
vec4 texture3DLod(const sampler3D sampler, const vec3 coord, const float lod)
{
vec4 coord4;
coord4.xyz = coord.xyz;
coord4.w = lod;
__asm vec4_texb3d __retVal, sampler, coord4;
}
vec4 texture3DProjLod(const sampler3D sampler, const vec4 coord, const float lod)
{
// do projection here (there's no vec4_texbp3d instruction)
vec4 pcoord;
pcoord.xyz = coord.xyz / coord.w;
pcoord.w = lod;
__asm vec4_texb3d __retVal, sampler, pcoord;
}
vec4 textureCubeLod(const samplerCube sampler, const vec3 coord, const float lod)
{
vec4 coord4;
coord4.xyz = coord;
coord4.w = lod;
__asm vec4_texcube __retVal, sampler, coord4;
}
vec4 shadow1DLod(const sampler1DShadow sampler, const vec3 coord, const float lod)
{
vec4 coord4;
coord4.xyz = coord;
coord4.w = lod;
__asm vec4_texb1d __retVal, sampler, coord4;
}
vec4 shadow1DProjLod(const sampler1DShadow sampler, const vec4 coord,
const float lod)
{
vec4 pcoord;
pcoord.x = coord.x / coord.w;
pcoord.z = coord.z;
pcoord.w = lod;
__asm vec4_texb1d __retVal, sampler, pcoord;
}
vec4 shadow2DLod(const sampler2DShadow sampler, const vec3 coord, const float lod)
{
vec4 coord4;
coord4.xyz = coord;
coord4.w = lod;
__asm vec4_texb2d __retVal, sampler, coord4;
}
vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord,
const float lod)
{
vec4 pcoord;
pcoord.xy = coord.xy / coord.w;
pcoord.z = coord.z;
pcoord.w = lod;
__asm vec4_texb2d __retVal, sampler, pcoord;
}

View File

@ -700,37 +700,6 @@ _slang_find_node_type(slang_operation *oper, slang_operation_type type)
}
/**
* Produce inline code for a call to an assembly instruction.
* XXX Note: children are passed as asm args in-order, not by name!
*/
static slang_operation *
slang_inline_asm_function(slang_assemble_ctx *A,
slang_function *fun, slang_operation *oper)
{
const GLuint numArgs = oper->num_children;
const slang_operation *args = oper->children;
GLuint i;
slang_operation *inlined = slang_operation_new(1);
/*assert(oper->type == SLANG_OPER_CALL); or vec4_add, etc */
/*
printf("Inline asm %s\n", (char*) fun->header.a_name);
*/
inlined->type = fun->body->children[0].type;
inlined->a_id = fun->body->children[0].a_id;
inlined->num_children = numArgs;
inlined->children = slang_operation_new(numArgs);
inlined->locals->outer_scope = oper->locals->outer_scope;
for (i = 0; i < numArgs; i++) {
slang_operation_copy(inlined->children + i, args + i);
}
return inlined;
}
static void
slang_resolve_variable(slang_operation *oper)
{
@ -891,6 +860,70 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
/**
* Produce inline code for a call to an assembly instruction.
* This is typically used to compile a call to a built-in function like this:
*
* vec4 mix(const vec4 x, const vec4 y, const vec4 a)
* {
* __asm vec4_lrp __retVal, a, y, x;
* }
*
* We basically translate a SLANG_OPER_CALL into a SLANG_OPER_ASM.
*/
static slang_operation *
slang_inline_asm_function(slang_assemble_ctx *A,
slang_function *fun, slang_operation *oper)
{
const GLuint numArgs = oper->num_children;
GLuint i;
slang_operation *inlined;
const GLboolean haveRetValue = _slang_function_has_return_value(fun);
slang_variable **substOld;
slang_operation **substNew;
ASSERT(slang_is_asm_function(fun));
ASSERT(fun->param_count == numArgs + haveRetValue);
/*
printf("Inline %s as %s\n",
(char*) fun->header.a_name,
(char*) fun->body->children[0].a_id);
*/
/*
* We'll substitute formal params with actual args in the asm call.
*/
substOld = (slang_variable **)
_slang_alloc(numArgs * sizeof(slang_variable *));
substNew = (slang_operation **)
_slang_alloc(numArgs * sizeof(slang_operation *));
for (i = 0; i < numArgs; i++) {
substOld[i] = fun->parameters->variables[i];
substNew[i] = oper->children + i;
}
/* make a copy of the code to inline */
inlined = slang_operation_new(1);
slang_operation_copy(inlined, &fun->body->children[0]);
if (haveRetValue) {
/* get rid of the __retVal child */
for (i = 0; i < numArgs; i++) {
inlined->children[i] = inlined->children[i + 1];
}
inlined->num_children--;
}
/* now do formal->actual substitutions */
slang_substitute(A, inlined, numArgs, substOld, substNew, GL_FALSE);
_slang_free(substOld);
_slang_free(substNew);
return inlined;
}
/**
* Inline the given function call operation.
* Return a new slang_operation that corresponds to the inlined code.
@ -2830,9 +2863,35 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
* MAX2(var->array_len, 1);
if (prog) {
/* user-defined uniform */
GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName,
size, datatype);
store = _slang_new_ir_storage(PROGRAM_UNIFORM, uniformLoc, size);
if (datatype == GL_NONE) {
if (var->type.specifier.type == SLANG_SPEC_STRUCT) {
_mesa_problem(NULL, "user-declared uniform structs not supported yet");
/* XXX what we need to do is unroll the struct into its
* basic types, creating a uniform variable for each.
* For example:
* struct foo {
* vec3 a;
* vec4 b;
* };
* uniform foo f;
*
* Should produce uniforms:
* "f.a" (GL_FLOAT_VEC3)
* "f.b" (GL_FLOAT_VEC4)
*/
}
else {
slang_info_log_error(A->log,
"invalid datatype for uniform variable %s",
(char *) var->a_name);
}
return GL_FALSE;
}
else {
GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName,
size, datatype);
store = _slang_new_ir_storage(PROGRAM_UNIFORM, uniformLoc, size);
}
}
else {
/* pre-defined uniform, like gl_ModelviewMatrix */

View File

@ -1618,7 +1618,8 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
A.program = O->program;
A.vartable = O->vartable;
A.curFuncEndLabel = NULL;
_slang_codegen_global_variable(&A, var, C->type);
if (!_slang_codegen_global_variable(&A, var, C->type))
return 0;
}
/* allocate global address space for a variable with a known size */

View File

@ -63,7 +63,7 @@ static const slang_ir_info IrInfo[] = {
{ IR_ABS, "IR_ABS", OPCODE_ABS, 4, 1 },
{ IR_NEG, "IR_NEG", OPCODE_NOP, 4, 1 }, /* special case: emit_negation() */
{ IR_DDX, "IR_DDX", OPCODE_DDX, 4, 1 },
{ IR_DDX, "IR_DDY", OPCODE_DDX, 4, 1 },
{ IR_DDY, "IR_DDY", OPCODE_DDY, 4, 1 },
{ IR_SIN, "IR_SIN", OPCODE_SIN, 1, 1 },
{ IR_COS, "IR_COS", OPCODE_COS, 1, 1 },
{ IR_NOISE1, "IR_NOISE1", OPCODE_NOISE1, 1, 1 },

View File

@ -93,7 +93,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
attribArray[i][0] = solve_plane(fx, fy, line->sPlane[attr]) * invQ;
attribArray[i][1] = solve_plane(fx, fy, line->tPlane[attr]) * invQ;
attribArray[i][2] = solve_plane(fx, fy, line->uPlane[attr]) * invQ;
if (attr < FRAG_ATTRIB_VAR0) {
if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) {
const GLuint unit = attr - FRAG_ATTRIB_TEX0;
line->span.array->lambda[unit][i]
= compute_lambda(line->sPlane[attr],
@ -220,7 +220,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[attr]);
compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[attr]);
compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[attr]);
if (attr < FRAG_ATTRIB_VAR0) {
if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) {
const GLuint u = attr - FRAG_ATTRIB_TEX0;
const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];

View File

@ -203,7 +203,7 @@
compute_plane(p0, p1, p2, t0, t1, t2, tPlane[attr]);
compute_plane(p0, p1, p2, r0, r1, r2, uPlane[attr]);
compute_plane(p0, p1, p2, q0, q1, q2, vPlane[attr]);
if (attr < FRAG_ATTRIB_VAR0) {
if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) {
const GLuint u = attr - FRAG_ATTRIB_TEX0;
const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];
@ -289,7 +289,7 @@
array->attribs[attr][count][0] = solve_plane(cx, cy, sPlane[attr]) * invQ;
array->attribs[attr][count][1] = solve_plane(cx, cy, tPlane[attr]) * invQ;
array->attribs[attr][count][2] = solve_plane(cx, cy, uPlane[attr]) * invQ;
if (attr < FRAG_ATTRIB_VAR0) {
if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) {
const GLuint unit = attr - FRAG_ATTRIB_TEX0;
array->lambda[unit][count] = compute_lambda(sPlane[attr], tPlane[attr],
vPlane[attr], cx, cy, invQ,
@ -381,7 +381,7 @@
array->attribs[attr][ix][0] = solve_plane(cx, cy, sPlane[attr]) * invQ;
array->attribs[attr][ix][1] = solve_plane(cx, cy, tPlane[attr]) * invQ;
array->attribs[attr][ix][2] = solve_plane(cx, cy, uPlane[attr]) * invQ;
if (attr < FRAG_ATTRIB_VAR0) {
if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) {
const GLuint unit = attr - FRAG_ATTRIB_TEX0;
array->lambda[unit][ix] = compute_lambda(sPlane[attr],
tPlane[attr],

View File

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
* Version: 7.0
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@ -34,21 +34,12 @@
#include "s_triangle.h"
#define FB_3D 0x01
#define FB_4D 0x02
#define FB_INDEX 0x04
#define FB_COLOR 0x08
#define FB_TEXTURE 0X10
static void feedback_vertex( GLcontext *ctx,
const SWvertex *v, const SWvertex *pv )
static void
feedback_vertex(GLcontext * ctx, const SWvertex * v, const SWvertex * pv)
{
GLfloat win[4];
GLfloat color[4];
GLfloat tc[4];
const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0];
win[0] = v->win[0];
@ -61,100 +52,93 @@ static void feedback_vertex( GLcontext *ctx,
color[2] = CHAN_TO_FLOAT(pv->color[2]);
color[3] = CHAN_TO_FLOAT(pv->color[3]);
if (vtc[3] != 1.0 && vtc[3] != 0.0) {
GLfloat invq = 1.0F / vtc[3];
tc[0] = vtc[0] * invq;
tc[1] = vtc[1] * invq;
tc[2] = vtc[2] * invq;
tc[3] = vtc[3];
}
else {
COPY_4V(tc, vtc);
}
_mesa_feedback_vertex( ctx, win, color, (GLfloat) v->index, tc );
_mesa_feedback_vertex(ctx, win, color, (GLfloat) v->index, vtc);
}
/*
* Put triangle in feedback buffer.
*/
void _swrast_feedback_triangle( GLcontext *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2)
void
_swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2)
{
if (_swrast_culltriangle( ctx, v0, v1, v2 )) {
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN );
FEEDBACK_TOKEN( ctx, (GLfloat) 3 ); /* three vertices */
if (_swrast_culltriangle(ctx, v0, v1, v2)) {
FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN);
FEEDBACK_TOKEN(ctx, (GLfloat) 3); /* three vertices */
if (ctx->Light.ShadeModel == GL_SMOOTH) {
feedback_vertex( ctx, v0, v0 );
feedback_vertex( ctx, v1, v1 );
feedback_vertex( ctx, v2, v2 );
} else {
feedback_vertex( ctx, v0, v2 );
feedback_vertex( ctx, v1, v2 );
feedback_vertex( ctx, v2, v2 );
feedback_vertex(ctx, v0, v0);
feedback_vertex(ctx, v1, v1);
feedback_vertex(ctx, v2, v2);
}
else {
feedback_vertex(ctx, v0, v2);
feedback_vertex(ctx, v1, v2);
feedback_vertex(ctx, v2, v2);
}
}
}
void _swrast_feedback_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
void
_swrast_feedback_line(GLcontext *ctx, const SWvertex *v0,
const SWvertex *v1)
{
GLenum token = GL_LINE_TOKEN;
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (swrast->StippleCounter==0)
if (swrast->StippleCounter == 0)
token = GL_LINE_RESET_TOKEN;
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token );
FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) token);
if (ctx->Light.ShadeModel == GL_SMOOTH) {
feedback_vertex( ctx, v0, v0 );
feedback_vertex( ctx, v1, v1 );
} else {
feedback_vertex( ctx, v0, v1 );
feedback_vertex( ctx, v1, v1 );
feedback_vertex(ctx, v0, v0);
feedback_vertex(ctx, v1, v1);
}
else {
feedback_vertex(ctx, v0, v1);
feedback_vertex(ctx, v1, v1);
}
swrast->StippleCounter++;
}
void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v )
void
_swrast_feedback_point(GLcontext *ctx, const SWvertex *v)
{
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN );
feedback_vertex( ctx, v, v );
FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
feedback_vertex(ctx, v, v);
}
void _swrast_select_triangle( GLcontext *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2)
void
_swrast_select_triangle(GLcontext *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2)
{
if (_swrast_culltriangle( ctx, v0, v1, v2 )) {
if (_swrast_culltriangle(ctx, v0, v1, v2)) {
const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
_mesa_update_hitflag( ctx, v0->win[2] * zs );
_mesa_update_hitflag( ctx, v1->win[2] * zs );
_mesa_update_hitflag( ctx, v2->win[2] * zs );
_mesa_update_hitflag(ctx, v0->win[2] * zs);
_mesa_update_hitflag(ctx, v1->win[2] * zs);
_mesa_update_hitflag(ctx, v2->win[2] * zs);
}
}
void _swrast_select_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
void
_swrast_select_line(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
{
const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
_mesa_update_hitflag( ctx, v0->win[2] * zs );
_mesa_update_hitflag( ctx, v1->win[2] * zs );
_mesa_update_hitflag(ctx, v0->win[2] * zs);
_mesa_update_hitflag(ctx, v1->win[2] * zs);
}
void _swrast_select_point( GLcontext *ctx, const SWvertex *v )
void
_swrast_select_point(GLcontext *ctx, const SWvertex *v)
{
const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
_mesa_update_hitflag( ctx, v->win[2] * zs );
_mesa_update_hitflag(ctx, v->win[2] * zs);
}

View File

@ -99,11 +99,6 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
const struct gl_fragment_program *program,
const SWspan *span, GLuint col)
{
GLuint inputsRead = program->Base.InputsRead;
if (ctx->FragmentProgram.CallbackEnabled)
inputsRead = ~0;
if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) {
/* Clear temporary registers (undefined for ARB_f_p) */
_mesa_bzero(machine->Temporaries,
@ -113,8 +108,14 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
/* Setup pointer to input attributes */
machine->Attribs = span->array->attribs;
/* Store front/back facing value in register FOGC.Y */
machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = (GLfloat) ctx->_Facing;
machine->DerivX = (GLfloat (*)[4]) span->attrStepX;
machine->DerivY = (GLfloat (*)[4]) span->attrStepY;
machine->NumDeriv = FRAG_ATTRIB_MAX;
if (ctx->Shader.CurrentProgram) {
/* Store front/back facing value in register FOGC.Y */
machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = (GLfloat) ctx->_Facing;
}
machine->CurElement = col;

View File

@ -275,7 +275,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & ATTRIBS
ATTRIB_LOOP_BEGIN
COPY_4V(span->array->attribs[attr][count], attrib[attr]);
if (attr < FRAG_ATTRIB_VAR0) {
if (attr < FRAG_ATTRIB_VAR0 && attr >= FRAG_ATTRIB_TEX0) {
const GLuint u = attr - FRAG_ATTRIB_TEX0;
span->array->lambda[u][count] = 0.0;
}

View File

@ -1357,7 +1357,11 @@ shade_texture_span(GLcontext *ctx, SWspan *span)
if ((inputsRead >= FRAG_BIT_VAR0) && (span->interpMask & SPAN_VARYING))
interpolate_varying(ctx, span);
#if 0
if (inputsRead & FRAG_BIT_WPOS)
#else
/* XXX always interpolate wpos so that DDX/DDY work */
#endif
interpolate_wpos(ctx, span);
/* Run fragment program/shader now */

View File

@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.3
* Version: 7.0
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@ -499,7 +499,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
# endif /* GL_FLOAT */
# ifdef INTERP_ALPHA
span.attrStepX[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da);
span.attrStepX[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
span.attrStepY[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
# if CHAN_TYPE == GL_FLOAT
span.alphaStep = span.attrStepX[FRAG_ATTRIB_COL0][3];
# else
@ -523,7 +523,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
span.blueStep = 0;
# endif /* GL_FLOAT */
# ifdef INTERP_ALPHA
span.attrStepX[FRAG_ATTRIB_COL0][3] = span.attrStepX[FRAG_ATTRIB_COL0][3] = 0.0F;
span.attrStepX[FRAG_ATTRIB_COL0][3] = span.attrStepY[FRAG_ATTRIB_COL0][3] = 0.0F;
# if CHAN_TYPE == GL_FLOAT
span.alphaStep = 0.0F;
# else
@ -893,11 +893,11 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
# endif
# ifdef INTERP_ALPHA
# if CHAN_TYPE == GL_FLOAT
aLeft = vLower->color[ACOMP] + (span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjy) * (1.0F / FIXED_SCALE);
fdaOuter = span.attrStepX[FRAG_ATTRIB_COL0][3] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3];
aLeft = vLower->color[ACOMP] + (span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][3] * adjy) * (1.0F / FIXED_SCALE);
fdaOuter = span.attrStepY[FRAG_ATTRIB_COL0][3] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3];
# else
aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjy) + FIXED_HALF;
fdaOuter = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][3] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]);
fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][3] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]);
# endif
# endif
}

View File

@ -131,8 +131,10 @@ setup_vertex_format(GLcontext *ctx)
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR_INDEX ))
EMIT_ATTR( _TNL_ATTRIB_COLOR_INDEX, EMIT_1F, index );
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, attrib[FRAG_ATTRIB_FOGC]);
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
const GLint emit = ctx->FragmentProgram._Current ? EMIT_4F : EMIT_1F;
EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[FRAG_ATTRIB_FOGC]);
}
if (RENDERINPUTS_TEST_RANGE(index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX))
{
@ -261,7 +263,7 @@ _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest )
dest->win[2] = m[10] * tmp[2] + m[14];
dest->win[3] = tmp[3];
/** XXX try to limit these loops someday */
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i,
dest->attrib[FRAG_ATTRIB_TEX0 + i] );
@ -282,6 +284,7 @@ _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest )
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR_INDEX, tmp );
dest->index = tmp[0];
/* XXX See _tnl_get_attr about pointsize ... */
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp );
dest->pointSize = tmp[0];
}

View File

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
* Version: 7.0
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 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"),
@ -50,7 +50,8 @@ run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
if (ctx->Point._Attenuated && !ctx->VertexProgram._Current) {
struct point_stage_data *store = POINT_STAGE_DATA(stage);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
const GLfloat (*eye)[4] = (const GLfloat (*)[4]) VB->EyePtr->data;
const GLfloat *eyeCoord = (GLfloat *) VB->EyePtr->data + 2;
const GLint eyeCoordStride = VB->EyePtr->stride / sizeof(GLfloat);
const GLfloat p0 = ctx->Point.Params[0];
const GLfloat p1 = ctx->Point.Params[1];
const GLfloat p2 = ctx->Point.Params[2];
@ -59,10 +60,11 @@ run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
GLuint i;
for (i = 0; i < VB->Count; i++) {
const GLfloat dist = FABSF(eye[i][2]);
const GLfloat dist = FABSF(*eyeCoord);
const GLfloat q = p0 + dist * (p1 + dist * p2);
const GLfloat atten = (q != 0.0) ? SQRTF(1.0 / q) : 1.0;
size[i][0] = pointSize * atten; /* clamping done in rasterization */
eyeCoord += eyeCoordStride;
}
VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->PointSize;

View File

@ -126,6 +126,8 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine)
}
}
machine->NumDeriv = 0;
/* init condition codes */
machine->CondCodes[0] = COND_EQ;
machine->CondCodes[1] = COND_EQ;

View File

@ -229,7 +229,15 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin,
/* Else return the value from ctx->Current.
*/
_mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
if (attr == _TNL_ATTRIB_POINTSIZE) {
/* If the hardware vertex doesn't have point size then use size from
* GLcontext. XXX this will be wrong if drawing attenuated points!
*/
dest[0] = ctx->Point._Size;
}
else {
_mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
}
}

View File

@ -129,8 +129,8 @@ LLBL (G3TN_transform):
PREFETCH ( REGIND(EDX) )
MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */
DEC_L ( EBP ) /* decrement normal counter */
JA ( LLBL (G3TN_transform) )
SUB_L ( CONST(1), EBP ) /* decrement normal counter */
JNZ ( LLBL (G3TN_transform) )
POP_L ( EDX ) /* end of transform --- */
@ -164,9 +164,9 @@ LLBL (G3TN_norm_w_lengths):
MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */
ADD_L ( CONST(16), EAX ) /* next r */
DEC_L ( EBP ) /* decrement normal counter */
SUB_L ( CONST(1), EBP ) /* decrement normal counter */
JA ( LLBL (G3TN_norm_w_lengths) )
JNZ ( LLBL (G3TN_norm_w_lengths) )
JMP ( LLBL (G3TN_exit_3dnow) )
ALIGNTEXT32
@ -192,7 +192,7 @@ LLBL (G3TN_norm):
MOVQ ( MM5, MM4 )
PUNPCKLDQ ( MM3, MM3 )
DEC_L ( EBP ) /* decrement normal counter */
SUB_L ( CONST(1), EBP ) /* decrement normal counter */
PFMUL ( MM5, MM5 )
PFRSQIT1 ( MM3, MM5 )
@ -204,7 +204,7 @@ LLBL (G3TN_norm):
PFMUL ( MM5, MM1 ) /* | x2 (normalize*/
MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */
JA ( LLBL (G3TN_norm) )
JNZ ( LLBL (G3TN_norm) )
LLBL (G3TN_exit_3dnow):
FEMMS
@ -289,13 +289,13 @@ LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */
ADD_L ( CONST(4), EDI ) /* next length */
PFMUL ( MM3, MM6 ) /* x1 (normalized) | x0 (normalized) */
DEC_L ( EBP ) /* decrement normal counter */
SUB_L ( CONST(1), EBP ) /* decrement normal counter */
MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */
MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */
MOVD ( REGIND(EDI), MM3 ) /* | length (x) */
JA ( LLBL (G3TNNR_norm_w_lengths) )
JNZ ( LLBL (G3TNNR_norm_w_lengths) )
JMP ( LLBL (G3TNNR_exit_3dnow) )
ALIGNTEXT32
@ -331,7 +331,7 @@ LLBL (G3TNNR_norm): /* need to calculate lengths */
PFMUL ( MM5, MM5 )
PFRSQIT1 ( MM3, MM5 )
DEC_L ( EBP ) /* decrement normal counter */
SUB_L ( CONST(1), EBP ) /* decrement normal counter */
PFRCPIT2 ( MM4, MM5 )
PFMUL ( MM5, MM6 ) /* x1 (normalized) | x0 (normalized) */
@ -340,7 +340,7 @@ LLBL (G3TNNR_norm): /* need to calculate lengths */
PFMUL ( MM5, MM7 ) /* | x2 (normalized) */
MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */
JA ( LLBL (G3TNNR_norm) )
JNZ ( LLBL (G3TNNR_norm) )
LLBL (G3TNNR_exit_3dnow):
@ -411,11 +411,11 @@ LLBL (G3TRNR_rescale):
PFMUL ( MM2, MM5 ) /* | x2*m10 */
ADD_L ( CONST(16), EAX ) /* next r */
DEC_L ( EBP ) /* decrement normal counter */
SUB_L ( CONST(1), EBP ) /* decrement normal counter */
MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */
MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */
JA ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */
JNZ ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */
FEMMS
@ -511,8 +511,8 @@ LLBL (G3TR_rescale):
PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */
MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */
DEC_L ( EDI ) /* decrement normal counter */
JA ( LLBL (G3TR_rescale) )
SUB_L ( CONST(1), EDI ) /* decrement normal counter */
JNZ ( LLBL (G3TR_rescale) )
FEMMS
@ -574,11 +574,11 @@ LLBL (G3TNR_transform):
PFMUL ( MM2, MM5 ) /* | x2*m10 */
ADD_L ( CONST(16), EAX ) /* next r */
DEC_L ( EDI ) /* decrement normal counter */
SUB_L ( CONST(1), EDI ) /* decrement normal counter */
MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */
MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */
JA ( LLBL (G3TNR_transform) )
JNZ ( LLBL (G3TNR_transform) )
FEMMS
@ -663,9 +663,9 @@ LLBL (G3T_transform):
PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */
MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */
DEC_L ( EDI ) /* decrement normal counter */
SUB_L ( CONST(1), EDI ) /* decrement normal counter */
JA ( LLBL (G3T_transform) )
JNZ ( LLBL (G3T_transform) )
FEMMS
@ -730,9 +730,9 @@ LLBL (G3N_norm1): /* use precalculated lengths */
ADD_L ( CONST(16), EAX ) /* next r */
ADD_L ( CONST(4), EDX ) /* next length */
DEC_L ( EBP ) /* decrement normal counter */
SUB_L ( CONST(1), EBP ) /* decrement normal counter */
JA ( LLBL (G3N_norm1) )
JNZ ( LLBL (G3N_norm1) )
JMP ( LLBL (G3N_end1) )
@ -765,7 +765,7 @@ LLBL (G3N_norm2): /* need to calculate lengths */
PFMUL ( MM5, MM5 )
PFRSQIT1 ( MM3, MM5 )
DEC_L ( EBP ) /* decrement normal counter */
SUB_L ( CONST(1), EBP ) /* decrement normal counter */
PFRCPIT2 ( MM4, MM5 )
@ -775,7 +775,7 @@ LLBL (G3N_norm2): /* need to calculate lengths */
PFMUL ( MM5, MM1 ) /* | x2 (normalized) */
MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */
JA ( LLBL (G3N_norm2) )
JNZ ( LLBL (G3N_norm2) )
LLBL (G3N_end1):
FEMMS
@ -835,8 +835,8 @@ LLBL (G3R_rescale):
MOVQ ( MM1, REGOFF(-16, EAX) ) /* write r0, r1 */
MOVD ( MM2, REGOFF(-8, EAX) ) /* write r2 */
DEC_L ( EDX ) /* decrement normal counter */
JA ( LLBL (G3R_rescale) )
SUB_L ( CONST(1), EDX ) /* decrement normal counter */
JNZ ( LLBL (G3R_rescale) )
FEMMS

View File

@ -58,12 +58,18 @@
#ifdef GLX_USE_TLS
#ifdef GLX_X86_READONLY_TEXT
# define CTX_INSNS MOV_L(GS:(EAX), EAX)
#else
# define CTX_INSNS NOP /* Pad for init_glapi_relocs() */
#endif
# define GL_STUB(fn,off,fn_alt) \
ALIGNTEXT16; \
GLOBL_FN(GL_PREFIX(fn, fn_alt)); \
GL_PREFIX(fn, fn_alt): \
CALL(_x86_get_dispatch) ; \
NOP ; \
CTX_INSNS ; \
JMP(GL_OFFSET(off))
#elif defined(PTHREADS)
@ -114,7 +120,10 @@ SEG_TEXT
HIDDEN(GLNAME(_x86_get_dispatch))
ALIGNTEXT16
GLNAME(_x86_get_dispatch):
movl %gs:_glapi_tls_Dispatch@NTPOFF, %eax
call 1f
1: popl %eax
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax
movl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax
ret
#elif defined(PTHREADS)
@ -133,7 +142,7 @@ GLNAME(_x86_get_dispatch):
EXTERN GLNAME(_glapi_get_dispatch)
#endif
#if defined( GLX_USE_TLS )
#if defined( GLX_USE_TLS ) && !defined( GLX_X86_READONLY_TEXT )
.section wtext, "awx", @progbits
#endif /* defined( GLX_USE_TLS ) */