diff options
author | Dave Airlie <[email protected]> | 2011-02-20 07:04:19 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-09-06 10:18:18 +0100 |
commit | f154ac9cc251c9c5f527a09819a7fb9c5595267f (patch) | |
tree | e06ce6bf65f6c89781dd7c1d0931853be616b37a /src/mesa/state_tracker/st_draw.c | |
parent | 6cd2d55a7bee289f20670cb97258d73911dac781 (diff) |
mesa/st: add support for 2101010 vertex format conversion.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_draw.c')
-rw-r--r-- | src/mesa/state_tracker/st_draw.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 5040c6fa5ab..39a947df70a 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -187,11 +187,44 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, GLboolean normalized) { assert((type >= GL_BYTE && type <= GL_DOUBLE) || - type == GL_FIXED || type == GL_HALF_FLOAT); + type == GL_FIXED || type == GL_HALF_FLOAT || + type == GL_INT_2_10_10_10_REV || + type == GL_UNSIGNED_INT_2_10_10_10_REV); assert(size >= 1); assert(size <= 4); assert(format == GL_RGBA || format == GL_BGRA); + if (type == GL_INT_2_10_10_10_REV || + type == GL_UNSIGNED_INT_2_10_10_10_REV) { + assert(size == 4); + + if (format == GL_BGRA) { + if (type == GL_INT_2_10_10_10_REV) { + if (normalized) + return PIPE_FORMAT_B10G10R10A2_SNORM; + else + return PIPE_FORMAT_B10G10R10A2_SSCALED; + } else { + if (normalized) + return PIPE_FORMAT_B10G10R10A2_UNORM; + else + return PIPE_FORMAT_B10G10R10A2_USCALED; + } + } else { + if (type == GL_INT_2_10_10_10_REV) { + if (normalized) + return PIPE_FORMAT_R10G10B10A2_SNORM; + else + return PIPE_FORMAT_R10G10B10A2_SSCALED; + } else { + if (normalized) + return PIPE_FORMAT_R10G10B10A2_UNORM; + else + return PIPE_FORMAT_R10G10B10A2_USCALED; + } + } + } + if (format == GL_BGRA) { /* this is an odd-ball case */ assert(type == GL_UNSIGNED_BYTE); |