summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2010-04-11 16:13:45 -0700
committerCorbin Simpson <[email protected]>2010-04-11 23:39:24 -0700
commitd5af1dce8fc23dc3763773e3c0b7e0be128d2aa0 (patch)
tree2ce3965762a830eeb61d97633cc92d144d3998ab /src/gallium/drivers/r300
parentf95ff1cf48a3da090dc999621f2d153af0c7db14 (diff)
r300/compiler: Implement texcoord repeat and mirror for NPOT.
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/r300_fs.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index c0d26e5ebde..6af6028447f 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -139,11 +139,14 @@ static void get_external_state(
for (i = 0; i < texstate->sampler_state_count; i++) {
struct r300_sampler_state* s = texstate->sampler_states[i];
+ struct r300_texture *t;
- if (!s) {
+ if (!s || !texstate->sampler_views[i]) {
continue;
}
+ t = (struct r300_texture*)texstate->sampler_views[i]->base.texture;
+
if (s->state.compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
/* XXX Gallium doesn't provide us with any information regarding
* this mode, so we are screwed. I'm setting 0 = LUMINANCE. */
@@ -153,30 +156,28 @@ static void get_external_state(
state->unit[i].texture_compare_func = s->state.compare_func;
}
- /* Should we ask the shader to handle wrapping modes for us? */
- if (!s->state.normalized_coords) {
- state->unit[i].non_normalized_coords = 1;
-
- /* XXX this should probably take into account STR, not just S. */
- switch (s->state.wrap_s) {
- case PIPE_TEX_WRAP_REPEAT:
- state->unit[i].wrap_mode = RC_WRAP_REPEAT;
- break;
- case PIPE_TEX_WRAP_CLAMP:
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- state->unit[i].wrap_mode = RC_WRAP_CLAMP;
- break;
- case PIPE_TEX_WRAP_MIRROR_REPEAT:
- case PIPE_TEX_WRAP_MIRROR_CLAMP:
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- state->unit[i].wrap_mode = RC_WRAP_MIRROR;
- break;
- default:
- state->unit[i].wrap_mode = RC_WRAP_NONE;
- break;
- }
+ state->unit[i].fake_npot = t->uses_pitch;
+ state->unit[i].non_normalized_coords = !s->state.normalized_coords;
+
+ /* XXX this should probably take into account STR, not just S. */
+ switch (s->state.wrap_s) {
+ case PIPE_TEX_WRAP_REPEAT:
+ state->unit[i].wrap_mode = RC_WRAP_REPEAT;
+ break;
+ case PIPE_TEX_WRAP_CLAMP:
+ case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+ state->unit[i].wrap_mode = RC_WRAP_CLAMP;
+ break;
+ case PIPE_TEX_WRAP_MIRROR_REPEAT:
+ case PIPE_TEX_WRAP_MIRROR_CLAMP:
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+ state->unit[i].wrap_mode = RC_WRAP_MIRROR;
+ break;
+ default:
+ state->unit[i].wrap_mode = RC_WRAP_NONE;
+ break;
}
}
}