summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorjoukj <joukj@tarantella.(none)>2007-11-30 11:12:41 +0100
committerjoukj <joukj@tarantella.(none)>2007-11-30 11:12:41 +0100
commit86f3135fbd9db9ca08a6c0bfc620345c8a8e3f04 (patch)
tree586dca229d09fb523554dd07ad39c9bf422ab927 /src/mesa/main
parentd1414da8f9dbf3c27cf05509be51e8c70ed1185d (diff)
parentd2540e6d4bdcfcda195f6dcf43f75b810001c227 (diff)
Merge branch 'master' of git+ssh://[email protected]/git/mesa/mesa
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_validate.c5
-rw-r--r--src/mesa/main/config.h41
-rw-r--r--src/mesa/main/dd.h5
-rw-r--r--src/mesa/main/dlist.c205
-rw-r--r--src/mesa/main/fbobject.c3
-rw-r--r--src/mesa/main/state.c8
6 files changed, 110 insertions, 157 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index e2eebccd477..74b0912bef6 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -247,8 +247,9 @@ _mesa_validate_DrawArrays(GLcontext *ctx,
{
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- if (count < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
+ if (count <= 0) {
+ if (count < 0)
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
return GL_FALSE;
}
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index cebef1c3832..ab0f035b45b 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -163,25 +163,6 @@
/** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */
#define MAX_TEXTURE_LOD_BIAS 11.0
-/** For GL_NV_vertex_program */
-/*@{*/
-#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128
-#define MAX_NV_VERTEX_PROGRAM_TEMPS 12
-#define MAX_NV_VERTEX_PROGRAM_PARAMS 128 /* KW: power of two */
-#define MAX_NV_VERTEX_PROGRAM_INPUTS 16
-#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15
-/*@}*/
-
-/** For GL_NV_fragment_program */
-/*@{*/
-#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 1024 /* 72 for GL_ARB_f_p */
-#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96
-#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64
-#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12
-#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3
-#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2
-/*@}*/
-
/** For GL_ARB_vertex_program */
/*@{*/
#define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1
@@ -209,10 +190,30 @@
#define MAX_VARYING 8
/*@}*/
+/** For GL_NV_vertex_program */
+/*@{*/
+#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128
+#define MAX_NV_VERTEX_PROGRAM_TEMPS 12
+#define MAX_NV_VERTEX_PROGRAM_PARAMS MAX_PROGRAM_ENV_PARAMS
+#define MAX_NV_VERTEX_PROGRAM_INPUTS 16
+#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15
+/*@}*/
+
+/** For GL_NV_fragment_program */
+/*@{*/
+#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 1024 /* 72 for GL_ARB_f_p */
+#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96
+#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64
+#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12
+#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3
+#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2
+/*@}*/
+
+
/** For GL_ARB_vertex_shader */
/*@{*/
#define MAX_VERTEX_ATTRIBS 16
-#define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0
+#define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_UNITS
#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS)
/*@}*/
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index caa50dd6826..77d27bb03dd 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -493,6 +493,11 @@ struct dd_function_table {
*/
void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage );
+ /** Map texture image data into user space */
+ void (*MapTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+ /** Unmap texture images from user space */
+ void (*UnmapTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+
/**
* Note: no context argument. This function doesn't initially look
* like it belongs here, except that the driver is the only entity
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index b881b12ff35..a421d049578 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -303,7 +303,6 @@ typedef enum
OPCODE_EXECUTE_PROGRAM_NV,
OPCODE_REQUEST_RESIDENT_PROGRAMS_NV,
OPCODE_LOAD_PROGRAM_NV,
- OPCODE_PROGRAM_PARAMETER4F_NV,
OPCODE_TRACK_MATRIX_NV,
/* GL_NV_fragment_program */
OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
@@ -4247,77 +4246,111 @@ save_BindProgramNV(GLenum target, GLuint id)
CALL_BindProgramNV(ctx->Exec, (target, id));
}
}
-#endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
-#if FEATURE_NV_vertex_program
static void GLAPIENTRY
-save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
+save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6);
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
if (n) {
n[1].e = target;
- n[2].ui = id;
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
+ n[2].ui = index;
+ n[3].f = x;
+ n[4].f = y;
+ n[5].f = z;
+ n[6].f = w;
}
if (ctx->ExecuteFlag) {
- CALL_ExecuteProgramNV(ctx->Exec, (target, id, params));
+ CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
}
}
static void GLAPIENTRY
-save_ProgramParameter4fNV(GLenum target, GLuint index,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
+ const GLfloat *params)
+{
+ save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
+ params[2], params[3]);
+}
+
+
+static void GLAPIENTRY
+save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
+ const GLfloat * params)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_PARAMETER4F_NV, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = x;
- n[4].f = y;
- n[5].f = z;
- n[6].f = w;
+
+ if (count > 0) {
+ GLint i;
+ const GLfloat * p = params;
+
+ for (i = 0 ; i < count ; i++) {
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = p[0];
+ n[4].f = p[1];
+ n[5].f = p[2];
+ n[6].f = p[3];
+ p += 4;
+ }
+ }
}
+
if (ctx->ExecuteFlag) {
- CALL_ProgramParameter4fNV(ctx->Exec, (target, index, x, y, z, w));
+ CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
}
}
static void GLAPIENTRY
-save_ProgramParameter4fvNV(GLenum target, GLuint index,
- const GLfloat *params)
+save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
+ GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
- save_ProgramParameter4fNV(target, index, params[0], params[1],
- params[2], params[3]);
+ save_ProgramEnvParameter4fARB(target, index,
+ (GLfloat) x,
+ (GLfloat) y, (GLfloat) z, (GLfloat) w);
}
static void GLAPIENTRY
-save_ProgramParameter4dNV(GLenum target, GLuint index,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
+ const GLdouble *params)
{
- save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y,
- (GLfloat) z, (GLfloat) w);
+ save_ProgramEnvParameter4fARB(target, index,
+ (GLfloat) params[0],
+ (GLfloat) params[1],
+ (GLfloat) params[2], (GLfloat) params[3]);
}
+#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
+#if FEATURE_NV_vertex_program
static void GLAPIENTRY
-save_ProgramParameter4dvNV(GLenum target, GLuint index,
- const GLdouble *params)
+save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
{
- save_ProgramParameter4fNV(target, index, (GLfloat) params[0],
- (GLfloat) params[1], (GLfloat) params[2],
- (GLfloat) params[3]);
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6);
+ if (n) {
+ n[1].e = target;
+ n[2].ui = id;
+ n[3].f = params[0];
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_ExecuteProgramNV(ctx->Exec, (target, id, params));
+ }
}
@@ -4327,7 +4360,7 @@ save_ProgramParameters4dvNV(GLenum target, GLuint index,
{
GLuint i;
for (i = 0; i < num; i++) {
- save_ProgramParameter4dvNV(target, index + i, params + 4 * i);
+ save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i);
}
}
@@ -4338,7 +4371,7 @@ save_ProgramParameters4fvNV(GLenum target, GLuint index,
{
GLuint i;
for (i = 0; i < num; i++) {
- save_ProgramParameter4fvNV(target, index + i, params + 4 * i);
+ save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i);
}
}
@@ -4666,90 +4699,6 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
}
}
-
-static void GLAPIENTRY
-save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = x;
- n[4].f = y;
- n[5].f = z;
- n[6].f = w;
- }
- if (ctx->ExecuteFlag) {
- CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
- const GLfloat *params)
-{
- save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
- params[2], params[3]);
-}
-
-
-static void GLAPIENTRY
-save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
- const GLfloat * params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- if (count > 0) {
- GLint i;
- const GLfloat * p = params;
-
- for (i = 0 ; i < count ; i++) {
- n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
- if (n) {
- n[1].e = target;
- n[2].ui = index;
- n[3].f = p[0];
- n[4].f = p[1];
- n[5].f = p[2];
- n[6].f = p[3];
- p += 4;
- }
- }
- }
-
- if (ctx->ExecuteFlag) {
- CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
- GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- save_ProgramEnvParameter4fARB(target, index,
- (GLfloat) x,
- (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-
-static void GLAPIENTRY
-save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
- const GLdouble *params)
-{
- save_ProgramEnvParameter4fARB(target, index,
- (GLfloat) params[0],
- (GLfloat) params[1],
- (GLfloat) params[2], (GLfloat) params[3]);
-}
-
#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
@@ -6429,10 +6378,6 @@ execute_list(GLcontext *ctx, GLuint list)
CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
(const GLubyte *) n[4].data));
break;
- case OPCODE_PROGRAM_PARAMETER4F_NV:
- CALL_ProgramParameter4fNV(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
- n[4].f, n[5].f, n[6].f));
- break;
case OPCODE_TRACK_MATRIX_NV:
CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
break;
@@ -6463,6 +6408,8 @@ execute_list(GLcontext *ctx, GLuint list)
CALL_ProgramStringARB(ctx->Exec,
(n[1].e, n[2].e, n[3].i, n[4].data));
break;
+#endif
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
n[4].f, n[5].f,
@@ -8018,10 +7965,10 @@ _mesa_init_dlist_table(struct _glapi_table *table)
SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
SET_IsProgramNV(table, _mesa_IsProgramARB);
SET_LoadProgramNV(table, save_LoadProgramNV);
- SET_ProgramParameter4dNV(table, save_ProgramParameter4dNV);
- SET_ProgramParameter4dvNV(table, save_ProgramParameter4dvNV);
- SET_ProgramParameter4fNV(table, save_ProgramParameter4fNV);
- SET_ProgramParameter4fvNV(table, save_ProgramParameter4fvNV);
+ SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
+ SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
+ SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
+ SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
SET_TrackMatrixNV(table, save_TrackMatrixNV);
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index db04c785de4..671f80c7a48 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -909,8 +909,7 @@ check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
GLuint i;
for (i = 0; i < BUFFER_COUNT; i++) {
struct gl_renderbuffer_attachment *att = fb->Attachment + i;
- struct gl_texture_object *texObj = att->Texture;
- if (texObj) {
+ if (att->Texture && att->Renderbuffer) {
ctx->Driver.FinishRenderTexture(ctx, att);
}
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index cabc3d8a44a..a42c4fd805f 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -535,10 +535,10 @@ _mesa_init_exec_table(struct _glapi_table *exec)
SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
SET_IsProgramNV(exec, _mesa_IsProgramARB);
SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
- SET_ProgramParameter4dNV(exec, _mesa_ProgramParameter4dNV);
- SET_ProgramParameter4dvNV(exec, _mesa_ProgramParameter4dvNV);
- SET_ProgramParameter4fNV(exec, _mesa_ProgramParameter4fNV);
- SET_ProgramParameter4fvNV(exec, _mesa_ProgramParameter4fvNV);
+ SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
+ SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */
+ SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */
+ SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */
SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);