summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_state_fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_state_fs.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index ded242d3dc..50bc2eea5f 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 );
}