Roderick Colenbrander : wined3d: Move R32G32F convertion to the formats table.

Alexandre Julliard julliard at winehq.org
Tue Apr 13 11:24:42 CDT 2010


Module: wine
Branch: master
Commit: e35f54ef1f6775b6cbf2707450b1930d540d1e12
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e35f54ef1f6775b6cbf2707450b1930d540d1e12

Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date:   Mon Apr 12 21:00:01 2010 +0200

wined3d: Move R32G32F convertion to the formats table.

---

 dlls/wined3d/surface.c |   26 --------------------------
 dlls/wined3d/utils.c   |   27 +++++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 7d8b7cd..25967b3 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2244,12 +2244,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
             desc->conv_byte_count = 6;
             break;
 
-        case WINED3DFMT_R32G32_FLOAT:
-            if (gl_info->supported[ARB_TEXTURE_RG]) break;
-            *convert = CONVERT_R32G32F;
-            desc->conv_byte_count = 12;
-            break;
-
         default:
             break;
     }
@@ -2536,26 +2530,6 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
             break;
         }
 
-        case CONVERT_R32G32F:
-        {
-            unsigned int x, y;
-            const float *Source;
-            float *Dest;
-            for(y = 0; y < height; y++) {
-                Source = (const float *)(src + y * pitch);
-                Dest = (float *) (dst + y * outpitch);
-                for (x = 0; x < width; x++ ) {
-                    float green = (*Source++);
-                    float red = (*Source++);
-                    Dest[0] = green;
-                    Dest[1] = red;
-                    Dest[2] = 1.0f;
-                    Dest += 3;
-                }
-            }
-            break;
-        }
-
         default:
             ERR("Unsupported conversion type %#x.\n", convert);
     }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 69216c2..b2a35c6 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -417,6 +417,29 @@ static void convert_r16g16_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT wi
     }
 }
 
+static void convert_r32g32_float(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height)
+{
+    unsigned int x, y;
+    const float *Source;
+    float *Dest;
+    UINT outpitch = (pitch * 3)/2;
+
+    for(y = 0; y < height; y++)
+    {
+        Source = (const float *)(src + y * pitch);
+        Dest = (float *) (dst + y * outpitch);
+        for (x = 0; x < width; x++ )
+        {
+            float green = (*Source++);
+            float red = (*Source++);
+            Dest[0] = green;
+            Dest[1] = red;
+            Dest[2] = 1.0f;
+            Dest += 3;
+        }
+    }
+}
+
 static void convert_s1_uint_d15_unorm(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height)
 {
     unsigned int x, y;
@@ -538,9 +561,9 @@ static const struct wined3d_format_texture_info format_texture_info[] =
             WINED3DFMT_FLAG_RENDERTARGET,
             ARB_TEXTURE_RG,             NULL},
     {WINED3DFMT_R32G32_FLOAT,           GL_RGB32F_ARB,                    GL_RGB32F_ARB,                          0,
-            GL_RGB,                     GL_FLOAT,                         0,
+            GL_RGB,                     GL_FLOAT,                         12,
             WINED3DFMT_FLAG_RENDERTARGET,
-            ARB_TEXTURE_FLOAT,          NULL},
+            ARB_TEXTURE_FLOAT,          &convert_r32g32_float},
     {WINED3DFMT_R32G32_FLOAT,           GL_RG32F,                         GL_RG32F,                               0,
             GL_RG,                      GL_FLOAT,                         0,
             WINED3DFMT_FLAG_RENDERTARGET,




More information about the wine-cvs mailing list