mesa: Create the default (name==0) buffer texture.
authorEric Anholt <eric@anholt.net>
Mon, 26 Mar 2012 23:49:23 +0000 (16:49 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 9 Apr 2012 21:34:30 +0000 (14:34 -0700)
All that should be needed is that it exists.  Fixes segfaults on first
_mesa_update_context() with a samplerBuffer-using shader active but
without a particular buffer texture enabled.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/texobj.c

index d7dee4f1b667d879d7bf6992d6f002dc946eb0b0..88dc3b195e7e406781b36713477d9ac98599b8e0 100644 (file)
@@ -756,6 +756,9 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
          target = GL_TEXTURE_1D;
          break;
       case TEXTURE_BUFFER_INDEX:
+         dims = 0;
+         target = GL_TEXTURE_BUFFER;
+         break;
       case TEXTURE_EXTERNAL_INDEX:
       default:
          /* no-op */
@@ -794,6 +797,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
                                     GL_RGBA, texFormat);
 
          switch (dims) {
+        case 0:
+           break;
          case 1:
             ctx->Driver.TexImage1D(ctx, texImage, GL_RGBA,
                                    width, 0,