summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-04-03 16:37:30 -0600
committerBrian <brian.paul@tungstengraphics.com>2008-04-03 16:37:30 -0600
commit1307eebfa07e3440554eb2871e5dbd94e98ed7a8 (patch)
treea13fad1b15516ebb45ed6d825262d46cf176b89f
parent766f3a545ebb317d2115b9053a8fc13b49ceec12 (diff)
gallium: test if PIPE_FORMAT_YCBCR[_REV] is supported and enable GL_MESA_ycbcr_texture
Update texture format selection code too.
-rw-r--r--src/mesa/state_tracker/st_extensions.c5
-rw-r--r--src/mesa/state_tracker/st_format.c25
2 files changed, 22 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 20f4652413..47a50d40ca 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -220,4 +220,9 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
}
+ if (screen->is_format_supported(screen, PIPE_FORMAT_YCBCR, PIPE_TEXTURE) ||
+ screen->is_format_supported(screen, PIPE_FORMAT_YCBCR_REV, PIPE_TEXTURE)) {
+ ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
+ }
+
}
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index cb6fa9a573..761645c105 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -189,15 +189,14 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
pinfo->base_format = GL_RGBA;
}
}
+ else if (pf_layout(format) == PIPE_FORMAT_LAYOUT_YCBCR) {
+ pinfo->base_format = GL_YCBCR_MESA;
+ pinfo->datatype = GL_UNSIGNED_SHORT;
+ pinfo->size = 2; /* two bytes per "texel" */
+ }
else {
- pipe_format_ycbcr_t info;
-
- assert( pf_layout(format) == PIPE_FORMAT_LAYOUT_YCBCR );
-
- info = format;
-
- /* TODO */
- assert( 0 );
+ /* compressed format? */
+ assert(0);
}
#if 0
@@ -275,6 +274,8 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat)
return PIPE_FORMAT_Z32_UNORM;
case MESA_FORMAT_Z24_S8:
return PIPE_FORMAT_Z24S8_UNORM;
+ case MESA_FORMAT_YCBCR:
+ return PIPE_FORMAT_YCBCR;
default:
assert(0);
return 0;
@@ -435,6 +436,14 @@ choose_format(struct pipe_context *pipe, GLint internalFormat, uint surfType)
return default_rgba_format( screen, surfType );
case GL_YCBCR_MESA:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_YCBCR,
+ PIPE_TEXTURE)) {
+ return PIPE_FORMAT_YCBCR;
+ }
+ if (screen->is_format_supported(screen, PIPE_FORMAT_YCBCR_REV,
+ PIPE_TEXTURE)) {
+ return PIPE_FORMAT_YCBCR_REV;
+ }
return PIPE_FORMAT_NONE;
case GL_RGB_S3TC: