summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/arbprogram.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-10-19 13:23:37 +1100
committerTimothy Arceri <[email protected]>2016-10-26 14:29:36 +1100
commit3423488d55b9c483fcdb3996eb89b424c1031d24 (patch)
tree270d90fe3fd4c090f2c8e59a3b20d0afe7d98e72 /src/mesa/main/arbprogram.c
parent17e28a1571b6141368fefc84cc8b0a3b4e52f8ee (diff)
st/mesa/r200/i915/i965: eliminate gl_fragment_program
Here we move OriginUpperLeft and PixelCenterInteger into gl_program all other fields have been replace by shader_info. V2: Don't use anonymous union/structs to hold vertex/fragment fields suggested by Ian. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main/arbprogram.c')
-rw-r--r--src/mesa/main/arbprogram.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index 0b6f7cbc2d6..9c7622ad5e5 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -63,7 +63,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- curProg = &ctx->FragmentProgram.Current->Base;
+ curProg = ctx->FragmentProgram.Current;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramARB(target)");
@@ -81,7 +81,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
if (target == GL_VERTEX_PROGRAM_ARB)
newProg = ctx->Shared->DefaultVertexProgram;
else
- newProg = &ctx->Shared->DefaultFragmentProgram->Base;
+ newProg = ctx->Shared->DefaultFragmentProgram;
}
else {
/* Bind a user program */
@@ -117,8 +117,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
_mesa_reference_program(ctx, &ctx->VertexProgram.Current, newProg);
}
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
- gl_fragment_program(newProg));
+ _mesa_reference_program(ctx, &ctx->FragmentProgram.Current, newProg);
}
/* Never null pointers */
@@ -166,7 +165,7 @@ _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids)
break;
case GL_FRAGMENT_PROGRAM_ARB:
if (ctx->FragmentProgram.Current &&
- ctx->FragmentProgram.Current->Base.Id == ids[i]) {
+ ctx->FragmentProgram.Current->Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgramARB(prog->Target, 0);
}
@@ -261,7 +260,7 @@ get_local_param_pointer(struct gl_context *ctx, const char *func,
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- prog = &(ctx->FragmentProgram.Current->Base);
+ prog = ctx->FragmentProgram.Current;
maxParams = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams;
}
else {
@@ -317,7 +316,7 @@ void GLAPIENTRY
_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
const GLvoid *string)
{
- struct gl_program *base;
+ struct gl_program *prog;
bool failed;
GET_CURRENT_CONTEXT(ctx);
@@ -335,17 +334,13 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
}
if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
- struct gl_program *prog = ctx->VertexProgram.Current;
+ prog = ctx->VertexProgram.Current;
_mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
-
- base = prog;
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- struct gl_fragment_program *prog = ctx->FragmentProgram.Current;
+ prog = ctx->FragmentProgram.Current;
_mesa_parse_arb_fragment_program(ctx, target, string, len, prog);
-
- base = & prog->Base;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)");
@@ -356,7 +351,7 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
if (!failed) {
/* finally, give the program to the driver for translation/checking */
- if (!ctx->Driver.ProgramStringNotify(ctx, target, base)) {
+ if (!ctx->Driver.ProgramStringNotify(ctx, target, prog)) {
failed = true;
_mesa_error(ctx, GL_INVALID_OPERATION,
"glProgramStringARB(rejected by driver");
@@ -368,16 +363,16 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
target == GL_FRAGMENT_PROGRAM_ARB ? "fragment" : "vertex";
fprintf(stderr, "ARB_%s_program source for program %d:\n",
- shader_type, base->Id);
+ shader_type, prog->Id);
fprintf(stderr, "%s\n", (const char *) string);
if (failed) {
fprintf(stderr, "ARB_%s_program %d failed to compile.\n",
- shader_type, base->Id);
+ shader_type, prog->Id);
} else {
fprintf(stderr, "Mesa IR for ARB_%s_program %d:\n",
- shader_type, base->Id);
- _mesa_print_program(base);
+ shader_type, prog->Id);
+ _mesa_print_program(prog);
fprintf(stderr, "\n");
}
fflush(stderr);
@@ -392,7 +387,7 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
target == GL_FRAGMENT_PROGRAM_ARB ? "fragment" : "vertex";
_mesa_snprintf(filename, sizeof(filename), "%s/%cp-%u.shader_test",
- capture_path, shader_type[0], base->Id);
+ capture_path, shader_type[0], prog->Id);
file = fopen(filename, "w");
if (file) {
fprintf(file,
@@ -661,7 +656,7 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- prog = &(ctx->FragmentProgram.Current->Base);
+ prog = ctx->FragmentProgram.Current;
limits = &ctx->Const.Program[MESA_SHADER_FRAGMENT];
}
else {
@@ -780,25 +775,25 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
* The following apply to fragment programs only (at this time)
*/
if (target == GL_FRAGMENT_PROGRAM_ARB) {
- const struct gl_fragment_program *fp = ctx->FragmentProgram.Current;
+ const struct gl_program *fp = ctx->FragmentProgram.Current;
switch (pname) {
case GL_PROGRAM_ALU_INSTRUCTIONS_ARB:
- *params = fp->Base.NumNativeAluInstructions;
+ *params = fp->NumNativeAluInstructions;
return;
case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
- *params = fp->Base.NumAluInstructions;
+ *params = fp->NumAluInstructions;
return;
case GL_PROGRAM_TEX_INSTRUCTIONS_ARB:
- *params = fp->Base.NumTexInstructions;
+ *params = fp->NumTexInstructions;
return;
case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
- *params = fp->Base.NumNativeTexInstructions;
+ *params = fp->NumNativeTexInstructions;
return;
case GL_PROGRAM_TEX_INDIRECTIONS_ARB:
- *params = fp->Base.NumTexIndirections;
+ *params = fp->NumTexIndirections;
return;
case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
- *params = fp->Base.NumNativeTexIndirections;
+ *params = fp->NumNativeTexIndirections;
return;
case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB:
*params = limits->MaxAluInstructions;
@@ -840,7 +835,7 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
prog = ctx->VertexProgram.Current;
}
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
- prog = &(ctx->FragmentProgram.Current->Base);
+ prog = ctx->FragmentProgram.Current;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(target)");