From 74b418c9e0a9d40e01b9a22bf9d3b4e652223da3 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 4 Sep 2011 22:43:49 +0200 Subject: [PATCH] wined3d: Don't print the GLSL info log by default on fglrx. --- dlls/wined3d/directx.c | 16 +++++++++++ dlls/wined3d/glsl_shader.c | 49 +++++++++------------------------- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 29 insertions(+), 37 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 116f1be8cc..11582d41bb 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -774,6 +774,12 @@ static BOOL match_broken_rgba16(const struct wined3d_gl_info *gl_info, const cha return size < 16; } +static BOOL match_fglrx(const struct wined3d_gl_info *gl_info, const char *gl_renderer, + enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device) +{ + return gl_vendor == GL_VENDOR_FGLRX; +} + static void quirk_arb_constants(struct wined3d_gl_info *gl_info) { TRACE_(d3d_caps)("Using ARB vs constant limit(=%u) for GLSL.\n", gl_info->limits.arb_vs_native_constants); @@ -891,6 +897,11 @@ static void quirk_broken_rgba16(struct wined3d_gl_info *gl_info) gl_info->quirks |= WINED3D_QUIRK_BROKEN_RGBA16; } +static void quirk_infolog_spam(struct wined3d_gl_info *gl_info) +{ + gl_info->quirks |= WINED3D_QUIRK_INFO_LOG_SPAM; +} + struct driver_quirk { BOOL (*match)(const struct wined3d_gl_info *gl_info, const char *gl_renderer, @@ -975,6 +986,11 @@ static const struct driver_quirk quirk_table[] = quirk_broken_rgba16, "True RGBA16 is not available" }, + { + match_fglrx, + quirk_infolog_spam, + "Not printing GLSL infolog" + }, }; /* Certain applications (Steam) complain if we report an outdated driver version. In general, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index ee7c3b72f7..837b7d4c0e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -198,26 +198,9 @@ static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLhandleA { int infologLength = 0; char *infoLog; - unsigned int i; - BOOL is_spam; - - static const char * const spam[] = - { - "Vertex shader was successfully compiled to run on hardware.\n", /* fglrx */ - "Fragment shader was successfully compiled to run on hardware.\n", /* fglrx, with \n */ - "Fragment shader was successfully compiled to run on hardware.", /* fglrx, no \n */ - "Fragment shader(s) linked, vertex shader(s) linked. \n ", /* fglrx, with \n */ - "Fragment shader(s) linked, vertex shader(s) linked. \n", /* fglrx, with \n */ - "Fragment shader(s) linked, vertex shader(s) linked.", /* fglrx, no \n */ - "Vertex shader(s) linked, no fragment shader(s) defined. \n ", /* fglrx, with \n */ - "Vertex shader(s) linked, no fragment shader(s) defined. \n", /* fglrx, with \n */ - "Vertex shader(s) linked, no fragment shader(s) defined.", /* fglrx, no \n */ - "Fragment shader(s) linked, no vertex shader(s) defined. \n ", /* fglrx, with \n */ - "Fragment shader(s) linked, no vertex shader(s) defined. \n", /* fglrx, with \n */ - "Fragment shader(s) linked, no vertex shader(s) defined.", /* fglrx, no \n */ - }; - if (!TRACE_ON(d3d_shader) && !FIXME_ON(d3d_shader)) return; + if (!WARN_ON(d3d_shader) && !FIXME_ON(d3d_shader)) + return; GL_EXTCALL(glGetObjectParameterivARB(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, @@ -229,31 +212,23 @@ static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLhandleA { char *ptr, *line; - /* Fglrx doesn't terminate the string properly, but it tells us the proper length. - * So use HEAP_ZERO_MEMORY to avoid uninitialized bytes - */ - infoLog = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, infologLength); + infoLog = HeapAlloc(GetProcessHeap(), 0, infologLength); + /* The info log is supposed to be zero-terminated, but at least some + * versions of fglrx don't terminate the string properly. The reported + * length does include the terminator, so explicitly set it to zero + * here. */ + infoLog[infologLength - 1] = 0; GL_EXTCALL(glGetInfoLogARB(obj, infologLength, NULL, infoLog)); - is_spam = FALSE; - - for (i = 0; i < sizeof(spam) / sizeof(*spam); ++i) - { - if (!strcmp(infoLog, spam[i])) - { - is_spam = TRUE; - break; - } - } ptr = infoLog; - if (is_spam) + if (gl_info->quirks & WINED3D_QUIRK_INFO_LOG_SPAM) { - TRACE("Spam received from GLSL shader #%u:\n", obj); - while ((line = get_info_log_line(&ptr))) TRACE(" %s\n", line); + WARN("Info log received from GLSL shader #%u:\n", obj); + while ((line = get_info_log_line(&ptr))) WARN(" %s\n", line); } else { - FIXME("Error received from GLSL shader #%u:\n", obj); + FIXME("Info log received from GLSL shader #%u:\n", obj); while ((line = get_info_log_line(&ptr))) FIXME(" %s\n", line); } HeapFree(GetProcessHeap(), 0, infoLog); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e210ca1efb..fd2bedc7bc 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -52,6 +52,7 @@ #define WINED3D_QUIRK_NV_CLIP_BROKEN 0x00000010 #define WINED3D_QUIRK_FBO_TEX_UPDATE 0x00000020 #define WINED3D_QUIRK_BROKEN_RGBA16 0x00000040 +#define WINED3D_QUIRK_INFO_LOG_SPAM 0x00000080 /* Texture format fixups */ -- 2.32.0.93.g670b81a890