X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_atom_texture.c;h=fb03766ff599cc4f0a9c59691a82eaac12105325;hb=4b7a84a36108eff8f17cbdf2c511593eb3260fd2;hp=1ec671ed48fc9b436e356604f85751dad508bb7f;hpb=73c5505c13c42ba1ab95fa1d1003d5f9327428a5;p=mesa.git diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 1ec671ed48f..fb03766ff59 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -49,6 +49,8 @@ update_textures(struct st_context *st) st->state.num_textures = 0; + /*printf("%s samplers used = 0x%x\n", __FUNCTION__, fprog->Base.SamplersUsed);*/ + for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) { struct pipe_texture *pt = NULL; @@ -56,24 +58,34 @@ update_textures(struct st_context *st) const GLuint texUnit = fprog->Base.SamplerUnits[su]; struct gl_texture_object *texObj = st->ctx->Texture.Unit[texUnit]._Current; - struct st_texture_object *stObj = st_texture_object(texObj); - - if (texObj) { - GLboolean flush, retval; + struct st_texture_object *stObj; + GLboolean flush, retval; - retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush); - if (!retval) { - /* out of mem */ - /* missing texture */ - continue; - } + if (!texObj) { + texObj = st_get_default_texture(st); + } + stObj = st_texture_object(texObj); - st->state.num_textures = su + 1; + retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush); + if (!retval) { + /* out of mem */ + continue; } + st->state.num_textures = su + 1; + pt = st_get_stobj_texture(stObj); } + /* + if (pt) { + printf("%s su=%u non-null\n", __FUNCTION__, su); + } + else { + printf("%s su=%u null\n", __FUNCTION__, su); + } + */ + pipe_texture_reference(&st->state.sampler_texture[su], pt); }