diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-09-30 17:39:17 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-09-30 17:42:01 +0100 |
commit | 4e6f5e8d43ee87c6f8cdc75de2eeb96f70beb013 (patch) | |
tree | aef4f60e46eeb52bb1ffba3b48f8827538976097 /src/gallium/auxiliary/gallivm/lp_bld_sample.c | |
parent | e2b51b7c5baaaa21e64df1377ce0be5c83d016ff (diff) |
gallivm: More comprehensive border usage logic.
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_sample.c')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index d9fbc0f305..d9fbbbe70f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -46,6 +46,39 @@ /** + * Does the given texture wrap mode allow sampling the texture border color? + * XXX maybe move this into gallium util code. + */ +boolean +lp_sampler_wrap_mode_uses_border_color(unsigned mode, + unsigned min_img_filter, + unsigned mag_img_filter) +{ + switch (mode) { + case PIPE_TEX_WRAP_REPEAT: + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + case PIPE_TEX_WRAP_MIRROR_REPEAT: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + return FALSE; + case PIPE_TEX_WRAP_CLAMP: + case PIPE_TEX_WRAP_MIRROR_CLAMP: + if (min_img_filter == PIPE_TEX_FILTER_NEAREST && + mag_img_filter == PIPE_TEX_FILTER_NEAREST) { + return FALSE; + } else { + return TRUE; + } + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + return TRUE; + default: + assert(0 && "unexpected wrap mode"); + return FALSE; + } +} + + +/** * Initialize lp_sampler_static_state object with the gallium sampler * and texture state. * The former is considered to be static and the later dynamic. |