aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-10-30 19:13:57 -0600
committerBrian Paul <[email protected]>2014-10-31 15:29:59 -0600
commitccd1ea9d52bc7fd11d9f05dc23ae7289fd0b9a99 (patch)
tree2ca58e6898ad77622c0a47813f9ddf7d5ad78371 /src/gallium/drivers
parente3ecb8206ac4cd50bbcd27fafa578a11b0b9f11a (diff)
util: simplify util_pstipple_create_fragment_shader() params
Pass and return tgsi_token buffers instead of pipe_shader_state. And update softpipe driver (the only user of this function). Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/softpipe/sp_state_shader.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_shader.c b/src/gallium/drivers/softpipe/sp_state_shader.c
index 93c547d2911..8d18ca98d4d 100644
--- a/src/gallium/drivers/softpipe/sp_state_shader.c
+++ b/src/gallium/drivers/softpipe/sp_state_shader.c
@@ -51,25 +51,27 @@ create_fs_variant(struct softpipe_context *softpipe,
const struct sp_fragment_shader_variant_key *key)
{
struct sp_fragment_shader_variant *var;
- struct pipe_shader_state *stipple_fs = NULL, *curfs = &fs->shader;
- unsigned unit = 0;
-
-#if DO_PSTIPPLE_IN_HELPER_MODULE
- if (key->polygon_stipple) {
- /* get new shader that implements polygon stippling */
- stipple_fs = util_pstipple_create_fragment_shader(&softpipe->pipe,
- curfs, &unit);
- curfs = stipple_fs;
- }
-#endif
+ struct pipe_shader_state *curfs = &fs->shader;
/* codegen, create variant object */
var = softpipe_create_fs_variant_exec(softpipe);
if (var) {
var->key = *key;
- var->tokens = tgsi_dup_tokens(curfs->tokens);
- var->stipple_sampler_unit = unit;
+
+#if DO_PSTIPPLE_IN_HELPER_MODULE
+ if (key->polygon_stipple) {
+ /* get new shader that implements polygon stippling */
+ var->tokens =
+ util_pstipple_create_fragment_shader(curfs->tokens,
+ &var->stipple_sampler_unit);
+ }
+ else
+#endif
+ {
+ var->tokens = tgsi_dup_tokens(curfs->tokens);
+ var->stipple_sampler_unit = 0;
+ }
tgsi_scan_shader(var->tokens, &var->info);
@@ -90,11 +92,6 @@ create_fs_variant(struct softpipe_context *softpipe,
fs->variants = var;
}
- if (stipple_fs) {
- FREE((void *) stipple_fs->tokens);
- FREE(stipple_fs);
- }
-
return var;
}