aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
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;
}