summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_fs.c121
-rw-r--r--src/mesa/state_tracker/st_atom_vs.c114
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c45
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c33
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c13
-rw-r--r--src/mesa/state_tracker/st_draw.c8
-rw-r--r--src/mesa/state_tracker/st_program.h27
7 files changed, 220 insertions, 141 deletions
diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c
index 6dd576a57c..94b69c8df7 100644
--- a/src/mesa/state_tracker/st_atom_fs.c
+++ b/src/mesa/state_tracker/st_atom_fs.c
@@ -27,6 +27,7 @@
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
+ * Brian Paul
*/
#include "shader/prog_parameter.h"
@@ -42,55 +43,121 @@
#include "st_atom.h"
#include "st_program.h"
+
#define TGSI_DEBUG 1
-static void compile_fs( struct st_context *st )
+
+/**
+ * Translate a Mesa fragment shader into a TGSI shader.
+ * \return pointer to cached pipe_shader object.
+ */
+struct pipe_shader_state *
+st_translate_fragment_shader(struct st_context *st,
+ struct st_fragment_program *stfp)
{
- /* Map FRAG_RESULT_COLR to output 1, map FRAG_RESULT_DEPR to output 0 */
- static const GLuint outputMapping[2] = {1, 0};
- struct st_fragment_program *fp = st->fp;
+ GLuint outputMapping[FRAG_RESULT_MAX];
+ GLuint inputMapping[PIPE_MAX_SHADER_INPUTS];
struct pipe_shader_state fs;
struct pipe_shader_state *cached;
GLuint interpMode[16]; /* XXX size? */
GLuint i;
+ GLbitfield inputsRead = stfp->Base.Base.InputsRead;
+
+ /* Check if all fragment programs need the fragment position (in order
+ * to do perspective-corrected interpolation).
+ */
+ if (st->pipe->get_param(st->pipe, PIPE_PARAM_FS_NEEDS_POS))
+ inputsRead |= FRAG_BIT_WPOS;
+
+ memset(&fs, 0, sizeof(fs));
for (i = 0; i < 16; i++) {
- if (fp->Base.Base.InputsRead & (1 << i)) {
- if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1) {
- interpMode[i] = TGSI_INTERPOLATE_LINEAR;
+ if (inputsRead & (1 << i)) {
+ inputMapping[i] = fs.num_inputs;
+
+ switch (i) {
+ case FRAG_ATTRIB_WPOS:
+ fs.input_semantics[fs.num_inputs] = TGSI_SEMANTIC_POSITION;
+ interpMode[fs.num_inputs] = TGSI_INTERPOLATE_CONSTANT;
+ break;
+ case FRAG_ATTRIB_COL0:
+ fs.input_semantics[fs.num_inputs] = TGSI_SEMANTIC_COLOR0;
+ interpMode[fs.num_inputs] = TGSI_INTERPOLATE_LINEAR;
+ break;
+ case FRAG_ATTRIB_COL1:
+ fs.input_semantics[fs.num_inputs] = TGSI_SEMANTIC_COLOR1;
+ interpMode[fs.num_inputs] = TGSI_INTERPOLATE_LINEAR;
+ break;
+ case FRAG_ATTRIB_TEX0:
+ fs.input_semantics[fs.num_inputs] = TGSI_SEMANTIC_TEX0;
+ interpMode[fs.num_inputs] = TGSI_INTERPOLATE_PERSPECTIVE;
+ break;
+ default:
+ assert(0);
}
- else {
- interpMode[i] = TGSI_INTERPOLATE_PERSPECTIVE;
+
+ fs.num_inputs++;
+ }
+ }
+
+ /*
+ * Outputs
+ */
+ for (i = 0; i < FRAG_RESULT_MAX; i++) {
+ if (stfp->Base.Base.OutputsWritten & (1 << i)) {
+ switch (i) {
+ case FRAG_RESULT_DEPR:
+ fs.output_semantics[fs.num_outputs] = TGSI_SEMANTIC_DEPTH;
+ outputMapping[i] = fs.num_outputs;
+ break;
+ case FRAG_RESULT_COLR:
+ fs.output_semantics[fs.num_outputs] = TGSI_SEMANTIC_COLOR0;
+ outputMapping[i] = fs.num_outputs;
+ break;
+ default:
+ assert(0);
}
+ fs.num_outputs++;
}
}
/* XXX: fix static allocation of tokens:
*/
- tgsi_mesa_compile_fp_program( &fp->Base, NULL, interpMode,
+ tgsi_mesa_compile_fp_program( &stfp->Base,
+ fs.num_inputs,
+ inputMapping,
+ fs.input_semantics,
+ interpMode,
outputMapping,
- fp->tokens, ST_FP_MAX_TOKENS );
+ stfp->tokens, ST_FP_MAX_TOKENS );
- memset(&fs, 0, sizeof(fs));
+#if 0
fs.inputs_read
- = tgsi_mesa_translate_fragment_input_mask(fp->Base.Base.InputsRead);
+ = tgsi_mesa_translate_fragment_input_mask(stfp->Base.Base.InputsRead);
+#endif
+#if 0
fs.outputs_written
- = tgsi_mesa_translate_fragment_output_mask(fp->Base.Base.OutputsWritten);
- fs.tokens = &fp->tokens[0];
+ = tgsi_mesa_translate_fragment_output_mask(stfp->Base.Base.OutputsWritten);
+#endif
+
+ fs.tokens = &stfp->tokens[0];
+
cached = st_cached_fs_state(st, &fs);
- fp->fsx = cached;
+ stfp->fs = cached;
if (TGSI_DEBUG)
- tgsi_dump( fp->tokens, 0/*TGSI_DUMP_VERBOSE*/ );
+ tgsi_dump( stfp->tokens, 0/*TGSI_DUMP_VERBOSE*/ );
+
+ stfp->dirty = 0;
- fp->dirty = 0;
+ return cached;
}
static void update_fs( struct st_context *st )
{
- struct st_fragment_program *fp = NULL;
+ struct st_fragment_program *stfp = NULL;
/* find active shader and params. Changes to this Mesa state
* should be covered by ST_NEW_FRAGMENT_PROGRAM, thanks to the
@@ -101,21 +168,21 @@ static void update_fs( struct st_context *st )
st->ctx->Shader.CurrentProgram->FragmentProgram) {
struct gl_fragment_program *f
= st->ctx->Shader.CurrentProgram->FragmentProgram;
- fp = st_fragment_program(f);
+ stfp = st_fragment_program(f);
}
else {
assert(st->ctx->FragmentProgram._Current);
- fp = st_fragment_program(st->ctx->FragmentProgram._Current);
+ stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
}
- /* translate shader to TGSI format */
- if (st->fp != fp || fp->dirty) {
- st->fp = fp;
+ /* if new binding, or shader has changed */
+ if (st->fp != stfp || stfp->dirty) {
+ /* Bind the program */
+ st->fp = stfp;
- if (fp->dirty)
- compile_fs( st );
+ if (stfp->dirty)
+ st->state.fs = st_translate_fragment_shader( st, st->fp );
- st->state.fs = fp->fsx;
st->pipe->bind_fs_state(st->pipe, st->state.fs);
}
}
diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c
index 322fabc456..cf9dd810e9 100644
--- a/src/mesa/state_tracker/st_atom_vs.c
+++ b/src/mesa/state_tracker/st_atom_vs.c
@@ -49,14 +49,15 @@
#define TGSI_DEBUG 1
-
-
/**
- * Translate Mesa shader to TGSI format
+ * Translate a Mesa vertex shader into a TGSI shader.
+ * \return pointer to cached pipe_shader object.
*/
-static void compile_vs( struct st_context *st )
+struct pipe_shader_state *
+st_translate_vertex_shader(struct st_context *st,
+ struct st_vertex_program *stvp)
{
- struct st_vertex_program *vp = st->vp;
+ GLuint outputMapping[PIPE_MAX_SHADER_INPUTS];
struct pipe_shader_state vs;
struct pipe_shader_state *cached;
GLuint i;
@@ -69,20 +70,56 @@ static void compile_vs( struct st_context *st )
* values and TGSI generic input indexes.
*/
for (i = 0; i < MAX_VERTEX_PROGRAM_ATTRIBS; i++) {
- if (vp->Base.Base.InputsRead & (1 << i)) {
- vp->input_to_index[i] = vs.num_inputs;
- vp->index_to_input[vs.num_inputs] = i;
+ if (stvp->Base.Base.InputsRead & (1 << i)) {
+ stvp->input_to_index[i] = vs.num_inputs;
+ stvp->index_to_input[vs.num_inputs] = i;
+ switch (i) {
+ case VERT_ATTRIB_POS:
+ vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_POSITION;
+ break;
+ case VERT_ATTRIB_COLOR0:
+ vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_COLOR0;
+ break;
+ case VERT_ATTRIB_COLOR1:
+ vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_COLOR1;
+ break;
+ default:
+ vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_OTHER;
+ }
vs.num_inputs++;
}
}
/*
- * Determine output register mapping.
+ * Determine number of outputs and the register mapping.
*/
for (i = 0; i < VERT_RESULT_MAX; i++) {
- if (vp->Base.Base.OutputsWritten & (1 << i)) {
- vp->output_to_index[i] = vs.num_outputs;
- vp->index_to_output[vs.num_outputs] = i;
+ if (stvp->Base.Base.OutputsWritten & (1 << i)) {
+#if 0
+ stvp->output_to_index[i] = vs.num_outputs;
+ stvp->index_to_output[vs.num_outputs] = i;
+#endif
+ outputMapping[i] = vs.num_outputs;
+
+ switch (i) {
+ case VERT_RESULT_HPOS:
+ vs.output_semantics[vs.num_outputs] = TGSI_SEMANTIC_POSITION;
+ break;
+ case VERT_RESULT_COL0:
+ vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_COLOR0;
+ break;
+ case VERT_RESULT_COL1:
+ vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_COLOR1;
+ break;
+ case VERT_RESULT_BFC0:
+ vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_COLOR0B;
+ break;
+ case VERT_RESULT_BFC1:
+ vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_COLOR1B;
+ break;
+ default:
+ vs.output_semantics[vs.num_outputs] = TGSI_SEMANTIC_OTHER;
+ }
vs.num_outputs++;
}
}
@@ -90,43 +127,50 @@ static void compile_vs( struct st_context *st )
/* XXX: fix static allocation of tokens:
*/
- tgsi_mesa_compile_vp_program( &vp->Base,
- vp->input_to_index,
- vp->output_to_index,
- vp->tokens, ST_FP_MAX_TOKENS );
+ tgsi_mesa_compile_vp_program( &stvp->Base,
+ stvp->input_to_index,
+#if 0
+ stvp->output_to_index,
+#else
+ outputMapping,
+#endif
+ stvp->tokens, ST_FP_MAX_TOKENS );
-#if 01
+#if 0
vs.inputs_read
- = tgsi_mesa_translate_vertex_input_mask(vp->Base.Base.InputsRead);
+ = tgsi_mesa_translate_vertex_input_mask(stvp->Base.Base.InputsRead);
#endif
+#if 0
vs.outputs_written
- = tgsi_mesa_translate_vertex_output_mask(vp->Base.Base.OutputsWritten);
+ = tgsi_mesa_translate_vertex_output_mask(stvp->Base.Base.OutputsWritten);
+#endif
- vs.tokens = &vp->tokens[0];
+ vs.tokens = &stvp->tokens[0];
cached = st_cached_vs_state(st, &vs);
-
- vp->vs = cached;
+ stvp->vs = cached;
if (TGSI_DEBUG)
- tgsi_dump( vp->tokens, 0 );
+ tgsi_dump( stvp->tokens, 0 );
#if defined(USE_X86_ASM) || defined(SLANG_X86)
- if (vp->sse2_program.csr == vp->sse2_program.store)
- tgsi_emit_sse2( vp->tokens, &vp->sse2_program );
+ if (stvp->sse2_program.csr == stvp->sse2_program.store)
+ tgsi_emit_sse2( stvp->tokens, &stvp->sse2_program );
if (!cached->executable)
- cached->executable = (void *) x86_get_func( &vp->sse2_program );
+ cached->executable = (void *) x86_get_func( &stvp->sse2_program );
#endif
- vp->dirty = 0;
+ stvp->dirty = 0;
+
+ return cached;
}
static void update_vs( struct st_context *st )
{
- struct st_vertex_program *vp;
+ struct st_vertex_program *stvp;
/* find active shader and params -- Should be covered by
* ST_NEW_VERTEX_PROGRAM
@@ -136,20 +180,20 @@ static void update_vs( struct st_context *st )
st->ctx->Shader.CurrentProgram->VertexProgram) {
struct gl_vertex_program *f
= st->ctx->Shader.CurrentProgram->VertexProgram;
- vp = st_vertex_program(f);
+ stvp = st_vertex_program(f);
}
else {
assert(st->ctx->VertexProgram._Current);
- vp = st_vertex_program(st->ctx->VertexProgram._Current);
+ stvp = st_vertex_program(st->ctx->VertexProgram._Current);
}
- if (st->vp != vp || vp->dirty) {
- st->vp = vp;
+ if (st->vp != stvp || stvp->dirty) {
+ /* Bind the vertex program */
+ st->vp = stvp;
- if (vp->dirty)
- compile_vs( st );
+ if (stvp->dirty)
+ st->state.vs = st_translate_vertex_shader( st, st->vp );
- st->state.vs = st->vp->vs;
st->pipe->bind_vs_state(st->pipe, st->state.vs);
}
}
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 5d5efd9eae..ee70ce3320 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -121,11 +121,9 @@ is_depth_stencil_format(GLuint pipeFormat)
static struct st_fragment_program *
make_frag_shader(struct st_context *st)
{
- static const GLuint outputMapping[] = { 1, 0 };
GLcontext *ctx = st->ctx;
struct st_fragment_program *stfp;
struct gl_program *p;
- GLboolean b;
GLuint interpMode[16];
GLuint i;
@@ -157,11 +155,7 @@ make_frag_shader(struct st_context *st)
p->OutputsWritten = (1 << FRAG_RESULT_COLR);
stfp = (struct st_fragment_program *) p;
- /* compile into tgsi format */
- b = tgsi_mesa_compile_fp_program(&stfp->Base, NULL, interpMode,
- outputMapping,
- stfp->tokens, ST_FP_MAX_TOKENS);
- assert(b);
+ st_translate_fragment_shader(st, stfp);
return stfp;
}
@@ -174,15 +168,9 @@ make_frag_shader(struct st_context *st)
static struct st_vertex_program *
make_vertex_shader(struct st_context *st)
{
- /* Map VERT_ATTRIB_POS to 0, VERT_ATTRIB_COLOR0 to 1 */
- static const GLuint inputMapping[4] = { 0, 0, 0, 1 };
- /* Map VERT_RESULT_HPOS to 0, VERT_RESULT_COL0 to 1 */
- static const GLuint outputMapping[2] = { 0, 1 };
-
GLcontext *ctx = st->ctx;
struct st_vertex_program *stvp;
struct gl_program *p;
- GLboolean b;
p = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
if (!p)
@@ -215,12 +203,8 @@ make_vertex_shader(struct st_context *st)
(1 << VERT_RESULT_HPOS));
stvp = (struct st_vertex_program *) p;
- /* compile into tgsi format */
- b = tgsi_mesa_compile_vp_program(&stvp->Base,
- inputMapping,
- outputMapping,
- stvp->tokens, ST_FP_MAX_TOKENS);
- assert(b);
+ st_translate_vertex_shader(st, stvp);
+ assert(stvp->vs);
return stvp;
}
@@ -361,33 +345,19 @@ clear_with_quad(GLcontext *ctx,
/* fragment shader state: color pass-through program */
{
static struct st_fragment_program *stfp = NULL;
- struct pipe_shader_state fs;
- const struct pipe_shader_state *cached;
if (!stfp) {
stfp = make_frag_shader(st);
}
- memset(&fs, 0, sizeof(fs));
- fs.inputs_read = tgsi_mesa_translate_fragment_input_mask(stfp->Base.Base.InputsRead);
- fs.outputs_written = tgsi_mesa_translate_fragment_output_mask(stfp->Base.Base.OutputsWritten);
- fs.tokens = &stfp->tokens[0];
- cached = st_cached_fs_state(st, &fs);
- pipe->bind_fs_state(pipe, cached);
+ pipe->bind_fs_state(pipe, stfp->fs);
}
/* vertex shader state: color/position pass-through */
{
static struct st_vertex_program *stvp = NULL;
- struct pipe_shader_state vs;
- const struct pipe_shader_state *cached;
if (!stvp) {
stvp = make_vertex_shader(st);
}
- memset(&vs, 0, sizeof(vs));
- vs.inputs_read = stvp->Base.Base.InputsRead;
- vs.outputs_written = stvp->Base.Base.OutputsWritten;
- vs.tokens = &stvp->tokens[0];
- cached = st_cached_vs_state(st, &vs);
- pipe->bind_vs_state(pipe, cached);
+ pipe->bind_vs_state(pipe, stvp->vs);
}
/* viewport state: viewport matching window dims */
@@ -522,12 +492,15 @@ clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
assert(strb->surface->format);
+#if 01
if (ctx->Scissor.Enabled ||
(isDS && ctx->DrawBuffer->Visual.stencilBits > 0)) {
/* scissoring or we have a combined depth/stencil buffer */
clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_FALSE);
}
- else {
+ else
+#endif
+ {
/* simple clear of whole buffer */
GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 0fd728c930..d4f260ee54 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -56,11 +56,9 @@
static struct st_fragment_program *
make_fragment_shader(struct st_context *st)
{
- static const GLuint outputMapping[2] = { 1, 0 };
GLcontext *ctx = st->ctx;
struct st_fragment_program *stfp;
struct gl_program *p;
- GLboolean b;
GLuint interpMode[16];
GLuint i;
@@ -94,11 +92,7 @@ make_fragment_shader(struct st_context *st)
p->OutputsWritten = (1 << FRAG_RESULT_COLR);
stfp = (struct st_fragment_program *) p;
- /* compile into tgsi format */
- b = tgsi_mesa_compile_fp_program(&stfp->Base, NULL, interpMode,
- outputMapping,
- stfp->tokens, ST_FP_MAX_TOKENS);
- assert(b);
+ st_translate_fragment_shader(st, stfp);
return stfp;
}
@@ -112,11 +106,9 @@ static struct st_vertex_program *
make_vertex_shader(struct st_context *st)
{
/* Map VERT_RESULT_HPOS to 0, VERT_RESULT_TEX0 to 1 */
- static const GLuint outputMapping[] = { 0, 0, 0, 0, 1 };
GLcontext *ctx = st->ctx;
struct st_vertex_program *stvp;
struct gl_program *p;
- GLboolean b;
p = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
if (!p)
@@ -149,11 +141,7 @@ make_vertex_shader(struct st_context *st)
(1 << VERT_RESULT_HPOS));
stvp = (struct st_vertex_program *) p;
- /* compile into tgsi format */
- b = tgsi_mesa_compile_vp_program(&stvp->Base, NULL,
- outputMapping,
- stvp->tokens, ST_FP_MAX_TOKENS);
- assert(b);
+ st_translate_vertex_shader(st, stvp);
return stvp;
}
@@ -339,32 +327,19 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* fragment shader state: TEX lookup program */
{
static struct st_fragment_program *stfp = NULL;
- struct pipe_shader_state fs;
- struct pipe_shader_state *cached;
if (!stfp) {
stfp = make_fragment_shader(ctx->st);
}
- memset(&fs, 0, sizeof(fs));
- fs.inputs_read = stfp->Base.Base.InputsRead;
- fs.tokens = &stfp->tokens[0];
- cached = st_cached_fs_state(ctx->st, &fs);
- pipe->bind_fs_state(pipe, cached);
+ pipe->bind_fs_state(pipe, stfp->fs);
}
/* vertex shader state: position + texcoord pass-through */
{
static struct st_vertex_program *stvp = NULL;
- struct pipe_shader_state vs;
- struct pipe_shader_state *cached;
if (!stvp) {
stvp = make_vertex_shader(ctx->st);
}
- memset(&vs, 0, sizeof(vs));
- vs.inputs_read = stvp->Base.Base.InputsRead;
- vs.outputs_written = stvp->Base.Base.OutputsWritten;
- vs.tokens = &stvp->tokens[0];
- cached = st_cached_vs_state(ctx->st, &vs);
- pipe->bind_vs_state(pipe, cached);
+ pipe->bind_vs_state(pipe, stvp->vs);
}
/* texture sampling state: */
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index 98efe1a10b..5245535a65 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -53,6 +53,7 @@ static void
setup_vertex_attribs(GLcontext *ctx)
{
struct pipe_context *pipe = ctx->st->pipe;
+#if 0
const uint inputAttrs = ctx->st->state.vs->inputs_read;
uint attr;
@@ -77,6 +78,9 @@ setup_vertex_attribs(GLcontext *ctx)
pipe->set_vertex_element(pipe, attr, &velement);
}
}
+#else
+ assert(0);
+#endif
}
@@ -84,7 +88,7 @@ static void
setup_feedback(GLcontext *ctx)
{
struct pipe_context *pipe = ctx->st->pipe;
- const uint outputAttrs = ctx->st->state.vs->outputs_written;
+ const struct pipe_shader_state *vs = ctx->st->state.vs;
struct pipe_feedback_state feedback;
uint i;
@@ -94,8 +98,8 @@ setup_feedback(GLcontext *ctx)
feedback.discard = 1;
feedback.num_attribs = 0;
- for (i = 0; i < TGSI_ATTRIB_VAR0; i++) {
- if ((1 << i) & outputAttrs) {
+ for (i = 0; i < vs->num_outputs; i++) {
+ if (1/***(1 << i) & outputAttrs***/) {
feedback.attrib[feedback.num_attribs] = i;
feedback.size[feedback.num_attribs] = 4;
feedback.num_attribs++;
@@ -306,6 +310,7 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4])
PIPE_BUFFER_FLAG_READ);
/* extract values and update rasterpos state */
+#if 0 /* XXX update */
{
const uint outputAttrs = ctx->st->state.vs->outputs_written;
const float *pos, *color0, *color1, *tex0;
@@ -333,7 +338,7 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4])
update_rasterpos(ctx, pos, color0, color1, tex0);
}
-
+#endif
/* free vertex feedback buffer */
pipe->winsys->buffer_unmap(pipe->winsys, fb_buf.buffer);
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 7075db82e9..238ade00ac 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -356,7 +356,7 @@ st_draw_vertices(GLcontext *ctx, unsigned prim,
velement.vertex_buffer_index = 0;
velement.src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
velement.dst_offset = 0;
- pipe->set_vertex_element(pipe, attribs[i], &velement);
+ pipe->set_vertex_element(pipe, i/**attribs[i]**/, &velement);
}
/* draw */
@@ -411,7 +411,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
update_default_attribs_buffer(ctx);
-
+#if 0
/* this must be after state validation */
attrsNeeded = ctx->st->state.vs->inputs_read;
@@ -480,7 +480,9 @@ st_feedback_draw_vbo(GLcontext *ctx,
draw_set_mapped_vertex_buffer(draw, attr, map);
}
}
-
+#else
+ assert(0);
+#endif
if (ib) {
unsigned indexSize;
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 68ceba4d78..4945141d15 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -45,16 +45,15 @@ struct st_fragment_program
{
struct gl_fragment_program Base;
GLboolean error; /* If program is malformed for any reason. */
-
- GLuint id; /* String id, for tracking
- * ProgramStringNotify changes.
- */
+ GLuint id; /**< String id, for tracking ProgramStringNotify changes. */
struct tgsi_token tokens[ST_FP_MAX_TOKENS];
GLboolean dirty;
- const struct pipe_shader_state *fsx;
+ /** Pointer to the corresponding cached shader */
+ const struct pipe_shader_state *fs;
+
GLuint param_state;
};
@@ -63,16 +62,17 @@ struct st_vertex_program
{
struct gl_vertex_program Base; /**< The Mesa vertex program */
GLboolean error; /**< Set if program is malformed for any reason. */
-
- GLuint id; /**< String id, for tracking ProgramStringNotify changes. */
+ GLuint id; /**< String id, for tracking ProgramStringNotify changes. */
/** maps a Mesa VERT_ATTRIB_x to a packed TGSI input index */
GLuint input_to_index[MAX_VERTEX_PROGRAM_ATTRIBS];
/** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */
GLuint index_to_input[MAX_VERTEX_PROGRAM_ATTRIBS];
+#if 0
GLuint output_to_index[MAX_VERTEX_PROGRAM_ATTRIBS];
GLuint index_to_output[MAX_VERTEX_PROGRAM_ATTRIBS];
+#endif
/** The program in TGSI format */
struct tgsi_token tokens[ST_FP_MAX_TOKENS];
@@ -82,7 +82,9 @@ struct st_vertex_program
struct x86_function sse2_program;
#endif
+ /** Pointer to the corresponding cached shader */
const struct pipe_shader_state *vs;
+
GLuint param_state;
};
@@ -102,4 +104,15 @@ st_vertex_program( struct gl_vertex_program *vp )
return (struct st_vertex_program *)vp;
}
+
+extern struct pipe_shader_state *
+st_translate_fragment_shader(struct st_context *st,
+ struct st_fragment_program *fp);
+
+
+extern struct pipe_shader_state *
+st_translate_vertex_shader(struct st_context *st,
+ struct st_vertex_program *vp);
+
+
#endif