Moved NumTexInstructions, NumTexIndirections, etc. into gl_program since

they can now apply to vertex programs.
This commit is contained in:
Brian
2007-01-09 11:00:21 -07:00
parent ae80d13f6d
commit 21f99792a9
5 changed files with 33 additions and 33 deletions

View File

@@ -1871,6 +1871,9 @@ struct gl_program
GLuint NumParameters; GLuint NumParameters;
GLuint NumAttributes; GLuint NumAttributes;
GLuint NumAddressRegs; GLuint NumAddressRegs;
GLuint NumAluInstructions;
GLuint NumTexInstructions;
GLuint NumTexIndirections;
/*@}*/ /*@}*/
/** Native, actual h/w counts */ /** Native, actual h/w counts */
/*@{*/ /*@{*/
@@ -1879,6 +1882,9 @@ struct gl_program
GLuint NumNativeParameters; GLuint NumNativeParameters;
GLuint NumNativeAttributes; GLuint NumNativeAttributes;
GLuint NumNativeAddressRegs; GLuint NumNativeAddressRegs;
GLuint NumNativeAluInstructions;
GLuint NumNativeTexInstructions;
GLuint NumNativeTexIndirections;
/*@}*/ /*@}*/
}; };
@@ -1897,12 +1903,6 @@ struct gl_vertex_program
struct gl_fragment_program struct gl_fragment_program
{ {
struct gl_program Base; /**< base class */ struct gl_program Base; /**< base class */
GLuint NumAluInstructions; /**< GL_ARB_fragment_program */
GLuint NumTexInstructions;
GLuint NumTexIndirections;
GLuint NumNativeAluInstructions; /**< GL_ARB_fragment_program */
GLuint NumNativeTexInstructions;
GLuint NumNativeTexIndirections;
GLenum FogOption; GLenum FogOption;
GLboolean UsesKill; GLboolean UsesKill;
}; };

View File

@@ -524,7 +524,7 @@ static struct ureg emit_arith( struct texenv_fragment_program *p,
if (dest.file == PROGRAM_TEMPORARY) if (dest.file == PROGRAM_TEMPORARY)
p->alu_temps |= 1 << dest.idx; p->alu_temps |= 1 << dest.idx;
p->program->NumAluInstructions++; p->program->Base.NumAluInstructions++;
return dest; return dest;
} }
@@ -546,7 +546,7 @@ static struct ureg emit_texld( struct texenv_fragment_program *p,
inst->TexSrcTarget = tex_idx; inst->TexSrcTarget = tex_idx;
inst->TexSrcUnit = tex_unit; inst->TexSrcUnit = tex_unit;
p->program->NumTexInstructions++; p->program->Base.NumTexInstructions++;
/* Is this a texture indirection? /* Is this a texture indirection?
*/ */
@@ -554,7 +554,7 @@ static struct ureg emit_texld( struct texenv_fragment_program *p,
(p->temps_output & (1<<coord.idx))) || (p->temps_output & (1<<coord.idx))) ||
(dest.file == PROGRAM_TEMPORARY && (dest.file == PROGRAM_TEMPORARY &&
(p->alu_temps & (1<<dest.idx)))) { (p->alu_temps & (1<<dest.idx)))) {
p->program->NumTexIndirections++; p->program->Base.NumTexIndirections++;
p->temps_output = 1<<coord.idx; p->temps_output = 1<<coord.idx;
p->alu_temps = 0; p->alu_temps = 0;
assert(0); /* KW: texture env crossbar */ assert(0); /* KW: texture env crossbar */
@@ -1013,9 +1013,9 @@ create_new_program(GLcontext *ctx, struct state_key *key,
*/ */
p.program->Base.Instructions = instBuffer; p.program->Base.Instructions = instBuffer;
p.program->Base.Target = GL_FRAGMENT_PROGRAM_ARB; p.program->Base.Target = GL_FRAGMENT_PROGRAM_ARB;
p.program->NumTexIndirections = 1; /* correct? */ p.program->Base.NumTexIndirections = 1; /* correct? */
p.program->NumTexInstructions = 0; p.program->Base.NumTexInstructions = 0;
p.program->NumAluInstructions = 0; p.program->Base.NumAluInstructions = 0;
p.program->Base.String = 0; p.program->Base.String = 0;
p.program->Base.NumInstructions = p.program->Base.NumInstructions =
p.program->Base.NumTemporaries = p.program->Base.NumTemporaries =
@@ -1086,13 +1086,13 @@ create_new_program(GLcontext *ctx, struct state_key *key,
} else } else
p.program->FogOption = GL_NONE; p.program->FogOption = GL_NONE;
if (p.program->NumTexIndirections > ctx->Const.FragmentProgram.MaxTexIndirections) if (p.program->Base.NumTexIndirections > ctx->Const.FragmentProgram.MaxTexIndirections)
program_error(&p, "Exceeded max nr indirect texture lookups"); program_error(&p, "Exceeded max nr indirect texture lookups");
if (p.program->NumTexInstructions > ctx->Const.FragmentProgram.MaxTexInstructions) if (p.program->Base.NumTexInstructions > ctx->Const.FragmentProgram.MaxTexInstructions)
program_error(&p, "Exceeded max TEX instructions"); program_error(&p, "Exceeded max TEX instructions");
if (p.program->NumAluInstructions > ctx->Const.FragmentProgram.MaxAluInstructions) if (p.program->Base.NumAluInstructions > ctx->Const.FragmentProgram.MaxAluInstructions)
program_error(&p, "Exceeded max ALU instructions"); program_error(&p, "Exceeded max ALU instructions");
ASSERT(p.program->Base.NumInstructions <= MAX_INSTRUCTIONS); ASSERT(p.program->Base.NumInstructions <= MAX_INSTRUCTIONS);

View File

@@ -4029,12 +4029,12 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
program->Base.NumNativeParameters = ap.Base.NumNativeParameters; program->Base.NumNativeParameters = ap.Base.NumNativeParameters;
program->Base.NumNativeAttributes = ap.Base.NumNativeAttributes; program->Base.NumNativeAttributes = ap.Base.NumNativeAttributes;
program->Base.NumNativeAddressRegs = ap.Base.NumNativeAddressRegs; program->Base.NumNativeAddressRegs = ap.Base.NumNativeAddressRegs;
program->NumAluInstructions = ap.NumAluInstructions; program->Base.NumAluInstructions = ap.Base.NumAluInstructions;
program->NumTexInstructions = ap.NumTexInstructions; program->Base.NumTexInstructions = ap.Base.NumTexInstructions;
program->NumTexIndirections = ap.NumTexIndirections; program->Base.NumTexIndirections = ap.Base.NumTexIndirections;
program->NumNativeAluInstructions = ap.NumAluInstructions; program->Base.NumNativeAluInstructions = ap.Base.NumAluInstructions;
program->NumNativeTexInstructions = ap.NumTexInstructions; program->Base.NumNativeTexInstructions = ap.Base.NumTexInstructions;
program->NumNativeTexIndirections = ap.NumTexIndirections; program->Base.NumNativeTexIndirections = ap.Base.NumTexIndirections;
program->Base.InputsRead = ap.Base.InputsRead; program->Base.InputsRead = ap.Base.InputsRead;
program->Base.OutputsWritten = ap.Base.OutputsWritten; program->Base.OutputsWritten = ap.Base.OutputsWritten;
for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)

View File

@@ -720,22 +720,22 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
const struct gl_fragment_program *fp = ctx->FragmentProgram.Current; const struct gl_fragment_program *fp = ctx->FragmentProgram.Current;
switch (pname) { switch (pname) {
case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: case GL_PROGRAM_ALU_INSTRUCTIONS_ARB:
*params = fp->NumNativeAluInstructions; *params = fp->Base.NumNativeAluInstructions;
return; return;
case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
*params = fp->NumAluInstructions; *params = fp->Base.NumAluInstructions;
return; return;
case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: case GL_PROGRAM_TEX_INSTRUCTIONS_ARB:
*params = fp->NumTexInstructions; *params = fp->Base.NumTexInstructions;
return; return;
case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
*params = fp->NumNativeTexInstructions; *params = fp->Base.NumNativeTexInstructions;
return; return;
case GL_PROGRAM_TEX_INDIRECTIONS_ARB: case GL_PROGRAM_TEX_INDIRECTIONS_ARB:
*params = fp->NumTexIndirections; *params = fp->Base.NumTexIndirections;
return; return;
case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
*params = fp->NumNativeTexIndirections; *params = fp->Base.NumNativeTexIndirections;
return; return;
case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB:
*params = limits->MaxAluInstructions; *params = limits->MaxAluInstructions;

View File

@@ -376,6 +376,12 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
clone->NumNativeParameters = prog->NumNativeParameters; clone->NumNativeParameters = prog->NumNativeParameters;
clone->NumNativeAttributes = prog->NumNativeAttributes; clone->NumNativeAttributes = prog->NumNativeAttributes;
clone->NumNativeAddressRegs = prog->NumNativeAddressRegs; clone->NumNativeAddressRegs = prog->NumNativeAddressRegs;
clone->NumAluInstructions = prog->NumAluInstructions;
clone->NumTexInstructions = prog->NumTexInstructions;
clone->NumTexIndirections = prog->NumTexIndirections;
clone->NumNativeAluInstructions = prog->NumNativeAluInstructions;
clone->NumNativeTexInstructions = prog->NumNativeTexInstructions;
clone->NumNativeTexIndirections = prog->NumNativeTexIndirections;
switch (prog->Target) { switch (prog->Target) {
case GL_VERTEX_PROGRAM_ARB: case GL_VERTEX_PROGRAM_ARB:
@@ -391,12 +397,6 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
const struct gl_fragment_program *fp const struct gl_fragment_program *fp
= (const struct gl_fragment_program *) prog; = (const struct gl_fragment_program *) prog;
struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone; struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone;
fpc->NumAluInstructions = fp->NumAluInstructions;
fpc->NumTexInstructions = fp->NumTexInstructions;
fpc->NumTexIndirections = fp->NumTexIndirections;
fpc->NumNativeAluInstructions = fp->NumNativeAluInstructions;
fpc->NumNativeTexInstructions = fp->NumNativeTexInstructions;
fpc->NumNativeTexIndirections = fp->NumNativeTexIndirections;
fpc->FogOption = fp->FogOption; fpc->FogOption = fp->FogOption;
fpc->UsesKill = fp->UsesKill; fpc->UsesKill = fp->UsesKill;
} }