[Mesa-dev] [PATCH 1/2] mesa: default DEPTH_TEXTURE_MODE should be RED in the core profile

Marek Olšák maraeo at gmail.com
Sat Jul 20 11:19:00 PDT 2013


Cc: mesa-stable at lists.freedesktop.org
---
 src/mesa/drivers/dri/i915/intel_tex.c          | 2 +-
 src/mesa/drivers/dri/i965/intel_tex.c          | 2 +-
 src/mesa/drivers/dri/nouveau/nouveau_texture.c | 2 +-
 src/mesa/drivers/dri/r200/r200_tex.c           | 2 +-
 src/mesa/drivers/dri/radeon/radeon_tex.c       | 2 +-
 src/mesa/main/texobj.c                         | 7 ++++---
 src/mesa/main/texobj.h                         | 3 ++-
 src/mesa/state_tracker/st_cb_texture.c         | 2 +-
 8 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tex.c b/src/mesa/drivers/dri/i915/intel_tex.c
index 6ac5a09..ce17395 100644
--- a/src/mesa/drivers/dri/i915/intel_tex.c
+++ b/src/mesa/drivers/dri/i915/intel_tex.c
@@ -39,7 +39,7 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
    if (obj == NULL)
       return NULL;
 
-   _mesa_initialize_texture_object(&obj->base, name, target);
+   _mesa_initialize_texture_object(ctx, &obj->base, name, target);
 
    obj->needs_validate = true;
 
diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c
index 175387d..eecffc9 100644
--- a/src/mesa/drivers/dri/i965/intel_tex.c
+++ b/src/mesa/drivers/dri/i965/intel_tex.c
@@ -39,7 +39,7 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
    if (obj == NULL)
       return NULL;
 
-   _mesa_initialize_texture_object(&obj->base, name, target);
+   _mesa_initialize_texture_object(ctx, &obj->base, name, target);
 
    obj->needs_validate = true;
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 0889b5a..da74e8f 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -46,7 +46,7 @@ nouveau_texture_new(struct gl_context *ctx, GLuint name, GLenum target)
 {
 	struct nouveau_texture *nt = CALLOC_STRUCT(nouveau_texture);
 
-	_mesa_initialize_texture_object(&nt->base, name, target);
+	_mesa_initialize_texture_object(ctx, &nt->base, name, target);
 
 	return &nt->base;
 }
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index 31a65c8..57e96de 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -476,7 +476,7 @@ static struct gl_texture_object *r200NewTextureObject(struct gl_context * ctx,
 	   __FUNCTION__, ctx,
 	   _mesa_lookup_enum_by_nr(target), t);
 
-   _mesa_initialize_texture_object(&t->base, name, target);
+   _mesa_initialize_texture_object(ctx, &t->base, name, target);
    t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
 
    /* Initialize hardware state */
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c
index 301949d..fe8d8ed 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex.c
@@ -410,7 +410,7 @@ radeonNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
    r100ContextPtr rmesa = R100_CONTEXT(ctx);
    radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj);
 
-   _mesa_initialize_texture_object(&t->base, name, target);
+   _mesa_initialize_texture_object(ctx, &t->base, name, target);
    t->base.Sampler.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
 
    t->border_fallback = GL_FALSE;
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 2168bff..a2b112c 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -83,7 +83,7 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
    struct gl_texture_object *obj;
    (void) ctx;
    obj = MALLOC_STRUCT(gl_texture_object);
-   _mesa_initialize_texture_object(obj, name, target);
+   _mesa_initialize_texture_object(ctx, obj, name, target);
    return obj;
 }
 
@@ -95,7 +95,8 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
  * \param target  the texture target
  */
 void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
+_mesa_initialize_texture_object( struct gl_context *ctx,
+                                 struct gl_texture_object *obj,
                                  GLuint name, GLenum target )
 {
    ASSERT(target == 0 ||
@@ -146,7 +147,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
    obj->Sampler.MaxAnisotropy = 1.0;
    obj->Sampler.CompareMode = GL_NONE;         /* ARB_shadow */
    obj->Sampler.CompareFunc = GL_LEQUAL;       /* ARB_shadow */
-   obj->DepthMode = GL_LUMINANCE;
+   obj->DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE;
    obj->Sampler.CubeMapSeamless = GL_FALSE;
    obj->Swizzle[0] = GL_RED;
    obj->Swizzle[1] = GL_GREEN;
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index a99f45b..0df088c 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -50,7 +50,8 @@ extern struct gl_texture_object *
 _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target );
 
 extern void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
+_mesa_initialize_texture_object( struct gl_context *ctx,
+                                 struct gl_texture_object *obj,
                                  GLuint name, GLenum target );
 
 extern void
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index c167744..faa9ee3 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -141,7 +141,7 @@ st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
    struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object);
 
    DBG("%s\n", __FUNCTION__);
-   _mesa_initialize_texture_object(&obj->base, name, target);
+   _mesa_initialize_texture_object(ctx, &obj->base, name, target);
 
    return &obj->base;
 }
-- 
1.8.1.2



More information about the mesa-dev mailing list