summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/p_state.h5
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c44
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c4
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_dump.c4
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_util.c15
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h2
6 files changed, 64 insertions, 10 deletions
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index fd5e7ad3af..e3f62a80ad 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -121,8 +121,11 @@ struct pipe_clip_state {
GLuint nr;
};
+
struct pipe_fs_state {
- struct gl_fragment_program *fp;
+ GLuint inputs_read; /* FRAG_ATTRIB_* */
+ const struct tgsi_token *tokens;
+
};
struct pipe_constant_buffer {
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 7b1c90cba6..536365f219 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -37,6 +37,7 @@
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_quad.h"
+#include "core/tgsi_core.h"
struct exec_machine {
const struct setup_coefficient *coef; /**< will point to quad->coef */
@@ -180,8 +181,47 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad )
#endif
}
-#if 0
- softpipe->run_fs( tri->fp, quad, &tri->outputs );
+#if 1
+ /*softpipe->run_fs( tri->fp, quad, &tri->outputs );*/
+
+ {
+ struct tgsi_exec_machine machine;
+ struct tgsi_exec_vector inputs[FRAG_ATTRIB_MAX + 1];
+ struct tgsi_exec_vector outputs[FRAG_ATTRIB_MAX + 1];
+ struct tgsi_exec_vector *ainputs;
+ struct tgsi_exec_vector *aoutputs;
+ GLuint i, total;
+
+ ainputs = (struct tgsi_exec_vector *) tgsi_align_128bit( inputs );
+ aoutputs = (struct tgsi_exec_vector *) tgsi_align_128bit( outputs );
+
+ for( i = total = 0; i < PIPE_ATTRIB_MAX; i++ ) {
+ GLuint attr;
+
+ attr = softpipe->fp_attr_to_slot[i];
+ if( attr ) {
+ assert( total < FRAG_ATTRIB_MAX );
+ assert( attr < FRAG_ATTRIB_MAX );
+ assert( sizeof( ainputs[0] ) == sizeof( exec.attr[0] ) );
+
+ memcpy(
+ &ainputs[total],
+ exec.attr[attr],
+ sizeof( ainputs[0] ) );
+ total++;
+ }
+ }
+
+ tgsi_exec_machine_init(
+ &machine,
+ softpipe->fs.tokens );
+
+ machine.Inputs = ainputs;
+ machine.Outputs = aoutputs;
+
+ tgsi_exec_machine_run(
+ &machine );
+ }
#else
{
GLuint attr = softpipe->fp_attr_to_slot[FRAG_ATTRIB_COL0];
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
index 18dfb50e38..fcdedb54a9 100644
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ b/src/mesa/pipe/softpipe/sp_state_derived.c
@@ -28,7 +28,6 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
#include "vf/vf.h"
#include "pipe/draw/draw_context.h"
@@ -68,8 +67,7 @@ static const GLuint frag_to_vf[FRAG_ATTRIB_MAX] =
*/
static void calculate_vertex_layout( struct softpipe_context *softpipe )
{
- struct gl_fragment_program *fp = softpipe->fs.fp;
- const GLuint inputsRead = fp->Base.InputsRead;
+ const GLuint inputsRead = softpipe->fs.inputs_read;
GLuint slot_to_vf_attr[VF_ATTRIB_MAX];
GLbitfield attr_mask = 0x0;
GLuint i;
diff --git a/src/mesa/pipe/tgsi/core/tgsi_dump.c b/src/mesa/pipe/tgsi/core/tgsi_dump.c
index fecb246ab1..0345fd93f7 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_dump.c
+++ b/src/mesa/pipe/tgsi/core/tgsi_dump.c
@@ -400,12 +400,16 @@ tgsi_dump(
GLuint deflt = !(flags & TGSI_DUMP_NO_DEFAULT);
{
+#if 0
static GLuint counter = 0;
char buffer[64];
sprintf( buffer, "sbir-dump-%.4u.txt", counter++ );
dump.file = fopen( buffer, "wt" );
+#else
+ dump.file = stderr;
dump.tabs = 0;
+#endif
}
tgsi_parse_init( &parse, tokens );
diff --git a/src/mesa/pipe/tgsi/core/tgsi_util.c b/src/mesa/pipe/tgsi/core/tgsi_util.c
index 2331affdfd..38d6d6e6bc 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_util.c
+++ b/src/mesa/pipe/tgsi/core/tgsi_util.c
@@ -1,15 +1,22 @@
#include "tgsi_platform.h"
#include "tgsi_core.h"
+union pointer_hack
+{
+ void *pointer;
+ unsigned long long uint64;
+};
+
void *
tgsi_align_128bit(
void *unaligned )
{
- GLuint *ptr, addr;
+ union pointer_hack ph;
- ptr = (GLuint *) unaligned;
- addr = (*(GLuint *) &ptr + 15) & ~15;
- return *(void **) &addr;
+ ph.uint64 = 0;
+ ph.pointer = unaligned;
+ ph.uint64 = (ph.uint64 + 15) & ~15;
+ return ph.pointer;
}
GLuint
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h
index 4c1141e579..9256318997 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h
@@ -5,6 +5,8 @@
extern "C" {
#endif // defined __cplusplus
+struct tgsi_token;
+
GLboolean
tgsi_mesa_compile_fp_program(
const struct gl_fragment_program *program,