summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-01-18 16:42:57 +0100
committerLuca Barbieri <[email protected]>2010-04-12 20:19:56 +0200
commitd5dcd4ee35308272d6b7b3549f05365aa438d7d2 (patch)
tree6a78eb1ce9555616411afcff2f765bc20f1a7105 /src
parentf9c665e9e6d8cb5b6bb34f9678575dab2784b045 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_draw.c11
1 files changed, 10 insertions, 1 deletions
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];