[Mesa-dev] [PATCH 11/13] st/mesa: remove st_get_default_texture()
Brian Paul
brianp at vmware.com
Mon Feb 13 08:19:27 PST 2012
Just use _mesa_get_fallback_texture() instead.
---
src/mesa/state_tracker/st_atom_sampler.c | 3 +-
src/mesa/state_tracker/st_atom_texture.c | 3 +-
src/mesa/state_tracker/st_cb_texture.c | 51 ------------------------------
src/mesa/state_tracker/st_cb_texture.h | 4 --
4 files changed, 4 insertions(+), 57 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index ee69fc3..dc0c789 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 e8941da..438595b 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 5cd9a4c..c2011da 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1337,57 +1337,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 f1502bd..27956bc 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);
--
1.7.3.4
More information about the mesa-dev
mailing list