[PATCH] WineD3D: Ask the ffp/shader/blit implementation about =

Stefan Doesinger stefan at codeweavers.com
Thu Aug 7 14:51:35 CDT 2008


format support=0A=
=0A=
If a format is not supported natively by opengl, a shader may be=0A=
able to convert it. Up to now, CheckDeviceFormat had magic=0A=
knowldge which GL extensions lead to which supported format. This=0A=
patch adds functions that allow CheckDeviceFormat to ask the=0A=
actual implementation for its capabilities=0A=
---=0A=
 dlls/wined3d/arb_program_shader.c    |   19 ++++=0A=
 dlls/wined3d/ati_fragment_shader.c   |   14 +++=0A=
 dlls/wined3d/baseshader.c            |   18 ++++-=0A=
 dlls/wined3d/directx.c               |  152 =
+++++++++++++++++-----------------=0A=
 dlls/wined3d/glsl_shader.c           |   18 ++++=0A=
 dlls/wined3d/nvidia_texture_shader.c |    7 ++=0A=
 dlls/wined3d/state.c                 |    5 +=0A=
 dlls/wined3d/surface.c               |    8 ++-=0A=
 dlls/wined3d/utils.c                 |   15 ++++=0A=
 dlls/wined3d/wined3d_private.h       |    3 +=0A=
 10 files changed, 180 insertions(+), 79 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/arb_program_shader.c =
b/dlls/wined3d/arb_program_shader.c=0A=
index dbb7f3f..32373b4 100644=0A=
--- a/dlls/wined3d/arb_program_shader.c=0A=
+++ b/dlls/wined3d/arb_program_shader.c=0A=
@@ -2180,6 +2180,23 @@ static void shader_arb_get_caps(WINED3DDEVTYPE =
devtype, WineD3D_GL_Info *gl_info=0A=
     }=0A=
 }=0A=
 =0A=
+static BOOL shader_arb_conv_supported(WINED3DFORMAT fmt) {=0A=
+    TRACE("Checking shader format support for format %s:", =
debug_d3dformat(fmt));=0A=
+    switch(fmt) {=0A=
+        case WINED3DFMT_V8U8:=0A=
+        case WINED3DFMT_V16U16:=0A=
+        case WINED3DFMT_X8L8V8U8:=0A=
+        case WINED3DFMT_L6V5U5:=0A=
+        case WINED3DFMT_Q8W8V8U8:=0A=
+        case WINED3DFMT_ATI2N:=0A=
+            TRACE("[OK]\n");=0A=
+            return TRUE;=0A=
+        default:=0A=
+            TRACE("[FAILED\n");=0A=
+            return FALSE;=0A=
+    }=0A=
+}=0A=
+=0A=
 const shader_backend_t arb_program_shader_backend =3D {=0A=
     shader_arb_select,=0A=
     shader_arb_select_depth_blt,=0A=
@@ -2194,6 +2211,7 @@ const shader_backend_t arb_program_shader_backend =
=3D {=0A=
     shader_arb_generate_pshader,=0A=
     shader_arb_generate_vshader,=0A=
     shader_arb_get_caps,=0A=
+    shader_arb_conv_supported,=0A=
 };=0A=
 =0A=
 /* ARB_fragment_program fixed function pipeline replacement definitions =
*/=0A=
@@ -2961,5 +2979,6 @@ const struct fragment_pipeline =
arbfp_fragment_pipeline =3D {=0A=
     arbfp_get_caps,=0A=
     arbfp_alloc,=0A=
     arbfp_free,=0A=
+    shader_arb_conv_supported,=0A=
     arbfp_fragmentstate_template=0A=
 };=0A=
diff --git a/dlls/wined3d/ati_fragment_shader.c =
b/dlls/wined3d/ati_fragment_shader.c=0A=
index 54b05b1..d6c133c 100644=0A=
--- a/dlls/wined3d/ati_fragment_shader.c=0A=
+++ b/dlls/wined3d/ati_fragment_shader.c=0A=
@@ -1063,10 +1063,24 @@ static void atifs_free(IWineD3DDevice *iface) {=0A=
 }=0A=
 #undef GLINFO_LOCATION=0A=
 =0A=
+static BOOL atifs_conv_supported(WINED3DFORMAT fmt) {=0A=
+    TRACE("Checking shader format support for format %s:", =
debug_d3dformat(fmt));=0A=
+    switch(fmt) {=0A=
+        case WINED3DFMT_V8U8:=0A=
+        case WINED3DFMT_V16U16:=0A=
+            TRACE("[OK]\n");=0A=
+            return TRUE;=0A=
+        default:=0A=
+            TRACE("[FAILED\n");=0A=
+            return FALSE;=0A=
+    }=0A=
+}=0A=
+=0A=
 const struct fragment_pipeline atifs_fragment_pipeline =3D {=0A=
     atifs_enable,=0A=
     atifs_get_caps,=0A=
     atifs_alloc,=0A=
     atifs_free,=0A=
+    atifs_conv_supported,=0A=
     atifs_fragmentstate_template=0A=
 };=0A=
diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c=0A=
index 7b52510..82187fc 100644=0A=
--- a/dlls/wined3d/baseshader.c=0A=
+++ b/dlls/wined3d/baseshader.c=0A=
@@ -1113,8 +1113,23 @@ static void shader_none_get_caps(WINED3DDEVTYPE =
devtype, WineD3D_GL_Info *gl_inf=0A=
     pCaps->PixelShaderVersion    =3D 0;=0A=
     pCaps->PixelShader1xMaxValue =3D 0.0;=0A=
 }=0A=
-=0A=
 #undef GLINFO_LOCATION=0A=
+static BOOL shader_none_conv_supported(WINED3DFORMAT fmt) {=0A=
+    TRACE("Checking shader format support for format %s", =
debug_d3dformat(fmt));=0A=
+    switch(fmt) {=0A=
+        /* Faked to make some apps happy. */=0A=
+        case WINED3DFMT_V8U8:=0A=
+        case WINED3DFMT_V16U16:=0A=
+        case WINED3DFMT_L6V5U5:=0A=
+        case WINED3DFMT_X8L8V8U8:=0A=
+        case WINED3DFMT_Q8W8V8U8:=0A=
+            TRACE("[OK]\n");=0A=
+            return TRUE;=0A=
+        default:=0A=
+            TRACE("[FAILED]\n");=0A=
+            return FALSE;=0A=
+    }=0A=
+}=0A=
 =0A=
 const shader_backend_t none_shader_backend =3D {=0A=
     shader_none_select,=0A=
@@ -1130,6 +1145,7 @@ const shader_backend_t none_shader_backend =3D {=0A=
     shader_none_generate_pshader,=0A=
     shader_none_generate_vshader,=0A=
     shader_none_get_caps,=0A=
+    shader_none_conv_supported=0A=
 };=0A=
 =0A=
 /* *******************************************=0A=
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c=0A=
index b5eb406..f0cca69 100644=0A=
--- a/dlls/wined3d/directx.c=0A=
+++ b/dlls/wined3d/directx.c=0A=
@@ -149,6 +149,9 @@ static int numAdapters =3D 0;=0A=
 static struct WineD3DAdapter Adapters[1];=0A=
 =0A=
 static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, =
UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, =
DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat);=0A=
+static const struct fragment_pipeline =
*select_fragment_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType);=0A=
+static const shader_backend_t *select_shader_backend(UINT Adapter, =
WINED3DDEVTYPE DeviceType);=0A=
+static const struct blit_shader *select_blit_implementation(UINT =
Adapter, WINED3DDEVTYPE DeviceType);=0A=
 =0A=
 /* lookup tables */=0A=
 int minLookup[MAX_LOOKUPS];=0A=
@@ -1960,46 +1963,40 @@ static HRESULT WINAPI =
IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter=0A=
 =0A=
 #define GLINFO_LOCATION Adapters[Adapter].gl_info=0A=
 /* Check if we support bumpmapping for a format */=0A=
-static BOOL CheckBumpMapCapability(UINT Adapter, WINED3DFORMAT =
CheckFormat)=0A=
+static BOOL CheckBumpMapCapability(UINT Adapter, WINED3DDEVTYPE =
DeviceType, WINED3DFORMAT CheckFormat)=0A=
 {=0A=
-    /* TODO: Check this in the fixed function pipeline backend */=0A=
-    if(GL_SUPPORT(NV_REGISTER_COMBINERS) && =
GL_SUPPORT(NV_TEXTURE_SHADER2)) {=0A=
-        switch (CheckFormat) {=0A=
-            case WINED3DFMT_V8U8:=0A=
-                TRACE_(d3d_caps)("[OK]\n");=0A=
-                return TRUE;=0A=
-            /* TODO: Other bump map formats */=0A=
-            default:=0A=
-                TRACE_(d3d_caps)("[FAILED]\n");=0A=
-                return FALSE;=0A=
-        }=0A=
-    }=0A=
-    if(GL_SUPPORT(ATI_ENVMAP_BUMPMAP) || =
GL_SUPPORT(ATI_FRAGMENT_SHADER)) {=0A=
-        switch (CheckFormat) {=0A=
-            case WINED3DFMT_V8U8:=0A=
+    const struct fragment_pipeline *fp;=0A=
+    const GlPixelFormatDesc *glDesc;=0A=
+=0A=
+    switch(CheckFormat) {=0A=
+        case WINED3DFMT_V8U8:=0A=
+        case WINED3DFMT_V16U16:=0A=
+        case WINED3DFMT_L6V5U5:=0A=
+        case WINED3DFMT_X8L8V8U8:=0A=
+        case WINED3DFMT_Q8W8V8U8:=0A=
+            getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);=0A=
+            if(glDesc->conversion_group =3D=3D WINED3DFMT_UNKNOWN) {=0A=
+                /* We have a GL extension giving native support */=0A=
                 TRACE_(d3d_caps)("[OK]\n");=0A=
                 return TRUE;=0A=
-            default:=0A=
-                TRACE_(d3d_caps)("[FAILED]\n");=0A=
-                return FALSE;=0A=
-        }=0A=
-    }=0A=
-    if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {=0A=
-        switch (CheckFormat) {=0A=
-            case WINED3DFMT_V8U8:=0A=
-            case WINED3DFMT_V16U16:=0A=
-            case WINED3DFMT_L6V5U5:=0A=
-            case WINED3DFMT_X8L8V8U8:=0A=
-            case WINED3DFMT_Q8W8V8U8:=0A=
+            }=0A=
+=0A=
+            /* No native support: Ask the fixed function pipeline =
implementation if it=0A=
+             * can deal with the conversion=0A=
+             */=0A=
+            fp =3D select_fragment_implementation(Adapter, DeviceType);=0A=
+            if(fp->conv_supported(CheckFormat)) {=0A=
                 TRACE_(d3d_caps)("[OK]\n");=0A=
                 return TRUE;=0A=
-            default:=0A=
+            } else {=0A=
                 TRACE_(d3d_caps)("[FAILED]\n");=0A=
                 return FALSE;=0A=
-        }=0A=
+            }=0A=
+=0A=
+        default:=0A=
+            TRACE_(d3d_caps)("[FAILED]\n");=0A=
+            return FALSE;=0A=
     }=0A=
-    TRACE_(d3d_caps)("[FAILED]\n");=0A=
-    return FALSE;=0A=
 }=0A=
 =0A=
 /* Check if the given DisplayFormat + DepthStencilFormat combination is =
valid for the Adapter */=0A=
@@ -2186,8 +2183,12 @@ static BOOL CheckWrapAndMipCapability(UINT =
Adapter, WINED3DFORMAT CheckFormat) {=0A=
 }=0A=
 =0A=
 /* Check if a texture format is supported on the given adapter */=0A=
-static BOOL CheckTextureCapability(UINT Adapter, WINED3DFORMAT =
CheckFormat)=0A=
+static BOOL CheckTextureCapability(UINT Adapter, WINED3DDEVTYPE =
DeviceType, WINED3DFORMAT CheckFormat)=0A=
 {=0A=
+    const shader_backend_t *shader_backend;=0A=
+    const struct fragment_pipeline *fp;=0A=
+    const GlPixelFormatDesc *glDesc;=0A=
+=0A=
     switch (CheckFormat) {=0A=
 =0A=
         /*****=0A=
@@ -2247,53 +2248,33 @@ static BOOL CheckTextureCapability(UINT Adapter, =
WINED3DFORMAT CheckFormat)=0A=
 =0A=
         /*****=0A=
          *  Not supported everywhere(depends on GL_ATI_envmap_bumpmap or=0A=
-         *  GL_NV_texture_shader), but advertized to make apps happy.=0A=
-         *  Enable some because games often fail when they are not =
available=0A=
-         *  and are still playable even without bump mapping=0A=
+         *  GL_NV_texture_shader). Emulated by shaders=0A=
          */=0A=
         case WINED3DFMT_V8U8:=0A=
-            if(GL_SUPPORT(NV_TEXTURE_SHADER) || =
GL_SUPPORT(ATI_ENVMAP_BUMPMAP) ||=0A=
-               GL_SUPPORT(ATI_FRAGMENT_SHADER)) {=0A=
-                return TRUE;=0A=
-            }=0A=
-            if(GL_SUPPORT(ARB_FRAGMENT_SHADER) || =
GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {=0A=
-                /* Shader emulated */=0A=
-                return TRUE;=0A=
-            }=0A=
-            TRACE_(d3d_caps)("[FAILED] - No converted formats on =
volumes\n");=0A=
-            return FALSE;=0A=
-=0A=
         case WINED3DFMT_X8L8V8U8:=0A=
         case WINED3DFMT_L6V5U5:=0A=
-            if(GL_SUPPORT(ARB_FRAGMENT_SHADER) || =
GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {=0A=
-                /* Shader emulated */=0A=
-                return TRUE;=0A=
-            }=0A=
-            WARN_(d3d_caps)("[FAILED]\n");=0A=
-            return FALSE;=0A=
-=0A=
         case WINED3DFMT_Q8W8V8U8:=0A=
         case WINED3DFMT_V16U16:=0A=
-            if(GL_SUPPORT(NV_TEXTURE_SHADER)) {=0A=
-                WARN_(d3d_caps)("[Not supported, but pretended to =
do]\n");=0A=
+        case WINED3DFMT_W11V11U10:=0A=
+        case WINED3DFMT_A2W10V10U10:=0A=
+            getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);=0A=
+            if(glDesc->conversion_group =3D=3D WINED3DFMT_UNKNOWN) {=0A=
+                /* We have a GL extension giving native support */=0A=
+                TRACE_(d3d_caps)("[OK]\n");=0A=
                 return TRUE;=0A=
             }=0A=
-            if(GL_SUPPORT(ARB_FRAGMENT_SHADER) || =
GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {=0A=
-                /* Shader emulated */=0A=
+=0A=
+            /* No native support: Ask the fixed function pipeline =
implementation if it=0A=
+             * can deal with the conversion=0A=
+             */=0A=
+            shader_backend =3D select_shader_backend(Adapter, =
DeviceType);=0A=
+            if(shader_backend->shader_conv_supported(CheckFormat)) {=0A=
+                TRACE_(d3d_caps)("[OK]\n");=0A=
                 return TRUE;=0A=
+            } else {=0A=
+                TRACE_(d3d_caps)("[FAILED]\n");=0A=
+                return FALSE;=0A=
             }=0A=
-            TRACE_(d3d_caps)("[FAILED] - No converted formats on =
volumes\n");=0A=
-            return FALSE;=0A=
-=0A=
-        /* Those are not advertized by the nvidia windows driver, and =
not=0A=
-         * supported natively by GL_NV_texture_shader or =
GL_ATI_envmap_bumpmap.=0A=
-         * WINED3DFMT_A2W10V10U10 could be loaded into shaders using =
the unsigned=0A=
-         * ARGB format if needed=0A=
-         */=0A=
-        case WINED3DFMT_W11V11U10:=0A=
-        case WINED3DFMT_A2W10V10U10:=0A=
-            WARN_(d3d_caps)("[FAILED]\n");=0A=
-            return FALSE;=0A=
 =0A=
         case WINED3DFMT_DXT1:=0A=
         case WINED3DFMT_DXT2:=0A=
@@ -2394,6 +2375,14 @@ static BOOL CheckTextureCapability(UINT Adapter, =
WINED3DFORMAT CheckFormat)=0A=
         /* Vendor specific formats */=0A=
         case WINED3DFMT_ATI2N:=0A=
             if(GL_SUPPORT(ATI_TEXTURE_COMPRESSION_3DC) || =
GL_SUPPORT(EXT_TEXTURE_COMPRESSION_RGTC)) {=0A=
+                shader_backend =3D select_shader_backend(Adapter, =
DeviceType);=0A=
+                fp =3D select_fragment_implementation(Adapter, =
DeviceType);=0A=
+                if(shader_backend->shader_conv_supported(CheckFormat) &&=0A=
+                   fp->conv_supported(CheckFormat)) {=0A=
+                    TRACE_(d3d_caps)("[OK]\n");=0A=
+                    return TRUE;=0A=
+                }=0A=
+=0A=
                 TRACE_(d3d_caps)("[OK]\n");=0A=
                 return TRUE;=0A=
             }=0A=
@@ -2410,12 +2399,21 @@ static BOOL CheckTextureCapability(UINT Adapter, =
WINED3DFORMAT CheckFormat)=0A=
     return FALSE;=0A=
 }=0A=
 =0A=
-static BOOL CheckSurfaceCapability(UINT Adapter, WINED3DFORMAT =
AdapterFormat, WINED3DFORMAT CheckFormat) {=0A=
+static BOOL CheckSurfaceCapability(UINT Adapter, WINED3DFORMAT =
AdapterFormat, WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat) {=0A=
+    const struct blit_shader *blitter;=0A=
+=0A=
     /* All format that are supported for textures are supported for =
surfaces as well */=0A=
-    if(CheckTextureCapability(Adapter, CheckFormat)) return TRUE;=0A=
+    if(CheckTextureCapability(Adapter, DeviceType, CheckFormat)) return =
TRUE;=0A=
     /* All depth stencil formats are supported on surfaces */=0A=
     if(CheckDepthStencilCapability(Adapter, AdapterFormat, =
CheckFormat)) return TRUE;=0A=
 =0A=
+    /* If opengl can't process the format natively, the blitter may be =
able to convert it */=0A=
+    blitter =3D select_blit_implementation(Adapter, DeviceType);=0A=
+    if(blitter->conv_supported(CheckFormat)) {=0A=
+        TRACE_(d3d_caps)("[OK]\n");=0A=
+        return TRUE;=0A=
+    }=0A=
+=0A=
     /* Reject other formats */=0A=
     TRACE_(d3d_caps)("[FAILED]\n");=0A=
     return FALSE;=0A=
@@ -2474,7 +2472,7 @@ static HRESULT WINAPI =
IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt=0A=
          */=0A=
         if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) {=0A=
             /* Check if the texture format is around */=0A=
-            if(CheckTextureCapability(Adapter, CheckFormat)) {=0A=
+            if(CheckTextureCapability(Adapter, DeviceType, =
CheckFormat)) {=0A=
                 if(Usage & WINED3DUSAGE_AUTOGENMIPMAP) {=0A=
                     /* Check for automatic mipmap generation support */=0A=
                     if(GL_SUPPORT(SGIS_GENERATE_MIPMAP)) {=0A=
@@ -2576,7 +2574,7 @@ static HRESULT WINAPI =
IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt=0A=
          *                - D3DUSAGE_RENDERTARGET=0A=
          */=0A=
 =0A=
-        if(CheckSurfaceCapability(Adapter, AdapterFormat, CheckFormat)) =
{=0A=
+        if(CheckSurfaceCapability(Adapter, AdapterFormat, DeviceType, =
CheckFormat)) {=0A=
             if(Usage & WINED3DUSAGE_DEPTHSTENCIL) {=0A=
                 if(CheckDepthStencilCapability(Adapter, AdapterFormat, =
CheckFormat)) {=0A=
                     UsageCaps |=3D WINED3DUSAGE_DEPTHSTENCIL;=0A=
@@ -2623,7 +2621,7 @@ static HRESULT WINAPI =
IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt=0A=
          */=0A=
 =0A=
         /* Check if the texture format is around */=0A=
-        if(CheckTextureCapability(Adapter, CheckFormat)) {=0A=
+        if(CheckTextureCapability(Adapter, DeviceType, CheckFormat)) {=0A=
             if(Usage & WINED3DUSAGE_AUTOGENMIPMAP) {=0A=
                 /* Check for automatic mipmap generation support */=0A=
                 if(GL_SUPPORT(SGIS_GENERATE_MIPMAP)) {=0A=
@@ -2663,7 +2661,7 @@ static HRESULT WINAPI =
IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt=0A=
 =0A=
             /* Check QUERY_LEGACYBUMPMAP support */=0A=
             if(Usage & WINED3DUSAGE_QUERY_LEGACYBUMPMAP) {=0A=
-                if(CheckBumpMapCapability(Adapter, CheckFormat)) {=0A=
+                if(CheckBumpMapCapability(Adapter, DeviceType, =
CheckFormat)) {=0A=
                     UsageCaps |=3D WINED3DUSAGE_QUERY_LEGACYBUMPMAP;=0A=
                 } else {=0A=
                     TRACE_(d3d_caps)("[FAILED] - No legacy bumpmap =
support\n");=0A=
@@ -2746,7 +2744,7 @@ static HRESULT WINAPI =
IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt=0A=
 =0A=
         /* Check volume texture and volume usage caps */=0A=
         if(GL_SUPPORT(EXT_TEXTURE3D)) {=0A=
-            if(CheckTextureCapability(Adapter, CheckFormat) =3D=3D =
FALSE) {=0A=
+            if(CheckTextureCapability(Adapter, DeviceType, CheckFormat) =
=3D=3D FALSE) {=0A=
                 TRACE_(d3d_caps)("[FAILED] - Format not supported\n");=0A=
                 return WINED3DERR_NOTAVAILABLE;=0A=
             }=0A=
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c=0A=
index 925a07c..63d95fd 100644=0A=
--- a/dlls/wined3d/glsl_shader.c=0A=
+++ b/dlls/wined3d/glsl_shader.c=0A=
@@ -3731,6 +3731,23 @@ static void shader_glsl_get_caps(WINED3DDEVTYPE =
devtype, WineD3D_GL_Info *gl_inf=0A=
     TRACE_(d3d_caps)("Hardware pixel shader version %d.%d enabled =
(GLSL)\n", (pCaps->PixelShaderVersion >> 8) & 0xff, =
pCaps->PixelShaderVersion & 0xff);=0A=
 }=0A=
 =0A=
+static BOOL shader_glsl_conv_supported(WINED3DFORMAT fmt) {=0A=
+    TRACE("Checking shader format support for format %s:", =
debug_d3dformat(fmt));=0A=
+    switch(fmt) {=0A=
+        case WINED3DFMT_V8U8:=0A=
+        case WINED3DFMT_V16U16:=0A=
+        case WINED3DFMT_X8L8V8U8:=0A=
+        case WINED3DFMT_L6V5U5:=0A=
+        case WINED3DFMT_Q8W8V8U8:=0A=
+        case WINED3DFMT_ATI2N:=0A=
+            TRACE("[OK]\n");=0A=
+            return TRUE;=0A=
+        default:=0A=
+            TRACE("[FAILED\n");=0A=
+            return FALSE;=0A=
+    }=0A=
+}=0A=
+=0A=
 const shader_backend_t glsl_shader_backend =3D {=0A=
     shader_glsl_select,=0A=
     shader_glsl_select_depth_blt,=0A=
@@ -3745,4 +3762,5 @@ const shader_backend_t glsl_shader_backend =3D {=0A=
     shader_glsl_generate_pshader,=0A=
     shader_glsl_generate_vshader,=0A=
     shader_glsl_get_caps,=0A=
+    shader_glsl_conv_supported,=0A=
 };=0A=
diff --git a/dlls/wined3d/nvidia_texture_shader.c =
b/dlls/wined3d/nvidia_texture_shader.c=0A=
index e217678..aea9960 100644=0A=
--- a/dlls/wined3d/nvidia_texture_shader.c=0A=
+++ b/dlls/wined3d/nvidia_texture_shader.c=0A=
@@ -673,6 +673,11 @@ static void nvrc_fragment_free(IWineD3DDevice =
*iface) {}=0A=
  * register combiners extension(Pre-GF3).=0A=
  */=0A=
 =0A=
+static BOOL nvts_conv_supported(WINED3DFORMAT fmt) {=0A=
+    TRACE("Checking shader format support for format %s: [FAILED]", =
debug_d3dformat(fmt));=0A=
+    return FALSE;=0A=
+}=0A=
+=0A=
 const struct StateEntryTemplate nvrc_fragmentstate_template[] =3D {=0A=
     { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP),          { =
STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP),          nvrc_colorop        =
}, 0                               },=0A=
     { STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG1),        { =
STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP),          nvrc_colorop        =
}, 0                               },=0A=
@@ -805,6 +810,7 @@ const struct fragment_pipeline =
nvts_fragment_pipeline =3D {=0A=
     nvrc_fragment_get_caps,=0A=
     nvrc_fragment_alloc,=0A=
     nvrc_fragment_free,=0A=
+    nvts_conv_supported,=0A=
     nvrc_fragmentstate_template=0A=
 };=0A=
 =0A=
@@ -813,5 +819,6 @@ const struct fragment_pipeline =
nvrc_fragment_pipeline =3D {=0A=
     nvrc_fragment_get_caps,=0A=
     nvrc_fragment_alloc,=0A=
     nvrc_fragment_free,=0A=
+    nvts_conv_supported,=0A=
     nvrc_fragmentstate_template=0A=
 };=0A=
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c=0A=
index dd81378..84be28b 100644=0A=
--- a/dlls/wined3d/state.c=0A=
+++ b/dlls/wined3d/state.c=0A=
@@ -5620,12 +5620,17 @@ static void ffp_fragment_get_caps(WINED3DDEVTYPE =
devtype, WineD3D_GL_Info *gl_in=0A=
 =0A=
 static HRESULT ffp_fragment_alloc(IWineD3DDevice *iface) { return =
WINED3D_OK; }=0A=
 static void ffp_fragment_free(IWineD3DDevice *iface) {}=0A=
+static BOOL ffp_conv_supported(WINED3DFORMAT fmt) {=0A=
+    TRACE("Checking shader format support for format %s: [FAILED]", =
debug_d3dformat(fmt));=0A=
+    return FALSE;=0A=
+}=0A=
 =0A=
 const struct fragment_pipeline ffp_fragment_pipeline =3D {=0A=
     ffp_enable,=0A=
     ffp_fragment_get_caps,=0A=
     ffp_fragment_alloc,=0A=
     ffp_fragment_free,=0A=
+    ffp_conv_supported,=0A=
     ffp_fragmentstate_template=0A=
 };=0A=
 =0A=
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c=0A=
index 603aa88..38ceb25 100644=0A=
--- a/dlls/wined3d/surface.c=0A=
+++ b/dlls/wined3d/surface.c=0A=
@@ -4646,9 +4646,15 @@ static void ffp_blit_unset(IWineD3DDevice *iface) =
{=0A=
     }=0A=
 }=0A=
 =0A=
+static BOOL ffp_blit_conv_supported(WINED3DFORMAT fmt) {=0A=
+    TRACE("Checking blit format support for format %s: [FAILED]\n", =
debug_d3dformat(fmt));=0A=
+    return FALSE;=0A=
+}=0A=
+=0A=
 const struct blit_shader ffp_blit =3D  {=0A=
     ffp_blit_alloc,=0A=
     ffp_blit_free,=0A=
     ffp_blit_set,=0A=
-    ffp_blit_unset=0A=
+    ffp_blit_unset,=0A=
+    ffp_blit_conv_supported=0A=
 };=0A=
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c=0A=
index cf8c3cd..6f3a447 100644=0A=
--- a/dlls/wined3d/utils.c=0A=
+++ b/dlls/wined3d/utils.c=0A=
@@ -413,6 +413,21 @@ BOOL initPixelFormats(WineD3D_GL_Info *gl_info)=0A=
         gl_info->gl_formats[dst].conversion_group=3D WINED3DFMT_ATI2N;=0A=
     }=0A=
 =0A=
+    if(!GL_SUPPORT(APPLE_YCBCR_422)) {=0A=
+        dst =3D getFmtIdx(WINED3DFMT_YUY2);=0A=
+        gl_info->gl_formats[dst].glInternal =3D GL_LUMINANCE_ALPHA;=0A=
+        gl_info->gl_formats[dst].glGammaInternal =3D =
GL_LUMINANCE_ALPHA; /* not srgb */=0A=
+        gl_info->gl_formats[dst].glFormat =3D GL_LUMINANCE_ALPHA;=0A=
+        gl_info->gl_formats[dst].glType =3D GL_UNSIGNED_BYTE;=0A=
+        gl_info->gl_formats[dst].conversion_group =3D WINED3DFMT_YUY2;=0A=
+=0A=
+        dst =3D getFmtIdx(WINED3DFMT_UYVY);=0A=
+        gl_info->gl_formats[dst].glInternal =3D GL_LUMINANCE_ALPHA;=0A=
+        gl_info->gl_formats[dst].glGammaInternal =3D =
GL_LUMINANCE_ALPHA; /* not srgb */=0A=
+        gl_info->gl_formats[dst].glFormat =3D GL_LUMINANCE_ALPHA;=0A=
+        gl_info->gl_formats[dst].glType =3D GL_UNSIGNED_BYTE;=0A=
+        gl_info->gl_formats[dst].conversion_group =3D WINED3DFMT_UYVY;=0A=
+    }=0A=
     return TRUE;=0A=
 }=0A=
 =0A=
diff --git a/dlls/wined3d/wined3d_private.h =
b/dlls/wined3d/wined3d_private.h=0A=
index 70bac96..0b8cca6 100644=0A=
--- a/dlls/wined3d/wined3d_private.h=0A=
+++ b/dlls/wined3d/wined3d_private.h=0A=
@@ -247,6 +247,7 @@ typedef struct {=0A=
     void (*shader_generate_pshader)(IWineD3DPixelShader *iface, =
SHADER_BUFFER *buffer);=0A=
     void (*shader_generate_vshader)(IWineD3DVertexShader *iface, =
SHADER_BUFFER *buffer);=0A=
     void (*shader_get_caps)(WINED3DDEVTYPE devtype, WineD3D_GL_Info =
*gl_info, struct shader_caps *caps);=0A=
+    BOOL (*shader_conv_supported)(WINED3DFORMAT conv);=0A=
 } shader_backend_t;=0A=
 =0A=
 extern const shader_backend_t atifs_shader_backend;=0A=
@@ -556,6 +557,7 @@ struct fragment_pipeline {=0A=
     void (*get_caps)(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, =
struct fragment_caps *caps);=0A=
     HRESULT (*alloc_private)(IWineD3DDevice *iface);=0A=
     void (*free_private)(IWineD3DDevice *iface);=0A=
+    BOOL (*conv_supported)(WINED3DFORMAT conv);=0A=
     const struct StateEntryTemplate *states;=0A=
 };=0A=
 =0A=
@@ -581,6 +583,7 @@ struct blit_shader {=0A=
     void (*free_private)(IWineD3DDevice *iface);=0A=
     HRESULT (*set_shader)(IWineD3DDevice *iface, WINED3DFORMAT fmt, =
GLenum textype, UINT width, UINT height);=0A=
     void (*unset_shader)(IWineD3DDevice *iface);=0A=
+    BOOL (*conv_supported)(WINED3DFORMAT conv);=0A=
 };=0A=
 =0A=
 extern const struct blit_shader ffp_blit;=0A=
-- =0A=
1.5.4.5=0A=
=0A=

------=_NextPart_000_0019_01C901F1.9F2B9730--




More information about the wine-patches mailing list