summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_texture.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-08-14 15:38:09 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-08-14 15:44:28 -0600
commit8f6d9e12be0be086ca2aab0b56dff8d2181addd9 (patch)
tree5f9b28a792eed3a01d00d1577617c97c40095bfd /src/mesa/state_tracker/st_atom_texture.c
parent6c46b49d12b33b04546bee137f75ca7649e9a4ef (diff)
gallium: use a default texture in update_textures(), update_samplers() when needed
The default texture is used when the current fragment shader has texture sample instructions but the user has not provided/bound a texture.
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 1ec671ed48..fb03766ff5 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);
}