From 6eb242a2757ee59822c23e0feb6a89d72a1f4fa7 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Wed, 27 Aug 2014 18:40:51 +0200 Subject: [PATCH] wined3d: Handle half-float attributes in load_numbered_arrays(). Fixes a bunch of graphic glitches in WildStar on Nvidia. --- dlls/wined3d/state.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 3712f3b34b4..700db847ec6 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -4203,13 +4203,32 @@ static void load_numbered_arrays(struct wined3d_context *context, break; case WINED3DFMT_R16G16_FLOAT: - /* Are those 16 bit floats. C doesn't have a 16 bit float type. I could read the single bits and calculate a 4 - * byte float according to the IEEE standard - */ - FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_2\n"); + if (gl_info->supported[NV_HALF_FLOAT] && gl_info->supported[NV_VERTEX_PROGRAM]) + { + /* Not supported by GL_ARB_half_float_vertex. */ + GL_EXTCALL(glVertexAttrib2hvNV(i, (const GLhalfNV *)ptr)); + } + else + { + float x = float_16_to_32(((const unsigned short *)ptr) + 0); + float y = float_16_to_32(((const unsigned short *)ptr) + 1); + GL_EXTCALL(glVertexAttrib2fARB(i, x, y)); + } break; case WINED3DFMT_R16G16B16A16_FLOAT: - FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_4\n"); + if (gl_info->supported[NV_HALF_FLOAT] && gl_info->supported[NV_VERTEX_PROGRAM]) + { + /* Not supported by GL_ARB_half_float_vertex. */ + GL_EXTCALL(glVertexAttrib4hvNV(i, (const GLhalfNV *)ptr)); + } + else + { + float x = float_16_to_32(((const unsigned short *)ptr) + 0); + float y = float_16_to_32(((const unsigned short *)ptr) + 1); + float z = float_16_to_32(((const unsigned short *)ptr) + 2); + float w = float_16_to_32(((const unsigned short *)ptr) + 3); + GL_EXTCALL(glVertexAttrib4fARB(i, x, y, z, w)); + } break; default: