static void
init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
{
+ GLuint texObj;
+
/* prefer texture rectangle */
if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.NV_texture_rectangle) {
tex->Target = GL_TEXTURE_RECTANGLE;
tex->MinSize = 16; /* 16 x 16 at least */
assert(tex->MaxSize > 0);
- _mesa_GenTextures(1, &tex->TexObj);
+ _mesa_GenTextures(1, &texObj);
+ tex->tex_obj = NULL;
+
+ if (texObj == 0)
+ return;
+
+ tex->tex_obj = _mesa_lookup_texture(ctx, texObj);
}
static void
cleanup_temp_texture(struct temp_texture *tex)
{
- if (!tex->TexObj)
+ if (tex->tex_obj == NULL)
return;
- _mesa_DeleteTextures(1, &tex->TexObj);
- tex->TexObj = 0;
+ _mesa_DeleteTextures(1, &tex->tex_obj->Name);
+ tex->tex_obj = NULL;
}
{
struct temp_texture *tex = &ctx->Meta->TempTex;
- if (!tex->TexObj) {
+ if (tex->tex_obj == NULL) {
init_temp_texture(ctx, tex);
}
{
struct temp_texture *tex = &ctx->Meta->Bitmap.Tex;
- if (!tex->TexObj) {
+ if (tex->tex_obj == NULL) {
init_temp_texture(ctx, tex);
}
{
struct temp_texture *tex = &ctx->Meta->Blit.depthTex;
- if (!tex->TexObj) {
+ if (tex->tex_obj == NULL) {
init_temp_texture(ctx, tex);
}
{
bool newTex;
- _mesa_BindTexture(tex->Target, tex->TexObj);
- _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, filter);
- _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, filter);
+ _mesa_BindTexture(tex->Target, tex->tex_obj->Name);
+ _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MIN_FILTER,
+ (GLint *) &filter, false);
+ _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MAG_FILTER,
+ (GLint *) &filter, false);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
newTex = _mesa_meta_alloc_texture(tex, width, height, intFormat);
GLenum format, GLenum type,
const GLvoid *pixels)
{
- _mesa_BindTexture(tex->Target, tex->TexObj);
- _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ /* GLint so the compiler won't complain about type signedness mismatch in
+ * the call to _mesa_texture_parameteriv below.
+ */
+ static const GLint filter = GL_NEAREST;
+
+ _mesa_BindTexture(tex->Target, tex->tex_obj->Name);
+ _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MIN_FILTER, &filter,
+ false);
+ _mesa_texture_parameteriv(ctx, tex->tex_obj, GL_TEXTURE_MAG_FILTER, &filter,
+ false);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
/* copy pixel data to texture */