[PATCH] WineD3D: Reinstall the G16R16F format surface load fixup=0A=

Stefan Doesinger stefan at codeweavers.com
Mon Dec 15 19:14:15 CST 2008


=0A=
We cannot remove this because we still have to load the surface as RGB. =
The=0A=
shader may take care of setting the blue channel to 1.0 now, but we still=0A=
get the red and green channels loaded incorrectly if we don't insert a =
blue=0A=
channel before loading=0A=
=0A=
With R32F and R16F there's no problem because we can load it as GL_RED,=0A=
GL_FLOAT/GL_HALF.=0A=
=0A=
This fixes a regression introduced by commit =
e04556bb166804edc5c6cb16e6001b25aab9563e=0A=
---=0A=
 dlls/wined3d/surface.c         |   29 +++++++++++++++++++++++++++++=0A=
 dlls/wined3d/wined3d_private.h |    1 +=0A=
 2 files changed, 30 insertions(+), 0 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c=0A=
index b43697e..0eedf23 100644=0A=
--- a/dlls/wined3d/surface.c=0A=
+++ b/dlls/wined3d/surface.c=0A=
@@ -1696,6 +1696,14 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl =
*This, BOOL need_alpha_ck, BOOL use_=0A=
             *target_bpp =3D 2;=0A=
             break;=0A=
 =0A=
+        case WINED3DFMT_G16R16:=0A=
+            *convert =3D CONVERT_G16R16;=0A=
+            *format =3D GL_RGB;=0A=
+            *internal =3D GL_RGB16_EXT;=0A=
+            *type =3D GL_UNSIGNED_SHORT;=0A=
+            *target_bpp =3D 6;=0A=
+            break;=0A=
+=0A=
         default:=0A=
             break;=0A=
     }=0A=
@@ -2023,6 +2031,27 @@ static HRESULT d3dfmt_convert_surface(const BYTE =
*src, BYTE *dst, UINT pitch, UI=0A=
             break;=0A=
         }=0A=
 =0A=
+        case CONVERT_G16R16:=0A=
+        {=0A=
+            unsigned int x, y;=0A=
+            const WORD *Source;=0A=
+            WORD *Dest;=0A=
+=0A=
+            for(y =3D 0; y < height; y++) {=0A=
+                Source =3D (const WORD *)(src + y * pitch);=0A=
+                Dest =3D (WORD *) (dst + y * outpitch);=0A=
+                for (x =3D 0; x < width; x++ ) {=0A=
+                    WORD green =3D (*Source++);=0A=
+                    WORD red =3D (*Source++);=0A=
+                    Dest[0] =3D green;=0A=
+                    Dest[1] =3D red;=0A=
+                    Dest[2] =3D 0xffff;=0A=
+                    Dest +=3D 3;=0A=
+                }=0A=
+            }=0A=
+            break;=0A=
+        }=0A=
+=0A=
         default:=0A=
             ERR("Unsupported conversation type %d\n", convert);=0A=
     }=0A=
diff --git a/dlls/wined3d/wined3d_private.h =
b/dlls/wined3d/wined3d_private.h=0A=
index 4aefe55..20dd10c 100644=0A=
--- a/dlls/wined3d/wined3d_private.h=0A=
+++ b/dlls/wined3d/wined3d_private.h=0A=
@@ -1679,6 +1679,7 @@ typedef enum {=0A=
     CONVERT_Q8W8V8U8,=0A=
     CONVERT_V16U16,=0A=
     CONVERT_A4L4,=0A=
+    CONVERT_G16R16,=0A=
 } CONVERT_TYPES;=0A=
 =0A=
 HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, =
BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, =
CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode);=0A=
-- =0A=
1.5.6.4=0A=
=0A=

------=_NextPart_000_0027_01C95EEE.C2C2E630--




More information about the wine-patches mailing list