diff options
author | Brian Paul <[email protected]> | 2012-01-04 14:55:32 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-02-15 14:07:43 -0700 |
commit | c04db7f7fad883891084d7f2e9a0040a17c48fe8 (patch) | |
tree | 94580cf15b55b6e017a8cd200a60dc2f687550e0 /src/mesa/main/texstate.c | |
parent | 447071cfb01cf52e3e6591c71684a689f7e900fa (diff) |
mesa: fix _mesa_get_fallback_texture() to handle all texture targets
Previously, this function only handled 2D textures.
The fallback texture is used when we try to sample from an incomplete
texture object. GLSL says sampling an incomplete texture should return
(0,0,0,1).
v2: use a 1-texel texture image, per José.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/main/texstate.c')
-rw-r--r-- | src/mesa/main/texstate.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index cc49916a92c..187ec9c366f 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -586,9 +586,15 @@ update_texture_state( struct gl_context *ctx ) * object, but there isn't one (or it's incomplete). Use the * fallback texture. */ - struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); - texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; + struct gl_texture_object *texObj; + gl_texture_index texTarget; + + assert(_mesa_bitcount(enabledTargets) == 1); + + texTarget = (gl_texture_index) (ffs(enabledTargets) - 1); + texObj = _mesa_get_fallback_texture(ctx, texTarget); _mesa_reference_texobj(&texUnit->_Current, texObj); + texUnit->_ReallyEnabled = 1 << texTarget; } else { /* fixed-function: texture unit is really disabled */ |