Stefan Dösinger : wined3d: Make use of GL_ARB_half_float_vertex.
Alexandre Julliard
julliard at winehq.org
Tue May 5 09:12:53 CDT 2009
Module: wine
Branch: master
Commit: d2e12a19ca47cbd98b233b000b77f4f5a624247b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2e12a19ca47cbd98b233b000b77f4f5a624247b
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Mon Apr 6 19:07:51 2009 +0200
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.
---
dlls/wined3d/buffer.c | 4 ++--
dlls/wined3d/directx.c | 8 +++++++-
dlls/wined3d/drawprim.c | 2 ++
dlls/wined3d/utils.c | 6 +++---
dlls/wined3d/vertexdeclaration.c | 2 +-
dlls/wined3d/wined3d_gl.h | 7 +++++++
6 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 8f68f5d..666de8e 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -214,7 +214,7 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This,
format = attrib->format_desc->format;
/* 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);
@@ -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
* opengl. This means D3DCOLOR attributes with fixed function vertex
* 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:
* The vertex buffer FVF doesn't help with finding them, we have to use
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index a859e08..61927fc 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -92,6 +92,7 @@ static const struct {
{"GL_ARB_vertex_shader", ARB_VERTEX_SHADER, 0 },
{"GL_ARB_shader_objects", ARB_SHADER_OBJECTS, 0 },
{"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD, 0 },
+ {"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX, 0 },
/* EXT */
{"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_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");
@@ -3629,7 +3634,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
WINED3DDTCAPS_UBYTE4N |
WINED3DDTCAPS_SHORT2N |
WINED3DDTCAPS_SHORT4N;
- if (GL_SUPPORT(NV_HALF_FLOAT)) {
+ if (GL_SUPPORT(ARB_HALF_FLOAT_VERTEX)) {
pCaps->DeclTypes |= WINED3DDTCAPS_FLOAT16_2 |
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;
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_4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4hvNV);
} else {
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index c96b975..68821b4 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -370,6 +370,7 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format
* byte float according to the IEEE standard
*/
if (GL_SUPPORT(NV_HALF_FLOAT)) {
+ /* Not supported by GL_ARB_half_float_vertex */
GL_EXTCALL(glVertexAttrib2hvNV(index, ptr));
} else {
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;
case WINED3DFMT_R16G16B16A16_FLOAT:
if (GL_SUPPORT(NV_HALF_FLOAT)) {
+ /* Not supported by GL_ARB_half_float_vertex */
GL_EXTCALL(glVertexAttrib4hvNV(index, ptr));
} else {
float x = float_16_to_32(((const unsigned short *)ptr) + 0);
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 7eb3d59..d697372 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -651,15 +651,15 @@ static void apply_format_fixups(WineD3D_GL_Info *gl_info)
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.
* It is the job of the vertex buffer code to make sure that the vbos have the right format */
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);
- gl_info->gl_formats[idx].gl_vtx_type = GL_HALF_FLOAT_NV;
+ gl_info->gl_formats[idx].gl_vtx_type = GL_HALF_FLOAT;
}
}
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index 0e41494..2c2b763 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -261,7 +261,7 @@ HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *This,
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;
}
}
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 63763aa..2072391 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -2537,6 +2537,12 @@ typedef void (WINE_GLAPI * PGLFNGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint
#define GL_DECR_WRAP_EXT 0x8508
#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 */
#ifndef GL_NV_half_float
#define GL_NV_half_float 1
@@ -3398,6 +3404,7 @@ typedef enum _GL_SupportedExt {
ARB_VERTEX_SHADER,
ARB_SHADER_OBJECTS,
ARB_SHADER_TEXTURE_LOD,
+ ARB_HALF_FLOAT_VERTEX,
/* EXT */
EXT_BLEND_COLOR,
EXT_BLEND_MINMAX,
More information about the wine-cvs
mailing list