mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 19:20:08 +01:00
st/mesa: remove st_get_default_texture()
Just use _mesa_get_fallback_texture() instead. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
c04db7f7fa
commit
ea2aca036c
4 changed files with 4 additions and 57 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue