Browse Source

r300g: fix psychedelic colors with SWTCL

r300_vertex_shader::outputs was uninitialized.
Also remove the tokens parameter.
undefined
Marek Olšák 15 years ago
parent
commit
f86ac27bf9

+ 3
- 1
src/gallium/drivers/r300/r300_state.c View File

@@ -1428,8 +1428,10 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
vs->state = *shader;
vs->state.tokens = tgsi_dup_tokens(shader->tokens);

r300_init_vs_outputs(vs);

if (r300->screen->caps.has_tcl) {
r300_translate_vertex_shader(r300, vs, vs->state.tokens);
r300_translate_vertex_shader(r300, vs);
} else {
vs->draw_vs = draw_create_vertex_shader(r300->draw, shader);
}

+ 11
- 9
src/gallium/drivers/r300/r300_vs.c View File

@@ -181,21 +181,23 @@ static void r300_dummy_vertex_shader(
state.tokens = ureg_finalize(ureg);

shader->dummy = TRUE;
r300_translate_vertex_shader(r300, shader, state.tokens);
r300_translate_vertex_shader(r300, shader);

ureg_destroy(ureg);
}

void r300_translate_vertex_shader(struct r300_context* r300,
struct r300_vertex_shader* vs,
const struct tgsi_token *tokens)
void r300_init_vs_outputs(struct r300_vertex_shader *vs)
{
tgsi_scan_shader(vs->state.tokens, &vs->info);
r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
}

void r300_translate_vertex_shader(struct r300_context *r300,
struct r300_vertex_shader *vs)
{
struct r300_vertex_program_compiler compiler;
struct tgsi_to_rc ttr;

tgsi_scan_shader(tokens, &vs->info);
r300_shader_read_vs_outputs(&vs->info, &vs->outputs);

/* Setup the compiler */
rc_init(&compiler.Base);

@@ -205,7 +207,7 @@ void r300_translate_vertex_shader(struct r300_context* r300,

if (compiler.Base.Debug) {
debug_printf("r300: Initial vertex program\n");
tgsi_dump(tokens, 0);
tgsi_dump(vs->state.tokens, 0);
}

/* Translate TGSI to our internal representation */
@@ -213,7 +215,7 @@ void r300_translate_vertex_shader(struct r300_context* r300,
ttr.info = &vs->info;
ttr.use_half_swizzles = FALSE;

r300_tgsi_to_rc(&ttr, tokens);
r300_tgsi_to_rc(&ttr, vs->state.tokens);

compiler.RequiredOutputs = ~(~0 << (vs->info.num_outputs + 1));
compiler.SetHwInputOutput = &set_vertex_inputs_outputs;

+ 3
- 3
src/gallium/drivers/r300/r300_vs.h View File

@@ -56,8 +56,8 @@ struct r300_vertex_shader {
void *draw_vs;
};

void r300_translate_vertex_shader(struct r300_context* r300,
struct r300_vertex_shader* vs,
const struct tgsi_token *tokens);
void r300_init_vs_outputs(struct r300_vertex_shader *vs);

void r300_translate_vertex_shader(struct r300_context *r300,
struct r300_vertex_shader *vs);
#endif /* R300_VS_H */

Loading…
Cancel
Save