summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_state.c
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2009-04-05 00:15:19 -0700
committerCorbin Simpson <MostAwesomeDude@gmail.com>2009-04-05 00:15:19 -0700
commit484795ff14faa794b7a150f29554a73e0113f67d (patch)
tree8ee966b2e15e2d4a8616c502aea285a56aa69e28 /src/gallium/drivers/r300/r300_state.c
parent316b244ff1b18b3916ebd31078ba4c920e9585c1 (diff)
r300-gallium: Update state handlers/setters for vertex shaders.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r--src/gallium/drivers/r300/r300_state.c65
1 files changed, 49 insertions, 16 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index b1d85260cc..4dee4ab8ce 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -333,9 +333,12 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
{
struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
- /* XXX this is part of HW TCL */
/* XXX endian control */
- rs->vap_control_status = R300_VAP_TCL_BYPASS;
+ if (r300_screen(pipe->screen)->caps->has_tcl) {
+ rs->vap_control_status = 0;
+ } else {
+ rs->vap_control_status = R300_VAP_TCL_BYPASS;
+ }
rs->point_size = pack_float_16_6x(state->point_size) |
(pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
@@ -584,31 +587,61 @@ static void r300_set_vertex_elements(struct pipe_context* pipe,
const struct pipe_vertex_element* elements)
{
struct r300_context* r300 = r300_context(pipe);
- /* XXX Draw */
+
draw_flush(r300->draw);
draw_set_vertex_elements(r300->draw, count, elements);
}
static void* r300_create_vs_state(struct pipe_context* pipe,
- const struct pipe_shader_state* state)
+ const struct pipe_shader_state* shader)
{
- struct r300_context* context = r300_context(pipe);
- tgsi_dump(state->tokens);
- /* XXX handing this off to Draw for now */
- return draw_create_vertex_shader(context->draw, state);
+ struct r300_context* r300 = r300_context(pipe);
+
+ if (r300_screen(pipe->screen)->caps->has_tcl) {
+ struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
+ /* Copy state directly into shader. */
+ vs->state = *shader;
+
+ tgsi_scan_shader(shader->tokens, &vs->info);
+
+ return (void*)vs;
+ } else {
+ return draw_create_vertex_shader(r300->draw, shader);
+ }
}
-static void r300_bind_vs_state(struct pipe_context* pipe, void* state) {
- struct r300_context* context = r300_context(pipe);
- /* XXX handing this off to Draw for now */
- draw_bind_vertex_shader(context->draw, (struct draw_vertex_shader*)state);
+static void r300_bind_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;
+
+ if (vs == NULL) {
+ r300->vs = NULL;
+ return;
+ } else if (!vs->translated) {
+ r300_translate_vertex_shader(r300, vs);
+ }
+
+ r300->vs = vs;
+ r300->dirty_state |= R300_NEW_VERTEX_SHADER;
+ } else {
+ draw_bind_vertex_shader(r300->draw,
+ (struct draw_vertex_shader*)shader);
+ }
}
-static void r300_delete_vs_state(struct pipe_context* pipe, void* state)
+static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
{
- struct r300_context* context = r300_context(pipe);
- /* XXX handing this off to Draw for now */
- draw_delete_vertex_shader(context->draw, (struct draw_vertex_shader*)state);
+ struct r300_context* r300 = r300_context(pipe);
+
+ if (r300_screen(pipe->screen)->caps->has_tcl) {
+ FREE(shader);
+ } else {
+ draw_delete_vertex_shader(r300->draw,
+ (struct draw_vertex_shader*)shader);
+ }
}
void r300_init_state_functions(struct r300_context* r300)