summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2007-09-28 12:28:16 -0400
committerZack Rusin <zack@tungstengraphics.com>2007-09-28 12:28:16 -0400
commit901577e07fcab0cf90a272fee900cb0831ae84c3 (patch)
tree9e8674230a3e584c674d0683de5d40321bd51fc1 /src/mesa/pipe/draw
parentf2a33a63f1f41681375baa2a9ad261cb60db2a85 (diff)
Revert "Redoing the way we handle vertex shaders for the draw module."
This reverts commit 6dcfddb8e2ec2bfb6187b912807fa65f28da2c5e.
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r--src/mesa/pipe/draw/draw_context.c8
-rw-r--r--src/mesa/pipe/draw/draw_context.h9
-rw-r--r--src/mesa/pipe/draw/draw_private.h14
-rw-r--r--src/mesa/pipe/draw/draw_vertex_fetch.c2
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader.c50
5 files changed, 18 insertions, 65 deletions
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c
index 5efb173228..66c66ff698 100644
--- a/src/mesa/pipe/draw/draw_context.c
+++ b/src/mesa/pipe/draw/draw_context.c
@@ -155,6 +155,14 @@ void draw_set_viewport_state( struct draw_context *draw,
}
+void
+draw_set_vertex_shader(struct draw_context *draw,
+ const struct pipe_shader_state *shader)
+{
+ draw_flush( draw );
+ draw->vertex_shader = *shader;
+}
+
void
draw_set_vertex_buffer(struct draw_context *draw,
diff --git a/src/mesa/pipe/draw/draw_context.h b/src/mesa/pipe/draw/draw_context.h
index 398e96d94d..0ccf5f6046 100644
--- a/src/mesa/pipe/draw/draw_context.h
+++ b/src/mesa/pipe/draw/draw_context.h
@@ -92,12 +92,9 @@ void draw_set_rasterize_stage( struct draw_context *draw,
struct draw_stage *stage );
-void * draw_create_vertex_shader(struct draw_context *draw,
- const struct pipe_shader_state *shader);
-void draw_bind_vertex_shader(struct draw_context *draw,
- void *vcso);
-void draw_delete_vertex_shader(struct draw_context *draw,
- void *vcso);
+void
+draw_set_vertex_shader(struct draw_context *draw,
+ const struct pipe_shader_state *shader);
void
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index 2f52299f74..ebef5347ab 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -46,7 +46,6 @@
#include "draw_vertex.h"
-#include "x86/rtasm/x86sse.h"
/**
* Basic vertex info.
@@ -105,7 +104,7 @@ struct draw_stage
void (*tri)( struct draw_stage *,
struct prim_header * );
-
+
void (*end)( struct draw_stage * );
void (*reset_stipple_counter)( struct draw_stage * );
@@ -117,15 +116,6 @@ struct draw_stage
#define VCACHE_OVERFLOW 4
#define VS_QUEUE_LENGTH (VCACHE_SIZE + VCACHE_OVERFLOW + 1) /* can never fill up */
-/**
- * Private version of the compiled vertex_shader
- */
-struct draw_vertex_shader {
- const struct pipe_shader_state *state;
-#if defined(__i386__) || defined(__386__)
- struct x86_function sse2_program;
-#endif
-};
/**
* Private context for the drawing module.
@@ -155,7 +145,7 @@ struct draw_context
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX];
- const struct draw_vertex_shader *vertex_shader;
+ struct pipe_shader_state vertex_shader;
struct pipe_vertex_buffer feedback_buffer[PIPE_ATTRIB_MAX];
struct pipe_vertex_element feedback_element[PIPE_ATTRIB_MAX];
diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c
index bc37e18c34..2b839d641e 100644
--- a/src/mesa/pipe/draw/draw_vertex_fetch.c
+++ b/src/mesa/pipe/draw/draw_vertex_fetch.c
@@ -85,7 +85,7 @@ void draw_vertex_fetch( struct draw_context *draw,
/*printf("fetch vertex %u: \n", j);*/
/* loop over vertex attributes (vertex shader inputs) */
- for (attr = 0; attr < draw->vertex_shader->state->num_inputs; attr++) {
+ for (attr = 0; attr < draw->vertex_shader.num_inputs; attr++) {
unsigned buf = draw->vertex_element[attr].vertex_buffer_index;
const void *src
diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c
index f7ddbd1909..a2e1cdc472 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader.c
@@ -36,8 +36,6 @@
#include "draw_context.h"
#include "draw_vertex.h"
-#include "x86/rtasm/x86sse.h"
-
#include "pipe/tgsi/exec/tgsi_core.h"
static INLINE unsigned
@@ -72,7 +70,6 @@ typedef void (XSTDCALL *codegen_function) (
float (*constant)[4],
struct tgsi_exec_vector *temporary );
-
/**
* Transform vertices with the current vertex program/shader
* Up to four vertices can be shaded at a time.
@@ -95,7 +92,7 @@ run_vertex_program(struct draw_context *draw,
const float *trans = draw->viewport.translate;
assert(count <= 4);
- assert(draw->vertex_shader->state->output_semantic_name[0]
+ assert(draw->vertex_shader.output_semantic_name[0]
== TGSI_SEMANTIC_POSITION);
#ifdef DEBUG
@@ -104,7 +101,7 @@ run_vertex_program(struct draw_context *draw,
/* init machine state */
tgsi_exec_machine_init(&machine,
- draw->vertex_shader->state->tokens,
+ draw->vertex_shader.tokens,
PIPE_MAX_SAMPLERS,
NULL /*samplers*/ );
@@ -117,8 +114,8 @@ run_vertex_program(struct draw_context *draw,
draw_vertex_fetch( draw, &machine, elts, count );
/* run shader */
- if( draw->vertex_shader->state->executable != NULL ) {
- codegen_function func = (codegen_function) draw->vertex_shader->state->executable;
+ if( draw->vertex_shader.executable != NULL ) {
+ codegen_function func = (codegen_function) draw->vertex_shader.executable;
func(
machine.Inputs,
machine.Outputs,
@@ -209,42 +206,3 @@ void draw_vertex_shader_queue_flush( struct draw_context *draw )
draw->vs.queue_nr = 0;
}
-
-void *
-draw_create_vertex_shader(struct draw_context *draw,
- const struct pipe_shader_state *shader)
-{
- struct draw_vertex_shader *vs = calloc(1, sizeof(struct draw_vertex_shader));
-
- vs->state = shader;
-#if defined(__i386__) || defined(__386__)
- x86_init_func(&vs->sse2_program);
-
- tgsi_emit_sse2(shader->tokens, &vs->sse2_program);
-
- ((struct pipe_shader_state*)(vs->state))->executable =
- x86_get_func(&vs->sse2_program);
-#endif
-
- return vs;
-}
-
-void draw_bind_vertex_shader(struct draw_context *draw,
- void *vcso)
-{
- draw_flush(draw);
- draw->vertex_shader = (struct draw_vertex_shader*)(vcso);
-}
-
-void draw_delete_vertex_shader(struct draw_context *draw,
- void *vcso)
-{
- struct draw_vertex_shader *vs = (struct draw_vertex_shader*)(vcso);
-#if defined(__i386__) || defined(__386__)
- x86_release_func(&vs->sse2_program);
-#endif
- free(vcso);
-}
-
-
-