[PATCH 3/5] wined3d: Always provide P8 GL texture information.

Stefan Dösinger stefan at codeweavers.com
Tue May 13 09:21:51 CDT 2014


This allows us to remove a few P8 special cases. We still load onscreen
P8 surfaces into GL textures and the GL drawable if ARB_fragment_program
is not supported. The special handling for this remains in the surface
upload path for now.

As far as I can see the entries for P8 in the format table are never
used to make any codepath decisions or report different capabilities to
the application.
---
 dlls/wined3d/surface.c | 23 ++---------------------
 dlls/wined3d/utils.c   |  2 +-
 2 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e0ba375..8e4b88b 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1457,12 +1457,6 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
         int src_pitch = 0;
         int dst_pitch = 0;
 
-        if (format->id == WINED3DFMT_P8_UINT)
-        {
-            gl_format = GL_ALPHA;
-            gl_type = GL_UNSIGNED_BYTE;
-        }
-
         if (surface->flags & SFLAG_NONPOW2)
         {
             unsigned char alignment = surface->resource.device->surface_alignment;
@@ -3211,8 +3205,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
     const struct wined3d_gl_info *gl_info;
     struct wined3d_context *context;
     BYTE *mem;
-    GLint fmt;
-    GLint type;
     BYTE *row, *top, *bottom;
     int i;
     BOOL srcIsUpsideDown;
@@ -3246,18 +3238,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
         srcIsUpsideDown = FALSE;
     }
 
-    switch (surface->resource.format->id)
-    {
-        case WINED3DFMT_P8_UINT:
-            fmt = GL_ALPHA;
-            type = GL_UNSIGNED_BYTE;
-            break;
-
-        default:
-            fmt = surface->resource.format->glFormat;
-            type = surface->resource.format->glType;
-    }
-
     if (data.buffer_object)
     {
         GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, data.buffer_object));
@@ -3270,7 +3250,8 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
 
     gl_info->gl_ops.gl.p_glReadPixels(0, 0,
             surface->resource.width, surface->resource.height,
-            fmt, type, data.addr);
+            surface->resource.format->glFormat,
+            surface->resource.format->glType, data.addr);
     checkGLcall("glReadPixels");
 
     /* Reset previous pixel store pack state */
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 044eed0..c077567 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -743,7 +743,7 @@ static const struct wined3d_format_texture_info format_texture_info[] =
     {WINED3DFMT_P8_UINT,                GL_RGBA,                          GL_RGBA,                                0,
             GL_ALPHA,                   GL_UNSIGNED_BYTE,                 0,
             0,
-            ARB_FRAGMENT_PROGRAM,       NULL},
+            0,                          NULL},
     /* Standard ARGB formats */
     {WINED3DFMT_B8G8R8_UNORM,           GL_RGB8,                          GL_RGB8,                                0,
             GL_BGR,                     GL_UNSIGNED_BYTE,                 0,
-- 
1.8.5.5




More information about the wine-patches mailing list