[Mesa-dev] [RFC PATCH 1/4] Add prefer_no_swizzle paramater to _mesa_choose_texture_format

Chris Forbes chrisf at ijw.co.nz
Mon Mar 10 02:20:19 PDT 2014


Future patches will pass this to where it is needed. For now, just
drop it on the floor.

TexStorage* and TextureView pass GL_TRUE; all other callers pass
GL_FALSE.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/mesa/main/teximage.c               | 11 +++++++----
 src/mesa/main/teximage.h               |  3 ++-
 src/mesa/main/texstorage.c             |  3 ++-
 src/mesa/main/textureview.c            |  3 ++-
 src/mesa/state_tracker/st_cb_texture.c |  2 +-
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index a6c3581..a59eac1 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2974,7 +2974,8 @@ mesa_format
 _mesa_choose_texture_format(struct gl_context *ctx,
                             struct gl_texture_object *texObj,
                             GLenum target, GLint level,
-                            GLenum internalFormat, GLenum format, GLenum type)
+                            GLenum internalFormat, GLenum format, GLenum type,
+                            GLboolean prefer_no_swizzle)
 {
    mesa_format f;
 
@@ -3179,7 +3180,8 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
    }
    else {
       texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                              internalFormat, format, type);
+                                              internalFormat, format, type,
+                                              GL_FALSE);
    }
 
    assert(texFormat != MESA_FORMAT_NONE);
@@ -3607,7 +3609,8 @@ copyteximage(struct gl_context *ctx, GLuint dims,
    assert(texObj);
 
    texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                           internalFormat, GL_NONE, GL_NONE);
+                                           internalFormat, GL_NONE, GL_NONE,
+                                           GL_FALSE);
    assert(texFormat != MESA_FORMAT_NONE);
 
    if (!ctx->Driver.TestProxyTexImage(ctx, proxy_target(target),
@@ -4435,7 +4438,7 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
    }
 
    texFormat = _mesa_choose_texture_format(ctx, texObj, target, 0,
-         internalformat, GL_NONE, GL_NONE);
+         internalformat, GL_NONE, GL_NONE, GL_FALSE);
    assert(texFormat != MESA_FORMAT_NONE);
 
    dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0,
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 51d94d1..9b3f5c2 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -87,7 +87,8 @@ extern mesa_format
 _mesa_choose_texture_format(struct gl_context *ctx,
                             struct gl_texture_object *texObj,
                             GLenum target, GLint level,
-                            GLenum internalFormat, GLenum format, GLenum type);
+                            GLenum internalFormat, GLenum format, GLenum type,
+                            GLboolean prefer_no_swizzle);
 
 extern void
 _mesa_update_fbo_texture(struct gl_context *ctx,
diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 86c8f3c..16caf4e 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -369,7 +369,8 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat,
    assert(texObj);
 
    texFormat = _mesa_choose_texture_format(ctx, texObj, target, 0,
-                                           internalformat, GL_NONE, GL_NONE);
+                                           internalformat, GL_NONE, GL_NONE,
+                                           GL_TRUE);
    assert(texFormat != MESA_FORMAT_NONE);
 
    /* check that width, height, depth are legal for the mipmap level */
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 77a3b78..99ccafd 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -517,7 +517,8 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture,
    }
 
    texFormat = _mesa_choose_texture_format(ctx, texObj, target, 0,
-                                           internalformat, GL_NONE, GL_NONE);
+                                           internalformat, GL_NONE, GL_NONE,
+                                           GL_TRUE);
    assert(texFormat != MESA_FORMAT_NONE);
    if (texFormat == MESA_FORMAT_NONE) return;
 
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index f0bf374..50b3961 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -527,7 +527,7 @@ prep_teximage(struct gl_context *ctx, struct gl_texture_image *texImage,
       /* oops, need to init this image again */
       texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
                                               texImage->InternalFormat, format,
-                                              type);
+                                              type, GL_FALSE);
 
       _mesa_init_teximage_fields(ctx, texImage,
                                  texImage->Width, texImage->Height,
-- 
1.9.0



More information about the mesa-dev mailing list