}
+static unsigned
+gl_target_to_pipe(GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_1D:
+ return PIPE_TEXTURE_1D;
+
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_RECTANGLE_NV:
+ return PIPE_TEXTURE_2D;
+
+ case GL_TEXTURE_3D:
+ return PIPE_TEXTURE_3D;
+
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ return PIPE_TEXTURE_CUBE;
+
+ default:
+ assert(0);
+ return 0;
+ }
+}
+
+
static int
compressed_num_bytes(GLuint mesaFormat)
{
if (stImage->base.IsCompressed)
comp_byte = compressed_num_bytes(stImage->base.TexFormat->MesaFormat);
stObj->mt = st_miptree_create(pipe,
- stObj->base.Target,
- stImage->base.InternalFormat,
- firstLevel,
- lastLevel,
- width,
- height,
- depth,
- stImage->base.TexFormat->TexelBytes,
- comp_byte);
+ gl_target_to_pipe(stObj->base.Target),
+ stImage->base.InternalFormat,
+ firstLevel,
+ lastLevel,
+ width,
+ height,
+ depth,
+ stImage->base.TexFormat->TexelBytes,
+ comp_byte);
stObj->mt->format
= st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat);
if (stObj->mt &&
stObj->mt->first_level == level &&
stObj->mt->last_level == level &&
- stObj->mt->target != GL_TEXTURE_CUBE_MAP_ARB &&
+ stObj->mt->target != PIPE_TEXTURE_CUBE &&
!st_miptree_match_image(stObj->mt, &stImage->base,
stImage->face, stImage->level)) {
* leaving the tree alone.
*/
if (stObj->mt &&
- (stObj->mt->target != stObj->base.Target ||
+ (stObj->mt->target != gl_target_to_pipe(stObj->base.Target) ||
stObj->mt->internal_format != firstImage->base.InternalFormat ||
stObj->mt->first_level != stObj->firstLevel ||
stObj->mt->last_level != stObj->lastLevel ||
*/
if (!stObj->mt) {
stObj->mt = st_miptree_create(pipe,
- stObj->base.Target,
+ gl_target_to_pipe(stObj->base.Target),
firstImage->base.InternalFormat,
stObj->firstLevel,
stObj->lastLevel,
#include "pipe/p_state.h"
#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
#define DBG if(0) printf
+#if 0
static GLenum
target_to_target(GLenum target)
{
return target;
}
}
+#endif
struct pipe_mipmap_tree *
st_miptree_create(struct pipe_context *pipe,
- GLenum target,
+ unsigned target,
GLenum internal_format,
GLuint first_level,
GLuint last_level,
struct pipe_mipmap_tree *mt = calloc(sizeof(*mt), 1);
GLbitfield flags = 0x0;
+ assert(target <= PIPE_TEXTURE_CUBE);
+
DBG("%s target %s format %s level %d..%d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target),
_mesa_lookup_enum_by_nr(internal_format), first_level, last_level);
- mt->target = target_to_target(target);
+ mt->target = target;
mt->internal_format = internal_format;
mt->first_level = first_level;
mt->last_level = last_level;