wined3d: Make use of GL_ARB_half_float_vertex.

This extension is a subset of GL_NV_half_float that defines support
for the stream format(same constant), but doesn't define texture
formats or immediate mode entrypoints.
oldstable
Stefan Dösinger 2009-04-06 19:07:51 +02:00 committed by Alexandre Julliard
parent f5e24f7a85
commit d2e12a19ca
6 changed files with 22 additions and 7 deletions

View File

@ -214,7 +214,7 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This,
format = attrib->format_desc->format; format = attrib->format_desc->format;
/* Look for newly appeared conversion */ /* Look for newly appeared conversion */
if (!GL_SUPPORT(NV_HALF_FLOAT) && (format == WINED3DFMT_R16G16_FLOAT || format == WINED3DFMT_R16G16B16A16_FLOAT)) if (!GL_SUPPORT(ARB_HALF_FLOAT_VERTEX) && (format == WINED3DFMT_R16G16_FLOAT || format == WINED3DFMT_R16G16B16A16_FLOAT))
{ {
ret = buffer_process_converted_attribute(This, CONV_FLOAT16_2, attrib, stride_this_run); ret = buffer_process_converted_attribute(This, CONV_FLOAT16_2, attrib, stride_this_run);
@ -327,7 +327,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This)
/* Certain declaration types need some fixups before we can pass them to /* Certain declaration types need some fixups before we can pass them to
* opengl. This means D3DCOLOR attributes with fixed function vertex * opengl. This means D3DCOLOR attributes with fixed function vertex
* processing, FLOAT4 POSITIONT with fixed function, and FLOAT16 if * processing, FLOAT4 POSITIONT with fixed function, and FLOAT16 if
* GL_NV_half_float is not supported. * GL_ARB_half_float_vertex is not supported.
* *
* Note for d3d8 and d3d9: * Note for d3d8 and d3d9:
* The vertex buffer FVF doesn't help with finding them, we have to use * The vertex buffer FVF doesn't help with finding them, we have to use

View File

@ -92,6 +92,7 @@ static const struct {
{"GL_ARB_vertex_shader", ARB_VERTEX_SHADER, 0 }, {"GL_ARB_vertex_shader", ARB_VERTEX_SHADER, 0 },
{"GL_ARB_shader_objects", ARB_SHADER_OBJECTS, 0 }, {"GL_ARB_shader_objects", ARB_SHADER_OBJECTS, 0 },
{"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD, 0 }, {"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD, 0 },
{"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX, 0 },
/* EXT */ /* EXT */
{"GL_EXT_blend_color", EXT_BLEND_COLOR, 0 }, {"GL_EXT_blend_color", EXT_BLEND_COLOR, 0 },
@ -1009,6 +1010,10 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
gl_info->supported[NV_TEXTURE_SHADER2] = FALSE; gl_info->supported[NV_TEXTURE_SHADER2] = FALSE;
gl_info->supported[NV_TEXTURE_SHADER3] = FALSE; gl_info->supported[NV_TEXTURE_SHADER3] = FALSE;
} }
if(gl_info->supported[NV_HALF_FLOAT]) {
/* GL_ARB_half_float_vertex is a subset of GL_NV_half_float */
gl_info->supported[ARB_HALF_FLOAT_VERTEX] = TRUE;
}
} }
checkGLcall("extension detection\n"); checkGLcall("extension detection\n");
@ -3629,7 +3634,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
WINED3DDTCAPS_UBYTE4N | WINED3DDTCAPS_UBYTE4N |
WINED3DDTCAPS_SHORT2N | WINED3DDTCAPS_SHORT2N |
WINED3DDTCAPS_SHORT4N; WINED3DDTCAPS_SHORT4N;
if (GL_SUPPORT(NV_HALF_FLOAT)) { if (GL_SUPPORT(ARB_HALF_FLOAT_VERTEX)) {
pCaps->DeclTypes |= WINED3DDTCAPS_FLOAT16_2 | pCaps->DeclTypes |= WINED3DDTCAPS_FLOAT16_2 |
WINED3DDTCAPS_FLOAT16_4; WINED3DDTCAPS_FLOAT16_4;
} }
@ -4340,6 +4345,7 @@ static void fillGLAttribFuncs(const WineD3D_GL_Info *gl_info)
multi_texcoord_funcs[WINED3D_FFP_EMIT_DEC3N] = invalid_texcoord_func; multi_texcoord_funcs[WINED3D_FFP_EMIT_DEC3N] = invalid_texcoord_func;
if (GL_SUPPORT(NV_HALF_FLOAT)) if (GL_SUPPORT(NV_HALF_FLOAT))
{ {
/* Not supported by ARB_HALF_FLOAT_VERTEX, so check for NV_HALF_FLOAT */
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT16_2] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord2hvNV); multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT16_2] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord2hvNV);
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT16_4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4hvNV); multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT16_4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4hvNV);
} else { } else {

View File

@ -370,6 +370,7 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format
* byte float according to the IEEE standard * byte float according to the IEEE standard
*/ */
if (GL_SUPPORT(NV_HALF_FLOAT)) { if (GL_SUPPORT(NV_HALF_FLOAT)) {
/* Not supported by GL_ARB_half_float_vertex */
GL_EXTCALL(glVertexAttrib2hvNV(index, ptr)); GL_EXTCALL(glVertexAttrib2hvNV(index, ptr));
} else { } else {
float x = float_16_to_32(((const unsigned short *)ptr) + 0); float x = float_16_to_32(((const unsigned short *)ptr) + 0);
@ -379,6 +380,7 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format
break; break;
case WINED3DFMT_R16G16B16A16_FLOAT: case WINED3DFMT_R16G16B16A16_FLOAT:
if (GL_SUPPORT(NV_HALF_FLOAT)) { if (GL_SUPPORT(NV_HALF_FLOAT)) {
/* Not supported by GL_ARB_half_float_vertex */
GL_EXTCALL(glVertexAttrib4hvNV(index, ptr)); GL_EXTCALL(glVertexAttrib4hvNV(index, ptr));
} else { } else {
float x = float_16_to_32(((const unsigned short *)ptr) + 0); float x = float_16_to_32(((const unsigned short *)ptr) + 0);

View File

@ -651,15 +651,15 @@ static void apply_format_fixups(WineD3D_GL_Info *gl_info)
gl_info->gl_formats[idx].gl_vtx_format = GL_BGRA; gl_info->gl_formats[idx].gl_vtx_format = GL_BGRA;
} }
if (GL_SUPPORT(NV_HALF_FLOAT)) if (GL_SUPPORT(ARB_HALF_FLOAT_VERTEX))
{ {
/* Do not change the size of the type, it is CPU side. We have to change the GPU-side information though. /* Do not change the size of the type, it is CPU side. We have to change the GPU-side information though.
* It is the job of the vertex buffer code to make sure that the vbos have the right format */ * It is the job of the vertex buffer code to make sure that the vbos have the right format */
idx = getFmtIdx(WINED3DFMT_R16G16_FLOAT); idx = getFmtIdx(WINED3DFMT_R16G16_FLOAT);
gl_info->gl_formats[idx].gl_vtx_type = GL_HALF_FLOAT_NV; gl_info->gl_formats[idx].gl_vtx_type = GL_HALF_FLOAT; /* == GL_HALF_FLOAT_NV */
idx = getFmtIdx(WINED3DFMT_R16G16B16A16_FLOAT); idx = getFmtIdx(WINED3DFMT_R16G16B16A16_FLOAT);
gl_info->gl_formats[idx].gl_vtx_type = GL_HALF_FLOAT_NV; gl_info->gl_formats[idx].gl_vtx_type = GL_HALF_FLOAT;
} }
} }

View File

@ -261,7 +261,7 @@ HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *This,
if (elements[i].format == WINED3DFMT_R16G16_FLOAT || elements[i].format == WINED3DFMT_R16G16B16A16_FLOAT) if (elements[i].format == WINED3DFMT_R16G16_FLOAT || elements[i].format == WINED3DFMT_R16G16B16A16_FLOAT)
{ {
if (!GL_SUPPORT(NV_HALF_FLOAT)) This->half_float_conv_needed = TRUE; if (!GL_SUPPORT(ARB_HALF_FLOAT_VERTEX)) This->half_float_conv_needed = TRUE;
} }
} }

View File

@ -2537,6 +2537,12 @@ typedef void (WINE_GLAPI * PGLFNGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint
#define GL_DECR_WRAP_EXT 0x8508 #define GL_DECR_WRAP_EXT 0x8508
#endif #endif
/* GL_ARB_half_float_vertex */
#ifndef GL_ARB_half_float_vertex
#define GL_ARB_half_float_vertex
/* No _ARB, see extension spec */
#define GL_HALF_FLOAT 0x140B
#endif
/* GL_NV_half_float */ /* GL_NV_half_float */
#ifndef GL_NV_half_float #ifndef GL_NV_half_float
#define GL_NV_half_float 1 #define GL_NV_half_float 1
@ -3398,6 +3404,7 @@ typedef enum _GL_SupportedExt {
ARB_VERTEX_SHADER, ARB_VERTEX_SHADER,
ARB_SHADER_OBJECTS, ARB_SHADER_OBJECTS,
ARB_SHADER_TEXTURE_LOD, ARB_SHADER_TEXTURE_LOD,
ARB_HALF_FLOAT_VERTEX,
/* EXT */ /* EXT */
EXT_BLEND_COLOR, EXT_BLEND_COLOR,
EXT_BLEND_MINMAX, EXT_BLEND_MINMAX,