diff options
author | Brian Paul <brianp@vmware.com> | 2011-07-21 09:55:22 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2011-07-21 10:32:15 -0600 |
commit | 57aa597b3d5dac0fc59c05557dafec59e14e1019 (patch) | |
tree | 8b08868af2be97c6f2032fbc1363f4461d5ead34 /src/gallium/drivers/softpipe/sp_state_shader.c | |
parent | c534f11164bbecf25eb2b1e697f9511eceb0c86f (diff) | |
download | external_mesa3d-57aa597b3d5dac0fc59c05557dafec59e14e1019.zip external_mesa3d-57aa597b3d5dac0fc59c05557dafec59e14e1019.tar.gz external_mesa3d-57aa597b3d5dac0fc59c05557dafec59e14e1019.tar.bz2 |
softpipe: use the polygon stipple utility module
This is an alternative to the draw module's polygon stipple stage.
The softpipe implementation here is just a test. The advantange of
using the new polygon stipple utility module (with other drivers)
is we can avoid software vertex processing in the draw module and
get much better performance.
Polygon stipple doesn't require special vertex processing like
the other draw module stage.
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_state_shader.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_shader.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_shader.c b/src/gallium/drivers/softpipe/sp_state_shader.c index ddb9a98..da89527 100644 --- a/src/gallium/drivers/softpipe/sp_state_shader.c +++ b/src/gallium/drivers/softpipe/sp_state_shader.c @@ -33,6 +33,7 @@ #include "pipe/p_defines.h" #include "util/u_memory.h" #include "util/u_inlines.h" +#include "util/u_pstipple.h" #include "draw/draw_context.h" #include "draw/draw_vs.h" #include "draw/draw_gs.h" @@ -51,7 +52,15 @@ 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 *curfs = &fs->shader; + struct pipe_shader_state *stipple_fs = NULL, *curfs = &fs->shader; + unsigned unit = 0; + + 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; + } /* codegen, create variant object */ var = softpipe_create_fs_variant_sse(softpipe, curfs); @@ -62,6 +71,7 @@ create_fs_variant(struct softpipe_context *softpipe, if (var) { var->key = *key; var->tokens = tgsi_dup_tokens(curfs->tokens); + var->stipple_sampler_unit = unit; tgsi_scan_shader(var->tokens, &var->info); @@ -82,6 +92,11 @@ create_fs_variant(struct softpipe_context *softpipe, fs->variants = var; } + if (stipple_fs) { + free((void *) stipple_fs->tokens); + free(stipple_fs); + } + return var; } |