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/ir_to_mesa.cpp12
-rw-r--r--mesalib/src/mesa/program/prog_cache.h11
-rw-r--r--mesalib/src/mesa/program/prog_execute.c74
-rw-r--r--mesalib/src/mesa/program/prog_instruction.c23
-rw-r--r--mesalib/src/mesa/program/prog_instruction.h4
-rw-r--r--mesalib/src/mesa/program/prog_optimize.h11
-rw-r--r--mesalib/src/mesa/program/prog_parameter.c2
-rw-r--r--mesalib/src/mesa/program/prog_print.h11
-rw-r--r--mesalib/src/mesa/program/programopt.h10
-rw-r--r--mesalib/src/mesa/program/sampler.cpp9
-rw-r--r--mesalib/src/mesa/program/sampler.h7
11 files changed, 59 insertions, 115 deletions
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 5cd905822..ce3af3120 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -43,19 +43,18 @@
#include "linker.h"
#include "main/mtypes.h"
+#include "main/shaderapi.h"
#include "main/shaderobj.h"
#include "main/uniforms.h"
-#include "program/hash_table.h"
-extern "C" {
-#include "main/shaderapi.h"
+#include "program/hash_table.h"
#include "program/prog_instruction.h"
#include "program/prog_optimize.h"
#include "program/prog_print.h"
#include "program/program.h"
#include "program/prog_parameter.h"
#include "program/sampler.h"
-}
+
static int swizzle_for_size(int size);
@@ -2943,12 +2942,9 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
/* Lowering */
do_mat_op_to_vec(ir);
- GLenum target = _mesa_shader_stage_to_program(prog->_LinkedShaders[i]->Stage);
lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
| LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP
- | ((options->EmitNoPow) ? POW_TO_EXP2 : 0)
- | ((target == GL_VERTEX_PROGRAM_ARB) ? SAT_TO_CLAMP
- : 0)));
+ | ((options->EmitNoPow) ? POW_TO_EXP2 : 0)));
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
diff --git a/mesalib/src/mesa/program/prog_cache.h b/mesalib/src/mesa/program/prog_cache.h
index fdd7e264b..e37f1d7be 100644
--- a/mesalib/src/mesa/program/prog_cache.h
+++ b/mesalib/src/mesa/program/prog_cache.h
@@ -32,6 +32,12 @@
#include "main/glheader.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct gl_context;
/** Opaque type */
@@ -65,4 +71,9 @@ _mesa_shader_cache_insert(struct gl_context *ctx,
struct gl_shader_program *program);
+#ifdef __cplusplus
+}
+#endif
+
+
#endif /* PROG_CACHE_H */
diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c
index 650c40f2a..33c1751e8 100644
--- a/mesalib/src/mesa/program/prog_execute.c
+++ b/mesalib/src/mesa/program/prog_execute.c
@@ -298,15 +298,6 @@ fetch_vector1(const struct prog_src_register *source,
}
-static GLuint
-fetch_vector1ui(const struct prog_src_register *source,
- const struct gl_program_machine *machine)
-{
- const GLuint *src = (GLuint *) get_src_register_pointer(source, machine);
- return src[GET_SWZ(source->Swizzle, 0)];
-}
-
-
/**
* Fetch texel from texture. Use partial derivatives when possible.
*/
@@ -488,71 +479,6 @@ store_vector4(const struct prog_instruction *inst,
/**
- * Store 4 uints into a register. Observe the set-condition-code flags.
- */
-static void
-store_vector4ui(const struct prog_instruction *inst,
- struct gl_program_machine *machine, const GLuint value[4])
-{
- const struct prog_dst_register *dstReg = &(inst->DstReg);
- GLuint writeMask = dstReg->WriteMask;
- GLuint *dst = (GLuint *) get_dst_register_pointer(dstReg, machine);
-
- if (dstReg->CondMask != COND_TR) {
- /* condition codes may turn off some writes */
- if (writeMask & WRITEMASK_X) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 0)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_X;
- }
- if (writeMask & WRITEMASK_Y) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 1)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_Y;
- }
- if (writeMask & WRITEMASK_Z) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 2)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_Z;
- }
- if (writeMask & WRITEMASK_W) {
- if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 3)],
- dstReg->CondMask))
- writeMask &= ~WRITEMASK_W;
- }
- }
-
- if (writeMask & WRITEMASK_X)
- dst[0] = value[0];
- if (writeMask & WRITEMASK_Y)
- dst[1] = value[1];
- if (writeMask & WRITEMASK_Z)
- dst[2] = value[2];
- if (writeMask & WRITEMASK_W)
- dst[3] = value[3];
-
- if (inst->CondUpdate) {
- if (writeMask & WRITEMASK_X)
- machine->CondCodes[0] = generate_cc((float)value[0]);
- if (writeMask & WRITEMASK_Y)
- machine->CondCodes[1] = generate_cc((float)value[1]);
- if (writeMask & WRITEMASK_Z)
- machine->CondCodes[2] = generate_cc((float)value[2]);
- if (writeMask & WRITEMASK_W)
- machine->CondCodes[3] = generate_cc((float)value[3]);
-#if DEBUG_PROG
- printf("CondCodes=(%s,%s,%s,%s) for:\n",
- _mesa_condcode_string(machine->CondCodes[0]),
- _mesa_condcode_string(machine->CondCodes[1]),
- _mesa_condcode_string(machine->CondCodes[2]),
- _mesa_condcode_string(machine->CondCodes[3]));
-#endif
- }
-}
-
-
-
-/**
* Execute the given vertex/fragment program.
*
* \param ctx rendering context
diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c
index 976024e3c..254c0128f 100644
--- a/mesalib/src/mesa/program/prog_instruction.c
+++ b/mesalib/src/mesa/program/prog_instruction.c
@@ -75,29 +75,6 @@ _mesa_alloc_instructions(GLuint numInst)
/**
- * Reallocate memory storing an array of program instructions.
- * This is used when we need to append additional instructions onto an
- * program.
- * \param oldInst pointer to first of old/src instructions
- * \param numOldInst number of instructions at <oldInst>
- * \param numNewInst desired size of new instruction array.
- * \return pointer to start of new instruction array.
- */
-struct prog_instruction *
-_mesa_realloc_instructions(struct prog_instruction *oldInst,
- GLuint numOldInst, GLuint numNewInst)
-{
- struct prog_instruction *newInst;
-
- newInst = (struct prog_instruction *)
- realloc(oldInst,
- numNewInst * sizeof(struct prog_instruction));
-
- return newInst;
-}
-
-
-/**
* Copy an array of program instructions.
* \param dest pointer to destination.
* \param src pointer to source.
diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h
index de7880499..0957bd9d7 100644
--- a/mesalib/src/mesa/program/prog_instruction.h
+++ b/mesalib/src/mesa/program/prog_instruction.h
@@ -385,10 +385,6 @@ extern struct prog_instruction *
_mesa_alloc_instructions(GLuint numInst);
extern struct prog_instruction *
-_mesa_realloc_instructions(struct prog_instruction *oldInst,
- GLuint numOldInst, GLuint numNewInst);
-
-extern struct prog_instruction *
_mesa_copy_instructions(struct prog_instruction *dest,
const struct prog_instruction *src, GLuint n);
diff --git a/mesalib/src/mesa/program/prog_optimize.h b/mesalib/src/mesa/program/prog_optimize.h
index 7607bffdd..1f20ac0f8 100644
--- a/mesalib/src/mesa/program/prog_optimize.h
+++ b/mesalib/src/mesa/program/prog_optimize.h
@@ -29,6 +29,11 @@
#include "main/glheader.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct gl_context;
struct gl_program;
struct prog_instruction;
@@ -46,4 +51,10 @@ _mesa_optimize_program(struct gl_context *ctx, struct gl_program *program);
extern GLboolean
_mesa_constant_fold(struct gl_program *prog);
+
+#ifdef __cplusplus
+}
+#endif
+
+
#endif
diff --git a/mesalib/src/mesa/program/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c
index 896c6052b..0ef46415d 100644
--- a/mesalib/src/mesa/program/prog_parameter.c
+++ b/mesalib/src/mesa/program/prog_parameter.c
@@ -120,7 +120,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
paramList->Size = paramList->Size + 4 * sz4;
/* realloc arrays */
- paramList->Parameters = (struct gl_program_parameter *)
+ paramList->Parameters =
realloc(paramList->Parameters,
paramList->Size * sizeof(struct gl_program_parameter));
diff --git a/mesalib/src/mesa/program/prog_print.h b/mesalib/src/mesa/program/prog_print.h
index cd61568e9..9058dfa76 100644
--- a/mesalib/src/mesa/program/prog_print.h
+++ b/mesalib/src/mesa/program/prog_print.h
@@ -31,6 +31,12 @@
#include "main/glheader.h"
#include "main/mtypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct gl_program;
struct gl_program_parameter_list;
struct gl_shader;
@@ -115,4 +121,9 @@ extern void
_mesa_append_uniforms_to_file(const struct gl_shader *shader);
+#ifdef __cplusplus
+}
+#endif
+
+
#endif /* PROG_PRINT_H */
diff --git a/mesalib/src/mesa/program/programopt.h b/mesalib/src/mesa/program/programopt.h
index f22109fb4..93c00f740 100644
--- a/mesalib/src/mesa/program/programopt.h
+++ b/mesalib/src/mesa/program/programopt.h
@@ -28,6 +28,12 @@
#include "main/mtypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
extern void
_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog);
@@ -52,4 +58,8 @@ extern void
_mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* PROGRAMOPT_H */
diff --git a/mesalib/src/mesa/program/sampler.cpp b/mesalib/src/mesa/program/sampler.cpp
index 29a540871..f8584c968 100644
--- a/mesalib/src/mesa/program/sampler.cpp
+++ b/mesalib/src/mesa/program/sampler.cpp
@@ -27,15 +27,14 @@
#include "glsl_types.h"
#include "ir_visitor.h"
#include "../glsl/program.h"
-#include "program/hash_table.h"
#include "ir_uniform.h"
-extern "C" {
#include "main/compiler.h"
#include "main/mtypes.h"
+#include "program/hash_table.h"
#include "program/prog_parameter.h"
#include "program/program.h"
-}
+
class get_sampler_name : public ir_hierarchical_visitor
{
@@ -104,7 +103,7 @@ public:
};
-extern "C" int
+int
_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
struct gl_shader_program *shader_program,
const struct gl_program *prog)
@@ -136,7 +135,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
}
-extern "C" class ir_rvalue *
+class ir_rvalue *
_mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler)
{
ir_dereference_array *deref_arr = sampler->as_dereference_array();
diff --git a/mesalib/src/mesa/program/sampler.h b/mesalib/src/mesa/program/sampler.h
index 8b7c3b63e..61c7f5851 100644
--- a/mesalib/src/mesa/program/sampler.h
+++ b/mesalib/src/mesa/program/sampler.h
@@ -23,6 +23,10 @@
* DEALINGS IN THE SOFTWARE.
*/
+#ifndef SAMPLER_H
+#define SAMPLER_H
+
+
int
_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
struct gl_shader_program *shader_program,
@@ -30,3 +34,6 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
class ir_rvalue *
_mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler);
+
+
+#endif /* SAMPLER_H */