case MESA_FORMAT_RGB565:
return GL_RGB5;
default:
- assert(0);
+ return GL_NONE;
}
}
struct gl_renderbuffer *rb = att->Renderbuffer;
struct gl_texture_image *ti =
att->Texture->Image[att->CubeMapFace][att->TextureLevel];
- int ret;
/* Allocate a renderbuffer object for the texture if we
* haven't already done so. */
}
/* Update the renderbuffer fields from the texture. */
- ret = set_renderbuffer_format(rb, get_tex_format(ti));
- assert(ret);
-
+ set_renderbuffer_format(rb, get_tex_format(ti));
rb->Width = ti->Width;
rb->Height = ti->Height;
nouveau_surface_ref(&to_nouveau_teximage(ti)->surface,
#include "main/mipmap.h"
#include "main/texfetch.h"
#include "main/teximage.h"
+#include "drivers/common/meta.h"
static struct gl_texture_object *
nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target)
}
}
+static void
+store_mipmap(GLcontext *ctx, GLenum target, int first, int last,
+ struct gl_texture_object *t)
+{
+ struct gl_pixelstore_attrib packing = {
+ .BufferObj = ctx->Shared->NullBufferObj,
+ .Alignment = 1
+ };
+ GLenum format = t->Image[0][first]->TexFormat;
+ unsigned base_format, type, comps;
+ int i;
+
+ base_format = _mesa_get_format_base_format(format);
+ _mesa_format_to_type_and_comps(format, &type, &comps);
+
+ for (i = first; i <= last; i++) {
+ struct gl_texture_image *ti = t->Image[0][i];
+ void *data = ti->Data;
+
+ nouveau_teximage(ctx, 3, target, i, ti->InternalFormat,
+ ti->Width, ti->Height, ti->Depth,
+ ti->Border, base_format, type, data,
+ &packing, t, ti);
+
+ _mesa_free_texmemory(data);
+ }
+}
+
+static void
+nouveau_generate_mipmap(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *t)
+{
+ if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, t)) {
+ struct gl_texture_image *base = t->Image[0][t->BaseLevel];
+
+ nouveau_teximage_map(ctx, base);
+ _mesa_generate_mipmap(ctx, target, t);
+ nouveau_teximage_unmap(ctx, base);
+
+ store_mipmap(ctx, target, t->BaseLevel + 1,
+ get_last_level(t), t);
+
+ } else {
+ _mesa_meta_GenerateMipmap(ctx, target, t);
+ }
+}
+
void
nouveau_texture_functions_init(struct dd_function_table *functions)
{
functions->BindTexture = nouveau_bind_texture;
functions->MapTexture = nouveau_texture_map;
functions->UnmapTexture = nouveau_texture_unmap;
+ functions->GenerateMipmap = nouveau_generate_mipmap;
}