summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-09-21 09:57:25 -0600
committerBrian Paul <[email protected]>2010-09-21 09:57:25 -0600
commitd49f153ab36fec16f687f35f3a9aaf19fb7254be (patch)
tree227a3561c276b5d9a6b20fd2bd5b4b7775b03086 /src/gallium/drivers/softpipe
parent441344ba7ed2a1d162ee33ac4bac4bf645188ceb (diff)
parent77af10955462819d973a395270777c5b8217f6ae (diff)
Merge branch 'sprite-coord'
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r--src/gallium/drivers/softpipe/sp_state.h2
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h
index 39d204de8a9..c5d61f840f2 100644
--- a/src/gallium/drivers/softpipe/sp_state.h
+++ b/src/gallium/drivers/softpipe/sp_state.h
@@ -70,6 +70,8 @@ struct sp_fragment_shader {
struct tgsi_shader_info info;
+ struct draw_fragment_shader *draw_shader;
+
boolean origin_lower_left; /**< fragment shader uses lower left position origin? */
boolean pixel_center_integer; /**< fragment shader uses integer pixel center? */
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index ded242d3dc5..50bc2eea5ff 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -60,7 +60,15 @@ softpipe_create_fs_state(struct pipe_context *pipe,
state = softpipe_create_fs_exec( softpipe, templ );
}
- assert(state);
+ if (!state)
+ return NULL;
+
+ /* draw's fs state */
+ state->draw_shader = draw_create_fragment_shader(softpipe->draw, templ);
+ if (!state->draw_shader) {
+ state->delete( state );
+ return NULL;
+ }
/* get/save the summary info for this shader */
tgsi_scan_shader(templ->tokens, &state->info);
@@ -90,6 +98,9 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
softpipe->fs = fs;
+ draw_bind_fragment_shader(softpipe->draw,
+ (softpipe->fs ? softpipe->fs->draw_shader : NULL));
+
softpipe->dirty |= SP_NEW_FS;
}
@@ -109,6 +120,8 @@ softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
tgsi_exec_machine_bind_shader(softpipe->fs_machine, NULL, 0, NULL);
}
+ draw_delete_fragment_shader(softpipe->draw, state->draw_shader);
+
state->delete( state );
}