summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/i915simple/i915_fpc_translate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/i915simple/i915_fpc_translate.c')
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc_translate.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/mesa/pipe/i915simple/i915_fpc_translate.c
index d74da85216..1cd554250c 100644
--- a/src/mesa/pipe/i915simple/i915_fpc_translate.c
+++ b/src/mesa/pipe/i915simple/i915_fpc_translate.c
@@ -32,8 +32,8 @@
#include "i915_context.h"
#include "i915_fpc.h"
-#include "pipe/tgsi/exec/tgsi_token.h"
-#include "pipe/tgsi/exec/tgsi_parse.h"
+#include "pipe/p_shader_tokens.h"
+#include "pipe/tgsi/util/tgsi_parse.h"
#include "pipe/draw/draw_vertex.h"
@@ -69,16 +69,16 @@ static unsigned passthrough[] =
/* 1, -1/3!, 1/5!, -1/7! */
static const float sin_constants[4] = { 1.0,
- -1.0 / (3 * 2 * 1),
- 1.0 / (5 * 4 * 3 * 2 * 1),
- -1.0 / (7 * 6 * 5 * 4 * 3 * 2 * 1)
+ -1.0f / (3 * 2 * 1),
+ 1.0f / (5 * 4 * 3 * 2 * 1),
+ -1.0f / (7 * 6 * 5 * 4 * 3 * 2 * 1)
};
/* 1, -1/2!, 1/4!, -1/6! */
static const float cos_constants[4] = { 1.0,
- -1.0 / (2 * 1),
- 1.0 / (4 * 3 * 2 * 1),
- -1.0 / (6 * 5 * 4 * 3 * 2 * 1)
+ -1.0f / (2 * 1),
+ 1.0f / (4 * 3 * 2 * 1),
+ -1.0f / (6 * 5 * 4 * 3 * 2 * 1)
};
@@ -102,7 +102,7 @@ i915_use_passthrough_shader(struct i915_context *i915)
{
fprintf(stderr, "**** Using i915 pass-through fragment shader\n");
- i915->current.program = (uint *) malloc(sizeof(passthrough));
+ i915->current.program = (uint *) MALLOC(sizeof(passthrough));
if (i915->current.program) {
memcpy(i915->current.program, passthrough, sizeof(passthrough));
i915->current.program_len = Elements(passthrough);
@@ -117,11 +117,13 @@ void
i915_program_error(struct i915_fp_compile *p, const char *msg, ...)
{
va_list args;
+ char buffer[1024];
fprintf(stderr, "i915_program_error: ");
va_start( args, msg );
- vfprintf( stderr, msg, args );
+ vsprintf( buffer, msg, args );
va_end( args );
+ fprintf(stderr, buffer);
fprintf(stderr, "\n");
p->error = 1;
@@ -167,7 +169,7 @@ src_vector(struct i915_fp_compile *p,
switch (sem_name) {
case TGSI_SEMANTIC_POSITION:
- printf("SKIP SEM POS\n");
+ fprintf(stderr, "SKIP SEM POS\n");
/*
assert(p->wpos_tex != -1);
src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
@@ -381,6 +383,9 @@ emit_simple_arith(struct i915_fp_compile *p,
arg3 );
}
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
/*
* Translate TGSI instruction to i915 instruction.
@@ -430,7 +435,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
- src0, i915_emit_const1f(p, 1.0 / (M_PI * 2)), 0);
+ src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0);
i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
@@ -439,7 +444,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
- tmp, i915_emit_const1f(p, (M_PI * 2)), 0);
+ tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0);
/*
* t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
@@ -772,7 +777,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
- src0, i915_emit_const1f(p, 1.0 / (M_PI * 2)), 0);
+ src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0);
i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
@@ -781,7 +786,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
i915_emit_arith(p,
A0_MUL,
tmp, A0_DEST_CHANNEL_X, 0,
- tmp, i915_emit_const1f(p, (M_PI * 2)), 0);
+ tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0);
/*
* t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
@@ -986,8 +991,8 @@ i915_init_compile(struct i915_context *i915,
static void
i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
{
- uint program_size = p->csr - p->program;
- uint decl_size = p->decl - p->declarations;
+ unsigned long program_size = (unsigned long) (p->csr - p->program);
+ unsigned long decl_size = (unsigned long) (p->decl - p->declarations);
if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT)
i915_program_error(p, "Exceeded max nr indirect texture lookups");
@@ -1003,7 +1008,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
/* free old program, if present */
if (i915->current.program) {
- free(i915->current.program);
+ FREE(i915->current.program);
i915->current.program_len = 0;
}
@@ -1028,7 +1033,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
/* Copy compilation results to fragment program struct:
*/
i915->current.program
- = (uint *) malloc((program_size + decl_size) * sizeof(uint));
+ = (uint *) MALLOC((program_size + decl_size) * sizeof(uint));
if (i915->current.program) {
i915->current.program_len = program_size + decl_size;
@@ -1049,7 +1054,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
/* Release the compilation struct:
*/
- free(p);
+ FREE(p);
}