r300-gallium: Properly interface with Draw for vert shaders.

This commit is contained in:
Corbin Simpson
2009-04-05 01:00:25 -07:00
parent 484795ff14
commit ce7963f338
5 changed files with 31 additions and 0 deletions

View File

@@ -236,6 +236,9 @@ struct r300_vertex_shader {
struct pipe_shader_state state;
struct tgsi_shader_info info;
/* Fallback shader, because Draw has issues */
struct draw_vertex_shader* draw;
/* Has this shader been translated yet? */
boolean translated;

View File

@@ -224,3 +224,15 @@ void r500_fs_dump(struct r500_fragment_shader* fs)
}
}
}
void r300_vs_dump(struct r300_vertex_shader* vs)
{
int i;
for (i = 0; i < vs->instruction_count; i++) {
debug_printf("inst0: 0x%x\n", vs->instructions[i].inst0);
debug_printf("inst1: 0x%x\n", vs->instructions[i].inst1);
debug_printf("inst2: 0x%x\n", vs->instructions[i].inst2);
debug_printf("inst3: 0x%x\n", vs->instructions[i].inst3);
}
}

View File

@@ -25,7 +25,10 @@
#include "r300_reg.h"
#include "r300_state_shader.h"
#include "r300_state_tcl.h"
void r500_fs_dump(struct r500_fragment_shader* fs);
void r300_vs_dump(struct r300_vertex_shader* vs);
#endif /* R300_DEBUG_H */

View File

@@ -403,6 +403,11 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
rs->rs = *state;
/* If using HW TCL, tell Draw to not do its magic. */
if (r300_screen(pipe->screen)->caps->has_tcl) {
rs->rs.bypass_vs_clip_and_viewport = TRUE;
}
return (void*)rs;
}
@@ -604,6 +609,9 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
tgsi_scan_shader(shader->tokens, &vs->info);
/* Appease Draw. */
vs->draw = draw_create_vertex_shader(r300->draw, shader);
return (void*)vs;
} else {
return draw_create_vertex_shader(r300->draw, shader);
@@ -624,6 +632,7 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
r300_translate_vertex_shader(r300, vs);
}
draw_bind_vertex_shader(r300->draw, vs->draw);
r300->vs = vs;
r300->dirty_state |= R300_NEW_VERTEX_SHADER;
} else {
@@ -637,6 +646,9 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
struct r300_context* r300 = r300_context(pipe);
if (r300_screen(pipe->screen)->caps->has_tcl) {
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
draw_delete_vertex_shader(r300->draw, vs->draw);
FREE(shader);
} else {
draw_delete_vertex_shader(r300->draw,

View File

@@ -267,6 +267,7 @@ void r300_translate_vertex_shader(struct r300_context* r300,
tgsi_dump(vs->state.tokens);
/* XXX finish r300 vertex shader dumper */
r300_vs_dump(vs);
tgsi_parse_free(&parser);
FREE(assembler);