summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/arbprogparse.c46
-rw-r--r--src/mesa/program/arbprogparse.h2
-rw-r--r--src/mesa/program/prog_statevars.c8
-rw-r--r--src/mesa/program/program.c15
-rw-r--r--src/mesa/program/program.h26
-rw-r--r--src/mesa/program/programopt.c42
-rw-r--r--src/mesa/program/programopt.h2
7 files changed, 55 insertions, 86 deletions
diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
index b7bddfe270f..80a05285838 100644
--- a/src/mesa/program/arbprogparse.c
+++ b/src/mesa/program/arbprogparse.c
@@ -160,7 +160,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
void
_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
const GLvoid *str, GLsizei len,
- struct gl_vertex_program *program)
+ struct gl_program *program)
{
struct gl_program prog;
struct asm_parser_state state;
@@ -180,37 +180,37 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
_mesa_optimize_program(ctx, &prog);
- free(program->Base.String);
+ free(program->String);
/* Copy the relevant contents of the arb_program struct into the
* vertex_program struct.
*/
- program->Base.String = prog.String;
- program->Base.NumInstructions = prog.NumInstructions;
- program->Base.NumTemporaries = prog.NumTemporaries;
- program->Base.NumParameters = prog.NumParameters;
- program->Base.NumAttributes = prog.NumAttributes;
- program->Base.NumAddressRegs = prog.NumAddressRegs;
- program->Base.NumNativeInstructions = prog.NumNativeInstructions;
- program->Base.NumNativeTemporaries = prog.NumNativeTemporaries;
- program->Base.NumNativeParameters = prog.NumNativeParameters;
- program->Base.NumNativeAttributes = prog.NumNativeAttributes;
- program->Base.NumNativeAddressRegs = prog.NumNativeAddressRegs;
- program->Base.InputsRead = prog.InputsRead;
- program->Base.OutputsWritten = prog.OutputsWritten;
- program->Base.IndirectRegisterFiles = prog.IndirectRegisterFiles;
+ program->String = prog.String;
+ program->NumInstructions = prog.NumInstructions;
+ program->NumTemporaries = prog.NumTemporaries;
+ program->NumParameters = prog.NumParameters;
+ program->NumAttributes = prog.NumAttributes;
+ program->NumAddressRegs = prog.NumAddressRegs;
+ program->NumNativeInstructions = prog.NumNativeInstructions;
+ program->NumNativeTemporaries = prog.NumNativeTemporaries;
+ program->NumNativeParameters = prog.NumNativeParameters;
+ program->NumNativeAttributes = prog.NumNativeAttributes;
+ program->NumNativeAddressRegs = prog.NumNativeAddressRegs;
+ program->InputsRead = prog.InputsRead;
+ program->OutputsWritten = prog.OutputsWritten;
+ program->IndirectRegisterFiles = prog.IndirectRegisterFiles;
program->IsPositionInvariant = (state.option.PositionInvariant)
? GL_TRUE : GL_FALSE;
- free(program->Base.Instructions);
- program->Base.Instructions = prog.Instructions;
+ free(program->Instructions);
+ program->Instructions = prog.Instructions;
- if (program->Base.Parameters)
- _mesa_free_parameter_list(program->Base.Parameters);
- program->Base.Parameters = prog.Parameters;
+ if (program->Parameters)
+ _mesa_free_parameter_list(program->Parameters);
+ program->Parameters = prog.Parameters;
#if DEBUG_VP
- printf("____________Vertex program %u __________\n", program->Base.Id);
- _mesa_print_program(&program->Base);
+ printf("____________Vertex program %u __________\n", program->Id);
+ _mesa_print_program(program);
#endif
}
diff --git a/src/mesa/program/arbprogparse.h b/src/mesa/program/arbprogparse.h
index 39d2116a041..05d93f0370b 100644
--- a/src/mesa/program/arbprogparse.h
+++ b/src/mesa/program/arbprogparse.h
@@ -35,7 +35,7 @@ struct gl_vertex_program;
extern void
_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
const GLvoid *str, GLsizei len,
- struct gl_vertex_program *program);
+ struct gl_program *program);
extern void
_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target,
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 2ac7b561b69..110dfda3062 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -399,14 +399,14 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
return;
case STATE_LOCAL:
- if (!ctx->VertexProgram.Current->Base.LocalParams) {
- ctx->VertexProgram.Current->Base.LocalParams =
+ if (!ctx->VertexProgram.Current->LocalParams) {
+ ctx->VertexProgram.Current->LocalParams =
calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
- if (!ctx->VertexProgram.Current->Base.LocalParams)
+ if (!ctx->VertexProgram.Current->LocalParams)
return;
}
- COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]);
+ COPY_4V(value, ctx->VertexProgram.Current->LocalParams[idx]);
return;
default:
_mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 28af5b5f21b..a72e6a11dbd 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -87,8 +87,8 @@ _mesa_init_program(struct gl_context *ctx)
ctx->VertexProgram.PointSizeEnabled =
(ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE;
ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
- ctx->Shared->DefaultVertexProgram);
+ _mesa_reference_program(ctx, &ctx->VertexProgram.Current,
+ ctx->Shared->DefaultVertexProgram);
assert(ctx->VertexProgram.Current);
ctx->VertexProgram.Cache = _mesa_new_program_cache();
@@ -112,7 +112,7 @@ _mesa_init_program(struct gl_context *ctx)
void
_mesa_free_program_data(struct gl_context *ctx)
{
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
+ _mesa_reference_program(ctx, &ctx->VertexProgram.Current, NULL);
_mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
_mesa_delete_shader_cache(ctx, ctx->FragmentProgram.Cache);
@@ -137,8 +137,8 @@ _mesa_free_program_data(struct gl_context *ctx)
void
_mesa_update_default_objects_program(struct gl_context *ctx)
{
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
- ctx->Shared->DefaultVertexProgram);
+ _mesa_reference_program(ctx, &ctx->VertexProgram.Current,
+ ctx->Shared->DefaultVertexProgram);
assert(ctx->VertexProgram.Current);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
@@ -215,14 +215,11 @@ struct gl_program *
_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
{
switch (target) {
- case GL_VERTEX_PROGRAM_ARB: { /* == GL_VERTEX_PROGRAM_NV */
- struct gl_vertex_program *prog = CALLOC_STRUCT(gl_vertex_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
- }
case GL_FRAGMENT_PROGRAM_ARB: {
struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
return _mesa_init_gl_program(&prog->Base, target, id);
}
+ case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
case GL_GEOMETRY_PROGRAM_NV:
case GL_TESS_CONTROL_PROGRAM_NV:
case GL_TESS_EVALUATION_PROGRAM_NV: {
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index a909dcc28d1..5f322da85a6 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -90,15 +90,6 @@ _mesa_reference_program(struct gl_context *ctx,
}
static inline void
-_mesa_reference_vertprog(struct gl_context *ctx,
- struct gl_vertex_program **ptr,
- struct gl_vertex_program *prog)
-{
- _mesa_reference_program(ctx, (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
-static inline void
_mesa_reference_fragprog(struct gl_context *ctx,
struct gl_fragment_program **ptr,
struct gl_fragment_program *prog)
@@ -184,10 +175,6 @@ _mesa_shader_stage_to_program(unsigned stage)
}
-/* Cast wrappers from gl_program to derived program types.
- * (e.g. gl_vertex_program)
- */
-
static inline struct gl_fragment_program *
gl_fragment_program(struct gl_program *prog)
{
@@ -200,19 +187,6 @@ gl_fragment_program_const(const struct gl_program *prog)
return (const struct gl_fragment_program *) prog;
}
-
-static inline struct gl_vertex_program *
-gl_vertex_program(struct gl_program *prog)
-{
- return (struct gl_vertex_program *) prog;
-}
-
-static inline const struct gl_vertex_program *
-gl_vertex_program_const(const struct gl_program *prog)
-{
- return (const struct gl_vertex_program *) prog;
-}
-
static inline struct gl_compute_program *
gl_compute_program(struct gl_program *prog)
{
diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c
index 4dd9998a887..4610035f291 100644
--- a/src/mesa/program/programopt.c
+++ b/src/mesa/program/programopt.c
@@ -46,10 +46,10 @@
* May be used to implement the position_invariant option.
*/
static void
-_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
+_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
{
struct prog_instruction *newInst;
- const GLuint origLen = vprog->Base.NumInstructions;
+ const GLuint origLen = vprog->NumInstructions;
const GLuint newLen = origLen + 4;
GLuint i;
@@ -66,8 +66,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro
GLint mvpRef[4];
for (i = 0; i < 4; i++) {
- mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters,
- mvpState[i]);
+ mvpRef[i] = _mesa_add_state_reference(vprog->Parameters, mvpState[i]);
}
/* Alloc storage for new instructions */
@@ -100,24 +99,24 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro
}
/* Append original instructions after new instructions */
- _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
+ _mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
/* free old instructions */
- _mesa_free_instructions(vprog->Base.Instructions, origLen);
+ _mesa_free_instructions(vprog->Instructions, origLen);
/* install new instructions */
- vprog->Base.Instructions = newInst;
- vprog->Base.NumInstructions = newLen;
- vprog->Base.InputsRead |= VERT_BIT_POS;
- vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
+ vprog->Instructions = newInst;
+ vprog->NumInstructions = newLen;
+ vprog->InputsRead |= VERT_BIT_POS;
+ vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
}
static void
-_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
+_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
{
struct prog_instruction *newInst;
- const GLuint origLen = vprog->Base.NumInstructions;
+ const GLuint origLen = vprog->NumInstructions;
const GLuint newLen = origLen + 4;
GLuint hposTemp;
GLuint i;
@@ -135,8 +134,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
GLint mvpRef[4];
for (i = 0; i < 4; i++) {
- mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters,
- mvpState[i]);
+ mvpRef[i] = _mesa_add_state_reference(vprog->Parameters, mvpState[i]);
}
/* Alloc storage for new instructions */
@@ -148,7 +146,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
}
/* TEMP hposTemp; */
- hposTemp = vprog->Base.NumTemporaries++;
+ hposTemp = vprog->NumTemporaries++;
/*
* Generated instructions:
@@ -202,21 +200,21 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
/* Append original instructions after new instructions */
- _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
+ _mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
/* free old instructions */
- _mesa_free_instructions(vprog->Base.Instructions, origLen);
+ _mesa_free_instructions(vprog->Instructions, origLen);
/* install new instructions */
- vprog->Base.Instructions = newInst;
- vprog->Base.NumInstructions = newLen;
- vprog->Base.InputsRead |= VERT_BIT_POS;
- vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
+ vprog->Instructions = newInst;
+ vprog->NumInstructions = newLen;
+ vprog->InputsRead |= VERT_BIT_POS;
+ vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
}
void
-_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
+_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog)
{
if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS)
_mesa_insert_mvp_dp4_code( ctx, vprog );
diff --git a/src/mesa/program/programopt.h b/src/mesa/program/programopt.h
index 1520d161ea8..2a76da4da5e 100644
--- a/src/mesa/program/programopt.h
+++ b/src/mesa/program/programopt.h
@@ -35,7 +35,7 @@ extern "C" {
extern void
-_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog);
+_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog);
extern void
_mesa_append_fog_code(struct gl_context *ctx,