Mesa (mesa_7_5_branch): mesa: Use PIPE_TEXTURE_USAGE_DEPTH_STENCIL for any depth or stencil format.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Jun 11 18:03:36 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: 7cafd49c936ba9727c3077af8c84afe81b6fa0b4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7cafd49c936ba9727c3077af8c84afe81b6fa0b4

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Jun 11 18:52:17 2009 +0100

mesa: Use PIPE_TEXTURE_USAGE_DEPTH_STENCIL for any depth or stencil format.

---

 src/mesa/state_tracker/st_format.c |   14 +++++++++-----
 src/mesa/state_tracker/st_format.h |    4 ++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index d507e3e..b243c24 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -392,7 +392,7 @@ default_depth_format(struct pipe_screen *screen,
  *                   or PIPE_TEXTURE_USAGE_SAMPLER
  */
 enum pipe_format
-st_choose_format(struct pipe_context *pipe, GLint internalFormat,
+st_choose_format(struct pipe_context *pipe, GLenum internalFormat,
                  enum pipe_texture_target target, unsigned tex_usage)
 {
    struct pipe_screen *screen = pipe->screen;
@@ -594,9 +594,13 @@ st_choose_format(struct pipe_context *pipe, GLint internalFormat,
 
 
 static GLboolean
-is_stencil_format(GLenum format)
+is_depth_or_stencil_format(GLenum internalFormat)
 {
-   switch (format) {
+   switch (internalFormat) {
+   case GL_DEPTH_COMPONENT:
+   case GL_DEPTH_COMPONENT16:
+   case GL_DEPTH_COMPONENT24:
+   case GL_DEPTH_COMPONENT32:
    case GL_STENCIL_INDEX:
    case GL_STENCIL_INDEX1_EXT:
    case GL_STENCIL_INDEX4_EXT:
@@ -614,10 +618,10 @@ is_stencil_format(GLenum format)
  * Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces.
  */
 enum pipe_format
-st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
+st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat)
 {
    uint usage;
-   if (is_stencil_format(internalFormat))
+   if (is_depth_or_stencil_format(internalFormat))
       usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
    else
       usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h
index 7bbbe2d..9d9e02f 100644
--- a/src/mesa/state_tracker/st_format.h
+++ b/src/mesa/state_tracker/st_format.h
@@ -64,11 +64,11 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat);
 
 
 extern enum pipe_format
-st_choose_format(struct pipe_context *pipe, GLint internalFormat,
+st_choose_format(struct pipe_context *pipe, GLenum internalFormat,
                  enum pipe_texture_target target, unsigned tex_usage);
 
 extern enum pipe_format
-st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat);
+st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat);
 
 
 extern const struct gl_texture_format *




More information about the mesa-commit mailing list