From: Luca Barbieri Date: Mon, 18 Jan 2010 15:42:57 +0000 (+0100) Subject: st/mesa: half float vertex support (unexposed) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5dcd4ee35308272d6b7b3549f05365aa438d7d2;p=mesa.git st/mesa: half float vertex support (unexposed) This was proposed by Marek Olšák and no one objected, so just pushing it. The extension is currently not exposed, because the mechanism to discover if the driver actually supports this is missing. We probably should change is_format_supported to handle this too. This will allow to test Gallium drivers anyway in the meantime. Based on work by Dave Airlie. Changes by me: 1. Fix assertion in st 2. Change to use unpadded Gallium formats --- diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 0ebc462ced4..4f4368ac9e4 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -74,6 +74,13 @@ static GLuint float_types[4] = { PIPE_FORMAT_R32G32B32A32_FLOAT }; +static GLuint half_float_types[4] = { + PIPE_FORMAT_R16_FLOAT, + PIPE_FORMAT_R16G16_FLOAT, + PIPE_FORMAT_R16G16B16_FLOAT, + PIPE_FORMAT_R16G16B16A16_FLOAT +}; + static GLuint uint_types_norm[4] = { PIPE_FORMAT_R32_UNORM, PIPE_FORMAT_R32G32_UNORM, @@ -175,7 +182,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, GLboolean normalized) { assert((type >= GL_BYTE && type <= GL_DOUBLE) || - type == GL_FIXED); + type == GL_FIXED || type == GL_HALF_FLOAT); assert(size >= 1); assert(size <= 4); assert(format == GL_RGBA || format == GL_BGRA); @@ -191,6 +198,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, switch (type) { case GL_DOUBLE: return double_types[size-1]; case GL_FLOAT: return float_types[size-1]; + case GL_HALF_FLOAT: return half_float_types[size-1]; case GL_INT: return int_types_norm[size-1]; case GL_SHORT: return short_types_norm[size-1]; case GL_BYTE: return byte_types_norm[size-1]; @@ -205,6 +213,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, switch (type) { case GL_DOUBLE: return double_types[size-1]; case GL_FLOAT: return float_types[size-1]; + case GL_HALF_FLOAT: return half_float_types[size-1]; case GL_INT: return int_types_scale[size-1]; case GL_SHORT: return short_types_scale[size-1]; case GL_BYTE: return byte_types_scale[size-1];