From: Matteo Bruni Subject: [PATCH 4/5] wined3d: Handle half-float attributes in load_numbered_arrays(). Message-Id: <1409157652-16487-4-git-send-email-mbruni@codeweavers.com> Date: Wed, 27 Aug 2014 18:40:51 +0200 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 3712f3b..700db84 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: -- 1.8.5.5