aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r--mesalib/src/mesa/program/arbprogparse.c7
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp2
-rw-r--r--mesalib/src/mesa/program/prog_execute.c5
-rw-r--r--mesalib/src/mesa/program/program.c88
-rw-r--r--mesalib/src/mesa/program/register_allocate.c2
5 files changed, 55 insertions, 49 deletions
diff --git a/mesalib/src/mesa/program/arbprogparse.c b/mesalib/src/mesa/program/arbprogparse.c
index 5b9665091..7dec399a5 100644
--- a/mesalib/src/mesa/program/arbprogparse.c
+++ b/mesalib/src/mesa/program/arbprogparse.c
@@ -60,6 +60,7 @@ having three separate program parameter arrays.
#include "prog_parameter.h"
#include "prog_statevars.h"
#include "prog_instruction.h"
+#include "prog_optimize.h"
#include "program_parser.h"
@@ -84,6 +85,9 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
return;
}
+ if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
+ _mesa_optimize_program(ctx, &prog);
+
free(program->Base.String);
/* Copy the relevant contents of the arb_program struct into the
@@ -177,6 +181,9 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
return;
}
+ if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
+ _mesa_optimize_program(ctx, &prog);
+
free(program->Base.String);
/* Copy the relevant contents of the arb_program struct into the
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 2a82e9d9d..b088160d3 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -793,7 +793,7 @@ ir_to_mesa_visitor::visit(ir_function *ir)
const ir_function_signature *sig;
exec_list empty;
- sig = ir->matching_signature(NULL, &empty);
+ sig = ir->matching_signature(NULL, &empty, false);
assert(sig);
diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c
index 115525eba..fcc9ed518 100644
--- a/mesalib/src/mesa/program/prog_execute.c
+++ b/mesalib/src/mesa/program/prog_execute.c
@@ -52,7 +52,6 @@
/**
* Set x to positive or negative infinity.
*/
-#if defined(USE_IEEE) || defined(_WIN32)
#define SET_POS_INFINITY(x) \
do { \
fi_type fi; \
@@ -65,10 +64,6 @@
fi.i = 0xFF800000; \
x = fi.f; \
} while (0)
-#else
-#define SET_POS_INFINITY(x) x = (GLfloat) HUGE_VAL
-#define SET_NEG_INFINITY(x) x = (GLfloat) -HUGE_VAL
-#endif
#define SET_FLOAT_BITS(x, bits) ((fi_type *) (void *) &(x))->i = bits
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index aedce3e3c..ef5bf6b11 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -226,27 +226,24 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
/**
- * Initialize a new vertex/fragment program object.
+ * Initialize a new gl_program object.
*/
-static struct gl_program *
-_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
- GLenum target, GLuint id)
+static void
+init_program_struct(struct gl_program *prog, GLenum target, GLuint id)
{
- (void) ctx;
- if (prog) {
- GLuint i;
- memset(prog, 0, sizeof(*prog));
- prog->Id = id;
- prog->Target = target;
- prog->RefCount = 1;
- prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
-
- /* default mapping from samplers to texture units */
- for (i = 0; i < MAX_SAMPLERS; i++)
- prog->SamplerUnits[i] = i;
- }
+ GLuint i;
- return prog;
+ assert(prog);
+
+ memset(prog, 0, sizeof(*prog));
+ prog->Id = id;
+ prog->Target = target;
+ prog->RefCount = 1;
+ prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
+
+ /* default mapping from samplers to texture units */
+ for (i = 0; i < MAX_SAMPLERS; i++)
+ prog->SamplerUnits[i] = i;
}
@@ -254,13 +251,15 @@ _mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
* Initialize a new fragment program object.
*/
struct gl_program *
-_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog,
- GLenum target, GLuint id)
+_mesa_init_fragment_program(struct gl_context *ctx,
+ struct gl_fragment_program *prog,
+ GLenum target, GLuint id)
{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
+ if (prog) {
+ init_program_struct(&prog->Base, target, id);
+ return &prog->Base;
+ }
+ return NULL;
}
@@ -268,13 +267,15 @@ _mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program
* Initialize a new vertex program object.
*/
struct gl_program *
-_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog,
- GLenum target, GLuint id)
+_mesa_init_vertex_program(struct gl_context *ctx,
+ struct gl_vertex_program *prog,
+ GLenum target, GLuint id)
{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
+ if (prog) {
+ init_program_struct(&prog->Base, target, id);
+ return &prog->Base;
+ }
+ return NULL;
}
@@ -283,13 +284,14 @@ _mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *pro
*/
struct gl_program *
_mesa_init_compute_program(struct gl_context *ctx,
- struct gl_compute_program *prog, GLenum target,
- GLuint id)
+ struct gl_compute_program *prog,
+ GLenum target, GLuint id)
{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
+ if (prog) {
+ init_program_struct(&prog->Base, target, id);
+ return &prog->Base;
+ }
+ return NULL;
}
@@ -297,13 +299,15 @@ _mesa_init_compute_program(struct gl_context *ctx,
* Initialize a new geometry program object.
*/
struct gl_program *
-_mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog,
- GLenum target, GLuint id)
+_mesa_init_geometry_program(struct gl_context *ctx,
+ struct gl_geometry_program *prog,
+ GLenum target, GLuint id)
{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
+ if (prog) {
+ init_program_struct(&prog->Base, target, id);
+ return &prog->Base;
+ }
+ return NULL;
}
diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c
index 6fac69033..549154e8a 100644
--- a/mesalib/src/mesa/program/register_allocate.c
+++ b/mesalib/src/mesa/program/register_allocate.c
@@ -71,8 +71,8 @@
*/
#include <stdbool.h>
-#include <ralloc.h>
+#include "util/ralloc.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"