From: Brian Paul Date: Sun, 12 Feb 2012 23:30:28 +0000 (-0700) Subject: st/mesa: remove st_get_default_texture() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ea2aca036c742474cda03e3b7012b188a14d0287;p=mesa.git st/mesa: remove st_get_default_texture() Just use _mesa_get_fallback_texture() instead. Reviewed-by: Jose Fonseca --- diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index ee69fc39012..dc0c789c5c6 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -35,6 +35,7 @@ #include "main/macros.h" #include "main/mtypes.h" #include "main/samplerobj.h" +#include "main/texobj.h" #include "st_context.h" #include "st_cb_texture.h" @@ -132,7 +133,7 @@ convert_sampler(struct st_context *st, texobj = ctx->Texture.Unit[texUnit]._Current; if (!texobj) { - texobj = st_get_default_texture(st); + texobj = _mesa_get_fallback_texture(ctx, TEXTURE_2D_INDEX); } msamp = _mesa_get_samplerobj(ctx, texUnit); diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index e8941da8d79..438595be2c2 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -35,6 +35,7 @@ #include "main/macros.h" #include "main/mtypes.h" #include "main/samplerobj.h" +#include "main/texobj.h" #include "program/prog_instruction.h" #include "st_context.h" @@ -201,7 +202,7 @@ update_single_texture(struct st_context *st, texObj = ctx->Texture.Unit[texUnit]._Current; if (!texObj) { - texObj = st_get_default_texture(st); + texObj = _mesa_get_fallback_texture(ctx, TEXTURE_2D_INDEX); samp = &texObj->Sampler; } stObj = st_texture_object(texObj); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 5cd9a4c94ee..c2011daa8e7 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1336,57 +1336,6 @@ st_finalize_texture(struct gl_context *ctx, } -/** - * Returns pointer to a default/dummy texture. - * This is typically used when the current shader has tex/sample instructions - * but the user has not provided a (any) texture(s). - */ -struct gl_texture_object * -st_get_default_texture(struct st_context *st) -{ - if (!st->default_texture) { - static const GLenum target = GL_TEXTURE_2D; - GLubyte pixels[16][16][4]; - struct gl_texture_object *texObj; - struct gl_texture_image *texImg; - GLuint i, j; - - /* The ARB_fragment_program spec says (0,0,0,1) should be returned - * when attempting to sample incomplete textures. - */ - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - pixels[i][j][0] = 0; - pixels[i][j][1] = 0; - pixels[i][j][2] = 0; - pixels[i][j][3] = 255; - } - } - - texObj = st->ctx->Driver.NewTextureObject(st->ctx, 0, target); - - texImg = _mesa_get_tex_image(st->ctx, texObj, target, 0); - - _mesa_init_teximage_fields(st->ctx, texImg, - 16, 16, 1, 0, /* w, h, d, border */ - GL_RGBA, MESA_FORMAT_RGBA8888); - - _mesa_store_teximage2d(st->ctx, texImg, - GL_RGBA, /* level, intformat */ - 16, 16, 1, /* w, h, d, border */ - GL_RGBA, GL_UNSIGNED_BYTE, pixels, - &st->ctx->DefaultPacking); - - texObj->Sampler.MinFilter = GL_NEAREST; - texObj->Sampler.MagFilter = GL_NEAREST; - texObj->_Complete = GL_TRUE; - - st->default_texture = texObj; - } - return st->default_texture; -} - - /** * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory * for a whole mipmap stack. diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h index f1502bda788..27956bcc2a6 100644 --- a/src/mesa/state_tracker/st_cb_texture.h +++ b/src/mesa/state_tracker/st_cb_texture.h @@ -44,10 +44,6 @@ st_finalize_texture(struct gl_context *ctx, struct gl_texture_object *tObj); -extern struct gl_texture_object * -st_get_default_texture(struct st_context *st); - - extern void st_init_texture_functions(struct dd_function_table *functions);