alias ProgramEnvParameter4xyARB and ProgramParameter4xyNV (bug #12935)

these should be the same functions (as per spec).
This commit is contained in:
Roland Scheidegger
2007-11-09 14:46:59 +01:00
parent d34caddb4e
commit 86a4810b09
7 changed files with 149 additions and 261 deletions

View File

@@ -11275,7 +11275,7 @@
<glx rop="4183"/>
</function>
<function name="ProgramParameter4dNV" offset="assign" vectorequiv="ProgramParameter4dvNV">
<function name="ProgramParameter4dNV" alias="ProgramEnvParameter4dARB">
<param name="target" type="GLenum"/>
<param name="index" type="GLuint"/>
<param name="x" type="GLdouble"/>
@@ -11284,14 +11284,13 @@
<param name="w" type="GLdouble"/>
</function>
<function name="ProgramParameter4dvNV" offset="assign">
<function name="ProgramParameter4dvNV" alias="ProgramEnvParameter4dvARB">
<param name="target" type="GLenum"/>
<param name="index" type="GLuint"/>
<param name="params" type="const GLdouble *" count="4"/>
<glx rop="4185" doubles_in_order="true"/>
<param name="params" type="const GLdouble *"/>
</function>
<function name="ProgramParameter4fNV" offset="assign" vectorequiv="ProgramParameter4fvNV">
<function name="ProgramParameter4fNV" alias="ProgramEnvParameter4fARB">
<param name="target" type="GLenum"/>
<param name="index" type="GLuint"/>
<param name="x" type="GLfloat"/>
@@ -11300,11 +11299,10 @@
<param name="w" type="GLfloat"/>
</function>
<function name="ProgramParameter4fvNV" offset="assign">
<function name="ProgramParameter4fvNV" alias="ProgramEnvParameter4fvARB">
<param name="target" type="GLenum"/>
<param name="index" type="GLuint"/>
<param name="params" type="const GLfloat *" count="4"/>
<glx rop="4184"/>
<param name="params" type="const GLfloat *"/>
</function>
<function name="ProgramParameters4dvNV" offset="assign">

View File

@@ -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,6 +190,26 @@
#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

View File

@@ -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,7 +4246,91 @@ 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 */
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 || FEATURE_NV_vertex_program */
#if FEATURE_NV_vertex_program
static void GLAPIENTRY
@@ -4271,63 +4354,13 @@ save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
}
static void GLAPIENTRY
save_ProgramParameter4fNV(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_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 (ctx->ExecuteFlag) {
CALL_ProgramParameter4fNV(ctx->Exec, (target, index, x, y, z, w));
}
}
static void GLAPIENTRY
save_ProgramParameter4fvNV(GLenum target, GLuint index,
const GLfloat *params)
{
save_ProgramParameter4fNV(target, index, params[0], params[1],
params[2], params[3]);
}
static void GLAPIENTRY
save_ProgramParameter4dNV(GLenum target, GLuint index,
GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y,
(GLfloat) z, (GLfloat) w);
}
static void GLAPIENTRY
save_ProgramParameter4dvNV(GLenum target, GLuint index,
const GLdouble *params)
{
save_ProgramParameter4fNV(target, index, (GLfloat) params[0],
(GLfloat) params[1], (GLfloat) params[2],
(GLfloat) params[3]);
}
static void GLAPIENTRY
save_ProgramParameters4dvNV(GLenum target, GLuint index,
GLuint num, const GLdouble *params)
{
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);

View File

@@ -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);

View File

@@ -247,6 +247,12 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
}
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
* Note, this function is also used by the GL_NV_vertex_program extension
* (alias to ProgramParameterdNV)
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
GLdouble x, GLdouble y, GLdouble z, GLdouble w)
@@ -256,6 +262,12 @@ _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
}
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
* Note, this function is also used by the GL_NV_vertex_program extension
* (alias to ProgramParameterdvNV)
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
const GLdouble *params)
@@ -266,6 +278,12 @@ _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
}
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
* Note, this function is also used by the GL_NV_vertex_program extension
* (alias to ProgramParameterfNV)
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
GLfloat x, GLfloat y, GLfloat z, GLfloat w)
@@ -283,8 +301,8 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
}
ASSIGN_4V(ctx->FragmentProgram.Parameters[index], x, y, z, w);
}
else if (target == GL_VERTEX_PROGRAM_ARB
&& ctx->Extensions.ARB_vertex_program) {
else if (target == GL_VERTEX_PROGRAM_ARB /* == GL_VERTEX_PROGRAM_NV */
&& (ctx->Extensions.ARB_vertex_program || ctx->Extensions.NV_vertex_program)) {
if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)");
return;
@@ -297,7 +315,12 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
}
}
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
* Note, this function is also used by the GL_NV_vertex_program extension
* (alias to ProgramParameterfvNV)
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
const GLfloat *params)

View File

@@ -575,75 +575,6 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
/**
* Set a program parameter register.
* \note Called from the GL API dispatcher.
*/
void GLAPIENTRY
_mesa_ProgramParameter4dNV(GLenum target, GLuint index,
GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
_mesa_ProgramParameter4fNV(target, index,
(GLfloat)x, (GLfloat)y, (GLfloat)z, (GLfloat)w);
}
/**
* Set a program parameter register.
* \note Called from the GL API dispatcher.
*/
void GLAPIENTRY
_mesa_ProgramParameter4dvNV(GLenum target, GLuint index,
const GLdouble *params)
{
_mesa_ProgramParameter4fNV(target, index,
(GLfloat)params[0], (GLfloat)params[1],
(GLfloat)params[2], (GLfloat)params[3]);
}
/**
* Set a program parameter register.
* \note Called from the GL API dispatcher.
*/
void GLAPIENTRY
_mesa_ProgramParameter4fNV(GLenum target, GLuint index,
GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) {
if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) {
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ASSIGN_4V(ctx->VertexProgram.Parameters[index], x, y, z, w);
}
else {
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameterNV(index)");
return;
}
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameterNV");
return;
}
}
/**
* Set a program parameter register.
* \note Called from the GL API dispatcher.
*/
void GLAPIENTRY
_mesa_ProgramParameter4fvNV(GLenum target, GLuint index,
const GLfloat *params)
{
_mesa_ProgramParameter4fNV(target, index,
params[0], params[1], params[2], params[3]);
}
/**
* Set a sequence of program parameter registers.
* \note Called from the GL API dispatcher.

View File

@@ -69,18 +69,6 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer);
extern void GLAPIENTRY
_mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program);
extern void GLAPIENTRY
_mesa_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern void GLAPIENTRY
_mesa_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params);
extern void GLAPIENTRY
_mesa_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern void GLAPIENTRY
_mesa_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params);
extern void GLAPIENTRY
_mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params);